Mobile declutter pass: step flows, compact cards, simplified settings

Phones only (<=639px); desktop markup is untouched.

- New deck is a 3-step flow: progress (1/3 + bar) and a fixed Back/Next
  bar above the tab bar. Step 1 = Add photos or files / Camera / Paste
  text instead (no drop zone or paste copy on touch), step 2 = folder,
  difficulty and count with defaults plus one collapsed focus/notes row,
  step 3 = one summary line (photos/docs/text · difficulty · count ·
  folder) with Freeze. Going Back keeps every input; step transitions
  respect prefers-reduced-motion.
- Make my homework is a 2-step flow sharing the same pattern; tapping a
  mode card starts it (no separate CTA on phones), with a short preview
  of the assignment on step 2. The hero is now 'Make my homework' /
  'Udělej mi úkol' everywhere ('Solve your homework' is gone) and the
  intro is one line.
- Library: stats line removed, folder row and 'Unorganized' heading
  hidden until folders exist (New folder lives in the drawer), Import is
  a small icon button beside the tabs. Deck and homework cards are
  compact on phones: title, one meta line (activities · difficulty ·
  best), a one-line description that expands on tap, the whole card
  tappable and a small Study/Open pill instead of the full-width button.
- Settings sheet on phones: no .env.local subtitle; Language stays first;
  one Connection card (status dot + 'Connected · 2 models ready', key
  field with the eye inside, Save only when edited, auto re-check on
  save, refresh icon instead of Test connection); privacy one-liner with
  a More expander (daemon tip inside); raw health rows behind one
  collapsed Details list; Remove key as a small danger button at the very
  bottom (same confirmation).
- Decorative orbs on phones moved further off the screen edges so they
  never glow under cards or primary buttons.
- Shared markup for folder/difficulty/count and mode cards keeps one
  source of state; new lib/use-phone.ts gates the layouts.

Verified: new declutter suite 116/116 (360 + 390, EN + CS, photo + PDF +
pasted text, Back keeps input, summaries, settings flow), regression
74/74, mobile 52/52, i18n 25/25. Lint + build clean. SW freezmo-v20.
This commit is contained in:
Martin Dvořák 2026-10-10 10:43:32 +00:00
commit 6564e88138
12 changed files with 1345 additions and 309 deletions

View file

@ -85,10 +85,6 @@ export function LibraryScreen({ initialTab = "decks" }: { initialTab?: "decks" |
return [...named, unorganized];
}, [folderList, selected, sorted, t]);
const totalActivities = decks.reduce((sum, deck) => sum + deck.activities.length, 0);
const bestEver = decks.reduce((best, deck) => Math.max(best, deck.bestScore ?? 0), 0);
const played = decks.some((deck) => deck.attempts > 0);
const handleImport = async (file: File | undefined) => {
if (!file) return;
try {
@ -126,9 +122,9 @@ export function LibraryScreen({ initialTab = "decks" }: { initialTab?: "decks" |
</p>
</div>
{/* Import sits above the tabs on every tab, so the header never
shifts when you switch pools. */}
<div className="flex flex-wrap items-center gap-2">
{/* Desktop keeps Import above the tabs; phones get a small icon
button in the tab row instead. */}
<div className="hidden flex-wrap items-center gap-2 sm:flex">
<Button
variant="secondary"
size="md"
@ -138,50 +134,42 @@ export function LibraryScreen({ initialTab = "decks" }: { initialTab?: "decks" |
<UploadIcon className="size-4" />
{t("library.import")}
</Button>
<input
ref={importRef}
type="file"
accept="application/json,.json"
className="sr-only"
onChange={(event) => {
void handleImport(event.target.files?.[0]);
event.target.value = "";
}}
/>
</div>
<input
ref={importRef}
type="file"
accept="application/json,.json"
className="sr-only"
onChange={(event) => {
void handleImport(event.target.files?.[0]);
event.target.value = "";
}}
/>
{/* Two pools, never mixed: study decks and saved homework. */}
<div className="segmented w-full sm:max-w-sm">
<Link href="/" aria-current={tab === "decks" ? "page" : undefined}>
{t("tabDecks")}
</Link>
<Link href="/?tab=homework" aria-current={tab === "homework" ? "page" : undefined}>
{t("tabHomework")}
</Link>
<div className="flex items-center gap-2">
<div className="segmented min-w-0 flex-1 sm:max-w-sm">
<Link href="/" aria-current={tab === "decks" ? "page" : undefined}>
{t("tabDecks")}
</Link>
<Link href="/?tab=homework" aria-current={tab === "homework" ? "page" : undefined}>
{t("tabHomework")}
</Link>
</div>
<button
type="button"
onClick={() => importRef.current?.click()}
aria-label={t("library.importAria")}
title={t("library.import")}
className="touch-target grid size-11 shrink-0 place-items-center rounded-2xl border border-[var(--glass-border)] bg-[var(--surface-strong)] text-[var(--text-muted)] transition hover:bg-[var(--hover)] hover:text-[var(--text)] sm:hidden"
>
<UploadIcon className="size-4" />
</button>
</div>
{/* Secondary stats folded into the header as quiet text on desktop,
where the sidebar already shows per-folder counts. */}
{tab === "decks" && decks.length > 0 ? (
<p className="text-[13px] text-[var(--text-subtle)] lg:hidden">
{plural(decks.length, "stats.decks")}
<span aria-hidden> · </span>
{plural(folderList.length, "stats.folders")}
<span aria-hidden> · </span>
{plural(totalActivities, "stats.activities")}
{played ? (
<>
<span aria-hidden> · </span>
{t("library.stats.best", { n: bestEver })}
</>
) : null}
</p>
) : null}
{/* Mobile folder switcher; the sidebar covers desktop. With an empty
library there is nothing to filter, and the pills would compete
with the empty state's single call to action. */}
{tab === "decks" && !isEmpty ? (
{/* Mobile folder switcher; the sidebar covers desktop. Hidden while
there are no folders — the drawer's “New folder” is the way in. */}
{tab === "decks" && !isEmpty && hasFolders ? (
<FolderBar
className="lg:hidden"
folders={folderList}
@ -237,7 +225,7 @@ export function LibraryScreen({ initialTab = "decks" }: { initialTab?: "decks" |
return (
<section key={group.id} aria-label={group.name}>
{/* group header -------------------------------------- */}
<div className={cn("mb-4 flex items-center gap-2", !hasFolders && "lg:hidden")}>
<div className={cn("mb-4 flex items-center gap-2", !hasFolders && "hidden")}>
<FolderIcon className="size-4 shrink-0 text-[var(--text-subtle)]" />
{isEditing && editingFolder ? (