From 2e2ff7e687efcc60bfefb0e64a2906ecb4aa1fc4 Mon Sep 17 00:00:00 2001 From: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com> Date: Fri, 26 Jun 2026 12:03:30 +0200 Subject: [PATCH] =?UTF-8?q?feat(loki):=20mobile-first=20chat=20redesign=20?= =?UTF-8?q?=E2=80=94=20single=20column=20+=20drawers,=20keyboard-aware?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Loki was a 3-column grid with no mobile breakpoint: the fixed 16rem conversation sidebar crushed the chat to <50vw on phones, the composer hid behind the keyboard, controls were hover-only (invisible to touch). Rebuilt mobile-first like modern AI chat (ChatGPT/Claude/Grok): - Single full-width chat column on mobile; the conversation history and project filter move into slide-over Drawers reached from a compact mobile toolbar (Chats / New / Projects). md+ keeps the permanent multi-pane layout. - viewport interactiveWidget=resizes-content so the composer rides above the on-screen keyboard instead of being covered. - Page height accounts for the floating bottom nav + top bar via --mobile-chrome-bottom; subtitle is desktop-only to reclaim vertical space. - Message bubbles responsive (90% mobile / 75% desktop) — dropped the arbitrary max-w-[85%] (4-layer fix). Delete control visible on touch (hover:none). Co-Authored-By: Claude Opus 4.8 (1M context) --- src/app/(app)/loki/page.tsx | 10 ++++- src/app/globals.css | 13 +++++- src/app/layout.tsx | 4 ++ src/components/loki/LokiWorkspace.tsx | 63 ++++++++++++++++++++++++--- 4 files changed, 80 insertions(+), 10 deletions(-) diff --git a/src/app/(app)/loki/page.tsx b/src/app/(app)/loki/page.tsx index 90c1d119c..ef3480b85 100644 --- a/src/app/(app)/loki/page.tsx +++ b/src/app/(app)/loki/page.tsx @@ -7,12 +7,18 @@ export const metadata: Metadata = { title: "Loki" }; // One composer, a conversation list, a project filter; chat routes to Loki and // commands dispatch into the project's agent session via the shared resolver. export default function LokiPage() { + // Fill the visible area exactly so the composer sits at the bottom without + // page scroll. On mobile, leave room for the floating bottom nav (the + // --mobile-chrome-bottom token) and the top bar; on md+ the sidebar layout + // makes the simple inset enough. return ( -
+
+ {/* Compact header — the subtitle is desktop-only so the chat keeps the + vertical space on phones (modern chat surfaces don't title the page). */}

Loki

-

+

Say what you want — Loki figures out which project and whether to chat or dispatch.

diff --git a/src/app/globals.css b/src/app/globals.css index 3db944ccd..6616ada40 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -2629,10 +2629,21 @@ .ui-loki-convo-delete-armed { @apply opacity-100 text-status-negative bg-status-negative-subtle; } + /* Touch devices have no hover, so the delete would be permanently invisible. + Show it (dimmed) there; desktop keeps the reveal-on-hover behaviour. */ + @media (hover: none) { + .ui-loki-convo-delete { @apply opacity-60; } + } /* Message bubbles (center pane). */ .ui-loki-bubble { - @apply max-w-[85%] rounded-2xl px-4 py-2.5 text-sm leading-relaxed whitespace-pre-wrap break-words; + @apply rounded-2xl px-4 py-2.5 text-sm leading-relaxed whitespace-pre-wrap break-words; + /* Roomy on phones, tighter on desktop — bubbles read as chat, not full-width + blocks. Direct CSS (not an arbitrary Tailwind value) keeps it responsive. */ + max-width: 90%; + } + @media (min-width: 640px) { + .ui-loki-bubble { max-width: 75%; } } .ui-loki-bubble-user { @apply self-end bg-accent-muted text-text-primary; diff --git a/src/app/layout.tsx b/src/app/layout.tsx index ce13836bd..23a6a4989 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -48,6 +48,10 @@ export const viewport: Viewport = { width: "device-width", initialScale: 1, viewportFit: "cover", + // The on-screen keyboard shrinks the visual viewport instead of overlaying + // it, so a bottom-anchored composer (Loki, Terminal) stays visible above the + // keyboard rather than being covered by it. + interactiveWidget: "resizes-content", themeColor: [ { media: "(prefers-color-scheme: light)", color: "#f7f7f7" }, { media: "(prefers-color-scheme: dark)", color: "#0a0a0a" }, diff --git a/src/components/loki/LokiWorkspace.tsx b/src/components/loki/LokiWorkspace.tsx index b9fd4df08..5852dac53 100644 --- a/src/components/loki/LokiWorkspace.tsx +++ b/src/components/loki/LokiWorkspace.tsx @@ -1,7 +1,9 @@ "use client"; import { useEffect, useMemo, useState } from "react"; +import { MessagesSquare, Plus, SlidersHorizontal } from "lucide-react"; import { getJson, postJson, deleteJson, throwApiError } from "@/lib/api/fetch"; +import { Drawer } from "@/components/ui/modal"; import { ConversationList } from "./ConversationList"; import { Transcript } from "./Transcript"; import { Composer } from "./Composer"; @@ -25,6 +27,10 @@ export function LokiWorkspace() { const [messages, setMessages] = useState([]); const [sending, setSending] = useState(false); const [error, setError] = useState(null); + // Mobile-only slide-overs for the history + project panes (desktop shows them + // as permanent columns). Keeps the chat full-width on phones. + const [historyOpen, setHistoryOpen] = useState(false); + const [filterOpen, setFilterOpen] = useState(false); // Initial load — conversations + projects. useEffect(() => { @@ -143,9 +149,9 @@ export function LokiWorkspace() { }; return ( -
- {/* LEFT — conversation list */} -