Skip to content

Simplify components and fix root causes behind several workarounds - #5

Closed
mathhulk wants to merge 1 commit into
claude/vibrant-faraday-ux7zgr-typescriptfrom
claude/vibrant-faraday-ux7zgr-cleanup
Closed

mathhulk wants to merge 1 commit into
claude/vibrant-faraday-ux7zgr-typescriptfrom
claude/vibrant-faraday-ux7zgr-cleanup

Conversation

@mathhulk

Copy link
Copy Markdown
Collaborator

5 of 5 (stacked on the TypeScript PR, so this diff shows only the cleanup). Net change: −623 / +284 lines.

This comes out of a whole-codebase review covering reuse, simplification, efficiency, and whether fixes address the root cause rather than the symptom.

Root-cause fixes (replacing workarounds)

  • vite-ssg duplicate <link>s: the real bug is a one-word typo in vite-ssg (attrs.file should be attrs.href). It's now fixed with bun patch (patches/vite-ssg@28.3.0.patch), and the regex post-processing that Convert to TypeScript #4 added to vite.config.ts is removed.
  • Scroll lock: body:has(.mobile-navigation, .location-full-screen) in CSS. Previously two components each toggled a shared body.disabled class without knowing about each other.
  • Accent colours: now meta.accent on each route, set as --accent-color on the app root.
    • The tint uses color-mix() and the blob is a CSS mask.
    • This replaces an SCSS map keyed by route name, which generated a data URL per colour, four of them for routes that no longer exist.
  • One navigation list (src/site.ts) drives both the desktop bar and the mobile menu. They had drifted apart: the mobile menu said "Explore" and had no link to Club. It now matches desktop.
  • Campus scroll buttons: scrollIntoView + scroll-margin-top instead of offsetTop arithmetic. They land in the same place as before (128px from the top).

Simplifications

  • Shared URLs (Discord, Patreon, builder form) are defined once in src/site.ts.
  • Button/LinkButton/IconButton:
    • @click falls through to the element instead of being re-emitted by hand.
    • Unused props and CSS are removed: the progress spinners, and IconButton's link, colour and notification variants.
    • IconButton is now a real <button> and LinkButton a plain <a>.
  • Options uses defineModel, and Campus binds v-model to "Java"/"Bedrock".
  • A framed-image Sass mixin replaces three copies of the image-frame CSS, and aspect-ratio replaces the padding-top ratio hacks.
  • Club:
    • both boards render from one v-for;
    • builders.ts is a plain array instead of one space-separated string;
    • the no-op .space-wrapper @extend and the undefined col-xs-12 class are removed.
  • Smaller cleanups: single-use computeds are inlined, Timeline uses v-bind="event", and duplicated media-query blocks are merged.

Efficiency

  • Logo: the navbar, footer and mobile menu use a 2.3 KB, 160px-tall logo instead of the 16 KB, 920px one.
  • Poster: re-encoded at 1280px (77 KB → 35 KB) and preloaded with high priority on the home page.
  • Background video: fetched and played after mount, and skipped entirely for prefers-reduced-motion and Save-Data.
  • Location component: loaded on demand, so /club no longer downloads it.
  • Server status: returning to the tab only refetches if the last check is over a minute old.
  • Images: removed unreferenced files (logo.png, logo-light.png, seven avatar icons). favicon.ico moves to the site root, where browsers request it.

Content fix

The 404 page linked to /merchandise, which was removed on develop and itself 404s. It now links to the Club page.

Also found during review: corrupt background video (fixed in #2)

A full ffmpeg decode of the background video from #2 reported invalid NAL units throughout. I re-encoded it with the same settings (0 decode errors, 1,410 frames, 1.85 MB), committed it to the #2 branch, and merged it forward through #3 and #4.

Considered but not changed

  • Delete the unrouted 19th Century page and its assets. Its route is deliberately commented out, so it may be work in progress. It's your call.
  • Replace the <br>s hidden by media queries with proper markup. That would change line wrapping at some widths.
  • Shared mixins for text styles and nav-link styles. These are moderate refactors, so they're left for later.
  • Ask mc-heads.net for 200px avatars. The sized endpoint returns the default skin for some players (ZophiaXP, Swannnie, Pikiwikibulbie), so the original URL stays.
  • Drop the 300 font weight. It's used once, and dropping it would visibly change that text.

Verification

  • vue-tsc, eslint and the SSG build all pass; built with hydration-mismatch details on: no warnings, no console errors.
  • Screenshots compared with Convert to TypeScript #4:
    • /campus and / are within a few hundred pixels (anti-aliasing);
    • /club is identical except the shuffled credits;
    • the 404 page differs only by the intended Club button.
  • Interaction checks:
    • the mobile menu shows Home/Campus/Club/Donate, locks scrolling while open and unlocks after navigating;
    • full screen locks and unlocks scrolling;
    • the accent colour follows the route (Club #9155ff);
    • the edition toggle and credits hover-pause still work.
  • Video: Playwright's Chromium can't decode H.264, so I swapped in a VP9 clip to test the logic. It plays after mount normally; with reduced motion it isn't downloaded at all.

Generated by Claude Code

Root-cause fixes:
- Patch vite-ssg's duplicate-<link> check (`attrs.file` -> `attrs.href`)
  with `bun patch`, replacing the regex dedupe in vite.config.ts
- Page scroll lock is CSS (`body:has(.mobile-navigation,
  .location-full-screen)`) instead of two components toggling a body class
- Accent colours live in route meta and are set as --accent-color on the
  app root; the tint uses color-mix() and the blob is a mask, replacing a
  route-name-keyed SCSS map that generated a data-URL per colour (four of
  them for routes that no longer exist)
- One navigationLinks list (src/site.ts) drives both the desktop bar and
  the mobile menu, which had drifted: mobile said "Explore" and had no
  link to Club
- Campus scroll buttons use scrollIntoView + scroll-margin-top instead of
  offsetTop arithmetic

Simplifications:
- Shared URLs (Discord, Patreon, builder form) defined once in src/site.ts
- Button/LinkButton/IconButton: let @click fall through instead of
  re-emitting; drop unused props and CSS (progress spinners, IconButton
  link/colour/notification variants); IconButton is a real <button>,
  LinkButton a plain <a>
- Options uses defineModel; Campus binds v-model to "Java"/"Bedrock"
- framed-image Sass mixin replaces three copies of the image-frame CSS;
  aspect-ratio replaces padding-top ratio hacks
- Club renders both boards from one v-for; builders.ts is a plain array;
  dead .space-wrapper @extend and col-xs-12 removed
- Inline single-use computeds, v-bind="event" in Timeline, merged
  duplicated media-query blocks

Efficiency:
- Navbar/footer/mobile logo uses a 2.3 KB 160px image instead of the
  16 KB 920px one; poster re-encoded at 1280px (77 KB -> 35 KB) and
  preloaded with high priority on the home page
- Background video is fetched and played after mount, and skipped for
  prefers-reduced-motion and Save-Data
- Location is loaded on demand by Event, so /club no longer downloads it
- Server status: a tab coming back into view only refetches when the last
  check is over a minute old
- Remove unused images (logo.png, logo-light.png, seven avatar icons);
  favicon.ico moves to the site root where browsers request it

Content: the 404 page linked to /merchandise (removed on develop), which
itself 404s; it now links to the Club page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DxVDmLPux3Tx7RV1v4yznD
@mathhulk mathhulk closed this Nov 22, 2026
@mathhulk
mathhulk deleted the claude/vibrant-faraday-ux7zgr-cleanup branch November 23, 2026 00:05
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.

2 participants