Skip to content

Polish application shell and topic navigation - #12

Merged
prathamkashyap merged 1 commit into
mainfrom
chore/shell-topic-polish
Oct 4, 2026
Merged

prathamkashyap merged 1 commit into
mainfrom
chore/shell-topic-polish

Conversation

@prathamkashyap

Copy link
Copy Markdown
Owner

Two real inconsistencies in the app chrome. No behaviour, data, routing or API changes.

1. The header divider didn't line up — and it wasn't a fixed offset problem

The sidebar brand header sized itself from its contents, while the main topbar was a fixed height:

topbar (AppLayout.tsx:29)      h-16                = 64px, border-b
sidebar header, expanded       p-2 + py-3 + h-9    = 76px   ← border 12px lower
sidebar header, collapsed      p-0 + py-3 + h-11   = 68px   ← and it MOVED on collapse

So the divider sat low, and shifted when you collapsed the rail — which is why tuning an offset
would never have held. Fixed with one shared dimension instead:

/* index.css */     --app-header-height: 4rem;
/* tailwind.config */ height: { header: "var(--app-header-height)" }

Both headers now use h-header. Collapsing changes the header's contents, never its height, so
the two borders form one continuous line in both states. The tile fits either way (64 − 2×4 = 56px of
content; 44px collapsed, 36px expanded).

2. Topic icons: same glyph, same grey, arbitrary wrapping

Every topic rendered the same ScrollText at the same muted grey, so the icon communicated nothing.
Long titles then wrapped and pushed the mastery percentage onto a second line.

src/lib/topicIdentity.ts resolves a topic to an icon and accent, with two rules:

  • Deterministic. Keyword match first, then a stable string hash. The same topic always looks the
    same, every render and session. Nothing is random or time-seeded.
  • Restrained. One 20px tinted chip — not a coloured card. The dashboard already carries the
    strong colour; navigation stays quiet and lets typography work. Accents use the same 400-level
    tones as the subject cards so the two read as one system.

Your example set now resolves to distinct identities:

Topic Icon concept Accent
Operating Systems Cpu sky
Computer Networks Network cyan
Data Structures & Algorithms GitBranch emerald
Deep Learning / AI-ML Brain violet
Natural Language Processing MessagesSquare teal
Computer Vision Microscope pink
Customer Churn Users rose
Smart Retail ShoppingBag orange
Internship Report Briefcase blue

DSA takes GitBranch rather than sharing the graph icon with networking — your original suggestion.

The row is now a real three-column grid — fixed icon, min-w-0 flex-1 truncate title, fixed count.
min-w-0 is the part that actually enables ellipsis; without it flex children refuse to shrink. The
full name stays available via title plus an aria-label carrying the mastery figure, and counts
use tabular-nums so they stop jittering.

A bug worth flagging

My first matcher used patterns like /\boperating system\b/, and the trailing \b made every
plural fall through to the hash fallback
. "Operating Systems" and "Computer Networks" — the two most
common topics — got arbitrary fallback icons, which is precisely the bug being fixed. The tests caught
it by asserting on the very topics in your screenshot. Patterns are now plural-tolerant
(operating systems?, networks?, algorithms?, databases?, internships?, labs?).

Honest limitation: a fixed icon container plus a fixed glyph size normalises box size, but two
Lucide glyphs with different internal padding can still differ slightly in visual weight. That's a
property of the icon set, not something CSS can fully solve.

Tests — 28 new, and PR #8's suite earned its keep

topicIdentity.test.ts (28): determinism across repeated calls; the screenshot's topic list produces
more than one accent; subject-appropriate icons; a specific phrase beating a broad one
("Internship Report" → briefcase, not book); unknowns still deliberate rather than defaulting;
accents restricted to 300/400 tones with matched chip colours; empty title safe.

sidebarProportions.test.ts gained a shared-height contract test — and its two existing assertions
failed on this refactor, because they pinned the exact className strings. That is the coupling
working: an earlier commit's tests caught a later change. Both are now rewritten to assert intent
(conditional centring, conditional padding) rather than brittle literals.

Two of my own mistakes were caught before commit: the plural \b bug above, and a dangling expect(
from a bad edit that left the suite unparseable.

Verification

Check Before After
Frontend 287 / 24 files 316 / 25 files
Backend unit 942 942 (untouched)
Backend integration 101 passed, 13 skipped unchanged
Playwright E2E 26 passed, 2 skipped unchanged
typecheck / build / lint 0 / 0 / 0 0 / 0 / 0

Also confirmed in the built CSS: h-header{height:var(--app-header-height)} is emitted and
--app-header-height:4rem is present, so the token resolves in production rather than silently
falling back.

Needs a human eye: expanded and collapsed, plus a long topic name. These tests pin the geometry
contract and the identity function, not the rendered pixel.

@prathamkashyap
prathamkashyap merged commit 8cce920 into main Oct 4, 2026
3 checks passed
@prathamkashyap
prathamkashyap deleted the chore/shell-topic-polish branch October 4, 2026 17:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant