This commit is contained in:
zx 2024-03-23 18:16:23 +08:00
parent 8577be010e
commit 62610ed6f8
2 changed files with 8 additions and 3 deletions

View File

@ -23,6 +23,7 @@ export interface ListMenuProps {
onChangePosition: (selectInfo: SelectInfo) => void
onDislikeMusic: (selectInfo: SelectInfo) => void
onRemove: (selectInfo: SelectInfo) => void
onDownload: (selectInfo: SelectInfo) => void
}
export interface ListMenuType {
show: (selectInfo: SelectInfo, position: Position) => void
@ -32,7 +33,7 @@ export type {
Position,
}
const hasEditMetadata = async(musicInfo: LX.Music.MusicInfo) => {
const hasEditMetadata = async (musicInfo: LX.Music.MusicInfo) => {
if (musicInfo.source != 'local') return false
return existsFile(musicInfo.meta.filePath)
}
@ -62,7 +63,7 @@ export default forwardRef<ListMenuType, ListMenuProps>((props, ref) => {
const menu = [
{ action: 'play', label: t('play') },
{ action: 'playLater', label: t('play_later') },
// { action: 'download', label: '下载' },
{ action: 'download', label: '下载' },
{ action: 'add', label: t('add_to') },
{ action: 'move', label: t('move_to') },
{ action: 'copyName', label: t('copy_name') },
@ -84,7 +85,7 @@ export default forwardRef<ListMenuType, ListMenuProps>((props, ref) => {
const menu = [
{ action: 'play', label: t('play') },
{ action: 'playLater', label: t('play_later') },
// { action: 'download', label: '下载' },
{ action: 'download', label: '下载' },
{ action: 'add', label: t('add_to') },
{ action: 'move', label: t('move_to') },
{ action: 'copyName', label: t('copy_name') },
@ -138,6 +139,8 @@ export default forwardRef<ListMenuType, ListMenuProps>((props, ref) => {
case 'remove':
props.onRemove(selectInfo)
break
case 'download':
props.onDownload(selectInfo)
default:
break
}

View File

@ -14,6 +14,7 @@ import ListSearchBar, { type ListSearchBarType } from './ListSearchBar'
import ListMusicSearch, { type ListMusicSearchType } from './ListMusicSearch'
import MusicPositionModal, { type MusicPositionModalType } from './MusicPositionModal'
import MetadataEditModal, { type MetadataEditType, type MetadataEditProps } from '@/components/MetadataEditModal'
import { handelDownload } from '@/components/OnlineList/listAction'
export default () => {
@ -157,6 +158,7 @@ export default () => {
onDislikeMusic={info => { void handleDislikeMusic(info.musicInfo) }}
onCopyName={info => { handleShare(info.musicInfo) }}
onAdd={handleAddMusic}
onDownload={info => { handelDownload(info.musicInfo) }}
onMove={handleMoveMusic}
onEditMetadata={handleEditMetadata}
onChangePosition={info => musicPositionModalRef.current?.show(info)}