GetClaps
Ücretsiz DenetimFiyatlandırmaSözlükAkademi
  1. Ana sayfa
  2. /Akademi
  3. /L11 · Frontend: Next.js, the closed kit, words, accessibility

Ana sayfa / Akademi / L11 · Frontend: Next.js, the closed kit, words, accessibility

L11Bölüm C · Ürün motorlarıOrtaKod doğrulama tarihi: 2026-12-04

Frontend: Next.js, the closed kit, words, accessibility

How the web app splits server and browser code, talks to the API honestly, locks visuals into a 58-part closed kit, writes calm Turkish-first copy, and meets WCAG 2.2 AA and print rules.

20 dk·3859 kelime·7 soru·32 terim·docs/lessons/11-frontend.md
Ön koşul:L01 · The big picture: what we are building and how the pieces fit
Tüm derslere dön
●

Ders içerikleri İngilizce yayınlanır (OD-23)

Sayfa çerçevesi Türkçe ve İngilizce olarak sunulur. Teknik ders metinleri, kod örnekleri ve kendini sına soruları doğrudan ortak kaynak dosyalarından İngilizce okunur; hukuk ve ürün terimlerinde Türkçe karşılıklar yer alır.

0%
▲Yanıtlanan sorular
0 / 7
—
○Doğruluk oranı
Henüz yanıt yok

Bu dersteki bölümler

  1. 1.Why this matters
  2. 2.The ideas
  3. 3.How this repository does it
  4. 4.What went wrong once
  5. 5.Try it yourself
  6. 6.Check yourself
  7. 7.Words to know
  8. 8.Go deeper

Why this matters

Every number, approval button, and error message a store owner sees passes through the frontend, so a careless screen can erase months of backend security and math discipline in one glance. When an overview screen grew to 8,872 pixels tall, founders scrolled past 76 expanded technical panels just to check daily spend; when browser code misread a real cookie session as offline preview, a signed-in user saw stamped sample numbers and even a fabricated disconnect receipt. The frontend rules here exist to prevent those exact failures: keep browser bundles lean and secret-free, never disguise an API error as sample data, lock every pixel into a closed 58-part kit, write calm Turkish-first copy, and make every screen work at 320 pixels, by keyboard, with screen readers, and on monochrome paper.

The ideas

1. Next.js App Router, Server Components, hydration, and workspace routes

A web app splits work between our Node.js server and the visitor's browser. In the Next.js App Router, folders under apps/web/src/app/ map directly to URL paths, and every file is a React Server Component by default unless it starts with 'use client'.

Server Components execute strictly on the server, export metadata, and send finished HTML without shipping their own JavaScript. Only interactive parts that need clicks, form inputs, useState, or useEffect cross into a client component. Once server HTML paints, React runs hydration to attach browser listeners onto the existing DOM. Because hydration expects the first browser render to match server HTML identically, reading browser-only storage like localStorage during render raises React error 418 (a hydration mismatch); instead, initial markup stays deterministic and browser preferences sync inside useEffect.

●

In plain words

Think of the server as a print shop handing over a readable page immediately, and client JavaScript as the small mechanism wired onto only the controls that need to move. Anything sent to a browser is visible in developer tools, so secrets and Node modules such as node:fs must stay strictly on the server.

Public pages (/, /pricing, /trust, /methodology, /academy, /glossary) sit at the root of apps/web/src/app/, while tenant routes sit under the dynamic segment /w/[workspaceId]/... wrapped in one persistent app shell (WorkspaceShell): a 240-pixel desktop rail that turns into a compact header and bottom navigation bar on phones. Only NEXT_PUBLIC_ environment variables (NEXT_PUBLIC_SITE_URL, NEXT_PUBLIC_API_URL) enter browser bundles, carrying public addresses and never secrets.

text
Browser request: /w/mora-deri/overview
        |
        v
[Next.js Server]  layout.tsx + page.tsx (Server Components, 0 KB client JS)
        |         exports metadata, awaits workspaceId from params
        v
[Initial HTML]    fast paint -> React hydrates only 'use client' islands
        |
        v
[Browser Client]  WorkspaceShell + OverviewClient -> apiRequestJson()
        |
        +---> cookie hint (__Host-gd_signed_in=1) -> credentials: 'include' -> live_api
        +---> explicit dev Bearer token string    -> Authorization header   -> live_api
        +---> signed-out preview (null, no hint)  -> local_sample_fallback  -> "Sample data"

2. Talking to the API honestly: cookie sessions, the three-way signal, and sample fallback

Screens never call raw fetch with ad-hoc headers. Every request flows through one API request helper (apiRequestJson) that rejects path traversal (.., encoded slashes, cross-origin URLs), serialises plain object bodies once, sends x-gd-request: 1 on non-GET mutations, scrubs secrets from error text, and tags each answer live_api or local_sample_fallback.

Real browser sessions use an HttpOnly cookie (__Host-gd_session) that JavaScript cannot read so XSS cannot steal it. To let browser code tell signed-in visitors apart from signed-out previews without exposing the secret cookie, the API sets a paired non-secret hint cookie (__Host-gd_signed_in=1). That drives the three-way session token signal:

Value of sessionTokenMeaningBrowser behaviour
Non-empty stringExplicit dev or test Bearer tokenSends Authorization: Bearer ... to live API
null (hint cookie absent)Signed-out offline previewStays offline and shows stamped sample fallback
null (__Host-gd_signed_in=1 present)Real cookie-authenticated browserSends credentials: 'include', no Bearer, calls live API
undefinedInspect active browser stateReads browser cookie hint or dev token

Two frequent mistakes break this helper: coercing sessionToken with ?? (which collapses explicit null into undefined) and double-serialising body before passing it in (which sends a quoted string instead of a JSON object). Equally strict is honesty: signed-out previews must display the sample data stamp (Örnek veri / Sample data), whereas a signed-in user's API error stays tagged live_api and shows a calm error banner—never silent sample numbers.

3. The closed UI kit and design tokens

Open styling codebases drift fast as pages invent custom greys, shadows, and button sizes. This repository locks visuals into one closed kit (packages/ui) governed by one design system.

Inside packages/ui/src/tokens.css, Tailwind CSS v4 @theme first wipes Tailwind's built-in scales (--color-*: initial, --radius-*: initial, --spacing-*: initial) and defines strictly our closed design tokens:

  • Canvas, surface, ink and line: Four neutral families (--canvas background, --surface to --surface-3 sheets, --ink to --ink-3 text, and --line 1-pixel decorative hairlines) defined for both light and [data-theme="dark"] modes.
  • Control edge contrast: A stronger --line-field token for inputs, selects, and outlined buttons so interactive borders always clear 3:1 contrast.
  • One accent colour: Signal Emerald-Pine (--accent plus hover, subtle, text, and on-accent tokens), reserved for the one primary action per screen and active cues.
  • Three semantic tones and a 4 px grid: ok, wait, and stop foreground/soft pairs, plus strict 4-pixel spacing steps (--spacing-11: 44px for touch targets).

