-
Notifications
You must be signed in to change notification settings - Fork 968
V2 top bar: right sidebar toggle, org dropdown in sidebar, unified open-in button #3197
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
Changes from all commits
3b77404
af9b7ae
506976b
d392c1d
11ac4db
371d0bb
65733ae
d3bc8cf
76df36d
1a7f4fa
b44be71
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 | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -1,12 +1,9 @@ | ||||||||||||||||||||||||||||||||||||||||
| import { Tooltip, TooltipContent, TooltipTrigger } from "@superset/ui/tooltip"; | ||||||||||||||||||||||||||||||||||||||||
| import { cn } from "@superset/ui/utils"; | ||||||||||||||||||||||||||||||||||||||||
| import { useMatchRoute, useNavigate } from "@tanstack/react-router"; | ||||||||||||||||||||||||||||||||||||||||
| import { LuLayers, LuPlus } from "react-icons/lu"; | ||||||||||||||||||||||||||||||||||||||||
| import { LuFolderPlus, LuPlus } from "react-icons/lu"; | ||||||||||||||||||||||||||||||||||||||||
| import { useHotkeyDisplay } from "renderer/hotkeys"; | ||||||||||||||||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||||||||||||||||
| STROKE_WIDTH, | ||||||||||||||||||||||||||||||||||||||||
| STROKE_WIDTH_THICK, | ||||||||||||||||||||||||||||||||||||||||
| } from "renderer/screens/main/components/WorkspaceSidebar/constants"; | ||||||||||||||||||||||||||||||||||||||||
| import { OrganizationDropdown } from "renderer/routes/_authenticated/_dashboard/components/TopBar/components/OrganizationDropdown"; | ||||||||||||||||||||||||||||||||||||||||
| import { STROKE_WIDTH_THICK } from "renderer/screens/main/components/WorkspaceSidebar/constants"; | ||||||||||||||||||||||||||||||||||||||||
| import { useOpenNewWorkspaceModal } from "renderer/stores/new-workspace-modal"; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| interface DashboardSidebarHeaderProps { | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -16,35 +13,24 @@ interface DashboardSidebarHeaderProps { | |||||||||||||||||||||||||||||||||||||||
| export function DashboardSidebarHeader({ | ||||||||||||||||||||||||||||||||||||||||
| isCollapsed = false, | ||||||||||||||||||||||||||||||||||||||||
| }: DashboardSidebarHeaderProps) { | ||||||||||||||||||||||||||||||||||||||||
| const navigate = useNavigate(); | ||||||||||||||||||||||||||||||||||||||||
| const matchRoute = useMatchRoute(); | ||||||||||||||||||||||||||||||||||||||||
| const openModal = useOpenNewWorkspaceModal(); | ||||||||||||||||||||||||||||||||||||||||
| const shortcutText = useHotkeyDisplay("NEW_WORKSPACE").text; | ||||||||||||||||||||||||||||||||||||||||
| const isWorkspacesPageOpen = !!matchRoute({ to: "/v2-workspaces" }); | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| const handleWorkspacesClick = () => { | ||||||||||||||||||||||||||||||||||||||||
| navigate({ to: "/v2-workspaces" }); | ||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| if (isCollapsed) { | ||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||
| <div className="flex flex-col items-center gap-2 border-b border-border py-2"> | ||||||||||||||||||||||||||||||||||||||||
| <OrganizationDropdown variant="collapsed" /> | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| <Tooltip delayDuration={300}> | ||||||||||||||||||||||||||||||||||||||||
| <TooltipTrigger asChild> | ||||||||||||||||||||||||||||||||||||||||
| <button | ||||||||||||||||||||||||||||||||||||||||
| type="button" | ||||||||||||||||||||||||||||||||||||||||
| onClick={handleWorkspacesClick} | ||||||||||||||||||||||||||||||||||||||||
| className={cn( | ||||||||||||||||||||||||||||||||||||||||
| "flex size-8 items-center justify-center rounded-md transition-colors", | ||||||||||||||||||||||||||||||||||||||||
| isWorkspacesPageOpen | ||||||||||||||||||||||||||||||||||||||||
| ? "bg-accent text-foreground" | ||||||||||||||||||||||||||||||||||||||||
| : "text-muted-foreground hover:bg-accent/50 hover:text-foreground", | ||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||
| className="flex size-8 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground" | ||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||
| <LuLayers className="size-4" strokeWidth={STROKE_WIDTH} /> | ||||||||||||||||||||||||||||||||||||||||
| <LuFolderPlus className="size-4" /> | ||||||||||||||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||||||||||||||
| </TooltipTrigger> | ||||||||||||||||||||||||||||||||||||||||
| <TooltipContent side="right">Workspaces</TooltipContent> | ||||||||||||||||||||||||||||||||||||||||
| <TooltipContent side="right">Add Repository</TooltipContent> | ||||||||||||||||||||||||||||||||||||||||
| </Tooltip> | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
26
to
34
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.
The Collapsed state:
Suggested change
Comment on lines
24
to
34
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. Don't expose Both variants render a focusable, actionable-looking button, but there is no click handler, navigation target, or disabled state, so the new action does nothing. Please either wire it to the add-repository flow or render it disabled/hidden until that behavior lands; once it is interactive, it should also get an explicit Also applies to: 37-47 🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| <Tooltip delayDuration={300}> | ||||||||||||||||||||||||||||||||||||||||
|
|
@@ -67,21 +53,22 @@ export function DashboardSidebarHeader({ | |||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||
| <div className="flex flex-col gap-1 border-b border-border px-2 pt-2 pb-2"> | ||||||||||||||||||||||||||||||||||||||||
| <button | ||||||||||||||||||||||||||||||||||||||||
| type="button" | ||||||||||||||||||||||||||||||||||||||||
| onClick={handleWorkspacesClick} | ||||||||||||||||||||||||||||||||||||||||
| className={cn( | ||||||||||||||||||||||||||||||||||||||||
| "flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium transition-colors", | ||||||||||||||||||||||||||||||||||||||||
| isWorkspacesPageOpen | ||||||||||||||||||||||||||||||||||||||||
| ? "bg-accent text-foreground" | ||||||||||||||||||||||||||||||||||||||||
| : "text-muted-foreground hover:bg-accent/50 hover:text-foreground", | ||||||||||||||||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||
| <div className="flex size-5 items-center justify-center"> | ||||||||||||||||||||||||||||||||||||||||
| <LuLayers className="size-4" strokeWidth={STROKE_WIDTH} /> | ||||||||||||||||||||||||||||||||||||||||
| <div className="flex items-center gap-1"> | ||||||||||||||||||||||||||||||||||||||||
| <div className="flex-1 min-w-0"> | ||||||||||||||||||||||||||||||||||||||||
| <OrganizationDropdown variant="expanded" /> | ||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||
| <span className="flex-1 text-left">Workspaces</span> | ||||||||||||||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||||||||||||||
| <Tooltip delayDuration={300}> | ||||||||||||||||||||||||||||||||||||||||
| <TooltipTrigger asChild> | ||||||||||||||||||||||||||||||||||||||||
| <button | ||||||||||||||||||||||||||||||||||||||||
| type="button" | ||||||||||||||||||||||||||||||||||||||||
| className="flex size-8 shrink-0 items-center justify-center rounded-md text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground" | ||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||
| <LuFolderPlus className="size-4" /> | ||||||||||||||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||||||||||||||
| </TooltipTrigger> | ||||||||||||||||||||||||||||||||||||||||
| <TooltipContent side="right">Add Repository</TooltipContent> | ||||||||||||||||||||||||||||||||||||||||
| </Tooltip> | ||||||||||||||||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| <button | ||||||||||||||||||||||||||||||||||||||||
| type="button" | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,7 +2,6 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@superset/ui/tooltip"; | |||||||||||||||||||||||||
| import { cn } from "@superset/ui/utils"; | ||||||||||||||||||||||||||
| import { type ComponentPropsWithoutRef, forwardRef } from "react"; | ||||||||||||||||||||||||||
| import { HiChevronRight, HiMiniPlus } from "react-icons/hi2"; | ||||||||||||||||||||||||||
| import { LuPencil } from "react-icons/lu"; | ||||||||||||||||||||||||||
| import { ProjectThumbnail } from "renderer/routes/_authenticated/components/ProjectThumbnail"; | ||||||||||||||||||||||||||
| import { RenameInput } from "renderer/screens/main/components/WorkspaceSidebar/RenameInput"; | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
|
|
@@ -52,6 +51,7 @@ export const DashboardSidebarProjectRow = forwardRef< | |||||||||||||||||||||||||
| role={isRenaming ? undefined : "button"} | ||||||||||||||||||||||||||
| tabIndex={isRenaming ? undefined : 0} | ||||||||||||||||||||||||||
| onClick={isRenaming ? undefined : onToggleCollapse} | ||||||||||||||||||||||||||
|
Comment on lines
51
to
53
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. Expose expanded/collapsed state on the interactive row. Since the row is now the collapse control ( Suggested fix role={isRenaming ? undefined : "button"}
tabIndex={isRenaming ? undefined : 0}
+ aria-expanded={isRenaming ? undefined : !isCollapsed}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| onDoubleClick={isRenaming ? undefined : onStartRename} | ||||||||||||||||||||||||||
|
Comment on lines
53
to
+54
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. Prevent duplicate collapse toggles on double-click rename. Double-click emits click events first, so this path can fire Suggested fix- onClick={isRenaming ? undefined : onToggleCollapse}
+ onClick={
+ isRenaming
+ ? undefined
+ : (event) => {
+ // Ignore multi-clicks; double-click is reserved for rename.
+ if (event.detail > 1) return;
+ onToggleCollapse();
+ }
+ }
onDoubleClick={isRenaming ? undefined : onStartRename}📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||
| onKeyDown={ | ||||||||||||||||||||||||||
| isRenaming | ||||||||||||||||||||||||||
| ? undefined | ||||||||||||||||||||||||||
|
|
@@ -70,10 +70,21 @@ export const DashboardSidebarProjectRow = forwardRef< | |||||||||||||||||||||||||
| {...props} | ||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||
| <div className="flex min-w-0 flex-1 items-center gap-2 py-0.5"> | ||||||||||||||||||||||||||
| <ProjectThumbnail | ||||||||||||||||||||||||||
| projectName={projectName} | ||||||||||||||||||||||||||
| githubOwner={githubOwner} | ||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||
| <div className="relative shrink-0 size-5 flex items-center justify-center"> | ||||||||||||||||||||||||||
| <span className="group-hover:opacity-0 transition-opacity duration-150"> | ||||||||||||||||||||||||||
| <ProjectThumbnail | ||||||||||||||||||||||||||
| projectName={projectName} | ||||||||||||||||||||||||||
| githubOwner={githubOwner} | ||||||||||||||||||||||||||
| className="size-4" | ||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||
| <HiChevronRight | ||||||||||||||||||||||||||
| className={cn( | ||||||||||||||||||||||||||
| "absolute inset-0 m-auto size-4 text-muted-foreground opacity-0 group-hover:opacity-100 transition-all duration-150", | ||||||||||||||||||||||||||
| !isCollapsed && "rotate-90", | ||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||
| {isRenaming ? ( | ||||||||||||||||||||||||||
| <RenameInput | ||||||||||||||||||||||||||
| value={renameValue} | ||||||||||||||||||||||||||
|
|
@@ -85,26 +96,11 @@ export const DashboardSidebarProjectRow = forwardRef< | |||||||||||||||||||||||||
| ) : ( | ||||||||||||||||||||||||||
| <span className="truncate">{projectName}</span> | ||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||
| <div className="grid shrink-0 items-center [&>*]:col-start-1 [&>*]:row-start-1"> | ||||||||||||||||||||||||||
| {!isRenaming && ( | ||||||||||||||||||||||||||
| <span className="text-xs font-normal tabular-nums text-muted-foreground transition-all duration-150 group-hover:scale-95 group-hover:opacity-0"> | ||||||||||||||||||||||||||
| ({totalWorkspaceCount}) | ||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||
| {!isRenaming && ( | ||||||||||||||||||||||||||
| <button | ||||||||||||||||||||||||||
| type="button" | ||||||||||||||||||||||||||
| onClick={(event) => { | ||||||||||||||||||||||||||
| event.stopPropagation(); | ||||||||||||||||||||||||||
| onStartRename(); | ||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||
| className="flex items-center justify-center opacity-0 scale-90 text-muted-foreground transition-all duration-150 group-hover:scale-100 group-hover:opacity-100 hover:text-foreground" | ||||||||||||||||||||||||||
| aria-label="Rename project" | ||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||
| <LuPencil className="size-3.5 transition-transform duration-150 group-hover:rotate-[-8deg]" /> | ||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||
| {!isRenaming && ( | ||||||||||||||||||||||||||
| <span className="shrink-0 text-xs font-normal tabular-nums text-muted-foreground"> | ||||||||||||||||||||||||||
| ({totalWorkspaceCount}) | ||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| <Tooltip delayDuration={500}> | ||||||||||||||||||||||||||
|
|
@@ -125,24 +121,6 @@ export const DashboardSidebarProjectRow = forwardRef< | |||||||||||||||||||||||||
| New workspace | ||||||||||||||||||||||||||
| </TooltipContent> | ||||||||||||||||||||||||||
| </Tooltip> | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| <button | ||||||||||||||||||||||||||
| type="button" | ||||||||||||||||||||||||||
| onClick={(event) => { | ||||||||||||||||||||||||||
| event.stopPropagation(); | ||||||||||||||||||||||||||
| onToggleCollapse(); | ||||||||||||||||||||||||||
| }} | ||||||||||||||||||||||||||
| onContextMenu={(event) => event.stopPropagation()} | ||||||||||||||||||||||||||
| aria-expanded={!isCollapsed} | ||||||||||||||||||||||||||
| className="p-1 rounded hover:bg-muted transition-colors shrink-0 ml-1" | ||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||
| <HiChevronRight | ||||||||||||||||||||||||||
| className={cn( | ||||||||||||||||||||||||||
| "size-3.5 text-muted-foreground transition-transform duration-150", | ||||||||||||||||||||||||||
| !isCollapsed && "rotate-90", | ||||||||||||||||||||||||||
| )} | ||||||||||||||||||||||||||
| /> | ||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||
| </div> | ||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||
| }, | ||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -32,7 +32,11 @@ import { authClient } from "renderer/lib/auth-client"; | |
| import { electronTrpc } from "renderer/lib/electron-trpc"; | ||
| import { useCollections } from "renderer/routes/_authenticated/providers/CollectionsProvider"; | ||
|
|
||
| export function OrganizationDropdown() { | ||
| export function OrganizationDropdown({ | ||
| variant = "topbar", | ||
| }: { | ||
| variant?: "topbar" | "expanded" | "collapsed"; | ||
| }) { | ||
| const { data: session } = authClient.useSession(); | ||
| const collections = useCollections(); | ||
| const signOutMutation = electronTrpc.auth.signOut.useMutation(); | ||
|
|
@@ -65,27 +69,60 @@ export function OrganizationDropdown() { | |
| const userName = session?.user?.name; | ||
| const displayName = activeOrganization?.name ?? userName ?? "Organization"; | ||
|
|
||
| const triggerButton = | ||
| variant === "collapsed" ? ( | ||
| <button | ||
| type="button" | ||
| className="flex size-8 items-center justify-center rounded-md transition-colors text-muted-foreground hover:bg-accent/50 hover:text-foreground" | ||
| aria-label="Organization menu" | ||
| > | ||
| <Avatar | ||
| size="xs" | ||
| fullName={activeOrganization?.name} | ||
| image={activeOrganization?.logo} | ||
| className="rounded size-4" | ||
| /> | ||
| </button> | ||
| ) : variant === "expanded" ? ( | ||
| <button | ||
| type="button" | ||
| className="flex w-full items-center gap-2 rounded-md px-2 py-1.5 text-sm font-medium text-muted-foreground transition-colors hover:bg-accent/50 hover:text-foreground min-w-0" | ||
| aria-label="Organization menu" | ||
| > | ||
| <Avatar | ||
| size="xs" | ||
| fullName={activeOrganization?.name} | ||
| image={activeOrganization?.logo} | ||
| className="rounded size-4 shrink-0" | ||
| /> | ||
| <span className="truncate">{displayName}</span> | ||
| <HiChevronUpDown className="h-3.5 w-3.5 text-muted-foreground shrink-0" /> | ||
| </button> | ||
|
Comment on lines
+87
to
+100
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. 🧩 Analysis chain🏁 Script executed: # Check if the file exists and read it
cat -n "apps/desktop/src/renderer/routes/_authenticated/_dashboard/components/TopBar/components/OrganizationDropdown/OrganizationDropdown.tsx" | head -110 | tail -40Repository: superset-sh/superset Length of output: 1767 Make the expanded label shrinkable. In a flex row, the span needs Suggested fix- <span className="truncate">{displayName}</span>
+ <span className="min-w-0 flex-1 truncate">{displayName}</span>🤖 Prompt for AI Agents |
||
| ) : ( | ||
| <button | ||
| type="button" | ||
| className="no-drag flex items-center gap-1.5 h-6 px-1.5 rounded border border-border/60 bg-secondary/50 hover:bg-secondary hover:border-border transition-all duration-150 ease-out focus:outline-none focus:ring-1 focus:ring-ring" | ||
| aria-label="Organization menu" | ||
| > | ||
| <Avatar | ||
| size="xs" | ||
| fullName={activeOrganization?.name} | ||
| image={activeOrganization?.logo} | ||
| className="rounded size-4" | ||
| /> | ||
| <span className="text-xs font-medium truncate max-w-32"> | ||
| {displayName} | ||
| </span> | ||
| <HiChevronUpDown className="h-3.5 w-3.5 text-muted-foreground shrink-0" /> | ||
| </button> | ||
| ); | ||
|
|
||
| const contentAlign = variant === "topbar" ? "end" : "start"; | ||
|
|
||
| return ( | ||
| <DropdownMenu> | ||
| <DropdownMenuTrigger asChild> | ||
| <button | ||
| type="button" | ||
| className="no-drag flex items-center gap-1.5 h-6 px-1.5 rounded border border-border/60 bg-secondary/50 hover:bg-secondary hover:border-border transition-all duration-150 ease-out focus:outline-none focus:ring-1 focus:ring-ring" | ||
| aria-label="Organization menu" | ||
| > | ||
| <Avatar | ||
| size="xs" | ||
| fullName={activeOrganization?.name} | ||
| image={activeOrganization?.logo} | ||
| className="rounded size-4" | ||
| /> | ||
| <span className="text-xs font-medium truncate max-w-32"> | ||
| {displayName} | ||
| </span> | ||
| <HiChevronUpDown className="h-3.5 w-3.5 text-muted-foreground shrink-0" /> | ||
| </button> | ||
| </DropdownMenuTrigger> | ||
| <DropdownMenuContent align="end" className="w-56"> | ||
| <DropdownMenuTrigger asChild>{triggerButton}</DropdownMenuTrigger> | ||
| <DropdownMenuContent align={contentAlign} className="w-56"> | ||
| {/* Organization */} | ||
| <DropdownMenuItem | ||
| onSelect={() => navigate({ to: "/settings/account" })} | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,55 @@ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { Tooltip, TooltipContent, TooltipTrigger } from "@superset/ui/tooltip"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LuPanelRight, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LuPanelRightClose, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| LuPanelRightOpen, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } from "react-icons/lu"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { HotkeyLabel } from "renderer/hotkeys"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| import { useCollections } from "renderer/routes/_authenticated/providers/CollectionsProvider"; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| export function RightSidebarToggle({ workspaceId }: { workspaceId: string }) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const collections = useCollections(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const localState = collections.v2WorkspaceLocalState.get(workspaceId); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const isOpen = localState?.rightSidebarOpen ?? false; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const toggle = () => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| collections.v2WorkspaceLocalState.update(workspaceId, (draft) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
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. P2: Guard Prompt for AI agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| draft.rightSidebarOpen = !draft.rightSidebarOpen; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| const getToggleIcon = (isHovering: boolean) => { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| if (!isOpen) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return isHovering ? ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <LuPanelRightOpen className="size-4" strokeWidth={1.5} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) : ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <LuPanelRight className="size-4" strokeWidth={1.5} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return isHovering ? ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <LuPanelRightClose className="size-4" strokeWidth={1.5} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ) : ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <LuPanelRight className="size-4" strokeWidth={1.5} /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+21
to
+34
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.
The Consider returning
Suggested change
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| return ( | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <Tooltip delayDuration={300}> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <TooltipTrigger asChild> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <button | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| type="button" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| onClick={toggle} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| className="no-drag group flex items-center justify-center size-8 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| > | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span className="group-hover:hidden">{getToggleIcon(false)}</span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <span className="hidden group-hover:block"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| {getToggleIcon(true)} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </span> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </button> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </TooltipTrigger> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <TooltipContent side="left"> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| <HotkeyLabel label="Toggle sidebar" id="TOGGLE_SIDEBAR" /> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+39
to
+51
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. Give the new icon button a specific accessible name and state. Right now this is an unnamed icon-only control, and "Toggle sidebar" is ambiguous because the top bar already has a left Suggested fix <button
type="button"
onClick={toggle}
+ aria-label="Toggle right sidebar"
+ aria-pressed={isOpen}
className="no-drag group flex items-center justify-center size-8 rounded-md text-muted-foreground hover:text-foreground hover:bg-accent/50 transition-colors"
>
@@
<TooltipContent side="left">
- <HotkeyLabel label="Toggle sidebar" id="TOGGLE_SIDEBAR" />
+ <HotkeyLabel label="Toggle right sidebar" id="TOGGLE_SIDEBAR" />
</TooltipContent>📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </TooltipContent> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| </Tooltip> | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { RightSidebarToggle } from "./RightSidebarToggle"; |
Uh oh!
There was an error while loading. Please reload this page.
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.
P2: The "Add Repository" button is rendered as an interactive
<button>element but has noonClickhandler attached, so clicking it does nothing. The previous "New Workspace" button this replaced hadonClick={() => openModal()}. Either wire up the intended action or disable the button and add a TODO comment if this is a placeholder.Prompt for AI agents