feat(frontend): edit projects and show semantic match evidence

This commit is contained in:
shira committed 2026-10-11 14:03:31 +03:00
1 parent 5a731c25b7
commit bc00d6901f
52 files changed
+2992 -111

No files matched your search

+9 -2
View File
@@ -39,12 +39,14 @@ Generated Orval hooks call the shared same-origin `apiRequest` client, so the `Q
`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 goes in steps (`Stepper`): contacts, roles with the self-assessment and the confirmed categories, experience with the confirmation of parallel periods, skills, terms, and review with saving. The server takes the whole profile with `expected_version`, so saving exists on the last step only. "Далее" validates the fields of the current step; a client or server error on save opens the step that owns the field. Inactive steps stay mounted with the hidden attribute: "Назад" keeps what was entered, and the links of fields to their hints and errors remain. A step change moves the focus to the step heading. A saved profile offers "К проверке и сохранению", and the review step leads to any step with "Изменить". A reload opens the first step with the server record; an unsaved draft is not restored.
The form goes in steps (`Stepper`): contacts, roles with the self-assessment and the confirmed categories, experience with the confirmation of parallel periods, projects, skills, terms, and review with saving. The server takes the whole profile with `expected_version`, so saving exists on the last step only. "Далее" validates the fields of the current step; a client or server error on save opens the step that owns the field. Inactive steps stay mounted with the hidden attribute: "Назад" keeps what was entered, and the links of fields to their hints and errors remain. A step change moves the focus to the step heading. A saved profile offers "К проверке и сохранению", and the review step leads to any step with "Изменить". A reload opens the first step with the server record; an unsaved draft is not restored.
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.
The "Проекты" step is optional: up to 10 projects, each with a title (one line, up to 100 characters), a description (up to 500), up to 10 technology tags (chips; a tag is added by Enter, a comma, the "Добавить" button, or leaving the field, and duplicates are dropped without regard to letter case), and an optional repository address. The client accepts only `https://github.com/<owner>/<repository>`, as the contract and the server do: a trailing slash and `.git` are removed; other hosts, ports, credentials, paths, query strings, and fragments are rejected; one repository cannot be listed twice (letter case does not matter). An empty project row is not sent; a project without a title but with other values blocks the step. A note at the top says that the title and the description can identify the candidate and that companies never receive the repository address. The `projects` list always goes whole with `expected_version`; an untouched suggestion stays `extracted`. The repository check status comes from the latest profile response (`repository_check`) and is shown as a tag and in words: "Проверяется", "Публичный репозиторий найден", "Не найден или закрыт", "Лимит GitHub, повторим позже"; an address that the server has not stored yet reads "Проверка после сохранения". While a check is `pending`, the screen reloads the profile every 4 seconds (for at most two minutes) and leaves the draft alone. The mark only means that a public repository exists; it does not prove authorship. The "Проверить снова" button calls `RequestMyRepositoryChecks` once for all saved addresses and shows the number of scheduled checks. On a 429 the button is disabled with a countdown from `Retry-After` and the `detail` text of the server; when the server names no time there is no countdown and no time is invented.
## 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.
@@ -98,8 +100,10 @@ On the attempt screen only the phrase "Result received" is a live message; the r
- Consents (`features/consent-management`): C1-C5 are granted and revoked separately, with the text and version shown before a grant. The block of each purpose has an anchor that the "Go to the C2 consent" button moves focus to.
- Publication (`features/profile-visibility`): step 1 shows whether C2 is active from the complete active consent history; an unknown or partly loaded state is not treated as consent, and saving stays unavailable. The step button only moves focus to the C2 block and grants nothing. The card state and fields are chosen next, and the publication is saved by a separate action (`SetMyPublication`, `expected_version` in the body). A 412 conflict keeps the draft on screen and offers an explicit reload of the current settings; a failed save does not reset the draft. Revoking C2 closes the card, and a new C2 does not reopen it.
- Closure explanation: from `closed_reason` the screen says that future reads are closed at once, that a new C2 does not reopen the card by itself, and that a former company needs a new invitation and a new C4 to read contacts. The same words appear after revoking C2, hiding an organization, unhiding it, and republishing: an earlier contact access is not restored. Hiding does not change the C4 record in the consent ledger, so next to the C4 of a hidden company a note says that the record does not bring contact access back.
- Projects in the publication. The `projects` field is its own choice, "Проекты: название, описание и технологии". The warning stands under it at all times (assistive technology reads it with the checkbox) and turns into a caution once the field is chosen: the candidate writes the project texts and can be recognized by them, the size of a group of similar candidates does not hide them, and the repository address and its owner are never shown to companies, which see only the mark that a public repository was found.
- Search status (`SetMySearchStatus`) is its own request and its own text. It does not change the publication and grants no consent.
- Employer preview (`EmployerCardPreview` from `entities/candidate-view`) is built only from the `GET /me/privacy/preview` response. The preview alias is separate from organization aliases. Confirmed categories and self-assessment are shown apart; each specialization has its own "Grade confirmed" or "Grade not confirmed" status (the Russian labels are "Грейд подтвержден" and "Грейд не подтвержден"), told apart by the shape of the mark and by text, not by color. A candidate without a confirmed grade sees the declared level (or "Level not specified") and the not-confirmed status for each specialization separately; a confirmed Backend is not carried over to a network specialization. The evidence block shows the skill, grade, confirmation level, year, and basis (`synthetic_demo` is shown as "Результат теста", a test result; calibration is not shown in the interface). A closed card is shown as an empty state. The preview creates no access record and ignores organization filters.
- Projects in the preview and in the employer's card are drawn by the shared `PublishedProjects` component (`shared/ui`): the title, the description (text with line breaks), the tags, and the badge "Подтвержден публичным репозиторием" for `repository_verified`, with a note that the mark does not prove authorship. There is no address or link in the data or in the markup, and all candidate text is shown as text.
- Hiding organizations: the hide button is offered only for organizations in the candidate's own access history (the server answers 404 for the rest), and only after the list of hidden organizations is fully loaded. Unhiding does not restore contact access.
- 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.
@@ -144,7 +148,8 @@ The tests take their fixtures from the named contract examples in `api/core/open
- 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.
- Matches by meaning (`semanticBlock` in `entities/match`). Inside "Почему в подборке" the block "Совпадения по смыслу" prints `semantic_evidence` in the order and within the limit the server sent: a row "requirement kind and text → item kind and title" (requirement: "Обязательный навык", "Желательный навык", "Задача"; item: "Проект", "Стек", "Роль") and a tag "Высокое сходство" or "Среднее сходство". A project shows its title and, when `repository_verified`, a "Публичный репозиторий" badge; the stack and the roles have no title, so they read "Технологии карточки" and "Специализации и грейды карточки" and get no badge. When there are no rows because the server names the `semantics` component unknown with the reason `ml_unavailable`, the block says "Совпадения по смыслу: смысловой анализ недоступен." in the same words as the explanation; an empty list without such a flag (a search over all profiles, no matches) shows no block. A repository address or owner cannot reach the breakdown: the adapter rejects a response with a field outside the contract.
- 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. When the candidate published projects, the card panel shows them in a "Проекты" block (title, description, tags, the badge of a verified public repository) without an address.
- Invitation. Every entry has a "Пригласить" button, an unconfirmed one included. It leads to `/employer/invitations/new` with `organization_id`, `candidate_handle`, `specialization`, and, for a need search, `need_id` (see [Invitation to a candidate](#invitation-to-a-candidate)). The alias is scoped to the organization and is not a candidate identifier.
- Layout. The form sits above the result at every width: the basis of the search (a segmented control with "По потребности" and "По всем профилям"), the selects, a row of filter chips (technologies, format, salary compatibility; an applied chip is blue with a check mark), and the action; the result takes the full width. From 768 px an entry is a content column and an action column ("Пригласить", the explanation, the card); at 360 px the actions and the facts fold into one column. The "Почему в подборке" block is set in mono on a nested surface: the sign "+" (confirmed), "+/-" (partial), "?" (declared), "-" (gap) repeats the state word. A technology chip that the search asked for carries a dot and hidden text "совпадает с условием поиска". Every action works from the keyboard, focus is visible, and status is carried by text and shape, not by color.
@@ -280,6 +285,8 @@ The interface has no FSP logo. `Wordmark` is the text mark "Lincodex" with a ter
- `Tabs` (WAI-ARIA tabs pattern, arrow keys, Home and End; inactive panels stay mounted with the hidden attribute, so form state survives) and `SegmentedControl` (a native radio group drawn as capsules). `SectionSwitch` is a sub-section switch drawn as capsules but made of links to routes: it has no panels, so tabs do not fit.
- `StatusView`, `LoadingState`, `EmptyState`, `ErrorState`, `ForbiddenState`, `SavingStatus`: screen states. Each state has its own shape and text; the empty state draws a circuit trace that ends at an open node. `ErrorState` shows the code, status, server text, and request ID as plain text and offers a retry. `Skeleton`: decorative placeholder lines while loading, always next to a loading message.
- `QueryView`: maps a query result to loading, error, forbidden (401 and 403 without retry), empty, or data.
- `describeError`: the Russian text of an error by problem code, and by HTTP status for an unknown code. The `service_unavailable` code (503, for example while a model loads) reads "Сервис пока не готов" with advice to retry in a minute; the server text stays only as a technical detail.
- `PublishedProjects`: the projects a candidate published on the anonymous card: the title, the description, the tags, and the badge "Подтвержден публичным репозиторием". It is a purely presentational component with no repository address; the candidate's text is shown as text, never as markup.
- `TrustLevel`: an empty mark, ring, partial fill, or full mark with a visible label.
- `CircuitTrace`, `Mono`, `VisuallyHidden`, `SkipLink`, `MainRegion`.