-
Notifications
You must be signed in to change notification settings - Fork 895
Start screen v3 #201
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
Start screen v3 #201
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
90be7fa
update themes and cards
AviPeltz d9565fd
Merge remote-tracking branch 'origin/main' into start-screen-v3
AviPeltz 46cadf3
start screen start
AviPeltz 7f367c9
fix: rerender bug, and error handling
AviPeltz 33c9816
fix: refetch and up'ed failure count to 5
AviPeltz 5aafcd7
fix: dedupe and cancel clone repo stuff
AviPeltz 4217873
update view all and path name stuff
AviPeltz 4590f38
Merge main into start-screen-v3
AviPeltz dbf8ae5
added min width and some fixes
AviPeltz 2d69eed
fix: lint error
AviPeltz 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
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
149 changes: 149 additions & 0 deletions
149
apps/desktop/src/renderer/screens/main/components/SettingsView/KeyboardShortcutsSettings.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,149 @@ | ||
| import { Input } from "@superset/ui/input"; | ||
| import { Kbd, KbdGroup } from "@superset/ui/kbd"; | ||
| import { useMemo, useState } from "react"; | ||
| import { HiMagnifyingGlass } from "react-icons/hi2"; | ||
| import { | ||
| formatKeysForDisplay, | ||
| getHotkeysByCategory, | ||
| type HotkeyCategory, | ||
| type HotkeyDefinition, | ||
| } from "shared/hotkeys"; | ||
|
|
||
| function useIsMac(): boolean { | ||
| return useMemo(() => { | ||
| const platform = navigator.platform?.toUpperCase() ?? ""; | ||
| const userAgent = navigator.userAgent?.toUpperCase() ?? ""; | ||
| return platform.includes("MAC") || userAgent.includes("MAC"); | ||
| }, []); | ||
| } | ||
|
|
||
| const CATEGORY_ORDER: HotkeyCategory[] = [ | ||
| "Workspace", | ||
| "Terminal", | ||
| "Layout", | ||
| "Window", | ||
| "Help", | ||
| ]; | ||
|
|
||
| function HotkeyRow({ | ||
| hotkey, | ||
| isEven, | ||
| }: { | ||
| hotkey: HotkeyDefinition; | ||
| isEven: boolean; | ||
| }) { | ||
| const keys = formatKeysForDisplay(hotkey.keys); | ||
|
|
||
| return ( | ||
| <div | ||
| className={`flex items-center justify-between py-3 px-4 ${ | ||
| isEven ? "bg-accent/20" : "" | ||
| }`} | ||
| > | ||
| <span className="text-sm text-foreground">{hotkey.label}</span> | ||
| <KbdGroup> | ||
| {keys.map((key) => ( | ||
| <Kbd key={key}>{key}</Kbd> | ||
| ))} | ||
| </KbdGroup> | ||
| </div> | ||
| ); | ||
| } | ||
|
|
||
| /** | ||
| * Consolidate individual workspace jump shortcuts (1-9) into a single entry | ||
| */ | ||
| function consolidateWorkspaceJumps( | ||
| hotkeys: HotkeyDefinition[], | ||
| ): HotkeyDefinition[] { | ||
| const workspaceJumpPattern = /^Switch to Workspace \d$/; | ||
| const hasWorkspaceJumps = hotkeys.some((h) => | ||
| workspaceJumpPattern.test(h.label), | ||
| ); | ||
|
|
||
| if (!hasWorkspaceJumps) return hotkeys; | ||
|
|
||
| const filtered = hotkeys.filter((h) => !workspaceJumpPattern.test(h.label)); | ||
| filtered.unshift({ | ||
| keys: "meta+1-9", | ||
| label: "Switch to Workspace 1-9", | ||
| category: "Workspace", | ||
| }); | ||
|
|
||
| return filtered; | ||
| } | ||
|
|
||
| export function KeyboardShortcutsSettings() { | ||
| const [searchQuery, setSearchQuery] = useState(""); | ||
| const hotkeysByCategory = getHotkeysByCategory(); | ||
| const isMac = useIsMac(); | ||
| const modifierKey = isMac ? "⌘" : "Ctrl"; | ||
|
|
||
| // Flatten and consolidate all hotkeys | ||
| const allHotkeys = CATEGORY_ORDER.flatMap((category) => | ||
| consolidateWorkspaceJumps(hotkeysByCategory[category]), | ||
| ); | ||
|
|
||
| // Filter based on search query | ||
| const filteredHotkeys = searchQuery | ||
| ? allHotkeys.filter((hotkey) => | ||
| hotkey.label.toLowerCase().includes(searchQuery.toLowerCase()), | ||
| ) | ||
| : allHotkeys; | ||
|
|
||
| return ( | ||
| <div className="p-6 w-full max-w-3xl"> | ||
| {/* Header */} | ||
| <div className="mb-6"> | ||
| <h2 className="text-lg font-semibold">Keyboard Shortcuts</h2> | ||
| <p className="text-sm text-muted-foreground mt-1"> | ||
| View all available keyboard shortcuts. Press{" "} | ||
| <Kbd className="mx-1">{modifierKey}</Kbd> | ||
| <Kbd>?</Kbd> to open this page anytime. | ||
| </p> | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| </div> | ||
|
|
||
| {/* Search */} | ||
| <div className="relative mb-6"> | ||
| <HiMagnifyingGlass className="absolute left-3 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground" /> | ||
| <Input | ||
| type="text" | ||
| placeholder="Search" | ||
| value={searchQuery} | ||
| onChange={(e) => setSearchQuery(e.target.value)} | ||
| className="pl-9 bg-accent/30 border-transparent focus:border-accent" | ||
| /> | ||
| </div> | ||
|
|
||
| {/* Table */} | ||
| <div className="rounded-lg border border-border overflow-hidden"> | ||
| {/* Table Header */} | ||
| <div className="flex items-center justify-between py-2 px-4 bg-accent/10 border-b border-border"> | ||
| <span className="text-xs font-medium text-muted-foreground uppercase tracking-wider"> | ||
| Command | ||
| </span> | ||
| <span className="text-xs font-medium text-muted-foreground uppercase tracking-wider"> | ||
| Shortcut | ||
| </span> | ||
| </div> | ||
|
|
||
| {/* Table Body */} | ||
| <div className="max-h-[calc(100vh-320px)] overflow-y-auto"> | ||
| {filteredHotkeys.length > 0 ? ( | ||
| filteredHotkeys.map((hotkey, index) => ( | ||
| <HotkeyRow | ||
| key={hotkey.keys} | ||
| hotkey={hotkey} | ||
| isEven={index % 2 === 0} | ||
| /> | ||
| )) | ||
| ) : ( | ||
| <div className="py-8 text-center text-sm text-muted-foreground"> | ||
| No shortcuts found matching "{searchQuery}" | ||
| </div> | ||
| )} | ||
| </div> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } | ||
Oops, something went wrong.
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.
SSH-style URLs will fail Zod's
.url()validation.The
z.string().url()validator only accepts URLs with valid protocols (http, https, etc.). SSH-style URLs likegit@github.com:user/repo.gitwill fail validation before reachingextractRepoName, even though that function is designed to handle them.Consider using a custom validation or a more permissive schema:
.input( z.object({ - url: z.string().url(), + url: z.string().min(1, "Repository URL is required"), // Trim and convert empty/whitespace strings to undefined targetDirectory: z .string() .trim() .optional() .transform((v) => (v && v.length > 0 ? v : undefined)), }), )Alternatively, add a custom refinement that validates both URL formats:
🤖 Prompt for AI Agents