Files
lincodex/frontend
..
2026-10-05 14:23:31 +03:00
2026-10-05 14:23:31 +03:00
2026-10-05 14:23:31 +03:00
2026-10-05 14:23:31 +03:00
2026-10-05 14:23:31 +03:00
2026-10-05 14:23:31 +03:00
2026-10-05 14:23:31 +03:00

Frontend

Русский | English

A React and TypeScript SPA built with Vite and organized using FSD. The interface scaffold exists: public pages and the candidate and employer cabinet shells with navigation, shared screen states, and brand tokens. Every screen is a placeholder; business screens are separate tasks.

  • src/app/ starts the application: the route tree (router/), the query client (providers/), global styles, and the route error page.
  • src/pages/ holds pages: welcome (start page), placeholder (screen placeholders and the screen map), status (technical status), not-found.
  • src/widgets/ holds shells: public-shell, candidate-shell, employer-shell, plus the technical system-status widget.
  • src/entities/ holds entities: need (the form model of an employer need, see Need entity); src/features/ is still empty.
  • src/shared/ui/ holds design tokens, fonts, logos, and primitives; src/shared/config/ holds route paths; src/shared/api/ holds the API client with generated endpoints, Zod schemas, and MSW mocks.
  • codegen/orval.config.ts configures generation from the shared OpenAPI contract; codegen/mock-patterns.ts is the step after Orval that fixes MSW mocks of strings with a pattern (see API client generation).
  • scripts/ checks FSD boundaries and Orval compatibility with the OpenAPI 3.2 fixture.
  • e2e/ holds Playwright specs and playwright.config.ts configures them; they run only against a Compose stack.

From the repository root, make -C frontend dev starts development and make -C frontend check runs checks and builds the app. In Docker, Nginx serves the built files using configuration from deploy/nginx/.

Routes

Group Paths Shell
Public /, /login, /register, /verify-email, /support, /status PublicShell
Candidate /candidate and /candidate/ + onboarding, profile, assessment, results, invitations, privacy CandidateShell
Employer /employer (redirects to /employer/company), /employer/ + company, needs, candidates, invitations EmployerShell

Each group has its own not-found page. Paths are defined once in shared/config/paths.ts. The router uses React Router data APIs (createBrowserRouter): a route-level error boundary, loader redirects, and later lazy code splitting for cabinets. Loaders do not fetch data; server data belongs to TanStack Query. Access control is not implemented in the interface; the server enforces it.

/status is a service page: it checks /api/v1/healthz and is linked from the public footer only. It is not a product readiness indicator. In development mode the same page shows a gallery of states built from local fixtures (an error with retry, loading, empty, forbidden, saving, trust levels); production builds do not include it.

Server data

Generated Orval hooks call the shared same-origin apiRequest client, so the QueryClient has no default query function. Defaults in app/providers/query-client.ts:

  • retries: up to two, only for no response (status 0) and 5xx except 501; 4xx and invalid_response fail at once;
  • staleTime of 30 s; window focus does not refetch, and screens that need fresh data opt in per query;
  • mutations do not retry until the API supports Idempotency-Key.

Need entity

entities/need converts the generated DTOs of the need contract (Need, NeedCreate, NeedUpdate) to a form model and back. It is pure functions without React and without its own store; server data stays in the TanStack Query cache. The need UI is not implemented yet.

  • fromTransport builds a draft from a Need. Each requirement field is an explicit state: unknown without a value, extracted as a stored suggestion with its provenance and quote, and confirmed as a confirmed value. An unknown field never becomes an empty string, an empty list, or a default value; a skill outside the taxonomy keeps taxonomy_code: null. Data that breaks the rule "value and source are null exactly when unknown" is rejected with NeedTransportError.
  • toUpdateBody(need, draft) sends only the fields whose request value changed, plus the expected_version of the read version. An untouched suggestion is not sent; when its field or list is sent for another reason, it goes with status extracted. A cleared field is sent as null, an emptied list as [], and an untouched list is absent.
  • toCreateBody(draft) always sends the title and leaves out unknown fields and empty lists, so the server extracts them from source_text.
  • The edit functions (confirmField, setFieldValue, clearField, confirmSkill, moveSkill, and others) keep the invariants: only an untouched suggestion has status extracted, an edited value becomes confirmed, and moving a skill between lists does not confirm it.
  • validateNeedCreate and validateNeedUpdate check the body with the generated Zod schemas and tie the problems to form fields. The server checks cross-field rules (the salary width, a repeated skill), and needFormFieldOf maps its pointer to a form field.

The tests take their fixtures from the named contract examples in api/core/openapi.bundle.yml and check every body with the generated NeedCreate and NeedUpdate schemas.

API client generation

