mirror of
https://github.com/jeffvli/feishin.git
synced 2026-06-16 16:34:24 +02:00
Updates to general commands
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { useCallback } from 'react';
|
||||
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';
|
||||
@@ -6,25 +6,29 @@ import { AppRoute } from '/@/renderer/router/routes';
|
||||
interface GoToCommandsProps {
|
||||
handleClose: () => void;
|
||||
setPages: (pages: CommandPalettePages[]) => void;
|
||||
setQuery: Dispatch<string>;
|
||||
}
|
||||
|
||||
export const GoToCommands = ({ setPages, handleClose }: GoToCommandsProps) => {
|
||||
export const GoToCommands = ({ setQuery, setPages, handleClose }: GoToCommandsProps) => {
|
||||
const navigate = useNavigate();
|
||||
|
||||
const goTo = useCallback(
|
||||
(route: string) => {
|
||||
navigate(route);
|
||||
setPages([CommandPalettePages.HOME]);
|
||||
handleClose();
|
||||
setPages([CommandPalettePages.HOME]);
|
||||
setQuery('');
|
||||
},
|
||||
[handleClose, navigate, setPages],
|
||||
[handleClose, navigate, setPages, setQuery],
|
||||
);
|
||||
|
||||
return (
|
||||
<>
|
||||
<Command.Item onSelect={() => goTo(AppRoute.HOME)}>Home</Command.Item>
|
||||
<Command.Item onSelect={() => goTo(AppRoute.SEARCH)}>Search</Command.Item>
|
||||
<Command.Item onSelect={() => goTo(AppRoute.SETTINGS)}>Settings</Command.Item>
|
||||
<Command.Group>
|
||||
<Command.Item onSelect={() => goTo(AppRoute.HOME)}>Home</Command.Item>
|
||||
<Command.Item onSelect={() => goTo(AppRoute.SEARCH)}>Search</Command.Item>
|
||||
<Command.Item onSelect={() => goTo(AppRoute.SETTINGS)}>Settings</Command.Item>
|
||||
</Command.Group>
|
||||
<Command.Group heading="Library">
|
||||
<Command.Item onSelect={() => goTo(AppRoute.LIBRARY_ALBUMS)}>Albums</Command.Item>
|
||||
<Command.Item onSelect={() => goTo(AppRoute.LIBRARY_SONGS)}>Tracks</Command.Item>
|
||||
|
||||
Reference in New Issue
Block a user