Skip to content

Commit f1d2244

Browse files
authored
added-more-keyboard-shortcuts (#233)
1 parent 3a4b32f commit f1d2244

2 files changed

Lines changed: 30 additions & 1 deletion

File tree

frontend/src/components/HomeComponents/Tasks/Tasks.tsx

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -791,6 +791,21 @@ export const Tasks = (
791791
document.getElementById('sync-task')?.click();
792792
}
793793
});
794+
useHotkeys(['p'], () => {
795+
if (!showReports) {
796+
document.getElementById('projects')?.click();
797+
}
798+
});
799+
useHotkeys(['s'], () => {
800+
if (!showReports) {
801+
document.getElementById('status')?.click();
802+
}
803+
});
804+
useHotkeys(['t'], () => {
805+
if (!showReports) {
806+
document.getElementById('tags')?.click();
807+
}
808+
});
794809
useHotkeys(['c'], () => {
795810
if (!showReports && !_isDialogOpen) {
796811
const task = currentTasks[selectedIndex];
@@ -921,25 +936,31 @@ export const Tasks = (
921936
icon={<Key lable="f" />}
922937
/>
923938
<MultiSelectFilter
939+
id="projects"
924940
title="Projects"
925941
options={uniqueProjects}
926942
selectedValues={selectedProjects}
927943
onSelectionChange={setSelectedProjects}
928944
className="flex-1 min-w-[140px]"
945+
icon={<Key lable="p" />}
929946
/>
930947
<MultiSelectFilter
948+
id="status"
931949
title="Status"
932950
options={status}
933951
selectedValues={selectedStatuses}
934952
onSelectionChange={setSelectedStatuses}
935953
className="flex-1 min-w-[140px]"
954+
icon={<Key lable="s" />}
936955
/>
937956
<MultiSelectFilter
957+
id="tags"
938958
title="Tags"
939959
options={uniqueTags}
940960
selectedValues={selectedTags}
941961
onSelectionChange={setSelectedTags}
942962
className="flex-1 min-w-[140px]"
963+
icon={<Key lable="t" />}
943964
/>
944965
<div className="pr-2">
945966
<Dialog

frontend/src/components/ui/multi-select.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,19 +20,23 @@ import {
2020
const ALL_ITEMS_VALUE = '__ALL__';
2121

2222
interface MultiSelectFilterProps {
23+
id?: string;
2324
title: string;
2425
options: string[];
2526
selectedValues: string[];
2627
onSelectionChange: (values: string[]) => void;
2728
className?: string;
29+
icon?: React.ReactNode;
2830
}
2931

3032
export function MultiSelectFilter({
33+
id,
3134
title,
3235
options,
3336
selectedValues,
3437
onSelectionChange,
3538
className,
39+
icon,
3640
}: MultiSelectFilterProps) {
3741
const [open, setOpen] = React.useState(false);
3842

@@ -52,6 +56,7 @@ export function MultiSelectFilter({
5256
<Popover open={open} onOpenChange={setOpen}>
5357
<PopoverTrigger asChild>
5458
<Button
59+
id={id}
5560
variant="outline"
5661
role="combobox"
5762
aria-expanded={open}
@@ -63,7 +68,10 @@ export function MultiSelectFilter({
6368
<div className="flex flex-wrap gap-1 items-center">
6469
<span className="font-medium">{title}</span>
6570
</div>
66-
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
71+
<div className="flex flex-wrap items-center">
72+
<ChevronsUpDown className="ml-2 h-4 w-4 shrink-0 opacity-50" />
73+
{icon && <span>{icon}</span>}
74+
</div>
6775
</Button>
6876
</PopoverTrigger>
6977

0 commit comments

Comments
 (0)