-
Notifications
You must be signed in to change notification settings - Fork 888
feat(desktop): add help menu to top bar #259
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
Merged
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
dc1fc3a
feat(desktop): add help menu to top bar
Kitenite dcccf76
refactor(desktop): add Help menu to Mac menu bar with shared constants
Kitenite 1d76124
fix(desktop): widen help menu dropdown for keyboard shortcuts
Kitenite f18970f
refactor(desktop): use trpc subscription for menu events
Kitenite da3a0cb
chore: remove redundant comments
Kitenite e87d287
merge: resolve conflict with origin/main
Kitenite File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| import { observable } from "@trpc/server/observable"; | ||
| import { | ||
| menuEmitter, | ||
| type OpenSettingsEvent, | ||
| type SettingsSection, | ||
| } from "main/lib/menu-events"; | ||
| import { publicProcedure, router } from ".."; | ||
|
|
||
| type MenuEvent = { type: "open-settings"; data: OpenSettingsEvent }; | ||
|
|
||
| export const createMenuRouter = () => { | ||
| return router({ | ||
| subscribe: publicProcedure.subscription(() => { | ||
| return observable<MenuEvent>((emit) => { | ||
| const onOpenSettings = (section?: SettingsSection) => { | ||
| emit.next({ type: "open-settings", data: { section } }); | ||
| }; | ||
|
|
||
| menuEmitter.on("open-settings", onOpenSettings); | ||
|
|
||
| return () => { | ||
| menuEmitter.off("open-settings", onOpenSettings); | ||
| }; | ||
| }); | ||
| }), | ||
| }); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| import { EventEmitter } from "node:events"; | ||
|
|
||
| export type SettingsSection = | ||
| | "project" | ||
| | "workspace" | ||
| | "appearance" | ||
| | "keyboard"; | ||
|
|
||
| export interface OpenSettingsEvent { | ||
| section?: SettingsSection; | ||
| } | ||
|
|
||
| export const menuEmitter = new EventEmitter(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
apps/desktop/src/renderer/screens/main/components/TopBar/HelpMenu/HelpMenu.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import { | ||
| DropdownMenu, | ||
| DropdownMenuContent, | ||
| DropdownMenuItem, | ||
| DropdownMenuSeparator, | ||
| DropdownMenuTrigger, | ||
| } from "@superset/ui/dropdown-menu"; | ||
| import { Kbd, KbdGroup } from "@superset/ui/kbd"; | ||
| import { FaDiscord } from "react-icons/fa"; | ||
| import { | ||
| HiOutlineBugAnt, | ||
| HiOutlineCommandLine, | ||
| HiOutlineEnvelope, | ||
| HiOutlineQuestionMarkCircle, | ||
| } from "react-icons/hi2"; | ||
| import { useOpenSettings } from "renderer/stores"; | ||
| import { HELP_MENU } from "shared/constants"; | ||
| import { formatKeysForDisplay, HOTKEYS } from "shared/hotkeys"; | ||
|
|
||
| export function HelpMenu() { | ||
| const openSettings = useOpenSettings(); | ||
| const hotkeyKeys = formatKeysForDisplay(HOTKEYS.SHOW_HOTKEYS.keys); | ||
|
|
||
| const handleContactUs = () => { | ||
| window.open(HELP_MENU.CONTACT_URL, "_blank"); | ||
| }; | ||
|
|
||
| const handleReportIssue = () => { | ||
| window.open(HELP_MENU.REPORT_ISSUE_URL, "_blank"); | ||
| }; | ||
|
|
||
| const handleJoinDiscord = () => { | ||
| window.open(HELP_MENU.DISCORD_URL, "_blank"); | ||
| }; | ||
|
|
||
| const handleViewHotkeys = () => { | ||
| openSettings("keyboard"); | ||
| }; | ||
|
|
||
| return ( | ||
| <DropdownMenu> | ||
| <DropdownMenuTrigger asChild> | ||
| <button | ||
| type="button" | ||
| className="no-drag flex h-8 w-8 items-center justify-center rounded-md text-accent-foreground hover:bg-accent hover:text-accent-foreground transition-colors" | ||
| aria-label="Help menu" | ||
| > | ||
| <HiOutlineQuestionMarkCircle className="h-4 w-4" /> | ||
| </button> | ||
| </DropdownMenuTrigger> | ||
| <DropdownMenuContent align="end" side="bottom" className="w-64"> | ||
| <DropdownMenuItem onClick={handleContactUs}> | ||
| <HiOutlineEnvelope className="h-4 w-4" /> | ||
| Contact Us | ||
| </DropdownMenuItem> | ||
| <DropdownMenuItem onClick={handleReportIssue}> | ||
| <HiOutlineBugAnt className="h-4 w-4" /> | ||
| Report Issue | ||
| </DropdownMenuItem> | ||
| <DropdownMenuItem onClick={handleJoinDiscord}> | ||
| <FaDiscord className="h-4 w-4" /> | ||
| Join Discord | ||
| </DropdownMenuItem> | ||
| <DropdownMenuSeparator /> | ||
| <DropdownMenuItem onClick={handleViewHotkeys}> | ||
| <HiOutlineCommandLine className="h-4 w-4" /> | ||
| <span className="flex-1">Keyboard Shortcuts</span> | ||
| <KbdGroup> | ||
| {hotkeyKeys.map((key) => ( | ||
| <Kbd key={key}>{key}</Kbd> | ||
| ))} | ||
| </KbdGroup> | ||
| </DropdownMenuItem> | ||
| </DropdownMenuContent> | ||
| </DropdownMenu> | ||
| ); | ||
| } | ||
1 change: 1 addition & 0 deletions
1
apps/desktop/src/renderer/screens/main/components/TopBar/HelpMenu/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { HelpMenu } from "./HelpMenu"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Fix incorrect
mailto:link handling.Using
window.openwith amailto:link and"_blank"target is incorrect. Mailto links open the user's default email client and don't work with window targets.Apply this diff to fix the handler:
const handleContactUs = () => { - window.open(CONTACT_EMAIL, "_blank"); + window.location.href = CONTACT_EMAIL; };📝 Committable suggestion
🤖 Prompt for AI Agents