fix: clipboard fallback for insecure contexts, session rename via sessions.patch

- Add copyToClipboard utility with execCommand fallback for HTTP deployments (#76)
- Replace all navigator.clipboard.writeText calls with copyToClipboard
- Session rename now persists server-side via sessions.patch (#78)
- Pass onRename callback from App to Sidebar
This commit is contained in:
Nicolas Varrot
2026-02-15 20:07:33 +00:00
parent e05e17acd3
commit 7606a09ba9
9 changed files with 102 additions and 15 deletions

View File

@@ -166,9 +166,10 @@ interface Props {
splitSession?: string | null;
open: boolean;
onClose: () => void;
onRename?: (key: string, label: string) => Promise<boolean>;
}
export function Sidebar({ sessions, activeSession, onSwitch, onDelete, onSplit, splitSession, open, onClose }: Props) {
export function Sidebar({ sessions, activeSession, onSwitch, onDelete, onSplit, splitSession, open, onClose, onRename }: Props) {
const t = useT();
const [filter, setFilter] = useState('');
const [focusIdx, setFocusIdx] = useState(-1);
@@ -259,9 +260,13 @@ export function Sidebar({ sessions, activeSession, onSwitch, onDelete, onSplit,
saveCustomNames(next);
return next;
});
// Also persist server-side via sessions.patch
if (onRename && trimmed) {
onRename(renamingKey, trimmed).catch(() => { /* best effort */ });
}
setRenamingKey(null);
setRenameValue('');
}, [renamingKey, renameValue]);
}, [renamingKey, renameValue, onRename]);
const cancelRename = useCallback(() => {
setRenamingKey(null);