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
2 changes: 1 addition & 1 deletion client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
"date-fns": "^4.1.0",
"framer-motion": "^12.6.3",
"lodash": "^4.17.21",
"lodash.debounce": "^4.0.8",
"lowlight": "^3.3.0",
"lucide-react": "^0.486.0",
"react": "^19.0.0",
Expand Down
34 changes: 32 additions & 2 deletions client/src/components/DashboardHeader.jsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,51 @@
import React from "react";
import React, { useRef } from "react";
import { Search } from "lucide-react";
import { Input } from "@/components/ui/input";
import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar";
import { useAuth } from "@/features/authentication/hooks/useAuth";
import { UserProfileMenu } from "./UserProfileMenu";
import { SearchResults } from "./SearchResults";
import { useSearchStore } from "@/stores/useSearchStore";

export function DashboardHeader() {
const { user } = useAuth();
const { search, isOpen, navigateResults } = useSearchStore();
const inputRef = useRef(null);

// Handle keyboard navigation
const handleKeyDown = (e) => {
if (isOpen) {
if (e.key === "ArrowDown") {
e.preventDefault();
navigateResults("down");
} else if (e.key === "ArrowUp") {
e.preventDefault();
navigateResults("up");
} else if (e.key === "Escape") {
e.preventDefault();
inputRef.current?.blur();
} else if (e.key === "Enter") {
// The enter behavior is handled by the focused item in SearchResults
}
}
};

const handleChange = (e) => {
search(e.target.value);
};

return (
<header className="border-b border-border p-4 flex items-center justify-between bg-background fixed top-0 left-0 right-0 z-30 md:relative md:top-auto md:z-auto">
<div className="flex items-center w-full max-w-md">
<div className="flex items-center w-full max-w-md relative">
<Search className="w-4 h-4 mr-2 text-muted-foreground" />
<Input
ref={inputRef}
placeholder="Search tasks, notes..."
className="bg-background text-sm md:text-base"
onChange={handleChange}
onKeyDown={handleKeyDown}
/>
<SearchResults />
</div>

<div className="flex items-center ml-4">
Expand Down
Loading
Loading