feat: remove header and buttons, move actions to toolbar, drag&drop to any folder level

This commit is contained in:
Agent Zero
2026-07-17 17:22:26 +02:00
parent f2d624720f
commit ede37aced8
2 changed files with 26 additions and 21 deletions
+2 -16
View File
@@ -36,13 +36,12 @@ function buildTree(folders: ChatFolder[], sessions: ChatSession[]): TreeNode[] {
}
function TreeItem({
node, activeSessionId, onSelectSession, depth, onMoveSession, onDeleteFolder, onAddFolder, onDragSession, onDropToFolder,
node, activeSessionId, onSelectSession, depth, onDeleteFolder, onAddFolder, onDragSession, onDropToFolder,
}: {
node: TreeNode;
activeSessionId: string | null;
onSelectSession: (id: string) => void;
depth: number;
onMoveSession: (sessionId: string, folderId: string | null) => void;
onDeleteFolder: (folderId: string) => void;
onAddFolder: (parentId: string | null) => void;
onDragSession: (sessionId: string) => void;
@@ -109,7 +108,6 @@ function TreeItem({
activeSessionId={activeSessionId}
onSelectSession={onSelectSession}
depth={depth + 1}
onMoveSession={onMoveSession}
onDeleteFolder={onDeleteFolder}
onAddFolder={onAddFolder}
onDragSession={onDragSession}
@@ -138,15 +136,8 @@ export function SessionList({ activeSessionId, onSelectSession, isSidebar, class
useEffect(() => { loadData(); }, [isSidebar]);
const handleNewChat = async () => {
try {
const session = await createSession({ is_sidebar: isSidebar || false });
setSessions((prev) => [session, ...prev]); onSelectSession(session.id);
} catch (e) { setError(e instanceof Error ? e.message : 'Failed'); }
};
const handleAddFolder = (parentId: string | null) => {
const name = prompt('Ordnername:');;
const name = prompt('Ordnername:');
if (!name) return;
createFolder({ name, parent_id: parentId || undefined }).then(() => loadData()).catch((e) => setError(e?.message));
};
@@ -171,10 +162,6 @@ export function SessionList({ activeSessionId, onSelectSession, isSidebar, class
return (
<div className={clsx('flex flex-col h-full', className)}>
<div className="p-3 border-b border-secondary-200 flex gap-2">
<button onClick={handleNewChat} className="flex-1 rounded-lg bg-primary-600 text-white px-3 py-2 text-sm font-medium hover:bg-primary-700">+ Neuer Chat</button>
<button onClick={() => handleAddFolder(null)} className="rounded-lg border border-secondary-300 px-3 py-2 text-sm hover:bg-secondary-100" title="Neuer Ordner">📁+</button>
</div>
{error && <div className="p-2 text-xs text-red-600">{error}</div>}
<div className="flex-1 overflow-y-auto p-2">
{tree.map((node) => (
@@ -184,7 +171,6 @@ export function SessionList({ activeSessionId, onSelectSession, isSidebar, class
activeSessionId={activeSessionId}
onSelectSession={onSelectSession}
depth={0}
onMoveSession={() => {}}
onDeleteFolder={handleDeleteFolder}
onAddFolder={handleAddFolder}
onDragSession={setDragSessionId}