-
Notifications
You must be signed in to change notification settings - Fork 328
feat: add tooltips to navbar elements #652
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -6,6 +6,11 @@ import { selectAvatar, selectName } from '@/features/onboardingSelectors'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { clearSearch } from '@/features/searchSlice'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { convertFileSrc } from '@tauri-apps/api/core'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { FaceSearchDialog } from '@/components/Dialog/FaceSearchDialog'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Tooltip, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TooltipContent, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| TooltipTrigger, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from '@/components/ui/tooltip'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export function Navbar() { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const userName = useSelector(selectName); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -42,14 +47,20 @@ export function Navbar() { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className="h-7 w-7 rounded object-cover" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {isSearchActive && ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <button | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClick={() => dispatch(clearSearch())} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className="absolute -top-1 -right-1 flex h-3 w-3 items-center justify-center rounded-full bg-red-600 text-[10px] leading-none text-white" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| title="Close" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| aria-label="Close" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ✕ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Tooltip> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <TooltipTrigger asChild> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <button | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClick={() => dispatch(clearSearch())} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className="absolute -top-1 -right-1 flex h-3 w-3 items-center justify-center rounded-full bg-red-600 text-[10px] leading-none text-white" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| aria-label="Close" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ✕ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </TooltipTrigger> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <TooltipContent> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <p>Clear search</p> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </TooltipContent> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Tooltip> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -62,16 +73,22 @@ export function Navbar() { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {/* FaceSearch Dialog */} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <FaceSearchDialog /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <button | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className="text-muted-foreground hover:bg-accent dark:hover:bg-accent/50 hover:text-foreground mx-1 cursor-pointer rounded-sm p-2" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| title="Search" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| aria-label="Search" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Search className="h-4 w-4" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {/* Search Button */} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Tooltip> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <TooltipTrigger asChild> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <button | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className="text-muted-foreground hover:bg-accent dark:hover:bg-accent/50 hover:text-foreground mx-1 cursor-pointer rounded-sm p-2" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| aria-label="Search" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Search className="h-4 w-4" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </TooltipTrigger> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <TooltipContent> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <p>Search images</p> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </TooltipContent> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Tooltip> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+79
to
+91
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Align aria-label with tooltip text for consistency. The button's Apply this diff: - aria-label="Search"
+ aria-label="Search images"📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
@@ -82,15 +99,22 @@ export function Navbar() { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span className="hidden text-sm sm:inline-block"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Welcome <span className="text-muted-foreground">{userName}</span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <a href="/settings" className="p-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <img | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| src={userAvatar || '/photo1.png'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className="hover:ring-primary/50 h-8 w-8 cursor-pointer rounded-full transition-all hover:ring-2" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| alt="User avatar" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </a> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Tooltip> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <TooltipTrigger asChild> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <a href="/settings" className="p-2"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <img | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| src={userAvatar || '/photo1.png'} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className="hover:ring-primary/50 h-8 w-8 cursor-pointer rounded-full transition-all hover:ring-2" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| alt="User avatar" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </a> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </TooltipTrigger> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <TooltipContent> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <p>Profile settings</p> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </TooltipContent> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Tooltip> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+102
to
+115
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion | 🟠 Major Add aria-label to the profile settings link. The anchor on line 113 is missing an Apply this diff: - <a href="/settings" className="p-2">
+ <a href="/settings" className="p-2" aria-label="Profile settings">📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Align aria-label with tooltip text for consistency.
The button's
aria-label="Close"(line 55) doesn't match the tooltip text "Clear search" (line 61). Since the action clears the search query, "Clear search" is more descriptive. Update the aria-label to match.Apply this diff:
📝 Committable suggestion
🤖 Prompt for AI Agents