Compare commits
1 Commits
v1.6.4-aut
...
v1.6.3-mob
| Author | SHA1 | Date | |
|---|---|---|---|
| 3cb1ead5e2 |
@@ -144,23 +144,4 @@ export async function maybeAutoNameChat(
|
|||||||
updated_at: updated[0]!.updated_at,
|
updated_at: updated[0]!.updated_at,
|
||||||
});
|
});
|
||||||
ctx.log.info({ chatId, name }, 'chat auto-named');
|
ctx.log.info({ chatId, name }, 'chat auto-named');
|
||||||
|
|
||||||
// Propagate to the parent session if it's still on its default name.
|
|
||||||
// The WHERE guard makes the check atomic — if the user has already
|
|
||||||
// renamed (or a prior chat already propagated), this UPDATE matches
|
|
||||||
// zero rows and we do nothing. First chat wins; manual renames win.
|
|
||||||
const renamedSession = await ctx.sql<{ id: string; name: string }[]>`
|
|
||||||
UPDATE sessions
|
|
||||||
SET name = ${name}
|
|
||||||
WHERE id = ${sessionId} AND name = 'New session'
|
|
||||||
RETURNING id, name
|
|
||||||
`;
|
|
||||||
if (renamedSession.length > 0) {
|
|
||||||
ctx.publishUser({
|
|
||||||
type: 'session_renamed',
|
|
||||||
session_id: sessionId,
|
|
||||||
name,
|
|
||||||
});
|
|
||||||
ctx.log.info({ sessionId, name }, 'session auto-named from chat');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { useEffect, useState } from 'react';
|
import { useEffect, useState } from 'react';
|
||||||
import { ChevronDown, ChevronRight, Folder, RotateCcw } from 'lucide-react';
|
import { ChevronDown, ChevronRight, Folder, FolderTree, Menu, RotateCcw } from 'lucide-react';
|
||||||
import { toast } from 'sonner';
|
import { toast } from 'sonner';
|
||||||
import { Button } from '@/components/ui/button';
|
import { Button } from '@/components/ui/button';
|
||||||
import { AddProjectModal } from '@/components/AddProjectModal';
|
import { AddProjectModal } from '@/components/AddProjectModal';
|
||||||
@@ -8,6 +8,9 @@ import { api } from '@/api/client';
|
|||||||
import type { Project } from '@/api/types';
|
import type { Project } from '@/api/types';
|
||||||
import { sessionEvents } from '@/hooks/sessionEvents';
|
import { sessionEvents } from '@/hooks/sessionEvents';
|
||||||
import { useSidebar } from '@/hooks/useSidebar';
|
import { useSidebar } from '@/hooks/useSidebar';
|
||||||
|
import { useSidebarDrawer } from '@/hooks/useSidebarDrawer';
|
||||||
|
import { useRightRailDrawer } from '@/hooks/useRightRailDrawer';
|
||||||
|
import { useViewport } from '@/hooks/useViewport';
|
||||||
|
|
||||||
export function Home() {
|
export function Home() {
|
||||||
const { data } = useSidebar();
|
const { data } = useSidebar();
|
||||||
@@ -15,6 +18,9 @@ export function Home() {
|
|||||||
const [createOpen, setCreateOpen] = useState(false);
|
const [createOpen, setCreateOpen] = useState(false);
|
||||||
const [archived, setArchived] = useState<Project[] | null>(null);
|
const [archived, setArchived] = useState<Project[] | null>(null);
|
||||||
const [showArchived, setShowArchived] = useState(false);
|
const [showArchived, setShowArchived] = useState(false);
|
||||||
|
const { setOpen: setSidebarOpen } = useSidebarDrawer();
|
||||||
|
const { toggle: toggleRightRail } = useRightRailDrawer();
|
||||||
|
const { isMobile } = useViewport();
|
||||||
|
|
||||||
const empty = data ? data.projects.length === 0 : false;
|
const empty = data ? data.projects.length === 0 : false;
|
||||||
|
|
||||||
@@ -70,8 +76,32 @@ export function Home() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="flex-1 flex flex-col items-center px-6 py-12 overflow-y-auto">
|
<div className="flex-1 flex flex-col min-h-0">
|
||||||
<div className="w-full max-w-md space-y-6">
|
{isMobile && (
|
||||||
|
<header
|
||||||
|
className="border-b px-3 sm:px-4 py-2 flex items-center gap-1.5 shrink-0 text-sm"
|
||||||
|
style={{ paddingTop: 'max(0.5rem, env(safe-area-inset-top))' }}
|
||||||
|
>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => setSidebarOpen(true)}
|
||||||
|
className="inline-flex items-center justify-center -ml-1 min-w-[44px] min-h-[44px] rounded text-muted-foreground hover:bg-muted hover:text-foreground shrink-0"
|
||||||
|
aria-label="Open sidebar"
|
||||||
|
>
|
||||||
|
<Menu className="size-5" />
|
||||||
|
</button>
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={toggleRightRail}
|
||||||
|
className="inline-flex items-center justify-center -mr-1 ml-auto min-w-[44px] min-h-[44px] rounded text-muted-foreground hover:bg-muted hover:text-foreground shrink-0"
|
||||||
|
aria-label="Toggle file browser"
|
||||||
|
>
|
||||||
|
<FolderTree className="size-5" />
|
||||||
|
</button>
|
||||||
|
</header>
|
||||||
|
)}
|
||||||
|
<div className="flex-1 flex flex-col items-center px-6 py-12 overflow-y-auto">
|
||||||
|
<div className="w-full max-w-md space-y-6">
|
||||||
<div className="text-center space-y-3">
|
<div className="text-center space-y-3">
|
||||||
{empty ? (
|
{empty ? (
|
||||||
<>
|
<>
|
||||||
@@ -127,9 +157,10 @@ export function Home() {
|
|||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
|
</div>
|
||||||
|
<AddProjectModal open={addOpen} onOpenChange={setAddOpen} onAdded={() => {}} />
|
||||||
|
<CreateProjectModal open={createOpen} onOpenChange={setCreateOpen} />
|
||||||
</div>
|
</div>
|
||||||
<AddProjectModal open={addOpen} onOpenChange={setAddOpen} onAdded={() => {}} />
|
|
||||||
<CreateProjectModal open={createOpen} onOpenChange={setCreateOpen} />
|
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user