1import React from 'react'; 2import {useNavigation} from '@react-navigation/native'; 3import ComplexAppBar from '@/components/base/ComplexAppBar'; 4import MusicSheet from '@/core/musicSheet'; 5import {ROUTE_PATH, useParams} from '@/entry/router'; 6import useDialog from '@/components/dialogs/useDialog'; 7import Toast from '@/utils/toast'; 8 9export default function () { 10 const navigation = useNavigation<any>(); 11 const {id = 'favorite'} = useParams<'local-sheet-detail'>(); 12 const musicSheet = MusicSheet.useSheets(id); 13 const {showDialog} = useDialog(); 14 15 return ( 16 <ComplexAppBar 17 title="歌单" 18 onSearchPress={() => { 19 navigation.navigate(ROUTE_PATH.SEARCH_MUSIC_LIST, { 20 musicList: musicSheet?.musicList, 21 }); 22 }} 23 menuOptions={[ 24 { 25 icon: 'trash-can-outline', 26 title: '删除歌单', 27 show: id !== 'favorite', 28 onPress() { 29 showDialog('SimpleDialog', { 30 title: '删除歌单', 31 content: `确定删除歌单「${musicSheet.title}」吗?`, 32 onOk: async () => { 33 await MusicSheet.removeSheet(id); 34 Toast.success('已删除'); 35 navigation.goBack(); 36 }, 37 }); 38 }, 39 }, 40 { 41 icon: 'playlist-edit', 42 title: '批量编辑', 43 onPress() { 44 navigation.navigate(ROUTE_PATH.MUSIC_LIST_EDITOR, { 45 musicList: musicSheet.musicList, 46 musicSheet: musicSheet, 47 }); 48 }, 49 }, 50 { 51 icon: 'square-edit-outline', 52 title: '编辑歌单信息', 53 onPress() { 54 showDialog('EditSheetDetailDialog', { 55 musicSheet: musicSheet, 56 }); 57 }, 58 }, 59 { 60 icon: 'sort', 61 title: '排序', 62 onPress() { 63 showDialog('RadioDialog', { 64 content: [ 65 { 66 value: 'random', 67 key: '随机顺序', 68 }, 69 { 70 value: 'a2z', 71 key: '歌曲名A-Z', 72 }, 73 { 74 value: 'z2a', 75 key: '歌曲名Z-A', 76 }, 77 { 78 value: 'arta2z', 79 key: '作者名A-Z', 80 }, 81 { 82 value: 'artz2a', 83 key: '作者名Z-A', 84 }, 85 ], 86 title: '排序', 87 async onOk(value) { 88 MusicSheet.sortMusicList( 89 value as any, 90 musicSheet, 91 ); 92 }, 93 }); 94 }, 95 }, 96 ]} 97 /> 98 ); 99} 100