Skip to content
Closed
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
Expand Up @@ -40,9 +40,7 @@ import {
useOpenTemplateGalleryModal,
} from "renderer/stores/add-repository-modal";
import { useOpenNewWorkspaceModal } from "renderer/stores/new-workspace-modal";

// Temporarily hidden, not removed — flip to true to restore the Workspaces tab.
const SHOW_WORKSPACES_TAB = false;
import { useIsWorkspacesTabVisible } from "renderer/stores/sidebar-workspaces-tab";

interface DashboardSidebarHeaderProps {
isCollapsed?: boolean;
Expand All @@ -54,6 +52,7 @@ export function DashboardSidebarHeader({
const openModal = useOpenNewWorkspaceModal();
const openNewProject = useOpenNewProjectModal();
const openTemplateGallery = useOpenTemplateGalleryModal();
const showWorkspacesTab = useIsWorkspacesTabVisible();
const navigate = useNavigate();
const folderImport = useFolderFirstImport({
onError: (message) => {
Expand Down Expand Up @@ -171,7 +170,7 @@ export function DashboardSidebarHeader({
</TooltipContent>
</Tooltip>

{SHOW_WORKSPACES_TAB && (
{showWorkspacesTab && (
<Tooltip delayDuration={300}>
<TooltipTrigger asChild>
<button
Expand Down Expand Up @@ -351,7 +350,7 @@ export function DashboardSidebarHeader({
)}
</button>

{SHOW_WORKSPACES_TAB && (
{showWorkspacesTab && (
<button
type="button"
onClick={handleWorkspacesClick}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
import { FontSettingSection } from "./components/FontSettingSection";
import { MarkdownStyleSection } from "./components/MarkdownStyleSection";
import { ThemeSection } from "./components/ThemeSection";
import { WorkspacesTabSection } from "./components/WorkspacesTabSection";

/**
* Renders a list of visible sections with automatic border separators.
Expand Down Expand Up @@ -49,6 +50,10 @@ export function AppearanceSettings({ visibleItems }: AppearanceSettingsProps) {
SETTING_ITEM_ID.APPEARANCE_CUSTOM_THEMES,
visibleItems,
);
const showWorkspacesTab = isItemVisible(
SETTING_ITEM_ID.APPEARANCE_WORKSPACES_TAB,
visibleItems,
);
const showThemeSection = showTheme || showCustomThemes;

return (
Expand All @@ -69,6 +74,7 @@ export function AppearanceSettings({ visibleItems }: AppearanceSettingsProps) {
{showTerminalFont && (
<FontSettingSection key="terminal-font" variant="terminal" />
)}
{showWorkspacesTab && <WorkspacesTabSection key="workspaces-tab" />}
</SectionList>
</div>
);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Label } from "@superset/ui/label";
import { Switch } from "@superset/ui/switch";
import {
useIsWorkspacesTabVisible,
useSetWorkspacesTabVisible,
} from "renderer/stores/sidebar-workspaces-tab";

export function WorkspacesTabSection() {
const isVisible = useIsWorkspacesTabVisible();
const setVisible = useSetWorkspacesTabVisible();

return (
<div className="flex items-center justify-between">
<div className="space-y-0.5">
<Label htmlFor="show-workspaces-tab" className="text-sm font-medium">
Show Workspaces tab
</Label>
<p className="text-xs text-muted-foreground">
Add a Workspaces entry to the sidebar that opens the full workspace
list. It is also reachable from the command palette.
</p>
</div>
<Switch
id="show-workspaces-tab"
checked={isVisible}
onCheckedChange={setVisible}
/>
</div>
);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { WorkspacesTabSection } from "./WorkspacesTabSection";
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const SETTING_ITEM_ID = {
APPEARANCE_CUSTOM_THEMES: "appearance-custom-themes",
APPEARANCE_EDITOR_FONT: "appearance-editor-font",
APPEARANCE_TERMINAL_FONT: "appearance-terminal-font",
APPEARANCE_WORKSPACES_TAB: "appearance-workspaces-tab",

RINGTONES_NOTIFICATION: "ringtones-notification",

Expand Down Expand Up @@ -132,6 +133,7 @@ export const SETTING_ITEM_VARIANT: Record<SettingItemId, SettingVariant> = {
[SETTING_ITEM_ID.APPEARANCE_CUSTOM_THEMES]: "shared",
[SETTING_ITEM_ID.APPEARANCE_EDITOR_FONT]: "shared",
[SETTING_ITEM_ID.APPEARANCE_TERMINAL_FONT]: "shared",
[SETTING_ITEM_ID.APPEARANCE_WORKSPACES_TAB]: "v2",

[SETTING_ITEM_ID.RINGTONES_NOTIFICATION]: "shared",

Expand Down Expand Up @@ -412,6 +414,23 @@ export const SETTINGS_ITEMS: SettingsItem[] = [
"readme",
],
},
{
id: SETTING_ITEM_ID.APPEARANCE_WORKSPACES_TAB,
section: "appearance",
title: "Show Workspaces Tab",
description: "Show a Workspaces entry in the sidebar",
keywords: [
"appearance",
"workspaces",
"tab",
"sidebar",
"nav",
"navigation",
"show",
"hide",
"list",
],
},
{
id: SETTING_ITEM_ID.APPEARANCE_CUSTOM_THEMES,
section: "appearance",
Expand Down
27 changes: 27 additions & 0 deletions apps/desktop/src/renderer/stores/sidebar-workspaces-tab.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import { create } from "zustand";
import { devtools, persist } from "zustand/middleware";

interface SidebarWorkspacesTabState {
isVisible: boolean;
setVisible: (isVisible: boolean) => void;
}

export const useSidebarWorkspacesTabStore = create<SidebarWorkspacesTabState>()(
devtools(
persist(
(set) => ({
isVisible: false,
setVisible: (isVisible) => {
set({ isVisible });
},
}),
{ name: "sidebar-workspaces-tab" },
),
{ name: "SidebarWorkspacesTabStore" },
),
);

export const useIsWorkspacesTabVisible = () =>
useSidebarWorkspacesTabStore((state) => state.isVisible);
export const useSetWorkspacesTabVisible = () =>
useSidebarWorkspacesTabStore((state) => state.setVisible);