Skip to content

Phase 1: Foundation + Discover page - #7

Merged
neuromechanist merged 5 commits into
feature/issue-1-epic-nemar-redesignfrom
feature/issue-2-phase1-foundation
May 15, 2026
Merged

neuromechanist merged 5 commits into
feature/issue-1-epic-nemar-redesignfrom
feature/issue-2-phase1-foundation

Conversation

@neuromechanist

Copy link
Copy Markdown
Contributor

Summary

Phase 1 of #1. Stands up the Astro on Cloudflare Pages site, defines the design system, ships the landing hero and the Discover page wired to the live api.nemar.org/datasets endpoint.

Closes #2.

What landed

  • Astro 6 + Cloudflare Pages adapter with output: \"server\", biome lint/format, vitest unit tests, playwright e2e harness, wrangler config (nemar-website, env vars for PUBLIC_API_BASE_URL / PUBLIC_DATA_BASE_URL)
  • Design tokens (src/styles/tokens.css): brand navy/teal/purple, semantic neutrals, type scale (Rubik display + Inter body + JetBrains Mono code), spacing, radii, shadows. Light + dark themes via prefers-color-scheme + manual override persisted to localStorage. FOUC-prevention inline boot script in Base.astro.
  • Base layout (src/layouts/Base.astro) with sticky Nav.astro (Login dialog stub), Footer.astro (funding line + section nav), ThemeToggle.astro, Brand.astro (legacy NEMAR logo SVG inlined as a static asset with currentColor theming)
  • Typed API client (src/lib/api.ts) for listDatasets / getDataset against api.nemar.org; CORS already open for *.nemar.org (verified in nemar-cli/backend/src/index.ts:42-65)
  • Filter state library (src/lib/filters.ts): URL serialize/deserialize, modality AND/OR, reserved-keyword auto-flip (EEG/MEG/iEEG/EMG/HED), single-modality server-side + multi-modality client-side, participant range. Mirrors the legacy dataexplorer.js AND/OR semantics
  • Formatters (src/lib/format.ts): bytes, count, date, relative time, modality normalization (handles BIDS-aware casing for iEEG, fMRI, ECoG)
  • Landing (/): gradient hero with brand-colored orb, search input, three stat tiles (Datasets / Participants / Total size) sourced from api.nemar.org/datasets with graceful legacy-figure fallback when the API is down
  • Discover (/discover): server-rendered, filter sidebar + dataset cards + pagination; URL-bound state means filter combinations are bookmarkable
  • Stub pages: /about, /support, /community, /citation-dashboard, /docs, /404 — each cross-links to its Phase-N issue so users see where the redesign is going

Tests

  • bun run test — 37 tests across filters.test.ts and format.test.ts, all green
  • bun run typecheck — 0 errors across 26 files
  • bun run dev — both / and /discover render against live api.nemar.org (verified by /browse screenshots, see images in screenshots/peer/new-*.png once deployed)

Test plan

  • CI: typecheck + lint + unit tests
  • Cloudflare Pages preview deploys (push triggers preview after project create)
  • Manual: /discover?modality=EEG&modality_op=OR narrows results
  • Manual: /discover?q=motor triggers search
  • Manual: switching between OR/AND with two modalities changes the list
  • Manual: Login button opens the modal stub; dialog closes
  • Manual: theme toggle cycles system → dark → light, persists across reload
  • Accessibility: keyboard navigation through nav, search, filters, pagination

Out of scope (intentional)

