Skip to content

Commit 78a2446

Browse files
fix(web): keep sidebar nav icons embedded (#319)
- Render workspace sidebar navigation icons with existing React SVG components instead of CSS mask URLs. - Remove the unused mask class for sidebar navigation icons.
1 parent 96c1a3a commit 78a2446

2 files changed

Lines changed: 29 additions & 32 deletions

File tree

web/app/src/pages/WorkspacePage/components/WorkspaceSidebar/WorkspaceSidebar.module.css

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -323,19 +323,11 @@
323323
}
324324

325325
.primaryNavIcon svg {
326+
display: block;
326327
width: 20px;
327328
height: 20px;
328329
}
329330

330-
.primaryNavIconMask {
331-
width: 20px;
332-
height: 20px;
333-
background: currentColor;
334-
display: block;
335-
-webkit-mask: var(--workspace-nav-icon-url) center / contain no-repeat;
336-
mask: var(--workspace-nav-icon-url) center / contain no-repeat;
337-
}
338-
339331
.primaryNavLabel {
340332
min-width: 0;
341333
flex: 1 1 auto;

web/app/src/pages/WorkspacePage/components/WorkspaceSidebar/WorkspaceSidebar.tsx

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
import { useEffect, useMemo, useRef, useState } from "react";
22
import { PanelLeftOpen, Plus, Search } from "lucide-react";
3+
import {
4+
SidebarAlertTriangleIcon,
5+
SidebarBoxIcon,
6+
SidebarGrid07Icon,
7+
SidebarLaptopIcon,
8+
SidebarListUnordered4Icon,
9+
SidebarMessageIcon,
10+
SidebarPuzzlePiece02Icon,
11+
SidebarRobotIcon,
12+
SidebarTimer2Icon,
13+
SidebarUserIcon,
14+
SidebarUsersIcon,
15+
} from "@/components/ui/Icons";
316
import { SidebarRailControlButton } from "./SidebarRailControlButton";
417
import { SidebarUserButton } from "./SidebarUserButton";
518
import { LogoMark, LogoWordmark } from "./WorkspaceSidebarBrand";
@@ -11,24 +24,22 @@ import { classNames } from "@/shared/lib/classNames";
1124
import styles from "./WorkspaceSidebar.module.css";
1225
import type { PrimaryNavigationItem, PrimaryNavigationSection } from "./WorkspacePrimaryNavigation";
1326
import type { WorkspaceContextSectionId, WorkspaceSidebarProps } from "./types";
14-
import type { CSSProperties } from "react";
27+
import type { ComponentType } from "react";
1528

16-
type NavigationIconStyle = CSSProperties & {
17-
"--workspace-nav-icon-url": string;
18-
};
29+
type SidebarNavigationIcon = ComponentType<{ size?: number | string }>;
1930

2031
const WORKSPACE_NAVIGATION_ICONS = {
21-
agents: "icons/workspace-agents.svg",
22-
computers: "icons/workspace-computers.svg",
23-
humans: "icons/workspace-humans.svg",
24-
messages: "icons/workspace-messages.svg",
25-
models: "icons/workspace-models.svg",
26-
notifications: "icons/workspace-notifications.svg",
27-
scheduledTasks: "icons/workspace-scheduled-tasks.svg",
28-
skills: "icons/workspace-skills.svg",
29-
tasks: "icons/workspace-tasks.svg",
30-
teams: "icons/workspace-teams.svg",
31-
templates: "icons/workspace-templates.svg",
32+
agents: SidebarRobotIcon,
33+
computers: SidebarLaptopIcon,
34+
humans: SidebarUserIcon,
35+
messages: SidebarMessageIcon,
36+
models: SidebarBoxIcon,
37+
notifications: SidebarAlertTriangleIcon,
38+
scheduledTasks: SidebarTimer2Icon,
39+
skills: SidebarPuzzlePiece02Icon,
40+
tasks: SidebarListUnordered4Icon,
41+
teams: SidebarUsersIcon,
42+
templates: SidebarGrid07Icon,
3243
} as const;
3344

3445
export function WorkspaceSidebar({
@@ -535,14 +546,8 @@ export function WorkspaceSidebar({
535546
);
536547
}
537548

538-
function navigationIcon(path: string) {
539-
return (
540-
<span
541-
className={styles.primaryNavIconMask}
542-
style={{ "--workspace-nav-icon-url": `url("${path}")` } as NavigationIconStyle}
543-
aria-hidden="true"
544-
/>
545-
);
549+
function navigationIcon(Icon: SidebarNavigationIcon) {
550+
return <Icon size={20} />;
546551
}
547552

548553
function badgeCount(count: number | null | undefined) {

0 commit comments

Comments
 (0)