feat(matches): add the candidate match screen with expandable explanations
This commit is contained in:
1 parent
0b11021b16
commit
28337d84cb
50 files changed
+4834
-37
No files matched your search
+27
-9
@@ -2,11 +2,11 @@
|
||||
|
||||
[Русский](README.md) | 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 result history and result page use the API; the candidate directory and employer invitations remain placeholders.
|
||||
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 result history and result page use the API. Candidate search and the employer's read of an anonymous card use the API; invitations remain a placeholder.
|
||||
|
||||
- `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, assessment results, company and employer needs pages, support cases, technical status, and remaining placeholders.
|
||||
- `src/widgets/` holds shells: `public-shell`, `candidate-shell`, `employer-shell`, the result history widget `assessment-history`, and the technical `system-status` widget.
|
||||
- `src/pages/` holds public pages, sign-in and registration, candidate profile and questionnaire, assessment results, company and employer needs pages, candidate search, support cases, technical status, and remaining placeholders.
|
||||
- `src/widgets/` holds shells: `public-shell`, `candidate-shell`, `employer-shell`, the result history widget `assessment-history`, the search result widget `match-list`, and the technical `system-status` widget.
|
||||
- `src/entities/` holds entity models, including `need` (see [Need entity](#need-entity)) and `company`; `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.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](#api-client-generation)).
|
||||
@@ -17,11 +17,11 @@ From the repository root, `make -C frontend dev` starts development and `make -C
|
||||
|
||||
## Routes
|
||||
|
||||
| Group | Paths | Shell |
|
||||
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
|
||||
| Public | `/`, `/login`, `/register`, `/verify-email`, `/support`, `/status` | `PublicShell` |
|
||||
| Candidate | `/candidate` with `onboarding`, `profile`, `questionnaire`, `assessment`, `results`, `results/:attemptId`, `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` |
|
||||
| Group | Paths | Shell |
|
||||
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
|
||||
| Public | `/`, `/login`, `/register`, `/verify-email`, `/support`, `/status` | `PublicShell` |
|
||||
| Candidate | `/candidate` with `onboarding`, `profile`, `questionnaire`, `assessment`, `results`, `results/:attemptId`, `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/candidates`, `/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.
|
||||
|
||||
@@ -92,7 +92,7 @@ On the attempt screen only the phrase "Result received" is a live message; the r
|
||||
- Histories: the settings history and the card access history are paginated; a partial page is never presented as complete. An access record shows the kind of access, the time, and the organization when the server names it (otherwise "Organization is not disclosed"); it carries no employees, queries, filters, or search position. An empty history and a load error are separate states.
|
||||
- A link to request a manual assessment stays below.
|
||||
|
||||
An employer reading the card and the employer candidate directory remain placeholders: the server-side anonymous-card read API does not imply that such a screen exists, so the effect of hiding on a particular employer cannot be checked in a browser.
|
||||
The employer's card read and the search are described in [Candidate search](#candidate-search). The effect of hiding or a revoked C2 on a search is not yet checked from the employer's browser: the end-to-end suite does not repeat it on the employer side.
|
||||
|
||||
## Company profile
|
||||
|
||||
@@ -118,6 +118,24 @@ The editor draft stays in memory. Fields and skills extracted from the source re
|
||||
|
||||
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.
|
||||
|
||||
## Candidate search
|
||||
|
||||
`/employer/candidates` (`pages/matches`) searches through `POST /organizations/{org_id}/matches` (`SearchOrganizationMatches`). The server model is in the [architecture](../docs/en/ARCHITECTURE.md#matching-and-explanations) and the contract in the [API](../api/README.en.md#match-search).
|
||||
|
||||
- Access. Only the active owner of a company can search. The organization comes from `organization_id`, and the owner's company list is read on every visit (as on the needs page). Without the right the page shows "Нужны права владельца компании"; 401 and 403 show the forbidden state, 404 shows the error "Потребность или компания не найдены", and other failures show a message with a retry. A 429, if one arrives, shows its `Retry-After`.
|
||||
- Runs only on an action. The page and a reload never search: the result lives in a component mutation and is not stored. Above the "Найти кандидатов" button the form says that a search spends card view quota: each newly shown candidate counts as one view, and a candidate already shown in the current window is not charged again. A second press is ignored while a search runs.
|
||||
- Basis. "По потребности": the first 100 needs of the company, the requirements version comes from the `GET` of the need (`requirements_version`, not the general `version`), filters are added on top; the grade of the need is not a filter, and the form says so under the picker. The "Подобрать кандидатов" link on a need opens the search with that need chosen. "По всем профилям": a request with filters only, and each specialization of a candidate arrives as its own entry.
|
||||
- Filters (`features/filter-matches`): specialization, confirmed grade, confirmation status, the grade the candidate declared, card technologies (all required), work format (one common format is enough), and salary expectation compatibility. The declared and the confirmed grade are separate fields with separate labels, and the hint under the declared one says it is not a confirmation. The form sends exactly the filters that are on and relaxes nothing: a contradictory pair (for example "not confirmed" with a confirmed grade) is sent as it is and gives an empty result. If the form changes after a result, a note above the result says that it is out of date; the result does not refresh by itself.
|
||||
- Result (`widgets/match-list`). The heading "Результат поиска" takes focus after a search. Below it come the basis and the current filters: for a search over all profiles these are the normalized filters of the response, and for a need search the response does not repeat them, so the sent filters are shown. Then the three groups in a fixed order: "Подтвержденные", "Близкие варианты", "Грейд не подтвержден". An empty group stays with the line "В этой группе записей нет.". The `truncated` flag is explained by "Показана часть выдачи; квота просмотров или предел группы" with no number. An empty result is explained separately: the filters stay on, the ones the employer can change are listed, and nothing is relaxed automatically.
|
||||
- Specializations. An entry is one candidate under one specialization, so one alias can stand in two groups (confirmed in Backend, not confirmed in Networks). When the result holds more than one specialization a view switch appears ("Все специализации", then each one): it hides the entries of the other specializations, recomputes nothing, and carries no confirmation across. The alias is shortened for display (`entities/match/model/views.ts`); the full value is used only by requests and the invitation link.
|
||||
- Entry (`entities/match`). It shows the specialization, the status "Грейд подтвержден: X" or "Грейд не подтвержден" (by icon shape and text), the confirmed category with its strength on a line apart from the grade the candidate declared, the safe card context (technologies, experience, formats, expectations), and the server's explanation of sources: every `evidence_summary` row with the state "Подтверждено", "Подтверждено частично", "Только заявлено кандидатом", or "Пробел: подтверждения нет". A `null` context value is printed as "Нет значения в карточке", because the contract does not say whether it is hidden or absent. The entry has no contact, no real identifier, and no reason why a grade is unconfirmed.
|
||||
- The explanation opens with a button that carries `aria-expanded`. It is built only from the components of the response: Fit, Cov, Dom, Sem, the percentile, V, Fr, Rsp, and the final score S appear exactly as they arrived, with no rounding beyond six decimals. A neutral value (`unknown_flags`) is labelled "Нейтральное значение, не измерено" with its reason (`ml_unavailable`, `cohort_below_30`, `percentile_not_computed`, and others). A `null` percentile is printed as "Нет значения" and no number is invented. A zero competition value is called "не штраф". An entry without a confirmed grade has only Fit and Cov: the server computes no S, percentile, or category for it, and the screen draws none. Unknowns outside the scores (experience, formats, expectations, the assessment result) are listed under "Что неизвестно" with a note that they are not an absence of ability.
|
||||
- Opening a card. The "Открыть карточку" button reads `GET /organizations/{org_id}/candidate-cards/{handle}` and, when the card has categories, the evidence section as well; the server refuses the section for a card without categories, so the request is not sent. Reads are neither retried automatically nor cached after the panel leaves the screen (`gcTime: 0`, no refetch on focus), because every read is an entry in the candidate's access history. A closed panel stays mounted, and opening it again does not read the card again. A 429 shows "Квота просмотров карточек исчерпана" and the time from `Retry-After`; when the server named none, no time is invented. A 404 replaces every hidden case with one text and names no reason.
|
||||
- Invitation. Every entry has a "Пригласить" button, an unconfirmed one included. It leads to `/employer/invitations` with `organization_id`, `candidate_handle`, `specialization`, and, for a need search, `need_id`. The alias is scoped to the organization and is not a candidate identifier. The invitations screen is still a placeholder, so the link lands on it for now.
|
||||
- Layout. At 1280 px the form is on the left and the result on the right; below 1024 px the form sits above the result; at 360 px the entry actions stack and the facts and the explanation fold into one column. Every action works from the keyboard, focus is visible, and status is carried by text and shape, not by color.
|
||||
|
||||
Checks. Unit tests cover parsing and labels (`entities/match`), the request built from a draft (`features/filter-matches`), and the result markup (`widgets/match-list`). The Playwright suite `e2e/match-search.spec.ts` has two groups. The first runs on the real backend (it needs the mail and company fixtures): five synthetic candidates publish the same card with declared Backend and Networks grades, and the owner searches and checks the groups, the Backend/Networks switch for one alias, Fit and Cov against the response, a card read, an explained empty result for an impossible filter, no repeated search after a reload, and 360 px. The second group answers from a stub and covers what the stand cannot produce: the order of three groups with a confirmed Backend and unconfirmed Networks for one alias, neutral values and reasons, `truncated`, a 429 with `Retry-After`, a 404 card, errors, rights, and a need search. Confirmed groups are not checked on the real backend: a card is served only to a group of at least five identical cards, and a confirmed category on the stand needs each of them to pass an assessment. A real exhausted quota and hiding or revoking C2 from the employer's browser are not checked either.
|
||||
|
||||
## 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.
|
||||
|
||||
Reference in new issue
Block a user