import { useCallback, Dispatch } from 'react'; import { useNavigate } from 'react-router'; import { Command, CommandPalettePages } from '/@/renderer/features/search/components/command'; import { AppRoute } from '/@/renderer/router/routes'; interface GoToCommandsProps { handleClose: () => void; setPages: (pages: CommandPalettePages[]) => void; setQuery: Dispatch; } export const GoToCommands = ({ setQuery, setPages, handleClose }: GoToCommandsProps) => { const navigate = useNavigate(); const goTo = useCallback( (route: string) => { navigate(route); handleClose(); setPages([CommandPalettePages.HOME]); setQuery(''); }, [handleClose, navigate, setPages, setQuery], ); return ( <> goTo(AppRoute.HOME)}>Home goTo(AppRoute.SEARCH)}>Search goTo(AppRoute.SETTINGS)}>Settings goTo(AppRoute.LIBRARY_ALBUMS)}>Albums goTo(AppRoute.LIBRARY_SONGS)}>Tracks goTo(AppRoute.LIBRARY_ALBUM_ARTISTS)}> Album artists goTo(AppRoute.LIBRARY_GENRES)}>Genres goTo(AppRoute.LIBRARY_FOLDERS)}>Folders goTo(AppRoute.PLAYLISTS)}>Playlists ); };