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 @@ + + + +