19 KiB
Frontend
Русский | English
A React and TypeScript SPA built with Vite and organized using FSD. Registration, email confirmation, sign-in, consent settings, the candidate profile and questionnaire, candidate assessment, company profiles, employer needs, and support cases use the API. A manual assessment request creates a support case and displays its current state; the screen does not present it as an assessment result. The standalone results page, candidate directory, and employer invitations remain placeholders.
src/app/starts the application: the route tree (router/), the query client (providers/), global styles, and the route error page.src/pages/holds public pages, sign-in and registration, candidate profile and questionnaire, company and employer needs pages, support cases, technical status, and remaining placeholders.src/widgets/holds shells:public-shell,candidate-shell,employer-shell, plus the technicalsystem-statuswidget.src/entities/holds entity models, includingneed(see Need entity) andcompany;src/features/holds user actions and forms.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.tsconfigures generation from the shared OpenAPI contract;codegen/mock-patterns.tsis the step after Orval that fixes MSW mocks of strings with apattern(see API client generation).scripts/checks FSD boundaries and Orval compatibility with the OpenAPI 3.2 fixture.e2e/holds Playwright specs andplaywright.config.tsconfigures 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 with onboarding, profile, questionnaire, assessment, results, invitations, privacy, support/cases, support/cases/new, support/cases/manual-assessment, and support/cases/:caseId |
CandidateShell |
| Employer | /employer redirects to /employer/company; /employer/company, /employer/needs, /employer/needs/new, /employer/needs/:needId, /employer/support/cases, /employer/support/cases/new, /employer/support/cases/:caseId |
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. Cabinet boundaries read the current session and direct guests to sign-in. /support sends a signed-in user to the support area for their account or to sign-in. Need pages pass organization_id in the query string, but the client checks the current owner directory and the server authorizes every request.
/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_responsefail at once; staleTimeof 30 s; window focus does not refetch, and screens that need fresh data opt in per query;- automatic mutation retries are disabled; company creation retries through an explicit action with the same body and
Idempotency-Key.
Candidate profile
entities/candidate holds the complete profile draft model and converts it to CandidateProfileUpdate. features/edit-profile owns the fields and saving, while pages/profile owns the page. Server data stays in React Query; contacts and drafts are not written to localStorage or sessionStorage.
The form preserves the provenance of untouched suggestions, displays overlapping employment periods, and requires explicit confirmation of parallel work. Confirmation is bound to the current indices and dates; reordering or changing periods requires another review. Confirmed categories are displayed separately and never enter the save body. A 412 version conflict preserves the draft and offers an explicit replacement with current data.
After saving, the form reloads the session and shows the account step returned by the server. Saving a profile does not complete the consent step; that transition is not implemented yet. Independent profile editing works without ML, a file, or FSP.
Candidate questionnaire
pages/questionnaire reads the specialization catalog and the current candidate's private answers through Orval. The draft stays in component state, saved answers stay in React Query, and reload restores the server record. The form offers one or two specializations, self-assessed grades, currently available task languages, stack, experience, and work formats. A specialization without a published bank is marked in development and can be saved without FSP.
A 412 conflict retains the draft and offers explicit reload or replacement against the latest read version. Session errors hide private answers; responses from a previous account cannot repopulate the cache. Onboarding links follow the step returned by the server. /candidate/questionnaire is the destination for the saved questionnaire step.
Candidate assessment
/candidate/assessment reads availability and creates attempts through the API; /candidate/assessment/:attemptId resumes an attempt, submits answers, and finalizes it through server commands. Real assessment requires current C3 consent. demo_express is labeled as a demonstration and does not award a qualification score or confirmed category. The attempt screen displays the server result, but the separate /candidate/results route is still a placeholder; result history and confirmed category assignment are not implemented. The client does not calculate scores.
The screen includes an informational notice about technical signals, but the browser does not yet collect or submit them. The server signal-ingest API exists separately; it is not connected to the UI.
Privacy settings
/candidate/privacy currently shows consent management and a link to request manual assessment. Publication, search status, hidden organizations, preview, and history are available through the backend API, but a dedicated UI for these settings is not implemented. The employer candidate directory is also a placeholder; the server-side anonymous-card read API does not imply that this screen exists.
Company profile
pages/company selects a company from the paginated active memberships of the current account. Only an owner may read or edit its profile. The form keeps its draft in memory, displays the server verification level without a promotion action, and builds its preview only from candidate_card.
Creation uses one idempotency key for retries of the same body after a lost response. A 412 version conflict preserves the draft; the user explicitly loads current data, reviews the reapplied changes, and saves again. Background refresh does not reset the draft. A 401/403/404 response hides the profile and clears its cached query, then reloads the company directory. This complements server membership checks rather than replacing them.
Employer needs
/employer/needs shows a paginated list of organizations where the current account has an active owner membership and their needs. /employer/needs/new?organization_id=... creates a need, and /employer/needs/:needId?organization_id=... edits one. A URL or cached response grants no access: the client checks the current session and owner directory, and the server checks membership for every request. Cached data is scoped to the account and organization; a response from a prior session cannot populate the new cache. A 401/403/404 removes the organization's private queries.
The editor draft stays in memory. Fields and skills extracted from the source remain suggestions with provenance until the user confirms, edits, or deletes them. Unknown values are not replaced with defaults. Readiness questions appear next to missing fields; recommendation status and categories come from the API, with no fabricated results. If a create response is uncertain, retry sends the unchanged body with the same idempotency key. A 412 conflict retains the draft, offers the latest version, and requires review of reapplied changes before another save.
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. Need pages and forms live in pages/needs, pages/need-editor, and features/edit-need.
fromTransportbuilds a draft from aNeed. Each requirement field is an explicit state:unknownwithout a value,extractedas a stored suggestion with its provenance and quote, andconfirmedas a confirmed value. An unknown field never becomes an empty string, an empty list, or a default value; a skill outside the taxonomy keepstaxonomy_code: null. Data that breaks the rule "value and source are null exactly when unknown" is rejected withNeedTransportError.toUpdateBody(need, draft)sends only the fields whose request value changed, plus theexpected_versionof the read version. An untouched suggestion is not sent; when its field or list is sent for another reason, it goes with statusextracted. 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 fromsource_text.- The edit functions (
confirmField,setFieldValue,clearField,confirmSkill,moveSkill, and others) keep the invariants: only an untouched suggestion has statusextracted, an edited value becomesconfirmed, and moving a skill between lists does not confirm it. validateNeedCreateandvalidateNeedUpdatecheck 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), andneedFormFieldOfmaps 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.
Support and manual assessment
/candidate/support/cases and /employer/support/cases show each account's paginated support history. Their .../new routes create a case and .../:caseId routes show its status and history. The public /support route directs a signed-in user to their cabinet. The form draft stays in memory, and a retry of an unchanged request reuses its idempotency key. Support history is scoped to the current account and cleared when the session changes or the server denies access.
Candidates can use /candidate/support/cases/manual-assessment to submit a support request with a specialization, desired grade, and description. This does not run automatic assessment, create an attempt, change C3, or grant a confirmed grade. The hint under the specialization and grade selectors uses the published grades from the catalog but does not promise a rubric: the server pins the version on submission. The case page displays the status and rubric version returned by the server and, for null, says plainly that no published rubric existed when the request was made; the client does not create an outcome. After a page reload the form loses its idempotency key, and a repeated submission while a manual assessment of the same specialization is open receives 409; the page explains this and links to "My cases" without creating a second request.
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;Pageowns the onlyh1and the document title.Button,ButtonLink,TextLink,NavItem: controls with text labels;NavItemmarks the active section witharia-current, a bar, and weight.StatusView,LoadingState,EmptyState,ErrorState,ForbiddenState,SavingStatus: screen states. Each state has its own shape and text.ErrorStateshows 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. Playwright checks clicks, input, and focus movement in real Chromium; Vitest does not substitute a browser environment.
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.