Follow-ups before merge

  • Create the nemar-website Cloudflare Pages project (bunx wrangler pages project create nemar-website --production-branch main)
  • Configure Pages env vars PUBLIC_API_BASE_URL / PUBLIC_DATA_BASE_URL (set to https://api.nemar.org / https://data.nemar.org)
  • Run /design-review against the preview URL once it's up — design choices in this PR are functional but deserve a polish pass before Phase 2 builds on top

Bun-managed Astro project targeting Cloudflare Pages. SSR by default for
filter + detail pages, with a static landing. Adds biome (lint/format),
vitest (unit), playwright (e2e), wrangler.toml, and a typed
@astrojs/cloudflare adapter config.

Phase 1 of #1; closes part of #2.
- design tokens (colors, type, spacing, radii) with light/dark via
  prefers-color-scheme + manual override persisted to localStorage
- Base.astro layout with inline FOUC-prevention bootstrap, preconnect
  to api/data.nemar.org
- Brand component using the legacy NEMAR logo SVG (text + brain +
  electrodes) extracted from the Joomla home
- Nav with sticky header, primary links, theme toggle, login modal stub
- Footer with funding line and section nav
- placeholder hero on / pointing to /discover

Part of #2.
- typed api client for api.nemar.org/datasets list + get
- DatasetQuery / SortOption / ModalityCode types
- filter state library: URL serialize/deserialize, modality AND/OR,
  reserved-keyword auto-flip (EEG/MEG/iEEG/EMG/HED), client-side
  multi-modality + participant-range filtering
- format helpers: bytes, count, date, relative time, modality split
- vitest coverage: 22 filter tests + 15 format tests, all green

Part of #2.
- Hero (/): gradient orb, two-line search input, three stat tiles
  (datasets/participants/total size) populated from api.nemar.org with
  graceful legacy-figure fallback when the API is unreachable
- Discover (/discover): SSR fetch with server-side search + sort + single-
  modality filter, client-side multi-modality AND/OR and participant range,
  URL-bound state via filterStateFromURL/toURL
- DatasetCard with modality badges, BIDS-aware ID/title pair, facts table
  (participants, size, version, updated), OpenNeuro cross-link
- FilterSidebar with chip selector, AND/OR pill, range inputs, soon-pills
  on Phase-3 toggles (has-QA, has-10-20)
- Pagination with ellipses, focusable nav links
- Stub pages: /about /support /community /citation-dashboard /docs /404
- Renders ≥10 cards from live api.nemar.org/datasets; typecheck clean
  across 26 files

Part of #2.
DatasetCard: when participants/file_size/version/updated are null or 0,
omit the corresponding fact instead of rendering '—' placeholders. With
the OpenNeuro catalog imports returning sparse metadata, the old layout
made every card look broken (four dashes in a row).

Also pull the OpenNeuro source link out of the body into a footer band
so the card has a clear two-zone layout (content + provenance), and
constrain the external-link arrow SVG to 12x12. The reset.css
'display: block; max-width: 100%' on svg was letting the icon stretch
to 126x126 because the scoped logical-property width on .ds-card__ext
didn't apply to the SVG's intrinsic size — fixed by adding explicit
width/height attributes and switching CSS to physical width/height.

FINDING-001 (HIGH), FINDING-002 (HIGH)
@neuromechanist

Copy link
Copy Markdown
Contributor Author

Design review (run on local preview)

Ran /design-review against http://localhost:4321/ on this branch. Full report saved to ~/.gstack/projects/nemar-website/designs/design-audit-20260515/design-audit-localhost-4321.md.

Headline: Design score C → B, AI-slop score C- → B+ after 7 fixes.

Findings fixed (commit 8eb0c3c)

# Impact Title
001 HIGH Empty card facts row looked broken — conditionalized facts so missing fields are omitted, not shown as 4 "—" placeholders
002 HIGH External-link SVG rendered at 126×126 (intended 12×12) — added explicit width="12" height="12" attributes; switched scoped CSS from inline-size to width because logical properties don't reliably override SVG intrinsic sizing
003 HIGH Login dialog rendered in Times New Roman — added dialog to font: inherit cluster in reset.css + explicit font-family on the dialog itself
004 HIGH Nav/toggle/login touch targets below 44px — bumped all to 44px min
005 MEDIUM Hero gradient orb was generic AI-slop — replaced with public/hero-brain.svg, an electrode net with concentric rings + 10-20 system meridians + brand-colored cardinal electrodes + two animated signal traces; prefers-reduced-motion honored
006 MEDIUM Empty modalities field left card header unbalanced — added "Modalities pending" muted-mono fallback
007 POLISH Card hover affordance was weak — wrapped content in <a>, added focus-within ring + shadow, split card into content + footer zones

Findings deferred to Phase 2

  • POLISH-008: hero "human neuroimaging" gradient text wraps awkwardly across the line break. Wait until /frontend-design runs in Phase 2.
  • POLISH-009: pagination page-number circles at 36px feel small. Will redesign pagination when detail-page nav lands in Phase 2.

Goodwill score

Started at 70/100. Cards-look-broken drained 10. After fixes, finished at 81/100 (healthy).

AI Slop blacklist sweep

11 of 11 anti-patterns clean. The one ⚠️ (decorative gradient) is now intentional 18%-opacity atmosphere behind the electrode net, not chrome.

Verification:

  • bun run typecheck — 0 errors across 26 files
  • bun run test — 37/37 unit tests passing
  • Mobile (375×812), dark theme, and full desktop captures archived

@neuromechanist
neuromechanist merged commit 6377817 into feature/issue-1-epic-nemar-redesign May 15, 2026
@neuromechanist
neuromechanist deleted the feature/issue-2-phase1-foundation branch May 15, 2026 21:03
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