Add review, discover, email; rebuild the design system

Three features and a typographic pass over everything.

REVIEW. Picking a file and trusting it are different questions, so they now
use different numbers. The existing rank decides which candidate to fetch and
is right to weigh peer upload slots and queue length -- but none of that says
anything about whether the file is the correct recording, and a fast peer must
not be able to raise the confidence of a wrong match. So confidence() scores
the filename alone: title 0.75, artist 0.25, album +0.05, and a variant tag
you did not ask for multiplies by 0.8 AND caps below the auto threshold.

Confidence gates the IMPORT, not the download. The transfer completes either
way and the file waits in downloads, so approving is instant and rejecting is
a delete. Holding the transfer instead would mean the peer is usually gone by
the time anyone looks.

The two cases it exists for: "02 Creep.flac" in an unsorted folder scores 0.75
-- title exactly right, artist simply absent, the commonest honest case there
is -- and must be reviewed rather than binned. And "Creep (Live at
Glastonbury)" scores 0.80 with BOTH artist and title perfect; the cap is what
stops a live recording auto-filing over the studio version. Ask for "Creep
(Acoustic)" and it auto-imports at 0.97, because then the variant is the
request.

DISCOVER. Related artists seeded from what you have actually imported, plus a
recap of top artists, genres and decades. Built on muse's own request history,
never on listening data: Navidrome owns play counts and history, and a second
source of truth for those would disagree with the one you listen through.

EMAIL. Optional, off unless MUSE_SMTP_HOST is set. Sends on import and on
review-needed. smtplib is blocking so it runs off the event loop, and every
failure is logged and swallowed -- a notification is never worth failing an
import over. Google accounts need no configuration, since the identity is an
address. Each user owns their own setting under Settings, deliberately not an
admin route: an address you cannot change yourself is someone else's chore.

DESIGN. A real type scale (display/title/headline/body/callout/caption) whose
tracking tightens as size grows, which is the single biggest tell of typography
nobody set. Specular top edges on glass surfaces -- blur alone reads as a grey
rectangle. A two-part elevation scale, contact shadow plus soft light. Semantic
colours are now per-theme: the amber tuned for the dark background failed
contrast outright on white, which was exactly the text a reviewer most needs to
read. The tab underline became a sliding pill so the eye tracks one object, and
Review only appears when something is actually waiting.

Add tests/test_matching.py: 13 assertions on the confidence bands rather than
the exact scores. 90 tests pass across the three suites.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Aryan SinghandClaude Opus 5 committed 2026-08-05 02:10:33 -05:00
1 parent cc3490483e
commit 205e0a44b8
23 files changed
+1484 -102

No files matched your search

