Chat layout: history in the main sidebar, consistent header, cleaner icon

- Desktop: on /chat the main sidebar shows the chat list (search, New chat,
  items with rename/delete, active highlight) in place of the deck
  navigation; the separate second column is gone and the chat uses the full
  width. The expand/collapse chevron sits outside the swappable section and
  a collapsed rail stays clean (the highlighted Chat row already opens a
  new chat). Active conversation travels via a tiny store (lib/chat-active)
  so the sidebar needs no useSearchParams and pages stay static.
- Header (phones): history, theme and New chat are now identical chips -
  same 44px hit area, rounded-2xl, border/surface tokens, size-5 icons,
  even spacing; the title block truncates cleanly. ThemeToggle gained a
  'plain' variant so the header styles it without touching other pages.
- ChatIcon redrawn (clean message-circle, no inner lines) and the empty
  state uses the app's icon-chip pattern (size-12 chip, accent-600/200)
  instead of the bare oversized glyph; the model chip icon follows.
- Also fixed a pre-existing dev-only breakage found while verifying: the
  tab-bar bounce animated three keyframes with a spring, which framer
  motion's dev build throws on - breaking client updates in the dev
  instance (library tab switching, sheet Escape). It now uses a tween.
- Dev metadata keeps the Apple icons in both branches.
- SW -> freezmo-v35.
This commit is contained in:
Martin Dvořák 2026-10-11 20:11:11 +00:00
commit 8a3bef0add
9 changed files with 192 additions and 75 deletions

View file

@ -1,8 +1,11 @@
"use client";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useMemo, useState, useSyncExternalStore, type ReactNode } from "react";
import { SidebarChatSection } from "@/components/chat/SidebarChatSection";
import {
ChatIcon,
ChevronLeftIcon,
@ -35,6 +38,8 @@ const COLLAPSE_KEY = "freezmo.sidebarCollapsed";
* there is no drawer any more, so this is the only consumer of the rail.
*/
function NavContent({ collapsed = false }: { collapsed?: boolean }) {
const pathname = usePathname();
const onChat = pathname === "/chat";
const decks = useSyncExternalStore(deckStore.subscribe, deckStore.getSnapshot, deckStore.getServerSnapshot);
const folders = useSyncExternalStore(
folderStore.subscribe,
@ -149,6 +154,7 @@ function NavContent({ collapsed = false }: { collapsed?: boolean }) {
{/* chat with your notes --------------------------------------------- */}
<Link
href="/chat"
aria-current={onChat ? "page" : undefined}
className={cn("nav-row mb-3", collapsed && "justify-center px-2")}
title={t("chat.nav")}
>
@ -156,19 +162,27 @@ function NavContent({ collapsed = false }: { collapsed?: boolean }) {
{!collapsed ? <span className="flex-1 truncate text-left">{t("chat.nav")}</span> : null}
</Link>
<nav aria-label={t("sidebar.library")} className="thin-scroll min-h-0 flex-1 space-y-0.5 overflow-y-auto">
{collapsed ? (
<button
type="button"
onClick={() => sidebarCollapse.set(false)}
aria-label={t("sidebar.expand")}
title={t("sidebar.expand")}
className="nav-row justify-center px-2"
>
<ChevronRightIcon className="size-4" />
</button>
) : null}
{/* The expand control sits outside the swappable section, so it stays
reachable when the chat list replaces the deck navigation. */}
{collapsed ? (
<button
type="button"
onClick={() => sidebarCollapse.set(false)}
aria-label={t("sidebar.expand")}
title={t("sidebar.expand")}
className="nav-row mb-1 justify-center px-2"
>
<ChevronRightIcon className="size-4" />
</button>
) : null}
{/* On the Chat route the chat list takes the deck navigation's place. */}
{onChat ? <SidebarChatSection collapsed={collapsed} /> : null}
<nav
aria-label={t("sidebar.library")}
className={cn("thin-scroll min-h-0 flex-1 space-y-0.5 overflow-y-auto", onChat && "hidden")}
>
{/* All decks + Unorganized are views, so they sit above Folders. */}
<div className={cn("space-y-0.5", !collapsed && "mb-1")}>
{viewRow(