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
50 changes: 27 additions & 23 deletions apps/ui/src/components/layout/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1029,12 +1029,6 @@ export function Sidebar() {
icon: UserCircle,
shortcut: shortcuts.profiles,
},
{
id: "terminal",
label: "Terminal",
icon: Terminal,
shortcut: shortcuts.terminal,
},
];

// Filter out hidden items
Expand All @@ -1048,29 +1042,39 @@ export function Sidebar() {
if (item.id === "profiles" && hideAiProfiles) {
return false;
}
if (item.id === "terminal" && hideTerminal) {
return false;
}
return true;
});

// Build project items - Terminal is conditionally included
const projectItems: NavItem[] = [
{
id: "board",
label: "Kanban Board",
icon: LayoutGrid,
shortcut: shortcuts.board,
},
{
id: "agent",
label: "Agent Runner",
icon: Bot,
shortcut: shortcuts.agent,
},
];

// Add Terminal to Project section if not hidden
if (!hideTerminal) {
projectItems.push({
id: "terminal",
label: "Terminal",
icon: Terminal,
shortcut: shortcuts.terminal,
});
}
Comment on lines +1049 to +1072
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

For improved readability and conciseness, you can construct the projectItems array declaratively using conditional spreading. This avoids mutating the array after its creation and makes the logic more self-contained.

    const projectItems: NavItem[] = [
      {
        id: "board",
        label: "Kanban Board",
        icon: LayoutGrid,
        shortcut: shortcuts.board,
      },
      {
        id: "agent",
        label: "Agent Runner",
        icon: Bot,
        shortcut: shortcuts.agent,
      },
      ...(!hideTerminal
        ? [
            {
              id: "terminal",
              label: "Terminal",
              icon: Terminal,
              shortcut: shortcuts.terminal,
            },
          ]
        : []),
    ];


return [
{
label: "Project",
items: [
{
id: "board",
label: "Kanban Board",
icon: LayoutGrid,
shortcut: shortcuts.board,
},
{
id: "agent",
label: "Agent Runner",
icon: Bot,
shortcut: shortcuts.agent,
},
],
items: projectItems,
},
{
label: "Tools",
Expand Down