No file outside tokens.css may hold a raw colour (literal hex or functional RGB/HSL). Every UI primitive in packages/ui/src/components/ exposes strictly closed cva variants, holds zero product copy or fetch imports, and receives every word through props.

■

Warning

Generic AI-style dashboards lean on neon glows, gradient tiles, sparkle icons, and boxes stacked inside boxes (nested card soup). The visual rules refuse all of them in favour of flat surfaces, 1-pixel hairlines, and tabular-nums alignment so lira columns line up digit under digit.

4. The words rule, Turkish-first copy, and owner decisions

Under the words rule (AGENTS rule 17), user-facing text is authored first in design/WORDS.md under a dotted key and mirrored into apps/web/src/lib/words.ts (WORDS_TR and WORDS_EN). Five rules govern every string:

  1. Turkish first, English equal. Turkish runs 15 to 25 percent longer than English, so screens are sized for Turkish first while key parity (tools/check-i18n.mjs) verifies an exact 1-to-1 match across both languages.
  2. Whole sentences with named slots. Turkish places verbs last and keeps nouns singular after numbers (2 onay vs 2 approvals), so sentences live whole with named placeholders ({tutar}, {tarih}, {n}) instead of code concatenation.
  3. Calm voice and zero banned words. Direct informal Turkish sen and plain English, exact numbers, two-sentence max errors explaining what failed and what to do next, zero exclamation marks, zero emoji, and zero hype or guaranteed-return claims.
  4. Sentence case and the upper-case ban. Only the first word and proper nouns are capitalised. CSS all-caps transforms are banned everywhere because browser casing breaks Turkish dotted İ/i and dotless I/ı (bildirim turning into BILDIRIM), and standard .toLowerCase() splits İ into i plus combining dot U+0307. Search and tag controls therefore use Turkish-safe case folding (toLocaleLowerCase('tr-TR')).
  5. Two explicit owner exceptions. Under OD-20 (3 December 2026), 1,455 legacy technical strings on older workspace pages stay as-is while Wave 46–48 owner flows (sign-in, connections, approval queue, delivery status) use plain everyday wording tested for zero leaked HTTP codes. Under OD-23, /academy and /glossary learning text is English-only from docs/lessons/ and docs/glossary/ while site chrome stays bilingual.

5. Explicit screen states and progressive disclosure

Every screen designs explicitly for nine screen states so edge cases never turn into blank boxes or fake zeroes:

StateExpected UIForbidden mistake
loadingStatic non-pulsing Skeleton blocks matching row heightLayout jump or blank white screen
emptyCalm EmptyState with one next stepTable filled with fake zeroes
errorCalm InlineAlert or RouteErrorState with retry and digestRaw stack trace or silent sample fallback
offlineBağlantı yok banner or stamped offline previewPresenting cached data as live
partialExplicit notice naming which connector laggedSilently summing incomplete totals
conflictClear 409 notice when another teammate acted firstOverwriting their decision silently
permissionCalm Read-only mode (Okuma modu) noticeUnexplained disabled controls
skipped_no_consentPlain KVKK/IYS explanation for skipped sendReporting legal skips as errors
successConcrete fact naming the exact record savedCheerleading filler or exclamation marks

Numeric cells obey the same rule: null renders as — (unknown), never 0 (confirmed zero). Route state files (loading.tsx, not-found.tsx, error.tsx) catch unexpected crashes and display only an opaque correlation token (resolveErrorDigest).

To keep screens focused without removing deep diagnostics, workspace routes use progressive disclosure: primary figures sit first, followed by a concise Ayrıntılar (Details) index and collapsible disclosure sections built on native HTML <details> and <summary>. Native <details> toggles without JavaScript, works natively with screen readers, expands on #hash deep links, and opens completely on beforeprint.

6. Accessibility (WCAG 2.2 AA), motion discipline, and monochrome print