+77 -34
View File
@@ -15,12 +15,22 @@ import { AlbumView } from "@/components/album-view";
import { ArtistView } from "@/components/artist-view";
import { BulkImport } from "@/components/bulk-import";
import { Requests, type JobsSnapshot } from "@/components/requests";
import { Review } from "@/components/review";
import { DiscoverPanel } from "@/components/discover";
import { Settings } from "@/components/settings";
import { Skeletons } from "@/components/skeletons";
import { PlayerProvider } from "@/components/player";
import { ToastProvider } from "@/components/toast";
import { AdminPanel } from "@/components/admin/admin-panel";
type Tab = "search" | "jobs" | "bulk" | "admin";
type Tab =
| "search"
| "discover"
| "jobs"
| "review"
| "bulk"
| "settings"
| "admin";
type View =
| { k: "welcome" }
| { k: "results"; q: string }
@@ -118,6 +128,7 @@ function Muse() {
(snap?.counts.queued ?? 0) +
(snap?.counts.searching ?? 0) +
(snap?.counts.downloading ?? 0);
const held = snap?.counts.review ?? 0;
const isAdmin = me?.role === "admin";
// Only worth showing when a limit actually exists — a permanent "0 / 0" chip
@@ -144,16 +155,18 @@ function Muse() {
<Music2 className="h-5 w-5" />
</motion.div>
<div className="min-w-0 flex-1">
<h1 className="text-[19px] font-bold leading-tight tracking-[-0.4px]">muse</h1>
<p className="text-xs text-dim">search · request · it appears in Navidrome</p>
<h1 className="text-title leading-none">muse</h1>
<p className="mt-0.5 text-caption text-dim">
search · request · it appears in Navidrome
</p>
</div>
{me?.user && (
<div className="flex items-center gap-2 text-[12.5px] text-dim">
<div className="flex items-center gap-2 text-callout text-dim">
{quotaLeft !== null && (
<span
title={`${me.usage!.requests} of ${me.quota} requests used this month`}
className={cn(
"hidden rounded-full border px-2 py-0.5 text-[11px] sm:inline",
"hidden rounded-pill border px-2 py-0.5 text-caption nums sm:inline",
quotaLeft === 0
? "border-err/50 text-err"
: quotaLeft <= 5
@@ -177,15 +190,15 @@ function Muse() {
</span>
{me.role && me.role !== "user" && (
<span
className="rounded-full border border-accent-line bg-accent-soft px-1.5
py-0.5 text-[10.5px] uppercase tracking-[0.6px] text-accent"
className="rounded-pill border border-accent-line bg-accent-soft px-1.5
py-0.5 text-caption uppercase tracking-[0.6px] text-accent"
>
{me.role}
</span>
)}
<a
href="/auth/logout"
className="border-b border-transparent hover:border-edge-hi hover:text-ink"
className="ring rounded-md px-1 transition-colors hover:text-ink"
>
Log out
</a>
@@ -195,40 +208,67 @@ function Muse() {
<SearchBar busy={busy} onSearch={doSearch} onAlbum={openAlbum} onArtist={openArtist} />
<nav className="flex overflow-x-auto pt-3 no-scrollbar">
{/* A sliding pill rather than an underline: the moving surface is
the selection itself, so the eye tracks one object across the
row instead of watching two things fade. layoutId does the
interpolation, so it stays correct when tabs appear or vanish
with a role change. */}
{/* The mask is the scroll affordance: on a narrow screen the last
tab fades out at the edge instead of being clipped flat, which
is the only cue that there is more to the right. */}
<nav
className="flex gap-0.5 overflow-x-auto pb-3 pt-2.5 no-scrollbar
[mask-image:linear-gradient(to_right,#000_calc(100%-28px),transparent)]
sm:[mask-image:none]"
>
{(
[
["search", "Search"],
["jobs", "Requests"],
["bulk", "Import list"],
...(isAdmin ? ([["admin", "Admin"]] as [Tab, string][]) : []),
] as [Tab, string][]
).map(([k, label]) => (
["search", "Search", 0],
["discover", "Discover", 0],
["jobs", "Requests", active],
// Only exists when it is actionable. An always-present tab
// that is empty nine days in ten is chrome; this one appears
// exactly when something is waiting on you.
...(held > 0 || tab === "review"
? ([["review", "Review", held]] as [Tab, string, number][])
: []),
["bulk", "Import", 0],
["settings", "Settings", 0],
...(isAdmin ? ([["admin", "Admin", 0]] as [Tab, string, number][]) : []),
] as [Tab, string, number][]
).map(([k, label, badge]) => (
<button
key={k}
onClick={() => setTab(k)}
aria-current={tab === k ? "page" : undefined}
className={cn(
"relative mr-4 cursor-pointer px-1 pb-3 pt-2 text-[13.5px] font-medium transition-colors",
"ring relative shrink-0 cursor-pointer rounded-pill px-3 py-1.5",
"text-callout font-medium transition-colors duration-200",
tab === k ? "text-ink" : "text-dim hover:text-ink",
)}
>
{label}
{k === "jobs" && active > 0 && (
<span
className="ml-1.5 inline-block min-w-[18px] rounded-full border
border-accent-line bg-accent-soft px-1.5 text-[11px]
font-bold text-accent"
>
{active}
</span>
)}
{tab === k && (
<motion.i
layoutId="tab-underline"
className="absolute inset-x-0 bottom-0 h-0.5 rounded-t bg-accent"
transition={{ type: "spring", stiffness: 420, damping: 34 }}
<motion.span
layoutId="tab-pill"
className="absolute inset-0 rounded-pill border border-edge-hi bg-[var(--glass-hi)]"
transition={{ type: "spring", stiffness: 460, damping: 38 }}
/>
)}
<span className="relative flex items-center gap-1.5">
{label}
{badge > 0 && (
<span
className={cn(
"min-w-[17px] rounded-pill px-1 text-caption font-bold nums",
k === "review"
? "bg-warn/20 text-warn"
: "bg-accent-soft text-accent",
)}
>
{badge}
</span>
)}
</span>
</button>
))}
</nav>
@@ -296,8 +336,11 @@ function Muse() {
</>
)}
{tab === "discover" && <DiscoverPanel onArtist={doSearch} />}
{tab === "jobs" && <Requests snap={snap} refresh={refresh} />}
{tab === "review" && <Review onDecided={refresh} />}
{tab === "bulk" && <BulkImport onQueued={refresh} />}
{tab === "settings" && me && <Settings me={me} refresh={refresh} />}
{tab === "admin" && isAdmin && <AdminPanel me={me?.user ?? null} />}
</motion.div>
</main>
@@ -321,10 +364,10 @@ function Welcome({ onPick }: { onPick: (q: string) => void }) {
>
<Disc3 className="h-7 w-7" />
</motion.div>
<h2 className="mb-2 text-[23px] font-bold tracking-[-0.4px]">Find anything</h2>
<p className="mx-auto max-w-[46ch] text-sm text-dim">
<h2 className="mb-2 text-display">Find anything</h2>
<p className="mx-auto max-w-[46ch] text-body text-dim">
Search a song and press{" "}
<kbd className="rounded-md border border-edge-hi bg-[var(--glass-hi)] px-1.5 py-0.5 text-[11.5px] text-ink">
<kbd className="rounded-md border border-edge-hi bg-[var(--glass-hi)] px-1.5 py-0.5 text-caption text-ink">
Enter
</kbd>
. Hit play to hear a 30-second preview before you commit, then <b>Get</b> to pull it into
@@ -339,7 +382,7 @@ function Welcome({ onPick }: { onPick: (q: string) => void }) {
transition={{ delay: 0.1 + i * 0.05 }}
whileHover={{ y: -2 }}
onClick={() => onPick(e)}
className="glass cursor-pointer rounded-full px-3.5 py-1.5 text-[13px] text-dim
className="glass ring cursor-pointer rounded-pill px-3.5 py-1.5 text-callout text-dim
transition hover:border-accent-line hover:bg-accent-soft hover:text-ink"
>
{e}