Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { Input } from "@superset/ui/input";
import { Tabs, TabsList, TabsTrigger } from "@superset/ui/tabs";
import { useRef } from "react";
import { HiOutlineMagnifyingGlass } from "react-icons/hi2";
import { useAppHotkey } from "renderer/stores/hotkeys";
import { ActiveIcon } from "../shared/icons/ActiveIcon";
import { AllIssuesIcon } from "../shared/icons/AllIssuesIcon";
import { BacklogIcon } from "../shared/icons/BacklogIcon";
Expand Down Expand Up @@ -43,6 +45,17 @@ export function TasksTopBar({
assigneeFilter,
onAssigneeFilterChange,
}: TasksTopBarProps) {
const searchInputRef = useRef<HTMLInputElement>(null);

useAppHotkey(
"FOCUS_TASK_SEARCH",
() => {
searchInputRef.current?.focus();
searchInputRef.current?.select();
},
{ preventDefault: true },
);

return (
<div className="flex items-center justify-between border-b border-border px-4 h-11">
{/* Tabs and filters on the left */}
Expand Down Expand Up @@ -80,10 +93,17 @@ export function TasksTopBar({
<div className="relative w-64">
<HiOutlineMagnifyingGlass className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none" />
<Input
ref={searchInputRef}
type="text"
placeholder="Search tasks..."
value={searchQuery}
onChange={(e) => onSearchChange(e.target.value)}
onKeyDown={(e) => {
if (e.key === "Escape") {
onSearchChange("");
searchInputRef.current?.blur();
}
}}
className="h-8 pl-9 pr-3 text-sm bg-muted/50 border-0 focus-visible:ring-1"
/>
</div>
Expand Down
6 changes: 6 additions & 0 deletions apps/desktop/src/shared/hotkeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -570,6 +570,12 @@ export const HOTKEYS = {
category: "Workspace",
description: "Quickly create a workspace in the current project",
}),
FOCUS_TASK_SEARCH: defineHotkey({
keys: "meta+f",
label: "Focus Task Search",
category: "Workspace",
description: "Focus the search input in the tasks view",
}),
OPEN_PROJECT: defineHotkey({
keys: "meta+shift+o",
label: "Open Project",
Expand Down
Loading