Skip to content

Open-source AI teammates in Slack, Teams, Discord, Telegram and Mattermost. Self-host it, with any agent harness and any model.

feat(console): New Room in the sidebar's room view

raullopez-sandbox03191e114978
diff --git a/console/apps/switch-console-desktop/src/renderer/features/sidebar/new-row-action.test.ts b/console/apps/switch-console-desktop/src/renderer/features/sidebar/new-row-action.test.ts
new file mode 100644
index 000000000..c1836e03b
--- /dev/null
+++ b/console/apps/switch-console-desktop/src/renderer/features/sidebar/new-row-action.test.ts
@@ -0,0 +1,9 @@
+import { describe, expect, it } from 'vitest';
+import { newRowAction } from './new-row-action';
+
+describe('newRowAction', () => {
+ it('makes a room in the room view and a session in the agent view', () => {
+ expect(newRowAction(true)).toBe('New Room');
+ expect(newRowAction(false)).toBe('New Session');
+ });
+});
diff --git a/console/apps/switch-console-desktop/src/renderer/features/sidebar/new-row-action.ts b/console/apps/switch-console-desktop/src/renderer/features/sidebar/new-row-action.ts
new file mode 100644
index 000000000..ed9441d91
--- /dev/null
+++ b/console/apps/switch-console-desktop/src/renderer/features/sidebar/new-row-action.ts
@@ -0,0 +1,4 @@
+/** The row under the Sessions header makes what the list is grouped by: a room in the room view, else a session. */
+export function newRowAction(roomMode: boolean): 'New Room' | 'New Session' {
+ return roomMode ? 'New Room' : 'New Session';
+}
diff --git a/console/apps/switch-console-desktop/src/renderer/features/sidebar/sessions-section-header.tsx b/console/apps/switch-console-desktop/src/renderer/features/sidebar/sessions-section-header.tsx
index 2391cb68b..098383370 100644
--- a/console/apps/switch-console-desktop/src/renderer/features/sidebar/sessions-section-header.tsx
+++ b/console/apps/switch-console-desktop/src/renderer/features/sidebar/sessions-section-header.tsx
@@ -36,6 +36,7 @@ import type { AgentConnectionKind } from '@shared/core/agents/agent-connection';
import { getProvider } from '@shared/core/providers/agent-provider-registry';
import type { RemoteRoomSummary } from '@shared/core/switch-servers/switch-servers';
import { type SidebarGrouping, UNBRIDGED_FILTER_VALUE } from '@shared/view-state';
+import { newRowAction } from './new-row-action';
import { listedRoomKeys } from './room-tree';
import { agentExpandKey, roomViewGroupKey } from './sidebar-store';
import { scopedAgents } from './sidebar-tree-data';
@@ -359,11 +360,15 @@ export const SessionsSectionHeader = observer(function SessionsSectionHeader({
<div className={legacy ? 'pb-1' : 'px-2 pb-1'}>
<button
type="button"
- onClick={() => showCreateSessionModal({ entryPoint: 'sidebar' })}
+ onClick={() =>
+ newRowAction(roomMode) === 'New Room'
+ ? showCreateRoomModal({})
+ : showCreateSessionModal({ entryPoint: 'sidebar' })
+ }
className="flex w-full cursor-pointer items-center gap-[9px] rounded-lg px-[9px] py-[6px] text-sm text-foreground-muted transition-colors hover:bg-[var(--sel-soft)] hover:text-foreground"
>
<Plus className="size-4 shrink-0" />
- New Session
+ {newRowAction(roomMode)}
</button>
</div>
</>