Every primitive and route targets WCAG 2.2 AA as an enforceable baseline:

  • Contrast and symbols: At least 4.5:1 for normal text, 3:1 for --line-field control edges and focus rings, and never colour alone—StatusPill pairs tones with distinct shapes (● ok, ◆ wait, ■ stop), HeatmapGrid uses ○ to ●, and AllocationBar pairs five glyphs with pure-BigInt percentages totalling exactly 100.
  • Semantic HTML, keyboard, and roving tabindex: Real <button>, <a>, <nav>, <main>, and <details> elements replace clickable <div> boxes, images require explicit alt, headings never skip levels, and positive tabIndex is banned. Modals (Drawer, ConfirmDialog, CommandBar) trap Tab, focus Cancel first on destructive actions, close on Escape, and restore focus to their trigger. Composite widgets (TreeView, CalendarGrid, HeatmapGrid, AllocationBar) take one Tab stop via roving tabindex (0 on the active item, -1 on siblings) and move with Arrow, Home, End, and Page keys. Slider and SplitPane never depend on dragging alone.
  • Target size, 320-pixel reflow, and 200 percent zoom: Interactive controls enforce a minimum touch target of 44 x 44 px (min-h-11 min-w-11, stricter than WCAG's 24 px), reflow down to 320 px with 0 px horizontal overflow, and expand without clipping at 200% text zoom.
  • Motion and prefers-reduced-motion: Daily actions (tabs, sorts, filters) snap in 0 ms; overlays animate only GPU-composited transform and opacity (zero transition: all); press feedback scales to 97% over 120 ms; Skeleton never pulses; Toast stays until manually dismissed; and reduced-motion preferences collapse every transition to 0 ms.
  • Monochrome print: @media print in apps/web/src/app/globals.css forces black ink on white paper even from dark mode, hides chrome and buttons, opens <Disclosure> panels via beforeprint, and swaps AllocationBar for archival monochrome tables.

7. Performance budgets, Higgsfield visuals, and proving screens in a browser

Core Web Vitals (LCP <= 2.5 s, INP <= 200 ms, CLS <= 0.1 at p75) and asset hygiene are protected statically and verified live:

  • The web budget gate (tools/check-web-budgets.mjs) blocks 16 heavy or vendor packages (moment, lodash, three, gsap, chart.js, recharts, framer-motion, proprietary LLM SDKs), verifies local /assets/** files with zero stock hosts, enforces verbatim sessionToken forwarding and single JSON bodies, checks 'use client' and zero Node built-ins in browser files, and bans mount-time fetches on watched public pages.
  • The media gate (tools/check-media-assets.mjs) verifies all 17 Higgsfield WebPs and the Option B SVG for valid RIFF....WEBP headers, byte caps (<= 60 KiB avatars, < 250 KiB editorial, <= 270 KiB hero, <= 2.5 MiB total), 100 percent SHA-256 parity with design/assets/ and design/higgsfield/LOG.md, zero stock photos, and zero orphan files.
  • Three verification layers: Static gates run in under a second; Vitest suites (renderToStaticMarkup and DOM checks) test ARIA roles, null -> —, and plain wording; and Playwright browser suites (a11y-tree-audit.mjs across 40 routes, sign-in-journey-e2e.mjs, connect-journey-e2e.mjs, event-and-approval-journey-e2e.mjs, plus next build + next start visual audits at 320, 390, and 1440 px) catch real hydration, useEffect, and overflow bugs static tests miss.

How this repository does it

Frontend code lives in two packages backed by six automated gates and real browser tests:

  • apps/web: Configured in web package manifest (Next.js 16.4.6, React 19.3.1, Tailwind CSS 4.3.5, TypeScript 7.0.2, Vitest 5.1.2) and Next.js config (output: 'standalone'). Root layout sets <html lang="tr" data-theme="light"> and resolveMetadataBase; global stylesheet defines @media print. Forty-four routes span public pages listed in sitemap (including component catalogue) and 11 workspace route folders under workspace layout, WorkspaceShell, workspace loading, workspace error, root error, and RouteErrorState. Client helpers live in api-client.ts, workspace-context.tsx, words.ts, drill-downs.ts, and MotionPrimitives.tsx.
  • packages/ui: UI package manifest depends strictly on class-variance-authority, clsx, and radix-ui. tokens.css locks @theme, and index.ts exports all 58 primitives—including Button, StatusPill, DataTable, MoneyCell, Disclosure, TreeView, and AllocationBar—verified by a11y.test.tsx.
Gate scriptEnforcesBreaks if removed
check-tokens.mjsZero raw colours, zero CSS all-caps, zero transition: all, pure packages/ui, zero working name in apps/webDark mode drifts, Turkish İ/ı breaks, kit leaks coupling
check-surface-invariants.mjsAll 58 primitives cleanly exported and alignedHidden components drift from /design-system
check-i18n.mjs1-to-1 WORDS_TR/WORDS_EN parity, zero ! or banned wordsMissing keys or hype copy reach screens
check-a11y-static.mjsSemantic interactive tags, explicit alt, no positive tabIndex, visible focus, labelled dialogsKeyboard and screen-reader bugs ship silently
check-web-budgets.mjsBans 16 heavy packages, local /assets/**, verbatim sessionToken, single JSON body, zero public mount fetchesBundles bloat, cookie sessions break, public routes trigger 401s
check-media-assets.mjsValid WebPs, KiB caps, SHA-256 Higgsfield parity, zero stock URLs or orphansOversized or unverified visuals hurt LCP and provenance

Live Playwright suites—a11y-tree-audit.mjs, sign-in-journey-e2e.mjs, connect-journey-e2e.mjs, and event-and-approval-journey-e2e.mjs—plus Wave 44 visual audit verify real rendered journeys.

◆

Not built yet

Four items remain staged rather than wired into production code:

  • TanStack Table (@tanstack/react-table): Named in AGENTS.md rule 16, not installed in any package.json; DataTable is pure React today.
  • Self-hosted @font-face wiring: Local fonts sit in design/prototypes/fonts/, but globals.css does not load them yet.
  • Service worker registration: sw.js and manifest.webmanifest exist, but no client file registers sw.js yet.
  • Rebuilt /academy and /glossary: academy page and glossary page await regeneration from docs/lessons/ and docs/glossary/ under OD-23.

Nothing in apps/web is deployed publicly yet, no real Meta or Google call has been made, and there are no live customers yet.

What went wrong once

1. Eight-thousand-pixel workspace screens buried the main job (CS-20, Wave 45)

By Wave 44, overview stretched to 8,872 px because 76 diagnostic panels across 11 workspace routes loaded fully expanded. Adding native <details> Disclosure and drill-downs.ts collapsed all 76 panels behind a top Ayrıntılar index, cutting overview to 2,869 px while keeping #hash deep links, zero-JS toggling, and beforeprint expansion. Rule: one primary task first, secondary depth one click away.

2. Signed-in users saw sample data and a fake revoke receipt (CS-36 and CS-44, Waves 46–47)

Because __Host-gd_session is HttpOnly, browser code could not read it, passed sessionToken: null, treated real signed-in visitors as offline preview, showed stamped sample figures, and even returned a local synthetic revoke receipt on transport failure. Adding the non-secret __Host-gd_signed_in=1 hint cookie, hasLiveWorkspaceSession in api-client.ts, strict live_api error handling, and the ?? guard in check-web-budgets.mjs closed the gap. Rule: sample fallback serves signed-out previews only and never hides a real user's API error.

3. Legacy technical wording across 11 older screens (CS-21, Wave 45 and OD-20)

An audit found 1,455 technical labels across older workspace routes. Rather than risking a noisy bulk rewrite, the owners logged OD-20 in owner decisions (3 December 2026): keep legacy workspace strings as-is while enforcing plain everyday wording and zero raw HTTP codes on all newer Wave 46–48 sign-in, connection, and approval screens. Rule: record conscious scope boundaries openly in owner decisions.

4. Unknown approval IDs fell back to the first queue item (CS-52, Wave 48)

Opening /w/[workspaceId]/approvals/missing-id fell back to items[0] when the ID was absent from the fetched queue, risking approval of the wrong budget change. MobileApprovalClient.tsx now renders an explicit not-found state linking back to the queue. Rule: missing record IDs always show not-found, never another record.

Try it yourself

Every step below is read-only, runs inside the repository root in PowerShell or Git Bash, touches zero running dev servers, and makes zero external calls.

Step 1: Run the closed-kit token and surface gates

bash
node tools/check-tokens.mjs
node tools/check-surface-invariants.mjs

Verify PASS confirming zero raw colours outside tokens.css, zero CSS all-caps transforms, pure copy-free packages/ui, and all 58 primitives exported from packages/ui/src/index.ts.

Step 2: Run the accessibility, copy parity, web budget, and media gates

bash
node tools/check-a11y-static.mjs
node tools/check-i18n.mjs
node tools/check-web-budgets.mjs
node tools/check-media-assets.mjs

Confirm zero errors across interactive semantics, WORDS_TR/WORDS_EN parity, forbidden packages, verbatim sessionToken forwarding, zero public mount-time fetches, and 100 percent SHA-256 Higgsfield asset parity.

Step 3: Inspect the closed token sheet and monochrome print reset

bash
git grep -n "initial;" packages/ui/src/tokens.css
git grep -n "@media print" apps/web/src/app/globals.css

See how @theme clears Tailwind defaults, how [data-theme="dark"] swaps --canvas, --surface, --ink, --line, --line-field, and --accent, and how @media print forces monochrome paper output.

Step 4: Trace the three-way sessionToken signal

bash
git grep -n "hasLiveWorkspaceSession\|SIGNED_IN_HINT_COOKIE_NAME\|local_sample_fallback" apps/web/src/lib/api-client.ts

Trace how string, null with or without __Host-gd_signed_in=1, and undefined route between live_api and local_sample_fallback.

Check yourself

0 / 7

Q1.Why can a React Server Component read server configuration while a 'use client' file must never import node:fs or secret environment variables?

Q2.A signed-in user carrying __Host-gd_session and __Host-gd_signed_in=1 opens overview while the API is unreachable. What must the screen show?

Q3.Why does tools/check-tokens.mjs ban CSS all-caps text transforms across apps/web and packages/ui?

Q4.Why must DataTable and MoneyCell render null spend as — instead of ₺0,00?

Q5.Why do TreeView, CalendarGrid, and AllocationBar use roving tabindex instead of tabIndex={0} on every item?

Q6.Why is Disclosure built on native HTML <details> and <summary> rather than a custom div toggle?

Q7.A Vitest test using renderToStaticMarkup passes on a component that reads localStorage during render, yet the live browser throws React error 418. Why?

Words to know

32
320-pixel reflowTR: 320 piksel yeniden akış

WCAG 2.2 Success Criterion 1.4.10 requiring every screen to wrap cleanly down to a 320-pixel viewport width with zero horizontal page scrolling.

Ön yüz ve tasarımSözlükte incele
accent colourTR: vurgu rengi

The design system single signal colour, a deep emerald-pine green reserved for the primary action and live tracking cues.

Ön yüz ve tasarımSözlükte incele
API request helperTR: API istek yardımcısı

The single typed browser helper that calls the backend API, handles credentials and JSON serialisation, and scrubs secrets from errors.

Ön yüz ve tasarımSözlükte incele
App RouterTR: App Router yönlendiricisi

The Next.js routing system under src/app/ where nested folders define URL paths, shared layouts, loading states, and server-first pages.

Ön yüz ve tasarımSözlükte incele
app shellTR: uygulama kabuğu

The persistent navigation frame around every workspace route, providing the desktop rail, mobile bottom bar, top bar, and main landmark.

Ön yüz ve tasarımSözlükte incele
banned wordsTR: yasaklı sözcükler

The marketing hype phrases, hollow filler words, exclamation marks, emoji, and unverified return claims barred from every product screen.

Ön yüz ve tasarımSözlükte incele
calm voiceTR: sakin sen dili

The product editorial voice: direct informal Turkish sen, short factual sentences, exact numbers, two-sentence max errors, and zero exclamation marks.

Ön yüz ve tasarımSözlükte incele
canvas, surface, ink and lineTR: zemin, yüzey, mürekkep ve çizgi

The four foundational semantic colour families: --canvas for page background, --surface for panels, --ink for text, and --line for borders.

Ön yüz ve tasarımSözlükte incele
client componentTR: istemci bileşeni

A React component file starting with the use client directive so its code ships to the browser for state, effects, and event handlers.

Ön yüz ve tasarımSözlükte incele
closed kitTR: kapalı UI kiti

The fixed library of 58 UI primitives and closed design tokens in packages/ui, the sole permitted source of colours, spacing, radii, and controls.

Ön yüz ve tasarımSözlükte incele
design systemTR: tasarım sistemi

The unified set of visual tokens, editorial voice rules, accessibility invariants, and closed UI primitives from which every screen is built.

Ön yüz ve tasarımSözlükte incele
design tokenTR: tasarım belirteci

A named semantic value for colour, spacing, border radius, shadow, typography, or motion duration that components reference instead of raw numbers.

Ön yüz ve tasarımSözlükte incele
disclosure (details and summary)TR: açılır detay bölümü

A collapsible content section built on native HTML <details> and <summary> elements so it works without JavaScript, supports #hash deep links, and opens on print.

Ön yüz ve tasarımSözlükte incele
hydrationTR: hidrasyon

The browser step where React attaches event handlers and interactive state onto server-rendered HTML without redrawing the page from scratch.

Ön yüz ve tasarımSözlükte incele
key parityTR: anahtar denkliği

The automated gate checking that every string key exists in both Turkish (WORDS_TR) and English (WORDS_EN) with matching slots and zero banned copy.

Ön yüz ve tasarımSözlükte incele
prefers-reduced-motionTR: azaltılmış hareket tercihi

The CSS media query and OS accessibility setting signalling that the user wants animations disabled or replaced with instant state changes.

Ön yüz ve tasarımSözlükte incele
progressive disclosureTR: kademeli bilgi açılımı

Presenting the essential decision and key figures first on a screen while placing secondary diagnostics one click away inside labelled collapsible drill-downs.

Ön yüz ve tasarımSözlükte incele
raw colourTR: ham renk kodu

A literal colour written directly as a hex code or rgb/hsl function instead of a semantic design token, banned outside packages/ui/src/tokens.css.

Ön yüz ve tasarımSözlükte incele
React Server ComponentRSCTR: React Sunucu Bileşeni

A React component that executes strictly on the server, shipping rendered output rather than its own JavaScript code to the browser—the default in Next.js App Router.

Ön yüz ve tasarımSözlükte incele
roving tabindexTR: gezici sekme sırası

An ARIA keyboard pattern where a composite widget exposes only one active item with tabIndex={0} (others -1) and moves focus internally with Arrow, Home, and End keys.

Ön yüz ve tasarımSözlükte incele
sample data stampTR: örnek veri damgası

The mandatory visible label (Örnek veri in Turkish, Sample data in English) placed on every panel or screen showing illustrative demo figures so they can never be mistaken for real numbers.

Ön yüz ve tasarımSözlükte incele
sample fallbackTR: örnek veri yedeği

The offline preview mode (local_sample_fallback) that displays stamped sample data only when nobody is signed in, never as a silent substitute for a signed-in person live API error.

Ön yüz ve tasarımSözlükte incele
screen statesTR: ekran durumları

The nine explicit conditions every screen designs for (loading, empty, error, offline, partial, conflict, permission, skipped_no_consent, success) so no view turns blank.

Ön yüz ve tasarımSözlükte incele
sentence caseTR: cümle düzeni

Capitalising only the first word and proper nouns in headings, buttons, table headers, and badges—the sole text casing permitted across product screens.

Ön yüz ve tasarımSözlükte incele
three-way session token signalTR: üç durumlu oturum belirteci sinyali

The API client contract distinguishing three states of sessionToken: an explicit dev Bearer string, explicit null (rely on browser cookie or offline mode), and undefined (read browser state).

Ön yüz ve tasarımSözlükte incele
touch targetTR: dokunma hedefi

The clickable and tappable hit area of an interactive control, enforced in this kit at >= 44 x 44 px (min-h-11 min-w-11), far stricter than WCAG 2.2 AA minimum of 24 x 24 px.

Ön yüz ve tasarımSözlükte incele
UI primitiveTR: temel arayüz bileşeni

One reusable, domain-agnostic building block inside packages/ui/src/components/ (such as Button, Drawer, DataTable, or Disclosure) that holds zero product words or network calls.

Ön yüz ve tasarımSözlükte incele
upper-case banTR: büyük harf dönüştürme yasağı

The enforced project ban forbidding CSS all-caps text transforms anywhere in the web app or UI kit because browser capitalisation corrupts Turkish dotted i and dotless ı.

Ön yüz ve tasarımSözlükte incele
variantTR: bileşen varyantı

One of the closed, named visual options a kit primitive accepts via props, such as button variant="primary" or badge tone="wait".

Ön yüz ve tasarımSözlükte incele
WCAG 2.2 AAWCAGTR: Web İçeriği Erişilebilirlik Yönergeleri 2.2 AA

The W3C Web Content Accessibility Guidelines version 2.2 at conformance level AA (the middle tier between A and AAA), the mandatory accessibility baseline for every screen.

Ön yüz ve tasarımSözlükte incele
web budget gateTR: web bütçe kapısı

The five-invariant gate in tools/check-web-budgets.mjs enforcing lean packages, local assets, session-token and JSON-body hygiene, client boundaries, and zero public mount fetches.

Ön yüz ve tasarımSözlükte incele
words ruleTR: sözcük kuralı

AGENTS rule 17: every user-facing string is authored first in design/WORDS.md under a stable key in calm Turkish and equal English before any screen displays it.

Ön yüz ve tasarımSözlükte incele

Go deeper

  • Repository rules and contracts: AGENTS.md, design frame, visual rules, words dictionary, owner decisions, and independent review.
  • Archived lessons replaced by this chapter: archived lesson 07 on design systems, a11y, motion, and print, archived lesson 13 on Next.js App Router, RSC, and web budgets, archived lesson 21 on frontend security and webhooks, archived lesson 25 on the 50-primitive UI kit, and archived lesson 31 on CalendarGrid and SEO guards.
  • Official framework docs: Next.js App Router, React Server Components, and Tailwind CSS v4 theme variables.
  • Official standards: W3C WCAG 2.2, W3C WAI-ARIA APG, MDN details element, MDN prefers-reduced-motion, and web.dev Core Web Vitals.
◆

NOT LEGAL OR TAX ADVICE · Açık karar kapıları dürüstlüğü

Bu müfredat öğrenme amaçlıdır; hukuk veya vergi danışmanlığı değildir. #3 hukuk ve mali müşavir onayı, #21 keşif görüşmeleri, OD-01 marka tescil kontrolü ve canlı dağıtım henüz tamamlanmamıştır. ISO-27001 / SOC 2: UNOBTAINED. Sıfır canlı müşteri veya canlı reklam harcaması iddia edilmez.

Önceki ders: L10Sonraki ders: L12

L11 · Part C · intermediate · Verified 2026-12-04 · 20 min

Frontend: Next.js, the closed kit, words, accessibility

How the web app splits server and browser code, talks to the API honestly, locks visuals into a 58-part closed kit, writes calm Turkish-first copy, and meets WCAG 2.2 AA and print rules.

Bu müfredat öğrenme amaçlıdır; hukuk veya vergi danışmanlığı değildir. #3 hukuk ve mali müşavir onayı, #21 keşif görüşmeleri, OD-01 marka tescil kontrolü ve canlı dağıtım henüz tamamlanmamıştır. ISO-27001 / SOC 2: UNOBTAINED. Sıfır canlı müşteri veya canlı reklam harcaması iddia edilmez.

Why this matters

Every number, approval button, and error message a store owner sees passes through the frontend, so a careless screen can erase months of backend security and math discipline in one glance. When an overview screen grew to 8,872 pixels tall, founders scrolled past 76 expanded technical panels just to check daily spend; when browser code misread a real cookie session as offline preview, a signed-in user saw stamped sample numbers and even a fabricated disconnect receipt. The frontend rules here exist to prevent those exact failures: keep browser bundles lean and secret-free, never disguise an API error as sample data, lock every pixel into a closed 58-part kit, write calm Turkish-first copy, and make every screen work at 320 pixels, by keyboard, with screen readers, and on monochrome paper.

The ideas

1. Next.js App Router, Server Components, hydration, and workspace routes

A web app splits work between our Node.js server and the visitor's browser. In the Next.js App Router, folders under apps/web/src/app/ map directly to URL paths, and every file is a React Server Component by default unless it starts with 'use client'.

Server Components execute strictly on the server, export metadata, and send finished HTML without shipping their own JavaScript. Only interactive parts that need clicks, form inputs, useState, or useEffect cross into a client component. Once server HTML paints, React runs hydration to attach browser listeners onto the existing DOM. Because hydration expects the first browser render to match server HTML identically, reading browser-only storage like localStorage during render raises React error 418 (a hydration mismatch); instead, initial markup stays deterministic and browser preferences sync inside useEffect.

●

In plain words

Think of the server as a print shop handing over a readable page immediately, and client JavaScript as the small mechanism wired onto only the controls that need to move. Anything sent to a browser is visible in developer tools, so secrets and Node modules such as node:fs must stay strictly on the server.

Public pages (/, /pricing, /trust, /methodology, /academy, /glossary) sit at the root of apps/web/src/app/, while tenant routes sit under the dynamic segment /w/[workspaceId]/... wrapped in one persistent app shell (WorkspaceShell): a 240-pixel desktop rail that turns into a compact header and bottom navigation bar on phones. Only NEXT_PUBLIC_ environment variables (NEXT_PUBLIC_SITE_URL, NEXT_PUBLIC_API_URL) enter browser bundles, carrying public addresses and never secrets.

Browser request: /w/mora-deri/overview
        |
        v
[Next.js Server]  layout.tsx + page.tsx (Server Components, 0 KB client JS)
        |         exports metadata, awaits workspaceId from params
        v
[Initial HTML]    fast paint -> React hydrates only 'use client' islands
        |
        v
[Browser Client]  WorkspaceShell + OverviewClient -> apiRequestJson()
        |
        +---> cookie hint (__Host-gd_signed_in=1) -> credentials: 'include' -> live_api
        +---> explicit dev Bearer token string    -> Authorization header   -> live_api
        +---> signed-out preview (null, no hint)  -> local_sample_fallback  -> "Sample data"

2. Talking to the API honestly: cookie sessions, the three-way signal, and sample fallback

Screens never call raw fetch with ad-hoc headers. Every request flows through one API request helper (apiRequestJson) that rejects path traversal (.., encoded slashes, cross-origin URLs), serialises plain object bodies once, sends x-gd-request: 1 on non-GET mutations, scrubs secrets from error text, and tags each answer live_api or local_sample_fallback.

Real browser sessions use an HttpOnly cookie (__Host-gd_session) that JavaScript cannot read so XSS cannot steal it. To let browser code tell signed-in visitors apart from signed-out previews without exposing the secret cookie, the API sets a paired non-secret hint cookie (__Host-gd_signed_in=1). That drives the three-way session token signal:

Value of sessionTokenMeaningBrowser behaviour
Non-empty stringExplicit dev or test Bearer tokenSends Authorization: Bearer ... to live API
null (hint cookie absent)Signed-out offline previewStays offline and shows stamped sample fallback
null (__Host-gd_signed_in=1 present)Real cookie-authenticated browserSends credentials: 'include', no Bearer, calls live API
undefinedInspect active browser stateReads browser cookie hint or dev token

Two frequent mistakes break this helper: coercing sessionToken with ?? (which collapses explicit null into undefined) and double-serialising body before passing it in (which sends a quoted string instead of a JSON object). Equally strict is honesty: signed-out previews must display the sample data stamp (Örnek veri / Sample data), whereas a signed-in user's API error stays tagged live_api and shows a calm error banner—never silent sample numbers.

3. The closed UI kit and design tokens

Open styling codebases drift fast as pages invent custom greys, shadows, and button sizes. This repository locks visuals into one closed kit (packages/ui) governed by one design system.

Inside packages/ui/src/tokens.css, Tailwind CSS v4 @theme first wipes Tailwind's built-in scales (--color-*: initial, --radius-*: initial, --spacing-*: initial) and defines strictly our closed design tokens:

  • Canvas, surface, ink and line: Four neutral families (--canvas background, --surface to --surface-3 sheets, --ink to --ink-3 text, and --line 1-pixel decorative hairlines) defined for both light and [data-theme="dark"] modes.
  • Control edge contrast: A stronger --line-field token for inputs, selects, and outlined buttons so interactive borders always clear 3:1 contrast.
  • One accent colour: Signal Emerald-Pine (--accent plus hover, subtle, text, and on-accent tokens), reserved for the one primary action per screen and active cues.
  • Three semantic tones and a 4 px grid: ok, wait, and stop foreground/soft pairs, plus strict 4-pixel spacing steps (--spacing-11: 44px for touch targets).

No file outside tokens.css may hold a raw colour (literal hex or functional RGB/HSL). Every UI primitive in packages/ui/src/components/ exposes strictly closed cva variants, holds zero product copy or fetch imports, and receives every word through props.

■

Warning

Generic AI-style dashboards lean on neon glows, gradient tiles, sparkle icons, and boxes stacked inside boxes (nested card soup). The visual rules refuse all of them in favour of flat surfaces, 1-pixel hairlines, and tabular-nums alignment so lira columns line up digit under digit.

4. The words rule, Turkish-first copy, and owner decisions

Under the words rule (AGENTS rule 17), user-facing text is authored first in design/WORDS.md under a dotted key and mirrored into apps/web/src/lib/words.ts (WORDS_TR and WORDS_EN). Five rules govern every string:

  1. Turkish first, English equal. Turkish runs 15 to 25 percent longer than English, so screens are sized for Turkish first while key parity (tools/check-i18n.mjs) verifies an exact 1-to-1 match across both languages.
  2. Whole sentences with named slots. Turkish places verbs last and keeps nouns singular after numbers (2 onay vs 2 approvals), so sentences live whole with named placeholders ({tutar}, {tarih}, {n}) instead of code concatenation.
  3. Calm voice and zero banned words. Direct informal Turkish sen and plain English, exact numbers, two-sentence max errors explaining what failed and what to do next, zero exclamation marks, zero emoji, and zero hype or guaranteed-return claims.
  4. Sentence case and the upper-case ban. Only the first word and proper nouns are capitalised. CSS all-caps transforms are banned everywhere because browser casing breaks Turkish dotted İ/i and dotless I/ı (bildirim turning into BILDIRIM), and standard .toLowerCase() splits İ into i plus combining dot U+0307. Search and tag controls therefore use Turkish-safe case folding (toLocaleLowerCase('tr-TR')).
  5. Two explicit owner exceptions. Under OD-20 (3 December 2026), 1,455 legacy technical strings on older workspace pages stay as-is while Wave 46–48 owner flows (sign-in, connections, approval queue, delivery status) use plain everyday wording tested for zero leaked HTTP codes. Under OD-23, /academy and /glossary learning text is English-only from docs/lessons/ and docs/glossary/ while site chrome stays bilingual.

5. Explicit screen states and progressive disclosure

Every screen designs explicitly for nine screen states so edge cases never turn into blank boxes or fake zeroes:

StateExpected UIForbidden mistake
loadingStatic non-pulsing Skeleton blocks matching row heightLayout jump or blank white screen
emptyCalm EmptyState with one next stepTable filled with fake zeroes
errorCalm InlineAlert or RouteErrorState with retry and digestRaw stack trace or silent sample fallback
offlineBağlantı yok banner or stamped offline previewPresenting cached data as live
partialExplicit notice naming which connector laggedSilently summing incomplete totals
conflictClear 409 notice when another teammate acted firstOverwriting their decision silently
permissionCalm Read-only mode (Okuma modu) noticeUnexplained disabled controls
skipped_no_consentPlain KVKK/IYS explanation for skipped sendReporting legal skips as errors
successConcrete fact naming the exact record savedCheerleading filler or exclamation marks

Numeric cells obey the same rule: null renders as — (unknown), never 0 (confirmed zero). Route state files (loading.tsx, not-found.tsx, error.tsx) catch unexpected crashes and display only an opaque correlation token (resolveErrorDigest).

To keep screens focused without removing deep diagnostics, workspace routes use progressive disclosure: primary figures sit first, followed by a concise Ayrıntılar (Details) index and collapsible disclosure sections built on native HTML <details> and <summary>. Native <details> toggles without JavaScript, works natively with screen readers, expands on #hash deep links, and opens completely on beforeprint.

6. Accessibility (WCAG 2.2 AA), motion discipline, and monochrome print

Every primitive and route targets WCAG 2.2 AA as an enforceable baseline:

  • Contrast and symbols: At least 4.5:1 for normal text, 3:1 for --line-field control edges and focus rings, and never colour alone—StatusPill pairs tones with distinct shapes (● ok, ◆ wait, ■ stop), HeatmapGrid uses ○ to ●, and AllocationBar pairs five glyphs with pure-BigInt percentages totalling exactly 100.
  • Semantic HTML, keyboard, and roving tabindex: Real <button>, <a>, <nav>, <main>, and <details> elements replace clickable <div> boxes, images require explicit alt, headings never skip levels, and positive tabIndex is banned. Modals (Drawer, ConfirmDialog, CommandBar) trap Tab, focus Cancel first on destructive actions, close on Escape, and restore focus to their trigger. Composite widgets (TreeView, CalendarGrid, HeatmapGrid, AllocationBar) take one Tab stop via roving tabindex (0 on the active item, -1 on siblings) and move with Arrow, Home, End, and Page keys. Slider and SplitPane never depend on dragging alone.
  • Target size, 320-pixel reflow, and 200 percent zoom: Interactive controls enforce a minimum touch target of 44 x 44 px (min-h-11 min-w-11, stricter than WCAG's 24 px), reflow down to 320 px with 0 px horizontal overflow, and expand without clipping at 200% text zoom.
  • Motion and prefers-reduced-motion: Daily actions (tabs, sorts, filters) snap in 0 ms; overlays animate only GPU-composited transform and opacity (zero transition: all); press feedback scales to 97% over 120 ms; Skeleton never pulses; Toast stays until manually dismissed; and reduced-motion preferences collapse every transition to 0 ms.
  • Monochrome print: @media print in apps/web/src/app/globals.css forces black ink on white paper even from dark mode, hides chrome and buttons, opens <Disclosure> panels via beforeprint, and swaps AllocationBar for archival monochrome tables.

7. Performance budgets, Higgsfield visuals, and proving screens in a browser

Core Web Vitals (LCP <= 2.5 s, INP <= 200 ms, CLS <= 0.1 at p75) and asset hygiene are protected statically and verified live:

  • The web budget gate (tools/check-web-budgets.mjs) blocks 16 heavy or vendor packages (moment, lodash, three, gsap, chart.js, recharts, framer-motion, proprietary LLM SDKs), verifies local /assets/** files with zero stock hosts, enforces verbatim sessionToken forwarding and single JSON bodies, checks 'use client' and zero Node built-ins in browser files, and bans mount-time fetches on watched public pages.
  • The media gate (tools/check-media-assets.mjs) verifies all 17 Higgsfield WebPs and the Option B SVG for valid RIFF....WEBP headers, byte caps (<= 60 KiB avatars, < 250 KiB editorial, <= 270 KiB hero, <= 2.5 MiB total), 100 percent SHA-256 parity with design/assets/ and design/higgsfield/LOG.md, zero stock photos, and zero orphan files.
  • Three verification layers: Static gates run in under a second; Vitest suites (renderToStaticMarkup and DOM checks) test ARIA roles, null -> —, and plain wording; and Playwright browser suites (a11y-tree-audit.mjs across 40 routes, sign-in-journey-e2e.mjs, connect-journey-e2e.mjs, event-and-approval-journey-e2e.mjs, plus next build + next start visual audits at 320, 390, and 1440 px) catch real hydration, useEffect, and overflow bugs static tests miss.

How this repository does it

Frontend code lives in two packages backed by six automated gates and real browser tests:

  • apps/web: Configured in web package manifest (Next.js 16.4.6, React 19.3.1, Tailwind CSS 4.3.5, TypeScript 7.0.2, Vitest 5.1.2) and Next.js config (output: 'standalone'). Root layout sets <html lang="tr" data-theme="light"> and resolveMetadataBase; global stylesheet defines @media print. Forty-four routes span public pages listed in sitemap (including component catalogue) and 11 workspace route folders under workspace layout, WorkspaceShell, workspace loading, workspace error, root error, and RouteErrorState. Client helpers live in api-client.ts, workspace-context.tsx, words.ts, drill-downs.ts, and MotionPrimitives.tsx.
  • packages/ui: UI package manifest depends strictly on class-variance-authority, clsx, and radix-ui. tokens.css locks @theme, and index.ts exports all 58 primitives—including Button, StatusPill, DataTable, MoneyCell, Disclosure, TreeView, and AllocationBar—verified by a11y.test.tsx.
Gate scriptEnforcesBreaks if removed
check-tokens.mjsZero raw colours, zero CSS all-caps, zero transition: all, pure packages/ui, zero working name in apps/webDark mode drifts, Turkish İ/ı breaks, kit leaks coupling
check-surface-invariants.mjsAll 58 primitives cleanly exported and alignedHidden components drift from /design-system
check-i18n.mjs1-to-1 WORDS_TR/WORDS_EN parity, zero ! or banned wordsMissing keys or hype copy reach screens
check-a11y-static.mjsSemantic interactive tags, explicit alt, no positive tabIndex, visible focus, labelled dialogsKeyboard and screen-reader bugs ship silently
check-web-budgets.mjsBans 16 heavy packages, local /assets/**, verbatim sessionToken, single JSON body, zero public mount fetchesBundles bloat, cookie sessions break, public routes trigger 401s
check-media-assets.mjsValid WebPs, KiB caps, SHA-256 Higgsfield parity, zero stock URLs or orphansOversized or unverified visuals hurt LCP and provenance

Live Playwright suites—a11y-tree-audit.mjs, sign-in-journey-e2e.mjs, connect-journey-e2e.mjs, and event-and-approval-journey-e2e.mjs—plus Wave 44 visual audit verify real rendered journeys.

◆

Not built yet

Four items remain staged rather than wired into production code:

  • TanStack Table (@tanstack/react-table): Named in AGENTS.md rule 16, not installed in any package.json; DataTable is pure React today.
  • Self-hosted @font-face wiring: Local fonts sit in design/prototypes/fonts/, but globals.css does not load them yet.
  • Service worker registration: sw.js and manifest.webmanifest exist, but no client file registers sw.js yet.
  • Rebuilt /academy and /glossary: academy page and glossary page await regeneration from docs/lessons/ and docs/glossary/ under OD-23.

Nothing in apps/web is deployed publicly yet, no real Meta or Google call has been made, and there are no live customers yet.

What went wrong once

1. Eight-thousand-pixel workspace screens buried the main job (CS-20, Wave 45)

By Wave 44, overview stretched to 8,872 px because 76 diagnostic panels across 11 workspace routes loaded fully expanded. Adding native <details> Disclosure and drill-downs.ts collapsed all 76 panels behind a top Ayrıntılar index, cutting overview to 2,869 px while keeping #hash deep links, zero-JS toggling, and beforeprint expansion. Rule: one primary task first, secondary depth one click away.

2. Signed-in users saw sample data and a fake revoke receipt (CS-36 and CS-44, Waves 46–47)

Because __Host-gd_session is HttpOnly, browser code could not read it, passed sessionToken: null, treated real signed-in visitors as offline preview, showed stamped sample figures, and even returned a local synthetic revoke receipt on transport failure. Adding the non-secret __Host-gd_signed_in=1 hint cookie, hasLiveWorkspaceSession in api-client.ts, strict live_api error handling, and the ?? guard in check-web-budgets.mjs closed the gap. Rule: sample fallback serves signed-out previews only and never hides a real user's API error.

3. Legacy technical wording across 11 older screens (CS-21, Wave 45 and OD-20)

An audit found 1,455 technical labels across older workspace routes. Rather than risking a noisy bulk rewrite, the owners logged OD-20 in owner decisions (3 December 2026): keep legacy workspace strings as-is while enforcing plain everyday wording and zero raw HTTP codes on all newer Wave 46–48 sign-in, connection, and approval screens. Rule: record conscious scope boundaries openly in owner decisions.

4. Unknown approval IDs fell back to the first queue item (CS-52, Wave 48)

Opening /w/[workspaceId]/approvals/missing-id fell back to items[0] when the ID was absent from the fetched queue, risking approval of the wrong budget change. MobileApprovalClient.tsx now renders an explicit not-found state linking back to the queue. Rule: missing record IDs always show not-found, never another record.

Try it yourself

Every step below is read-only, runs inside the repository root in PowerShell or Git Bash, touches zero running dev servers, and makes zero external calls.

Step 1: Run the closed-kit token and surface gates

node tools/check-tokens.mjs
node tools/check-surface-invariants.mjs

Verify PASS confirming zero raw colours outside tokens.css, zero CSS all-caps transforms, pure copy-free packages/ui, and all 58 primitives exported from packages/ui/src/index.ts.

Step 2: Run the accessibility, copy parity, web budget, and media gates

node tools/check-a11y-static.mjs
node tools/check-i18n.mjs
node tools/check-web-budgets.mjs
node tools/check-media-assets.mjs

Confirm zero errors across interactive semantics, WORDS_TR/WORDS_EN parity, forbidden packages, verbatim sessionToken forwarding, zero public mount-time fetches, and 100 percent SHA-256 Higgsfield asset parity.

Step 3: Inspect the closed token sheet and monochrome print reset

git grep -n "initial;" packages/ui/src/tokens.css
git grep -n "@media print" apps/web/src/app/globals.css

See how @theme clears Tailwind defaults, how [data-theme="dark"] swaps --canvas, --surface, --ink, --line, --line-field, and --accent, and how @media print forces monochrome paper output.

Step 4: Trace the three-way sessionToken signal

git grep -n "hasLiveWorkspaceSession\|SIGNED_IN_HINT_COOKIE_NAME\|local_sample_fallback" apps/web/src/lib/api-client.ts

Trace how string, null with or without __Host-gd_signed_in=1, and undefined route between live_api and local_sample_fallback.

Words to know

  • 320-pixel reflow
  • accent colour
  • API request helper
  • App Router
  • app shell
  • banned words
  • calm voice
  • canvas, surface, ink and line
  • client component
  • closed kit
  • design system
  • design token
  • disclosure (details and summary)
  • hydration
  • key parity
  • prefers-reduced-motion
  • progressive disclosure
  • raw colour
  • React Server Component
  • roving tabindex
  • sample data stamp
  • sample fallback
  • screen states
  • sentence case
  • three-way session token signal
  • touch target
  • UI primitive
  • upper-case ban
  • variant
  • WCAG 2.2 AA
  • web budget gate
  • words rule

Go deeper

  • Repository rules and contracts: AGENTS.md, design frame, visual rules, words dictionary, owner decisions, and independent review.
  • Archived lessons replaced by this chapter: archived lesson 07 on design systems, a11y, motion, and print, archived lesson 13 on Next.js App Router, RSC, and web budgets, archived lesson 21 on frontend security and webhooks, archived lesson 25 on the 50-primitive UI kit, and archived lesson 31 on CalendarGrid and SEO guards.
  • Official framework docs: Next.js App Router, React Server Components, and Tailwind CSS v4 theme variables.
  • Official standards: W3C WCAG 2.2, W3C WAI-ARIA APG, MDN details element, MDN prefers-reduced-motion, and web.dev Core Web Vitals.

Kendini sına soru özeti ve yanıt anahtarı

Q1. Why can a React Server Component read server configuration while a 'use client' file must never import node:fs or secret environment variables?

Answer: B

Server Components never ship code to browsers; 'use client' files and NEXT_PUBLIC_ values land in client bundles anyone can inspect (and browsers lack node:fs). A, C, and D are false.

Q2. A signed-in user carrying __Host-gd_session and __Host-gd_signed_in=1 opens overview while the API is unreachable. What must the screen show?

Answer: C

__Host-gd_signed_in=1 tells the client a real session exists so failures stay live_api and show an honest error banner. A repeats the Wave 46–47 CS-36 bug; B hides the outage; D leaks internal details.

Q3. Why does tools/check-tokens.mjs ban CSS all-caps text transforms across apps/web and packages/ui?

Answer: C

Turkish pairs i/İ and ı/I, unlike English, so CSS all-caps breaks Turkish spelling and calm tone; authoring directly in sentence case prevents the defect. A, B, and D are false.

Q4. Why must DataTable and MoneyCell render null spend as — instead of ₺0,00?

Answer: A

Unknown (—) and confirmed zero (₺0,00) carry completely different financial meanings; showing zero for missing data misleads budget decisions. B, C, and D are false.

Q5. Why do TreeView, CalendarGrid, and AllocationBar use roving tabindex instead of tabIndex={0} on every item?

Answer: B

Following WAI-ARIA APG roving tabindex keeps one active item at 0 and siblings at -1, eliminating dozens of tedious Tab presses across calendars and trees. A, C, and D are false.

Q6. Why is Disclosure built on native HTML <details> and <summary> rather than a custom div toggle?

Answer: B

Native <details>/<summary> work before hydration, announce expanded state cleanly, and pair smoothly with resolveDisclosureHashTarget and beforeprint. A, C, and D are false.

Q7. A Vitest test using renderToStaticMarkup passes on a component that reads localStorage during render, yet the live browser throws React error 418. Why?

Answer: C

Static markup tests check pure HTML output quickly but never hydrate or run effects; reading browser-only storage during render must move into useEffect and be proved with real browser runs. A, B, and D are false.

GetClaps Kurucu Akademisi · Tarayıcı açılışında ağ çağrısı yapılmaz; ilerleme yalnızca cihazındaki yerel depolamada tutulur.