From 281e7dad7cfe4539b13d0218f4b0fd5a03f3abc9 Mon Sep 17 00:00:00 2001 From: Aleksander Grygier Date: Tue, 10 Nov 2026 15:44:46 +0100 Subject: [PATCH] ui: gather chats into named groups in the sidebar (#32012) * ui: let a menu action open a submenu Group and project pickers open as flyouts from a chat's menus. Master's menu list has no submenus, so bring them back next to its tooltips, with a close callback for picks made inside them. Assisted-by: Claude (Opus 5.5 Medium) * ui : store groups and let conversations join them Groups live in their own IndexedDB table (schema version 2) with a name. groupsStore creates, renames and deletes them; deleting a group keeps its chats, out of any group. A conversation records the group it is sorted into, and a group picked before the first message is kept pending and applied when the conversation is created. Assisted-by: Claude (Opus 5.5 Medium) * ui : show each group as a sidebar section Every group is a sidebar section next to Pinned and Recent, folding, showing its first six chats and dragged into place like them. A chat dropped on a group joins it and leaves Pinned; dropped on Recent, it leaves its group. Recent is called Ungrouped once a group exists, and its menus create a group in a small naming dialog; so does a right-click anywhere in the list that no row or heading takes, down to the empty space under the last section. A group's heading starts a new chat in it, and its menus rename or delete it; deleting keeps its chats, back in Ungrouped. Assisted-by: Claude (Opus 5.5 Medium) * ui : move chats into groups from their menus A chat's menus, in the sidebar and on right-click, move it into a group or take it out of its group. Desktop menus show a searchable group flyout whose New group entry names a group in the group dialog and moves the chat into it; a phone gets a picker dialog instead, which creates a group from what is typed. Assisted-by: Claude (Opus 5.5 Medium) * ui: open the group picker from a phone's hold menu The hold menu is anchored to the row, so it showed the desktop flyout, which ran off the left edge of the screen and whose New group closed without naming one. On a phone, Move to group now opens the picker dialog, as intended. Assisted-by: Claude (Opus 5.5 Medium) * ui: open a new chat in a tab of its own With conversation tabs on, New chat from the sidebar, a group's heading or the shortcut replaced the open chat's tab. It now adds a tab, as the tab bar's "+" does, and the open chat keeps its own. Assisted-by: Claude (Opus 5.5 Medium) * ui: list a phone's groups under the picker's search On a phone the picker fills the screen, and its grid spread the rows over the height, so the list sat in the middle. It is now a column: the list starts under the search and scrolls in the rest of the screen. Assisted-by: Claude (Opus 5.5 Medium) * ui: fix gaps in chat groups found in review - A phone shows a group heading's New chat and menu, and the Ungrouped heading's menu, which were reachable only by hover or right-click. - A pinned chat moved into a group from its menu leaves Pinned, as a drag onto the group already did, so the move shows. - Only the sidebar's New chat, a group's New chat and the new-chat shortcut open a new tab; stepping past the last chat, search and the models drawer show the new-chat screen in the current tab again. - An export carries each chat's group, and an import sorts the chat into the group of that id or name, or creates it; a group the file does not carry is dropped. - The group picked with a group's New chat survives leaving the new-chat tab and coming back. - A phone's menus skip any submenu in the shared menu list, not only the group one. - Deleting a group forgets its section's place and fold. - Groups load newest first by creation, so a rename no longer moves one after a reload. - groupsStore looks groups up in a map and answers which live group a chat is in, for the three places that checked it by hand. Assisted-by: Claude (Opus 5.5 Medium) * ui: keep a forked chat in its source chat's group A fork copied the working directory but not the group, so it landed in Ungrouped. Assisted-by: Claude (Opus 5.5 Medium) * ui: move a chat with its whole fork family between groups Moving a chat into a group, or out of one, takes its parents and its children along, so a fork tree never splits across sidebar sections. A pinned member that joins a group leaves Pinned with the rest. Group sections render the tree with its depth, as Ungrouped does. * ui: show the group name prompt as a small centered card on phones The new and rename group prompt opened full screen on a phone, like a large dialog. It is now built on the alert dialog, as the chat rename prompt is, so a phone shows it as a card in the middle of the screen. Its Cancel is a plain button, so Enter in the name field saves. Assisted-by: Claude (Opus 5.5 Medium) * ui: space a phone's group sections like Ungrouped On a phone a group or Pinned section put its first chat right under the heading, where Ungrouped leaves a row gap. They now leave the same gap, and the sections sit a little further apart than the rows inside them. Assisted-by: Claude (Opus 5.5 Medium) --------- Co-authored-by: Pascal --- .../components/app/dialogs/DialogGroup.svelte | 103 ++++++++++ .../app/dialogs/DialogGroupPicker.svelte | 94 +++++++++ .../src/lib/components/app/dialogs/index.ts | 18 ++ .../app/navigation/ContextMenuActions.svelte | 2 +- .../app/navigation/DropdownMenuActions.svelte | 2 +- .../app/navigation/MenuActionsList.svelte | 10 +- .../SidebarNavigation.svelte | 8 +- .../SidebarNavigationConversationItem.svelte | 56 +++++- .../SidebarNavigationConversationList.svelte | 189 ++++++++++++------ .../SidebarNavigationGroupSection.svelte | 176 ++++++++++++++++ .../SidebarNavigationGroupSubmenu.svelte | 123 ++++++++++++ .../SettingsChatImportExportTab.svelte | 5 +- .../src/lib/constants/database.constants.ts | 12 ++ .../ui/src/lib/constants/groups.constants.ts | 2 + tools/ui/src/lib/constants/index.ts | 1 + tools/ui/src/lib/constants/ui.constants.ts | 2 + tools/ui/src/lib/enums/ui.enums.ts | 1 + .../hooks/use-keyboard-shortcuts.svelte.ts | 2 +- .../services/conversation-transfer.service.ts | 11 +- tools/ui/src/lib/services/database.service.ts | 146 +++++++++++++- .../ui/src/lib/services/migration.service.ts | 6 +- .../lib/stores/conversations/index.svelte.ts | 80 +++++++- .../conversations/preferences.svelte.ts | 8 + tools/ui/src/lib/stores/groups.svelte.ts | 148 ++++++++++++++ tools/ui/src/lib/stores/index.ts | 3 + tools/ui/src/lib/stores/init.ts | 2 + tools/ui/src/lib/stores/ui.svelte.ts | 42 ++++ tools/ui/src/lib/types/database.d.ts | 5 + tools/ui/src/lib/types/groups.d.ts | 7 + tools/ui/src/lib/types/index.ts | 3 + tools/ui/src/lib/types/navigation.d.ts | 9 +- tools/ui/src/lib/utils/conversation-utils.ts | 30 +++ tools/ui/src/lib/utils/index.ts | 1 + .../ui/tests/client/groups-db.svelte.test.ts | 98 +++++++++ .../ui/tests/unit/conversation-export.test.ts | 2 +- .../ui/tests/unit/conversation-import.test.ts | 14 ++ 36 files changed, 1329 insertions(+), 92 deletions(-) create mode 100644 tools/ui/src/lib/components/app/dialogs/DialogGroup.svelte create mode 100644 tools/ui/src/lib/components/app/dialogs/DialogGroupPicker.svelte create mode 100644 tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigationGroupSection.svelte create mode 100644 tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigationGroupSubmenu.svelte create mode 100644 tools/ui/src/lib/constants/groups.constants.ts create mode 100644 tools/ui/src/lib/stores/groups.svelte.ts create mode 100644 tools/ui/src/lib/types/groups.d.ts create mode 100644 tools/ui/tests/client/groups-db.svelte.test.ts diff --git a/tools/ui/src/lib/components/app/dialogs/DialogGroup.svelte b/tools/ui/src/lib/components/app/dialogs/DialogGroup.svelte new file mode 100644 index 000000000..bc198768c --- /dev/null +++ b/tools/ui/src/lib/components/app/dialogs/DialogGroup.svelte @@ -0,0 +1,103 @@ + + + + !open && close()} open={options !== null}> + { + event.preventDefault(); + nameInput?.focus(); + nameInput?.select(); + }} + > + + + {#if group} + + {:else} + + {/if} + + {group ? 'Rename group' : 'New group'} + + + + {group ? 'Choose a new name for this group.' : 'Name a group to sort chats into.'} + + + +
+
+ + + +
+ + + + Cancel + + + +
+
+
diff --git a/tools/ui/src/lib/components/app/dialogs/DialogGroupPicker.svelte b/tools/ui/src/lib/components/app/dialogs/DialogGroupPicker.svelte new file mode 100644 index 000000000..e541b793b --- /dev/null +++ b/tools/ui/src/lib/components/app/dialogs/DialogGroupPicker.svelte @@ -0,0 +1,94 @@ + + + + !open && close()} open={options !== null}> + + Move to group + +
+ { + if (event.key === 'Enter' && newGroupName) void createAndSelect(); + }} + placeholder="Search or create a group" + size="sm" + /> +
+ +
+ + + {#if groups.length > 0} + + + {#each groups as group (group.id)} + + {/each} + {:else if newGroupName} +

No matching groups

+ {/if} +
+
+
diff --git a/tools/ui/src/lib/components/app/dialogs/index.ts b/tools/ui/src/lib/components/app/dialogs/index.ts index ca46ba753..5b3ca761d 100644 --- a/tools/ui/src/lib/components/app/dialogs/index.ts +++ b/tools/ui/src/lib/components/app/dialogs/index.ts @@ -177,6 +177,24 @@ export { default as DialogConversationDelete } from './DialogConversationDelete. */ export { default as DialogConversationRename } from './DialogConversationRename.svelte'; +/** + * **DialogGroup** - Name a new sidebar group, or rename one + * + * Opened through `uiStore.openGroupDialog()`, from the Recent heading's + * menus to create a group and from a group's menus to rename it. Mounted + * once, in the sidebar. + */ +export { default as DialogGroup } from './DialogGroup.svelte'; + +/** + * **DialogGroupPicker** - Pick the group a chat moves to, on a phone + * + * Opened through `uiStore.openGroupPicker()` where a desktop menu shows the + * group submenu: a search that filters the groups and creates one with + * the typed name. Mounted once, in the sidebar. + */ +export { default as DialogGroupPicker } from './DialogGroupPicker.svelte'; + /** * * CONTENT PREVIEW DIALOGS diff --git a/tools/ui/src/lib/components/app/navigation/ContextMenuActions.svelte b/tools/ui/src/lib/components/app/navigation/ContextMenuActions.svelte index ca0f7de60..dd68cb425 100644 --- a/tools/ui/src/lib/components/app/navigation/ContextMenuActions.svelte +++ b/tools/ui/src/lib/components/app/navigation/ContextMenuActions.svelte @@ -26,6 +26,6 @@ - + (open = false)} /> diff --git a/tools/ui/src/lib/components/app/navigation/DropdownMenuActions.svelte b/tools/ui/src/lib/components/app/navigation/DropdownMenuActions.svelte index 7dd6ea6ad..158c55858 100644 --- a/tools/ui/src/lib/components/app/navigation/DropdownMenuActions.svelte +++ b/tools/ui/src/lib/components/app/navigation/DropdownMenuActions.svelte @@ -129,7 +129,7 @@ - + (open = false)} /> {/if} diff --git a/tools/ui/src/lib/components/app/navigation/MenuActionsList.svelte b/tools/ui/src/lib/components/app/navigation/MenuActionsList.svelte index c48076bb9..7a0ba8a4d 100644 --- a/tools/ui/src/lib/components/app/navigation/MenuActionsList.svelte +++ b/tools/ui/src/lib/components/app/navigation/MenuActionsList.svelte @@ -4,15 +4,18 @@ import * as DropdownMenu from '$lib/components/ui/dropdown-menu'; import * as Tooltip from '$lib/components/ui/tooltip'; import { MenuKind } from '$lib/enums'; + import { deviceStore } from '$lib/stores'; import type { MenuAction } from '$lib/types'; import type { Component } from 'svelte'; interface Props { actions: MenuAction[]; kind: MenuKind; + /** Closes the menu, e.g. after a pick in a submenu. */ + onClose: () => void; } - let { actions, kind }: Props = $props(); + let { actions, kind, onClose }: Props = $props(); // both kits wrap the same bits-ui menu parts, so the rows render alike let Menu = $derived(kind === MenuKind.CONTEXT ? ContextMenu : DropdownMenu); @@ -23,7 +26,10 @@ {/if} - {#if action.tooltip} + + {#if action.submenu && !deviceStore.isMobile} + {@render action.submenu({ close: onClose, kind })} + {:else if action.tooltip} diff --git a/tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte b/tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte index 661a3df90..773f40448 100644 --- a/tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte +++ b/tools/ui/src/lib/components/app/navigation/SidebarNavigation/SidebarNavigation.svelte @@ -7,6 +7,8 @@ DialogConversationDelete, DialogConversationRename, DialogDiscoverModels, + DialogGroup, + DialogGroupPicker, DialogMcpServers, DialogSearch, DialogSettingsChat, @@ -502,7 +504,7 @@ function handleSidebarAction(action: SidebarAction): void { switch (action) { case SidebarAction.NEW_CHAT: - afterMobileClose(() => void conversationsStore.openNewChat()); + afterMobileClose(() => void conversationsStore.openNewChat({ inNewTab: true })); break; case SidebarAction.SEARCH: @@ -707,6 +709,10 @@ + + + +