Skip to content
Merged
Show file tree
Hide file tree
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
@@ -1,17 +1,35 @@
import { Kbd, KbdGroup } from "@superset/ui/kbd";
import { Tooltip, TooltipContent, TooltipTrigger } from "@superset/ui/tooltip";
import { HiOutlineCog6Tooth } from "react-icons/hi2";
import { useOpenSettings } from "renderer/stores";
import { formatKeysForDisplay, HOTKEYS } from "shared/hotkeys";

export function SettingsButton() {
const openSettings = useOpenSettings();
const keys = formatKeysForDisplay(HOTKEYS.SHOW_HOTKEYS.keys);

return (
<button
type="button"
onClick={() => openSettings()}
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="Open settings"
>
<HiOutlineCog6Tooth className="h-4 w-4" />
</button>
<Tooltip>
<TooltipTrigger asChild>
<button
type="button"
onClick={() => openSettings()}
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="Open settings"
>
<HiOutlineCog6Tooth className="h-4 w-4" />
</button>
</TooltipTrigger>
<TooltipContent side="bottom" showArrow={false}>
<span className="flex items-center gap-2">
Settings
<KbdGroup>
{keys.map((key) => (
<Kbd key={key}>{key}</Kbd>
))}
</KbdGroup>
</span>
</TooltipContent>
</Tooltip>
);
}
Original file line number Diff line number Diff line change
@@ -1,23 +1,41 @@
import { Button } from "@superset/ui/button";
import { Kbd, KbdGroup } from "@superset/ui/kbd";
import { Tooltip, TooltipContent, TooltipTrigger } from "@superset/ui/tooltip";
import { HiMiniBars3, HiMiniBars3BottomLeft } from "react-icons/hi2";
import { useSidebarStore } from "renderer/stores";
import { formatKeysForDisplay, HOTKEYS } from "shared/hotkeys";

export function SidebarControl() {
const { isSidebarOpen, toggleSidebar } = useSidebarStore();
const keys = formatKeysForDisplay(HOTKEYS.TOGGLE_SIDEBAR.keys);

return (
<Button
variant="ghost"
size="icon"
onClick={toggleSidebar}
aria-label="Toggle sidebar"
className="no-drag"
>
{isSidebarOpen ? (
<HiMiniBars3BottomLeft className="size-4" />
) : (
<HiMiniBars3 className="size-4" />
)}
</Button>
<Tooltip>
<TooltipTrigger asChild>
<Button
variant="ghost"
size="icon"
onClick={toggleSidebar}
aria-label="Toggle sidebar"
className="no-drag"
>
{isSidebarOpen ? (
<HiMiniBars3BottomLeft className="size-4" />
) : (
<HiMiniBars3 className="size-4" />
)}
</Button>
</TooltipTrigger>
<TooltipContent side="bottom" showArrow={false}>
<span className="flex items-center gap-2">
Toggle sidebar
<KbdGroup>
{keys.map((key) => (
<Kbd key={key}>{key}</Kbd>
))}
</KbdGroup>
</span>
</TooltipContent>
</Tooltip>
);
}