Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,12 @@ import { Tooltip, TooltipContent, TooltipTrigger } from "@superset/ui/tooltip";
import { useMatchRoute } from "@tanstack/react-router";
import { LuPlus } from "react-icons/lu";
import { electronTrpc } from "renderer/lib/electron-trpc";
import {
useEffectiveHotkeysMap,
useHotkeysStore,
} from "renderer/stores/hotkeys";
import { useOpenNewWorkspaceModal } from "renderer/stores/new-workspace-modal";
import { formatHotkeyText } from "shared/hotkeys";
import { STROKE_WIDTH_THICK } from "../constants";

interface NewWorkspaceButtonProps {
Expand All @@ -13,6 +18,9 @@ export function NewWorkspaceButton({
isCollapsed = false,
}: NewWorkspaceButtonProps) {
const openModal = useOpenNewWorkspaceModal();
const platform = useHotkeysStore((state) => state.platform);
const effective = useEffectiveHotkeysMap();
const shortcutText = formatHotkeyText(effective.NEW_WORKSPACE, platform);

// Derive current workspace from route to pre-select project in modal
const matchRoute = useMatchRoute();
Expand Down Expand Up @@ -50,7 +58,9 @@ export function NewWorkspaceButton({
</div>
</button>
</TooltipTrigger>
<TooltipContent side="right">New Workspace</TooltipContent>
<TooltipContent side="right">
New Workspace ({shortcutText})
</TooltipContent>
</Tooltip>
);
}
Expand All @@ -59,12 +69,15 @@ export function NewWorkspaceButton({
<button
type="button"
onClick={handleClick}
className="flex items-center gap-2 px-2 py-1.5 text-sm font-medium text-muted-foreground hover:text-foreground hover:bg-accent/50 rounded-md transition-colors"
className="group flex items-center gap-2 px-2 py-1.5 text-sm font-medium text-muted-foreground hover:text-foreground hover:bg-accent/50 rounded-md transition-colors"
>
<div className="flex items-center justify-center size-5 rounded bg-accent">
<LuPlus className="size-3" strokeWidth={STROKE_WIDTH_THICK} />
</div>
<span>New Workspace</span>
<span className="flex-1">New Workspace</span>
<span className="text-[10px] text-muted-foreground/50 opacity-0 group-hover:opacity-100 transition-opacity font-mono tabular-nums shrink-0">
{shortcutText}
</span>
</button>
);
}
Loading