From 78599a202ef0fee306fc37907e40c8ac95143b4c Mon Sep 17 00:00:00 2001 From: lovegaoshi <106490582+lovegaoshi@users.noreply.github.com> Date: Mon, 18 Mar 2024 06:14:43 -0700 Subject: [PATCH] feat: bvid search --- src/components/playlist/SongList/SongMenu.tsx | 17 +++++++++++++++++ src/hooks/useBiliSearch.ts | 2 +- src/localization/en/translation.json | 1 + src/localization/zhcn/translation.json | 1 + 4 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/components/playlist/SongList/SongMenu.tsx b/src/components/playlist/SongList/SongMenu.tsx index 6baf1b28..dce7f29c 100644 --- a/src/components/playlist/SongList/SongMenu.tsx +++ b/src/components/playlist/SongList/SongMenu.tsx @@ -8,11 +8,14 @@ import { CopiedPlaylistMenuItem } from '@components/buttons/CopiedPlaylistButton import RenameSongButton from '@components/player/TrackInfo/RenameSong/RenameSongButton'; import useSongOperations from '@hooks/useSongOperations'; import { SearchRegex } from '@enums/Playlist'; +import { SOURCE } from '@enums/MediaFetch'; +import useBiliSearch from '@hooks/useBiliSearch'; enum ICONS { SEND_TO = 'playlist-plus', COPY_SONG_NAME = '', SEARCH_IN_PLAYLIST = 'text-search', + SEARCH_BVID = 'search-web', RELOAD = 'refresh', REMOVE = 'delete', REMOVE_AND_BAN_BVID = 'delete-forever', @@ -46,6 +49,7 @@ export default ({ usePlaylist, prepareForLayoutAnimationRender }: Props) => { state => state.setPlaylistSearchAutoFocus ); const { startRadio, radioAvailable } = useSongOperations(); + const { setSearchVal, handleSearch } = useBiliSearch({}); const closeMenu = React.useCallback(() => setSongMenuVisible(false), []); @@ -126,6 +130,19 @@ export default ({ usePlaylist, prepareForLayoutAnimationRender }: Props) => { disabled={checking} title={t('SongOperations.songSearchInPlaylistTitle')} /> + {selectedSongs()[0]?.source === SOURCE.bilivideo && ( +