forge
Explore
Log in

Don't you dare go Hollow

💄 cleaner study page

Browse files at this commit

078b459691672e7fa5486c42cc6dbdfd08054cf5Burak BoduroğluParent: e726e76
  • style
    • 💄 cleaner study page
Show full message
style: 💄 cleaner study page
- header names the page and what it answers from, replacing the uppercase
  "Çalış" eyebrow
- empty chat shows a centred icon, title and hint
- messages and composer share a centred reading column; the view follows new
  turns and streamed text unless the reader scrolled up
- active chat in the history list is marked with the brand tint
src/components/rag/rag-composer.tsxmodified+3 -3
@@ -29,13 +29,13 @@ export function RagComposer(props: {
2929
3030 return (
3131 <form
32- class="border-t border-border/70 bg-surface-base px-4 py-3"
32+ class="border-t border-border/70 bg-surface-base px-4 py-3 sm:px-6"
3333 onSubmit={(event) => {
3434 event.preventDefault();
3535 if (!props.disabled) props.onSubmit();
3636 }}
3737 >
38- <div class="flex items-end gap-2 rounded-xl border border-border bg-background px-3 py-2 transition-colors focus-within:border-primary/50 focus-within:ring-2 focus-within:ring-ring">
38+ <div class="mx-auto flex w-full max-w-3xl items-end gap-2 rounded-xl border border-border bg-background px-3 py-2 transition-colors focus-within:border-primary/50 focus-within:ring-2 focus-within:ring-ring">
3939 <Textarea
4040 ref={field}
4141 rows={1}
@@ -63,7 +63,7 @@ export function RagComposer(props: {
6363 <IconSend class="h-4 w-4" />
6464 </Button>
6565 </div>
66- <p class="mt-1.5 px-1 text-[11px] leading-4 text-muted-foreground">{props.hint}</p>
66+ <p class="mx-auto mt-1.5 w-full max-w-3xl px-1 text-[11px] leading-4 text-muted-foreground">{props.hint}</p>
6767 </form>
6868 );
6969 }
src/components/rag/rag-study-panel.tsxmodified+38 -9
@@ -1,4 +1,4 @@
1-import { For, Show, createSignal, onCleanup } from "solid-js";
1+import { For, Show, createEffect, createSignal, on, onCleanup } from "solid-js";
22 import { formatApiError } from "@/api/client";
33 import type { RagMessage, RagThread } from "@/api/client";
44 import {
@@ -14,11 +14,12 @@ import { RagComposer } from "@/components/rag/rag-composer";
1414 import { ragCopy } from "@/components/rag/rag-copy";
1515 import { RagMessageRow } from "@/components/rag/rag-message-row";
1616 import { RagStudyActions } from "@/components/rag/rag-study-actions";
17+import { RagStudyWelcome } from "@/components/rag/rag-study-welcome";
1718 import { RagThreadList } from "@/components/rag/rag-thread-list";
1819 import { Alert } from "@/components/ui/alert";
1920 import { Button } from "@/components/ui/button";
2021 import { ConfirmDialog } from "@/components/ui/confirm-dialog";
21-import { IconEdit, IconPlus } from "@/components/ui/icons";
22+import { IconBook, IconEdit, IconPlus } from "@/components/ui/icons";
2223 import { scopeFromCitations } from "@/lib/rag-study-scope";
2324 import { usePreferences } from "@/stores/preferences-context";
2425
@@ -161,6 +162,25 @@ export function RagStudyPanel() {
161162 }
162163 };
163164
165+ // Follow the conversation: a new turn (or a streamed chunk) keeps the view
166+ // on the latest message, unless the reader has scrolled up to reread.
167+ let scroller: HTMLDivElement | undefined;
168+ createEffect(
169+ on(
170+ () => {
171+ const items = messages();
172+ return `${items.length}:${items[items.length - 1]?.content.length ?? 0}`;
173+ },
174+ () => {
175+ const el = scroller;
176+ if (!el) return;
177+ const nearBottom = el.scrollHeight - el.scrollTop - el.clientHeight < 160;
178+ if (nearBottom || sending()) queueMicrotask(() => el.scrollTo({ top: el.scrollHeight }));
179+ },
180+ { defer: true },
181+ ),
182+ );
183+
164184 /** The user turn an answer replies to, used as the study range's label. */
165185 const questionBefore = (index: number) => {
166186 for (let i = index - 1; i >= 0; i -= 1) if (messages()[i]?.role === "user") return messages()[i]!.content;
@@ -172,7 +192,7 @@ export function RagStudyPanel() {
172192 <aside class="flex h-full min-h-0 flex-col gap-3 rounded-xl border border-border-line bg-surface-base p-3 shadow-xs">
173193 <div class="flex items-center justify-between gap-2">
174194 <h2 class="text-sm font-semibold text-text-strong">{copy().history}</h2>
175- <Button type="button" size="sm" class="h-8 rounded-lg" onClick={newThread}>
195+ <Button type="button" size="sm" class="h-8 rounded-lg" disabled={!threadId() && messages().length === 0} onClick={newThread}>
176196 <IconPlus class="h-4 w-4" />
177197 {copy().newThread}
178198 </Button>
@@ -189,10 +209,15 @@ export function RagStudyPanel() {
189209 </aside>
190210
191211 <section class="flex h-full min-h-0 flex-col overflow-hidden rounded-xl border border-border-line bg-surface-base shadow-xs" aria-label={copy().title}>
192- <header class="flex shrink-0 items-center justify-between gap-3 border-b border-border-line px-4 py-3">
193- <div class="min-w-0">
194- <p class="text-[11px] font-semibold uppercase tracking-wide text-muted-foreground">{copy().tabLabel}</p>
195- <p class="truncate text-sm font-semibold text-text-strong">{activeThread()?.title || (threadId() ? copy().untitled : copy().emptyChat)}</p>
212+ <header class="flex shrink-0 items-center justify-between gap-3 border-b border-border-line px-4 py-3 sm:px-5">
213+ <div class="flex min-w-0 items-center gap-3">
214+ <span class="flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-primary/20 bg-primary/10 text-primary-text">
215+ <IconBook class="h-4 w-4" />
216+ </span>
217+ <div class="min-w-0">
218+ <p class="truncate text-sm font-semibold text-text-strong">{threadId() ? activeThread()?.title || copy().untitled : copy().title}</p>
219+ <p class="truncate text-xs text-muted-foreground">{copy().description}</p>
220+ </div>
196221 </div>
197222 <div class="flex shrink-0 items-center gap-2">
198223 <Show when={activeThread()}>
@@ -204,13 +229,16 @@ export function RagStudyPanel() {
204229 </Show>
205230 </div>
206231 </header>
207- <div class="min-h-0 flex-1 space-y-4 overflow-y-auto p-4" aria-live="polite">
232+ <div ref={scroller} class="min-h-0 flex-1 overflow-y-auto px-4 py-5 sm:px-6" aria-live="polite">
233+ <div class="mx-auto w-full max-w-3xl space-y-5">
208234 <Show when={error()}>
209235 <Alert variant="destructive">{error()}</Alert>
210236 </Show>
211237 <Show
212238 when={messages().length > 0}
213- fallback={<p class="py-16 text-center text-sm text-muted-foreground">{copy().emptyChatHint}</p>}
239+ fallback={
240+ <RagStudyWelcome title={copy().emptyChat} hint={copy().emptyChatHint} />
241+ }
214242 >
215243 <For each={messages()}>
216244 {(message, index) => {
@@ -239,6 +267,7 @@ export function RagStudyPanel() {
239267 }}
240268 </For>
241269 </Show>
270+ </div>
242271 </div>
243272 <RagComposer
244273 value={draft()}
src/components/rag/rag-study-welcome.tsxadded+14 -0
@@ -0,0 +1,14 @@
1+import { IconSparkles } from "@/components/ui/icons";
2+
3+/** The Study tab before the first question: what it answers from, nothing more. */
4+export function RagStudyWelcome(props: { title: string; hint: string }) {
5+ return (
6+ <div class="flex min-h-[40vh] flex-col items-center justify-center gap-3 py-10 text-center">
7+ <span class="flex h-12 w-12 items-center justify-center rounded-2xl border border-primary/20 bg-primary/10 text-primary-text">
8+ <IconSparkles class="h-6 w-6" />
9+ </span>
10+ <h2 class="text-xl font-semibold tracking-tight text-text-strong">{props.title}</h2>
11+ <p class="max-w-md text-sm leading-6 text-muted-foreground">{props.hint}</p>
12+ </div>
13+ );
14+}
src/components/rag/rag-thread-list.tsxmodified+8 -2
@@ -45,10 +45,16 @@ export function RagThreadList(props: {
4545 <ul class="space-y-1.5">
4646 <For each={result().items}>
4747 {(thread) => (
48- <li class={cn("flex overflow-hidden rounded-lg border border-border", thread.id === props.activeId ? "bg-accent" : "bg-card")}>
48+ <li
49+ class={cn(
50+ "flex overflow-hidden rounded-lg border transition-colors",
51+ thread.id === props.activeId ? "border-primary/40 bg-primary/5" : "border-border-hairline bg-card hover:border-border-line",
52+ )}
53+ aria-current={thread.id === props.activeId ? "true" : undefined}
54+ >
4955 <button
5056 type="button"
51- class="flex min-w-0 flex-1 flex-col items-start gap-0.5 px-3 py-2 text-left transition-colors hover:bg-muted"
57+ class="flex min-w-0 flex-1 flex-col items-start gap-0.5 px-3 py-2 text-left transition-colors hover:bg-muted/60"
5258 onClick={() => props.onOpen(thread)}
5359 >
5460 <span class="w-full truncate text-sm font-medium">{thread.title || props.labels.untitled}</span>