make -C frontend generate runs Orval with codegen/orval.config.ts and then codegen/mock-patterns.ts. For a string with a pattern, Orval 8.40 writes faker.helpers.fromRegExp(pattern) into the MSW mock: faker prints the ^ and $ anchors and (?:...) groups as plain text, and Orval ignores minLength and maxLength when a pattern is present. The second step replaces such calls with fakeFromPattern(pattern, {minLength, maxLength}) from src/shared/api/mock-pattern.ts. It takes the length bounds from the OpenAPI contract by the name of the property that holds the call and by the pattern. The step fails when a call has an unexpected form, when the contract has no such property with that pattern, or when the matching schemas disagree on the length bounds. It leaves its own output unchanged, so generation is reproducible and make check-generated stays stable. Enums in the mocks are written as literals (enumGenerationType: "union"): Object.values of a zod.enum returns Zod internals, not the values.

fakeFromPattern parses a regular expression subset (characters, escapes, classes, groups, alternatives, quantifiers, and ^ and $ at the ends), picks a length within the pattern and the bounds, and builds the string with the faker generator, so the same seed gives the same data. Every value is checked with new RegExp(pattern, "u") and the length bounds; a pattern outside the subset (for example, a lookahead or a back reference) or unreachable bounds throw an error.

src/shared/api/mock-validity.test.ts calls every get*ResponseMock factory in endpoints/*/*.msw.ts with 25 faker seeds and checks the result with the generated Zod response schema. Orval's Zod schemas do not check uniqueItems, so the test does not cover that constraint; the response arrays with uniqueItems currently hold enum values, and the mock picks them with faker.helpers.arrayElements without repeats.

Tokens and theme

Tokens live in shared/ui/theme/tokens.css: palette, semantic colors, type scale, spacing in 4px steps, radii, lines, focus ring, content widths, and motion. Breakpoints are fixed in media queries: 360px minimum, 768px tablet (48rem), 1024px desktop navigation (64rem), and 1280px verified wide layout.

Only the light theme ships. The graphite employer sidebar is a local dark region with its own checked text, link, and focus colors. A dark theme must define and check its own pairs instead of inheriting the light accents.

WCAG 2.2 contrast of the pairs in use:

Foreground Background Ratio Use
#1B1C21 #FFFFFF 17.01 Text on surfaces
#1B1C21 #EDEDED 14.53 Text on the canvas
#2D2E37 #FFFFFF 13.48 Secondary text
#2D2E37 #EDEDED 11.52 Secondary text on the canvas
#402FFF #FFFFFF 6.84 Links, active navigation, focus ring
#402FFF #EDEDED 5.85 Labels and links on the canvas
#FFFFFF #402FFF 6.84 Primary button, skip link
#EDEDED #1B1C21 14.53 Employer sidebar text
#FFFFFF #1B1C21 17.01 Active item and focus ring in the sidebar
#EC1D35 #FFFFFF 4.38 Error graphics only (needs 3:1)
#FFFFFF #EC1D35 4.38 Glyph inside the error mark (graphic)

Excluded pairs: red is not used for body text (4.38 is below 4.5); #402FFF on #1B1C21 (2.49) and on #2D2E37 (1.97) is not used; grey #C8C9CA (1.66 on white) is only for decorative dividers.

Fonts and logos

JetBrains Mono 2.304 (SIL OFL 1.1) is self-hosted from requirements/brandbook/: regular and bold woff2 files plus the license and authors list live in shared/ui/theme/fonts/. The font is used through Mono for numbers, scores, codes, and pseudonyms. Text uses the system font stack: Unbounded and Golos Text are not added, because their files and licenses are not in the repository.

The header uses the FSP brandbook logo: logo_02w.svg on light backgrounds and logo_01.svg on the graphite sidebar, unchanged, with the product name beside it.

Shared components

  • Page, Section, Stack: page layout; Page owns the only h1 and the document title.
  • Button, ButtonLink, TextLink, NavItem: controls with text labels; NavItem marks the active section with aria-current, a bar, and weight.
  • StatusView, LoadingState, EmptyState, ErrorState, ForbiddenState, SavingStatus: screen states. Each state has its own shape and text. ErrorState shows the code, status, server text, and request ID as plain text and offers a retry.
  • QueryView: maps a query result to loading, error, forbidden (401 and 403 without retry), empty, or data.
  • TrustLevel: an empty mark, ring, partial fill, or full mark with a visible label.
  • Mono, VisuallyHidden, SkipLink, MainRegion, BrandLogo.

Accessibility: every shell starts with a skip link to main, has landmarks and a visible focus ring, and moves focus to main after navigation. Animations respect prefers-reduced-motion.

Tests

Vitest runs in the Node environment with no DOM library. Routes are rendered through React Router's static handler and checked as HTML: shells, landmarks, the skip link, the active item, redirects, and not-found pages. State tests render components to markup; the query-error test runs the real QueryClient with the generated health operation and a stubbed fetch. Clicks and focus movement are checked manually in a browser; automated interaction tests need a DOM environment, which is a separate dependency decision.

Playwright specs in e2e/ run in a real Chromium against the built frontend and backend: make -C deploy test-e2e starts a throwaway Compose stack and runs them in the official Playwright image, so no browser is installed on the host. Vitest excludes e2e/; make -C frontend typecheck and lint cover the specs. Artifacts of the last run are in test-results/e2e/. Details: TESTING.md.

See the development guide.