feat(webui): rename sidebar topics inline
This commit is contained in:
1 parent
7edd377352
commit
d9537bcc94
23 files changed
+736
-68
No files matched your search
+7
-40
@@ -1212,6 +1212,7 @@ function Shell({
|
||||
state: sidebarState,
|
||||
loading: sidebarStateLoading,
|
||||
update: updateSidebarState,
|
||||
rename: onRequestRename,
|
||||
} =
|
||||
useSidebarState(sessions, sessionsLoaded);
|
||||
const initialRouteRef = useRef<ShellRoute | null>(null);
|
||||
@@ -1262,10 +1263,6 @@ function Shell({
|
||||
items: SidebarDeleteItem[];
|
||||
automations?: SessionAutomationJob[];
|
||||
} | null>(null);
|
||||
const [pendingRename, setPendingRename] = useState<{
|
||||
key: string;
|
||||
label: string;
|
||||
} | null>(null);
|
||||
const [pendingTabRename, setPendingTabRename] = useState<{
|
||||
key: string;
|
||||
label: string;
|
||||
@@ -1983,32 +1980,6 @@ function Shell({
|
||||
[updateSidebarState],
|
||||
);
|
||||
|
||||
const onRequestRename = useCallback((key: string, label: string) => {
|
||||
setPendingRename({ key, label });
|
||||
}, []);
|
||||
|
||||
const onConfirmRename = useCallback(
|
||||
(title: string) => {
|
||||
if (!pendingRename) return;
|
||||
const key = pendingRename.key;
|
||||
setPendingRename(null);
|
||||
void updateSidebarState((current) => {
|
||||
const titleOverrides = { ...current.title_overrides };
|
||||
const cleaned = title.trim();
|
||||
if (cleaned) {
|
||||
titleOverrides[key] = cleaned;
|
||||
} else {
|
||||
delete titleOverrides[key];
|
||||
}
|
||||
return {
|
||||
...current,
|
||||
title_overrides: titleOverrides,
|
||||
};
|
||||
});
|
||||
},
|
||||
[pendingRename, updateSidebarState],
|
||||
);
|
||||
|
||||
const onRequestRenameTab = useCallback((key: string, label: string) => {
|
||||
setPendingTabRename({ key, label });
|
||||
}, []);
|
||||
@@ -2926,6 +2897,12 @@ function Shell({
|
||||
>
|
||||
<SheetContent
|
||||
ref={mobileSidebarRef}
|
||||
onEscapeKeyDown={(event) => {
|
||||
if (event.target instanceof Element
|
||||
&& event.target.closest("[data-sidebar-topic-rename]")) {
|
||||
event.preventDefault();
|
||||
}
|
||||
}}
|
||||
onOpenAutoFocus={(event) => {
|
||||
// Keep opening navigation from focusing the search tooltip trigger.
|
||||
event.preventDefault();
|
||||
@@ -3177,16 +3154,6 @@ function Shell({
|
||||
/>
|
||||
</Suspense>
|
||||
) : null}
|
||||
{pendingRename ? (
|
||||
<Suspense fallback={null}>
|
||||
<RenameChatDialog
|
||||
open
|
||||
title={pendingRename.label}
|
||||
onCancel={() => setPendingRename(null)}
|
||||
onConfirm={onConfirmRename}
|
||||
/>
|
||||
</Suspense>
|
||||
) : null}
|
||||
{pendingTabRename ? (
|
||||
<Suspense fallback={null}>
|
||||
<RenameChatDialog
|
||||
|
||||
Reference in new issue
Block a user