feat(frontend): redesign the employer cabinet with step-by-step need and invitation forms
This commit is contained in:
1 parent
a0869d81a1
commit
15590d127c
45 files changed
+3600
-1983
No files matched your search
+18
-5
@@ -39,6 +39,8 @@ 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 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.
|
||||
@@ -47,6 +49,8 @@ After saving, the form reloads the session and shows the account step returned b
|
||||
|
||||
`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.
|
||||
|
||||
The questionnaire goes in steps: directions (one or two specializations and the assessment availability from the catalog), level and experience for each chosen specialization (self-assessment, task language, stack, experience), work format, and review with saving. The step rules are the same as in the profile: one whole save with `expected_version` on the last step, "Далее" validates the current step, a server error opens its step, steps stay mounted but hidden, the focus goes to the step heading, and a reload opens the first step.
|
||||
|
||||
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 home
|
||||
@@ -55,12 +59,16 @@ A 412 conflict retains the draft and offers explicit reload or replacement again
|
||||
|
||||
The declared level and the confirmed category are always shown apart, per specialization: the declared one comes from the questionnaire `self_assessed_grade` and is labeled as self-assessment, the confirmed one only from the availability `confirmed_grade`. The client does not derive a category from scores, thresholds, or the target grade. The page also shows the latest result (`GET /me/assessment-results?limit=1`, restated by `assessmentResultSummary`, with links to the breakdown and the history) and the profile visibility (`GET /me/privacy`: card open or closed with the reason, whether the category is shown, search status) with a link to `/candidate/privacy`.
|
||||
|
||||
Every block has loading, error with retry, forbidden (401 and 403 without retry), and empty states. The three reads that the next step depends on form one state: if any of them fails, an error with retry appears instead of a step guessed from partial data. The result and the visibility are independent, so their failure does not hide the next step. Query keys contain the account id, data does not outlive the screen (`gcTime: 0`) and is read again on every open and on returning to the tab, so a page refresh shows the current API state. Signing in again still opens the saved-step page (`getOnboardingDestination`), not the home.
|
||||
Every block has loading, error with retry, forbidden (401 and 403 without retry), and empty states. The three reads that the next step depends on form one state: if any of them fails, an error with retry appears instead of a step guessed from partial data. The result and the visibility are independent, so their failure does not hide the next step. Query keys contain the account id, data does not outlive the screen (`gcTime: 0`) and is read again on every open and on returning to the tab, so a page refresh shows the current API state. Signing in again still opens the saved-step page (`getOnboardingDestination`), not the home. That page (`/candidate/onboarding`, the "Consents" step) shows the account steps (consents, profile, questionnaire, and test) with a `Stepper`, the current step, and its action.
|
||||
|
||||
## 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 with the same component as the result page and links to it (see [Candidate results](#candidate-results)). Only the server assigns a category; the client calculates neither scores nor grades.
|
||||
|
||||
The attempt screen focuses on the item: a strip above it names the attempt and shows the progress of answered items, the time left until the server deadline `expires_at` in mono (a `timer` element that is not announced every second; color and a label mark the last minute), and the save state of the answer (a polite status message). Keys 1-9 choose an option, and Enter on an option sends the answer.
|
||||
|
||||
The `Idempotency-Key` of the express start is kept in the tab's sessionStorage per account until the run is finished or expired, and for 24 hours at most. When a new start gets 409 `state_conflict`, the page repeats the start with the key of the active run, and the server returns the stored 201 with that attempt: an unfinished demonstration continues after a reload. The key of a start with an unknown outcome (no response, 5xx) is kept and repeated as well. Without a key (another browser, a closed tab, blocked storage), the screen explains that the demonstration ends by itself within 5 minutes of its start.
|
||||
|
||||
Before a real attempt starts, the screen shows a dialog that lists the signals. The browser records tab or window switches, copy, paste and cut, and fullscreen exits; the server measures the answer time per item, a change of network address during the attempt, parallel sessions, and the match of answer digests with other candidates' answers. The dialog states that image, sound, and clipboard contents are not collected, that addresses and session tokens are not stored (only one-way keyed digests), and that browser events are stored only while the C3 consent is current. The attempt cannot start without confirmation: closing the dialog or pressing Escape starts nothing. The confirmation is stored on the server (`/me/assessment-signal-notice`) for the text version, so a reload or a new browser does not ask again; the same dialog opens when an older attempt that was created without the confirmation is resumed. It is a record of being informed, not a consent: C3 stays separate.
|
||||
|
||||
During a real attempt, `features/assessment-signals` collects the disclosed signals: focus loss with its duration, copy, paste and cut with a size only, and fullscreen exit. The listeners are passive, block nothing, and show nothing. Events go in batches (every 10 seconds, when the tab is hidden, or at 20 queued events), and each batch keeps one `Idempotency-Key` across retries. When the page is closed (`pagehide`) or the collector unmounts, what remains is sent in one last request with `keepalive`, so closing the tab does not lose the last seconds of events; the result of that request is not awaited and not retried. A network failure never affects answer submission: a failed batch is sent again with the same key and body after a growing pause and is dropped after the attempt limit. A server refusal (no C3, finished attempt) stops collection. The demonstration run collects no signals.
|
||||
@@ -106,6 +114,8 @@ Creation uses one idempotency key for retries of the same body after a lost resp
|
||||
|
||||
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.
|
||||
|
||||
The form has five steps (the `Stepper` component): role and grade, skills, tasks and domain, work conditions, and review and save (`features/edit-need/model/steps.ts`). Inactive steps stay mounted and hidden with the `hidden` attribute, so going back or forward loses no draft; focus moves to the heading of the new step. Enter in a field moves to the next step, and only the last step saves. The title is required: step 1 does not let the employer leave without it, and step 4 does not let them leave with an incomplete range. A server field error opens the step of the first one and focuses the field. Beside the form (below it under 1200 px) sits a live summary of the need: the `BACKEND · MIDDLE` tag, stack tags, the range in mono, the number of unconfirmed suggestions, and, for a saved need, the categories and versions. A saved need has a "К проверке и сохранению" button on steps 1-4. The grade and the tax basis are chosen with a segmented control (`SegmentedControl`) and the work format with checkbox chips; an unknown grade is its own "Не указан" option, not a default.
|
||||
|
||||
## 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`.
|
||||
@@ -132,7 +142,7 @@ The tests take their fixtures from the named contract examples in `api/core/open
|
||||
- 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/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. 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.
|
||||
- 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.
|
||||
|
||||
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.
|
||||
|
||||
@@ -144,11 +154,12 @@ Checks. Unit tests cover parsing and labels (`entities/match`), the request buil
|
||||
- Form (`features/send-invitation`). The fields follow `InvitationTerms` and nothing more: the role, the specialization (from the search entry), the grade, the offer type, the tasks (one per line), the team, the technologies, the work formats and the place of work, the channel with an optional note, the range in rubles with an explicit basis (net or gross), the four package conditions, and a response period of 3, 7, or 14 days. Each package condition is chosen explicitly: "Предусмотрено" with a description or "Не предусмотрено"; nothing is preselected. For a need search the form is prefilled only with the confirmed requirements of the need, and the draft refers to its `requirements_version`.
|
||||
- Checks before a request. The client repeats the contract rules: required fields and lengths, a range in whole rubles with a step of 1000, a lower bound below the upper one, and a width from 10% to 40% of the midpoint (`entities/invitation/model/salary-range.ts`), a place of work for office and hybrid, and a technology repeated in another letter case. With an incomplete range, no communication method, or an unanswered package condition nothing is sent. Issues are listed in a focused summary at the top of the form and bound to their fields with `aria-invalid` and `aria-describedby`.
|
||||
- The server decides. RFC 9457 errors from `errors[].pointer` are mapped to form fields (`fieldOfPointer`, for example `/terms/salary/salary_to`, `/terms/communication_method`, `/terms/package/training`); server text is not shown. `/candidate_handle` and `/need` give a general message without the reason.
|
||||
- Preview (`widgets/invitation-preview`). "Показать предпросмотр" checks the form and shows the company card from `candidate_card` (`GET /organizations/{org_id}`) and every term as the candidate will see them; focus moves to the preview. The preview sends nothing and creates no draft. When the form changes, a note says the preview is out of date.
|
||||
- Steps. The form runs in four steps (`Stepper`): terms, package and response period, preview, send. "Далее" on the first step checks only its fields; "К предпросмотру" checks the whole form. An error opens the step of the first field in trouble and focuses the issue list above the step. The offer type, the grade, the tax basis, the package conditions, and the response period are segmented controls, and the work format is chips. Enter in a field moves to the next step, and only the last step sends.
|
||||
- Preview (`widgets/invitation-preview`). "К предпросмотру" checks the form and shows the company card from `candidate_card` (`GET /organizations/{org_id}`) and every term as the candidate will see them; focus moves to the heading of the step. The preview is rebuilt each time the step opens, sends nothing, and creates no draft.
|
||||
- Sending. "Отправить приглашение" runs a command of three operations (`features/send-invitation/model/send-command.ts`): `CreateOrganizationInvitation` with an Idempotency-Key, `UpdateOrganizationInvitation` with `expected_version` when the terms of a saved draft changed, then `SendOrganizationInvitation` with its own Idempotency-Key. The create key is bound to the request body and the send key to the draft and its version; both are kept until the command completes, so a click after a lost response, a 5xx, or 409 `idempotency_in_progress` repeats the same key. A click while the command runs starts nothing. After 412 the form reads the draft again and applies its terms on the next send. Responses are checked with the generated Zod schema.
|
||||
- Result. After a successful send the screen shows the state "Доставлено", the delivery moment and the response deadline from the server response (`response_deadline_at`, in UTC), the terms version, the salary indicator, and the sent terms; focus moves to the heading. Once a draft exists its `invitation_id` is written to the address: a reload reopens an unsent draft for sending or a sent invitation with its stored deadline.
|
||||
|
||||
Checks. Unit tests cover the range rules (`entities/invitation`), draft validation and pointer mapping, the send command over MSW (keys, a retry after a lost create and a lost send response, 400 with fields, a draft update, 412), and the preview and page markup (owner access, an empty address). The Playwright suite `e2e/invitation-compose.spec.ts` runs on the real backend in `make -C deploy test-e2e-registration`: five synthetic candidates publish the same card, the owner finds them with a search, opens the invitation from the result, fills [100000; 140000] net and a package, and checks the preview against every term; without the communication method a field error shows, no request is sent, and the candidates' inboxes stay empty. Then the send is slowed down and its first response lost, a second click during the request starts nothing, and the retry uses the same key; the result is one invitation in one inbox (`GET /me/invitations`) with the deadline the screen shows, also after a reload. A 403 for a recruiter is not checked in the browser, since the stand cannot grant that role; the screen for a non-owner role is covered by a unit test.
|
||||
Checks. Unit tests cover the range rules (`entities/invitation`), draft validation and pointer mapping, the send command over MSW (keys, a retry after a lost create and a lost send response, 400 with fields, a draft update, 412), and the preview and page markup (owner access, an empty address). The Playwright suite `e2e/invitation-compose.spec.ts` runs on the real backend in `make -C deploy test-e2e-registration`: five synthetic candidates publish the same card, the owner finds them with a search, opens the invitation from the result, fills [100000; 140000] net and a package step by step, and checks the preview against every term; without the communication method the form does not leave the terms step, a field error shows, no request is sent, and the candidates' inboxes stay empty. Then the send is slowed down and its first response lost, a second click during the request starts nothing, and the retry uses the same key; the result is one invitation in one inbox (`GET /me/invitations`) with the deadline the screen shows, also after a reload. A 403 for a recruiter is not checked in the browser, since the stand cannot grant that role; the screen for a non-owner role is covered by a unit test.
|
||||
|
||||
## Candidate incoming invitations
|
||||
|
||||
@@ -256,7 +267,9 @@ The interface has no FSP logo. `Wordmark` is the text mark "Lincodex" with a ter
|
||||
- `TrustLevel`: an empty mark, ring, partial fill, or full mark with a visible label.
|
||||
- `CircuitTrace`, `Mono`, `VisuallyHidden`, `SkipLink`, `MainRegion`.
|
||||
|
||||
Shells. Public: a floating plate with the wordmark and links; below 700px the links open from a "Меню" button; a footer links the technical status. Candidate (phone first): below 700px the sections form a scrolling bottom tab bar and the current tab scrolls to the middle; from 700px the tabs sit in the plate. The navigation comes before `main` in the document, so the keyboard order is the same at every width. Employer (desktop first): from 1024px a floating 240px sidebar, below that a plate with a "Меню" button.
|
||||
The steps of a long form (`form-steps.tsx`, `use-form-steps.ts`: a step panel whose heading takes the focus, "Назад" and "Далее" navigation, and a review block with "Изменить") are identical copies in `features/edit-profile` and `features/fill-questionnaire` for now; a shared version belongs in `shared/ui`.
|
||||
|
||||
Shells. Public: a floating plate with the wordmark and links; below 700px the links open from a "Меню" button; a footer links the technical status. Candidate (phone first): below 700px the sections form a scrolling bottom tab bar and the current tab scrolls to the middle; from 700px the tabs sit in the plate. When the tabs do not fit, the strip fades at the edge that hides more of them. The navigation comes before `main` in the document, so the keyboard order is the same at every width. Employer (desktop first): from 1024px a floating 240px sidebar, below that a plate with a "Меню" button.
|
||||
|
||||
Accessibility: every shell starts with a skip link to `main`, has landmarks and a visible focus ring (2px `#9A92FF`, 2px offset), and moves focus to `main` after navigation. Animations respect `prefers-reduced-motion`.
|
||||
|
||||
|
||||
+18
-5
@@ -39,6 +39,8 @@ SPA на React и TypeScript со сборкой Vite и структурой FS
|
||||
|
||||
`entities/candidate` хранит модель полного черновика профиля и переводит ее в `CandidateProfileUpdate`. `features/edit-profile` отвечает за поля и сохранение, `pages/profile` - за страницу. Серверные данные остаются в React Query; контакты и черновик не записываются в localStorage или sessionStorage.
|
||||
|
||||
Форма идет по шагам (`Stepper`): контакты, роли с самооценкой и подтвержденными категориями, опыт с подтверждением параллельных периодов, навыки, условия, проверка и сохранение. Сервер принимает профиль целиком с `expected_version`, поэтому сохранение есть только на последнем шаге. «Далее» проверяет поля текущего шага; ошибка клиента или сервера при сохранении открывает шаг, которому принадлежит поле. Неактивные шаги остаются в дереве со скрытым атрибутом: «Назад» сохраняет введенное, а связи полей с подсказками и ошибками остаются. При смене шага фокус переходит на его заголовок. У сохраненного профиля есть переход «К проверке и сохранению», а шаг проверки ведет к любому шагу кнопкой «Изменить». Перезагрузка открывает первый шаг с серверной записью; несохраненный черновик не восстанавливается.
|
||||
|
||||
Форма сохраняет происхождение нетронутых предложений, показывает пересекающиеся периоды работы и требует явного подтверждения параллельной работы. Подтверждение связано с текущими индексами и датами; перестановка или изменение периодов требует проверки заново. Подтвержденные категории отображаются отдельно и не входят в тело сохранения. Ошибка версии 412 оставляет черновик и предлагает явно заменить его актуальными данными.
|
||||
|
||||
После сохранения форма перечитывает сессию и показывает шаг аккаунта, который вернул сервер. Сохранение профиля само по себе не завершает шаг согласий; переход от него пока не реализован. Независимое редактирование профиля доступно без ML, файла и ФСП.
|
||||
@@ -47,6 +49,8 @@ SPA на React и TypeScript со сборкой Vite и структурой FS
|
||||
|
||||
`pages/questionnaire` получает каталог специализаций и приватные ответы текущего кандидата через Orval. Черновик остается в состоянии компонента, сохраненные ответы принадлежат React Query, а reload восстанавливает серверную запись. Форма предлагает одну или две специализации, самооценку грейда, доступные языки заданий, стек, опыт и форматы работы. Специализация без опубликованного банка отмечена как находящаяся в разработке; ее можно сохранить без ФСП.
|
||||
|
||||
Анкета идет по шагам: направления (одна или две специализации и доступность проверки по каталогу), уровень и опыт для каждой выбранной специализации (самооценка, язык заданий, стек, опыт), формат работы, проверка и сохранение. Правила шагов те же, что у профиля: сохранение целиком на последнем шаге с `expected_version`, проверка текущего шага кнопкой «Далее», переход к шагу с ошибкой сервера, скрытые, но смонтированные шаги, фокус на заголовке шага, первый шаг после перезагрузки.
|
||||
|
||||
Конфликт 412 сохраняет черновик и предлагает явное перечитывание или замену по последней прочитанной версии. Ошибки сессии скрывают приватные ответы; ответ прежнего аккаунта не заполняет кеш заново. Переходы onboarding следуют шагу, возвращенному сервером. Сохраненный шаг анкеты открывает `/candidate/questionnaire`.
|
||||
|
||||
## Главная кандидата
|
||||
@@ -55,12 +59,16 @@ SPA на React и TypeScript со сборкой Vite и структурой FS
|
||||
|
||||
Заявленный уровень и подтвержденная категория всегда показаны раздельно, по специализациям: заявленный берется из `self_assessed_grade` анкеты и помечен как самооценка, подтвержденный - только из `confirmed_grade` доступности проверки. Клиент не выводит категорию из баллов, порогов или целевого грейда. Страница также показывает последний результат (`GET /me/assessment-results?limit=1`, пересказ через `assessmentResultSummary`, ссылки на разбор и историю) и видимость профиля (`GET /me/privacy`: карточка открыта или закрыта с причиной, показывается ли категория, статус поиска) со ссылкой на `/candidate/privacy`.
|
||||
|
||||
Состояния загрузки, ошибки с повтором, "нет доступа" (401 и 403 без повтора) и пусто есть у каждого блока. Три чтения, от которых зависит следующий шаг, образуют одно состояние: если любое из них не удалось, показывается ошибка с повтором, а не шаг, угаданный по неполным данным. Результат и видимость независимы, поэтому их сбой не скрывает следующий шаг. Ключи запросов содержат идентификатор аккаунта, данные не живут после ухода с экрана (`gcTime: 0`) и читаются заново при каждом открытии и возврате на вкладку, так что обновление страницы показывает актуальное состояние API. Вход после выхода по-прежнему ведет на страницу сохраненного шага (`getOnboardingDestination`), а не на главную.
|
||||
Состояния загрузки, ошибки с повтором, "нет доступа" (401 и 403 без повтора) и пусто есть у каждого блока. Три чтения, от которых зависит следующий шаг, образуют одно состояние: если любое из них не удалось, показывается ошибка с повтором, а не шаг, угаданный по неполным данным. Результат и видимость независимы, поэтому их сбой не скрывает следующий шаг. Ключи запросов содержат идентификатор аккаунта, данные не живут после ухода с экрана (`gcTime: 0`) и читаются заново при каждом открытии и возврате на вкладку, так что обновление страницы показывает актуальное состояние API. Вход после выхода по-прежнему ведет на страницу сохраненного шага (`getOnboardingDestination`), а не на главную. Эта страница (`/candidate/onboarding`, шаг «Согласия») показывает шаги аккаунта - согласия, профиль, анкету и тест - компонентом `Stepper` с текущим шагом и действием для него.
|
||||
|
||||
## Проверка кандидата
|
||||
|
||||
`/candidate/assessment` получает доступность и создает попытки через API; `/candidate/assessment/:attemptId` возобновляет попытку, отправляет ответы и завершает ее серверными командами. Реальный режим требует действующего C3. `demo_express` помечен как демонстрационный и не выдает квалификационный балл или подтвержденную категорию. Интерфейс показывает серверный итог в экране попытки тем же компонентом, что и страница результатов, со ссылкой на нее (см. [результаты кандидата](#результаты-кандидата)). Категорию присваивает только сервер; клиент не вычисляет баллы и грейды.
|
||||
|
||||
Экран попытки сосредоточен на задании: полоса над ним называет попытку, показывает прогресс отвеченных заданий, время до серверного срока `expires_at` моноширинным шрифтом (элемент `timer` без объявления каждой секунды; последнюю минуту отмечают цвет и подпись) и состояние сохранения ответа (вежливое сообщение о статусе). Вариант ответа выбирается клавишами 1-9, Enter на варианте отправляет ответ.
|
||||
|
||||
`Idempotency-Key` начала экспресс-запуска хранится в sessionStorage вкладки отдельно для каждого аккаунта, пока запуск не завершен или не истек, и не дольше 24 часов. Если новое начало получает 409 `state_conflict`, страница повторяет начало с ключом активного запуска, и сервер возвращает сохраненный ответ 201 с этой попыткой: незавершенная демонстрация продолжается после перезагрузки. Ключ начала с неизвестным исходом (нет ответа, 5xx) тоже сохраняется и повторяется. Если ключа нет (другой браузер, закрытая вкладка, заблокированное хранилище), экран объясняет, что демонстрация закончится сама не позже чем через 5 минут после начала.
|
||||
|
||||
Перед началом реальной попытки экран показывает окно с перечнем сигналов. Браузер фиксирует смену вкладки или окна, копирование, вставку и вырезание, выход из полноэкранного режима; сервер измеряет время ответа на задание, смену сетевого адреса во время попытки, параллельные сессии и совпадение отпечатков ответов с ответами других кандидатов. Окно прямо говорит, что изображение, звук и содержимое буфера обмена не собираются, что адреса и токены сессий не хранятся (только односторонние ключевые отпечатки) и что события браузера сохраняются, только пока действует согласие C3. Начало без подтверждения невозможно: закрытие окна или Escape ничего не запускает. Подтверждение сохраняется на сервере (`/me/assessment-signal-notice`) для версии текста, поэтому перезагрузка и новый браузер не спрашивают повторно; такое же окно открывается при продолжении старой попытки, начатой без подтверждения. Это запись об ознакомлении, а не согласие: C3 остается отдельным.
|
||||
|
||||
Во время реальной попытки `features/assessment-signals` собирает отправляемые сигналы: потерю фокуса с длительностью, копирование, вставку и вырезание только с размером, выход из полноэкранного режима. Слушатели пассивные, ничего не блокируют и не показывают; события уходят пакетами (по таймеру в 10 секунд, при скрытии вкладки или накоплении 20 событий), у каждого пакета свой `Idempotency-Key`, который сохраняется при повторах. При закрытии страницы (`pagehide`) и при размонтировании оставшиеся события отправляются последним запросом с `keepalive`, поэтому закрытие вкладки не теряет накопленное за последние секунды; результат такого запроса не ожидается и не повторяется. Сбой сети никогда не мешает отправке ответа: неудачный пакет повторяется с тем же ключом и телом с нарастающей паузой, а после лимита попыток отбрасывается. Ответ сервера об отказе (нет C3, попытка завершена) останавливает сбор. Демонстрационный запуск сигналы не собирает.
|
||||
@@ -106,6 +114,8 @@ SPA на React и TypeScript со сборкой Vite и структурой FS
|
||||
|
||||
Черновик редактора хранится в памяти. Извлеченные из описания поля и навыки остаются предложениями с происхождением, пока пользователь не подтвердит, не изменит или не удалит их. Неизвестные значения не подменяются дефолтами. Вопросы готовности показываются рядом с незаполненными полями; статус рекомендаций и категории берутся из API, без выдуманных результатов. Создание повторяет неизмененное тело с тем же ключом идемпотентности после неопределенного ответа. Конфликт версии 412 сохраняет черновик, предлагает загрузить актуальную версию и требует проверить перенесенные изменения до повтора.
|
||||
|
||||
Форма разбита на пять шагов (компонент `Stepper`): роль и грейд, навыки, задачи и область, условия работы, проверка и сохранение (`features/edit-need/model/steps.ts`). Неактивные шаги остаются смонтированными и скрыты атрибутом `hidden`, поэтому возврат назад и переход вперед не теряют черновик; фокус переходит на заголовок нового шага. Enter в поле ведет на следующий шаг, сохраняет только последний шаг. Название обязательно: шаг 1 не отпускает без него, шаг 4 не отпускает с неполной вилкой. Ошибки сервера по полям открывают шаг с первым из них и ставят фокус на поле. Справа (ниже 1200 px под формой) стоит живая сводка потребности: тег `BACKEND · MIDDLE`, стек-теги, вилка шрифтом mono, число неподтвержденных предложений, а для сохраненной потребности еще категории и версии. У сохраненной потребности на шагах 1-4 есть кнопка "К проверке и сохранению". Грейд и база суммы выбираются сегментным переключателем (`SegmentedControl`), формат работы - чипами-флажками; неизвестный грейд - отдельный пункт "Не указан", а не значение по умолчанию.
|
||||
|
||||
## Сущность потребности
|
||||
|
||||
`entities/need` переводит сгенерированные DTO контракта потребности (`Need`, `NeedCreate`, `NeedUpdate`) в модель формы и обратно; это чистые функции без React и без своего хранилища, серверные данные остаются в кеше TanStack Query. Страницы и формы потребностей находятся в `pages/needs`, `pages/need-editor` и `features/edit-need`.
|
||||
@@ -132,7 +142,7 @@ SPA на React и TypeScript со сборкой Vite и структурой FS
|
||||
- Объяснение раскрывается кнопкой с `aria-expanded`. Оно строится только из компонентов ответа: Fit, Cov, Dom, Sem, перцентиль, V, Fr, Rsp и итоговый балл S показаны ровно так, как пришли, без округления сверх шести знаков. Нейтральное значение (`unknown_flags`) подписано "Нейтральное значение, не измерено" с причиной (`ml_unavailable`, `cohort_below_30`, `percentile_not_computed` и другие). Перцентиль `null` выводится как "Нет значения", число не выдумывается. Нулевой соревновательный вклад назван "не штрафом". У записи без подтвержденного грейда есть только Fit и Cov: балла S, перцентиля и категории для нее не считают, и экран их не рисует. Неизвестное вне баллов (опыт, форматы, ожидания, результат проверки) перечислено в блоке "Что неизвестно" с пометкой, что это не отсутствие способности.
|
||||
- Открытие карточки. Кнопка "Открыть карточку" читает `GET /organizations/{org_id}/candidate-cards/{handle}`, а при наличии категорий - и раздел доказательств; без категорий сервер раздел не отдает, поэтому запрос не отправляется. Чтения не повторяются автоматически и не кешируются после ухода с экрана (`gcTime: 0`, без обновления при фокусе): каждое чтение попадает в журнал доступа кандидата. Закрытая панель остается в дереве, повторное открытие не читает карточку снова. Ответ 429 показывает "Квота просмотров карточек исчерпана" и время из `Retry-After`; если сервер его не назвал, время не выдумывается. Ответ 404 одним текстом заменяет все скрытые случаи и не называет причину.
|
||||
- Приглашение. Кнопка "Пригласить" есть у каждой записи, в том числе у неподтвержденной. Она ведет на `/employer/invitations/new` с параметрами `organization_id`, `candidate_handle`, `specialization` и, для поиска по потребности, `need_id` (см. [приглашение кандидату](#приглашение-кандидату)). Псевдоним привязан к организации и не является идентификатором кандидата.
|
||||
- Раскладка. На 1280 px форма слева, выдача справа; ниже 1024 px форма стоит над выдачей; на 360 px действия записи идут в столбец, а факты и объяснение складываются в один столбец. Все действия доступны с клавиатуры, фокус виден, статус кодируется текстом и формой, а не цветом.
|
||||
- Раскладка. Форма стоит над выдачей на всех ширинах: основание поиска (сегментный переключатель "По потребности" и "По всем профилям"), выборы, ряд фильтр-чипов (технологии, формат, совместимость ожиданий; примененный чип синий и с галочкой) и действие; выдача идет на всю ширину. Запись на 768 px и шире - колонка содержимого и колонка действий ("Пригласить", объяснение, карточка); на 360 px действия и факты складываются в один столбец. Блок "Почему в подборке" набран моно на вложенной поверхности: знак "+" (подтверждено), "+/-" (частично), "?" (заявлено), "-" (пробел) повторяет слово состояния. Чип технологии, которую запросил поиск, помечен точкой и скрытым текстом "совпадает с условием поиска". Все действия доступны с клавиатуры, фокус виден, статус кодируется текстом и формой, а не цветом.
|
||||
|
||||
Проверки. Модульные тесты: разбор и подписи (`entities/match`), сборка запроса из черновика (`features/filter-matches`), разметка выдачи (`widgets/match-list`). Playwright `e2e/match-search.spec.ts` состоит из двух групп. Первая работает на реальном бэкенде (нужны почтовая и компанийная фикстуры): пять синтетических кандидатов публикуют одинаковую карточку с заявленными грейдами Backend и сетей, владелец ищет, проверяет группы, переключение Backend/Сети для одного псевдонима, сравнение Fit и Cov с ответом, чтение карточки, объясненную пустую выдачу при невыполнимом фильтре, отсутствие повторного поиска после перезагрузки и 360 px. Вторая группа отвечает из заглушки и проверяет то, чего стенд не создает: порядок трех групп с подтвержденным Backend и неподтвержденными сетями у одного псевдонима, нейтральные значения и причины, `truncated`, 429 с `Retry-After`, 404 карточки, ошибки, права и поиск по потребности. Подтвержденные группы на реальном бэкенде не проверены: карточка отдается группе не меньше пяти одинаковых карточек, а подтвержденная категория на стенде требует прохождения проверки каждым из них. Реальная исчерпанная квота и скрытие или отзыв C2 из браузера работодателя тоже не проверены.
|
||||
|
||||
@@ -144,11 +154,12 @@ SPA на React и TypeScript со сборкой Vite и структурой FS
|
||||
- Форма (`features/send-invitation`). Поля повторяют `InvitationTerms` и ничего сверх: роль, специализация (из записи поиска), грейд, тип предложения, задачи (по одной в строке), команда, технологии, форматы и место работы, канал связи с необязательным комментарием, вилка в рублях с явной базой (net или gross), четыре условия пакета и срок ответа 3, 7 или 14 дней. Каждое условие пакета выбирается явно: "Предусмотрено" с описанием или "Не предусмотрено"; по умолчанию не выбрано ничего. При поиске по потребности форма заполняется только подтвержденными требованиями потребности, а в черновик уходит ссылка на ее `requirements_version`.
|
||||
- Проверка до запроса. Клиент повторяет правила контракта: обязательные поля и длины, вилка из целых рублей с шагом 1 000, нижняя граница меньше верхней, ширина от 10% до 40% середины (`entities/invitation/model/salary-range.ts`), место работы для офиса и гибрида, повтор технологии без учета регистра. С неполной вилкой, без способа связи или без выбора в пакете запрос не отправляется. Ошибки собираются в список с фокусом в начале формы и привязаны к полям через `aria-invalid` и `aria-describedby`.
|
||||
- Ответ сервера главнее. Ошибки RFC 9457 из `errors[].pointer` переводятся в поля формы (`fieldOfPointer`, например `/terms/salary/salary_to`, `/terms/communication_method`, `/terms/package/training`); текст сервера не показывается. `/candidate_handle` и `/need` дают общее сообщение без причины.
|
||||
- Предпросмотр (`widgets/invitation-preview`). "Показать предпросмотр" проверяет форму и показывает карточку компании из `candidate_card` (`GET /organizations/{org_id}`) и все условия так, как их увидит кандидат; фокус переходит на предпросмотр. Предпросмотр ничего не отправляет и не создает черновик. Если форма изменилась, над ним появляется пометка, что он устарел.
|
||||
- Шаги. Форма идет в четыре шага (`Stepper`): условия, пакет и срок ответа, предпросмотр, отправка. Кнопка "Далее" на первом шаге проверяет только его поля; "К предпросмотру" проверяет всю форму. Ошибка открывает шаг с первым проблемным полем и ставит фокус на список ошибок над шагом. Тип предложения, грейд, база суммы, условия пакета и срок ответа - сегментные переключатели, формат работы - чипы. Enter в поле ведет на следующий шаг, отправляет только последний.
|
||||
- Предпросмотр (`widgets/invitation-preview`). Переход "К предпросмотру" проверяет форму и показывает карточку компании из `candidate_card` (`GET /organizations/{org_id}`) и все условия так, как их увидит кандидат; фокус переходит на заголовок шага. Предпросмотр строится заново при каждом входе в шаг, ничего не отправляет и не создает черновик.
|
||||
- Отправка. "Отправить приглашение" выполняет команду из трех операций (`features/send-invitation/model/send-command.ts`): `CreateOrganizationInvitation` с Idempotency-Key, при изменившихся условиях сохраненного черновика `UpdateOrganizationInvitation` с `expected_version`, затем `SendOrganizationInvitation` с отдельным Idempotency-Key. Ключ создания привязан к телу запроса, ключ отправки - к черновику и его версии; оба сохраняются, пока команда не завершится, поэтому повторное нажатие после потерянного ответа, 5xx или 409 `idempotency_in_progress` повторяет тот же ключ. Нажатие во время выполнения ничего не запускает. После 412 форма перечитывает черновик и применит свои условия при следующей отправке. Ответы проверяются сгенерированной схемой Zod.
|
||||
- Результат. После успешной отправки экран показывает состояние "Доставлено", момент доставки и срок ответа из ответа сервера (`response_deadline_at`, в UTC), версию условий, зарплатный индикатор и отправленные условия; фокус переходит на заголовок. После создания черновика его `invitation_id` записывается в адрес: перезагрузка открывает несохраненный черновик для отправки или уже отправленное приглашение с сохраненным сроком.
|
||||
|
||||
Проверки. Модульные тесты: правила вилки (`entities/invitation`), проверка черновика и перевод указателей ошибок, команда отправки на MSW (ключи, повтор после потерянного ответа создания и отправки, 400 с полями, обновление черновика, 412), разметка предпросмотра и страницы (доступ владельца, пустой адрес). Playwright `e2e/invitation-compose.spec.ts` работает на реальном бэкенде в `make -C deploy test-e2e-registration`: пять синтетических кандидатов публикуют одинаковую карточку, владелец находит их поиском, открывает приглашение из выдачи, заполняет [100000; 140000] net и пакет и сверяет предпросмотр со всеми условиями; без способа связи видна ошибка поля, запросов нет, inbox кандидатов пуст. Затем отправка замедляется, первый ответ теряется, второе нажатие во время запроса ничего не запускает, повтор идет с тем же ключом; в итоге одно приглашение в одном inbox (`GET /me/invitations`) с тем же сроком, что на экране и после перезагрузки. Отказ 403 для рекрутера в браузере не проверен: на стенде нет способа выдать такую роль; поведение экрана для неглавной роли покрыто модульным тестом.
|
||||
Проверки. Модульные тесты: правила вилки (`entities/invitation`), проверка черновика и перевод указателей ошибок, команда отправки на MSW (ключи, повтор после потерянного ответа создания и отправки, 400 с полями, обновление черновика, 412), разметка предпросмотра и страницы (доступ владельца, пустой адрес). Playwright `e2e/invitation-compose.spec.ts` работает на реальном бэкенде в `make -C deploy test-e2e-registration`: пять синтетических кандидатов публикуют одинаковую карточку, владелец находит их поиском, открывает приглашение из выдачи, заполняет [100000; 140000] net и пакет по шагам и сверяет предпросмотр со всеми условиями; без способа связи форма не уходит с шага условий, видна ошибка поля, запросов нет, inbox кандидатов пуст. Затем отправка замедляется, первый ответ теряется, второе нажатие во время запроса ничего не запускает, повтор идет с тем же ключом; в итоге одно приглашение в одном inbox (`GET /me/invitations`) с тем же сроком, что на экране и после перезагрузки. Отказ 403 для рекрутера в браузере не проверен: на стенде нет способа выдать такую роль; поведение экрана для неглавной роли покрыто модульным тестом.
|
||||
|
||||
## Входящие приглашения кандидата
|
||||
|
||||
@@ -256,7 +267,9 @@ SPA на React и TypeScript со сборкой Vite и структурой FS
|
||||
- `TrustLevel` - пустая метка, кольцо, частичная или полная заливка с видимой подписью.
|
||||
- `CircuitTrace`, `Mono`, `VisuallyHidden`, `SkipLink`, `MainRegion`.
|
||||
|
||||
Оболочки. Публичная: плавающая плашка со словесным знаком и ссылками, ниже 700px ссылки открываются кнопкой "Меню"; подвал со ссылкой на технический статус. Кандидат (сначала телефон): ниже 700px разделы образуют нижнюю панель вкладок с прокруткой, текущая вкладка прокручивается в середину; с 700px вкладки стоят в плашке. Навигация в документе идет до `main`, поэтому порядок клавиатуры одинаков на любой ширине. Работодатель (сначала компьютер): с 1024px плавающая боковая панель 240px, ниже - плашка с кнопкой "Меню".
|
||||
Шаги длинной формы (`form-steps.tsx`, `use-form-steps.ts`: панель шага с заголовком, получающим фокус, навигация «Назад» и «Далее», блок проверки с кнопкой «Изменить») пока лежат одинаковыми копиями в `features/edit-profile` и `features/fill-questionnaire`; общий вариант стоит перенести в `shared/ui`.
|
||||
|
||||
Оболочки. Публичная: плавающая плашка со словесным знаком и ссылками, ниже 700px ссылки открываются кнопкой "Меню"; подвал со ссылкой на технический статус. Кандидат (сначала телефон): ниже 700px разделы образуют нижнюю панель вкладок с прокруткой, текущая вкладка прокручивается в середину; с 700px вкладки стоят в плашке. Если вкладки не помещаются, полоса затухает у того края, за которым они остались. Навигация в документе идет до `main`, поэтому порядок клавиатуры одинаков на любой ширине. Работодатель (сначала компьютер): с 1024px плавающая боковая панель 240px, ниже - плашка с кнопкой "Меню".
|
||||
|
||||
Доступность: каждая оболочка начинается со ссылки пропуска к `main`, содержит ориентиры и видимое кольцо фокуса (2px `#9A92FF` с отступом 2px) и переводит фокус на `main` после перехода. Анимации учитывают `prefers-reduced-motion`.
|
||||
|
||||
|
||||
@@ -250,10 +250,13 @@ test.describe("organization invitation with the real backend", () => {
|
||||
if (isInvitationCommand(request)) commands.push(request);
|
||||
});
|
||||
|
||||
// The form has four steps: terms, package, preview, send.
|
||||
await expect(page.getByText("Шаг 1 из 4")).toBeVisible();
|
||||
|
||||
// Step 1: the terms with [100000; 140000] net and a package.
|
||||
await page.getByLabel("Название роли", { exact: true }).fill("Аналитик SOC, стажировка");
|
||||
await page.getByLabel("Грейд", { exact: true }).selectOption("intern");
|
||||
await page.getByLabel("Тип предложения", { exact: true }).selectOption("internship");
|
||||
await page.getByRole("radio", { name: "Стажер", exact: true }).check();
|
||||
await page.getByRole("radio", { name: "Стажировка", exact: true }).check();
|
||||
await page
|
||||
.getByLabel("Задачи", { exact: true })
|
||||
.fill("Разбирать события SIEM\nГотовить отчеты об инцидентах");
|
||||
@@ -270,7 +273,11 @@ test.describe("organization invitation with the real backend", () => {
|
||||
.fill("Созвон с руководителем смены в течение трех рабочих дней");
|
||||
await page.getByLabel("От, ₽", { exact: true }).fill("100000");
|
||||
await page.getByLabel("До, ₽", { exact: true }).fill("140000");
|
||||
await page.getByLabel("База суммы", { exact: true }).selectOption("net");
|
||||
await page.getByRole("radio", { name: "После налога (net)", exact: true }).check();
|
||||
await page.getByRole("button", { name: "Далее", exact: true }).click();
|
||||
await expect(
|
||||
page.getByRole("heading", { level: 2, name: "Пакет и срок ответа" }),
|
||||
).toBeFocused();
|
||||
const bonus = page.getByRole("group", { name: "Премии и бонусы" });
|
||||
await bonus.getByRole("radio", { name: "Предусмотрено", exact: true }).check();
|
||||
await page.getByLabel("Премии и бонусы: описание").fill("Квартальная премия до 10%");
|
||||
@@ -286,9 +293,10 @@ test.describe("organization invitation with the real backend", () => {
|
||||
.getByRole("radio", { name: "Не предусмотрено", exact: true })
|
||||
.check();
|
||||
|
||||
await page.getByRole("button", { name: "Показать предпросмотр" }).click();
|
||||
await page.getByRole("button", { name: "К предпросмотру" }).click();
|
||||
await expect(page.getByRole("heading", { level: 2, name: "Предпросмотр" })).toBeFocused();
|
||||
const preview = page.getByRole("region", { name: "Предпросмотр приглашения" });
|
||||
await expect(preview).toBeFocused();
|
||||
await expect(preview).toBeVisible();
|
||||
await expect(preview.getByRole("heading", { name: organizationName })).toBeVisible();
|
||||
const terms = preview.getByRole("article", { name: "Условия приглашения" });
|
||||
for (const value of [
|
||||
@@ -319,17 +327,25 @@ test.describe("organization invitation with the real backend", () => {
|
||||
expect(commands).toEqual([]);
|
||||
expect(await inboxItems(candidates)).toEqual([]);
|
||||
|
||||
// Step 2: without the communication method the form refuses to send.
|
||||
// Step 2: without the communication method the form does not leave the
|
||||
// terms. The send step is only reachable through a valid preview, so
|
||||
// the employer walks back to the terms and clears the channel.
|
||||
await page.getByRole("button", { name: "К отправке" }).click();
|
||||
await expect(page.getByRole("heading", { level: 2, name: "Отправка" })).toBeFocused();
|
||||
for (let index = 0; index < 3; index += 1) {
|
||||
await page.getByRole("button", { name: "Назад", exact: true }).click();
|
||||
}
|
||||
await expect(page.getByText("Шаг 1 из 4")).toBeVisible();
|
||||
const channel = page.getByLabel("Канал связи", { exact: true });
|
||||
await channel.selectOption({ index: 0 });
|
||||
await page.getByRole("button", { name: "Отправить приглашение" }).click();
|
||||
await page.getByRole("button", { name: "Далее", exact: true }).click();
|
||||
const summary = page.getByRole("alert").filter({ hasText: "Проверьте условия приглашения" });
|
||||
await expect(summary).toBeFocused();
|
||||
await expect(channel).toHaveAttribute("aria-invalid", "true");
|
||||
await expect(channel).toHaveAccessibleDescription(
|
||||
"Выберите способ связи после принятия приглашения.",
|
||||
);
|
||||
await expect(page.getByText("Условия изменены после предпросмотра")).toBeVisible();
|
||||
await expect(page.getByText("Шаг 1 из 4")).toBeVisible();
|
||||
expect(commands).toEqual([]);
|
||||
expect(await inboxItems(candidates)).toEqual([]);
|
||||
|
||||
@@ -337,6 +353,10 @@ test.describe("organization invitation with the real backend", () => {
|
||||
// then retried. The browser keeps the key until the command completes.
|
||||
await channel.selectOption("video_call");
|
||||
await expect(channel).toHaveAttribute("aria-invalid", "false");
|
||||
await page.getByRole("button", { name: "Далее", exact: true }).click();
|
||||
await page.getByRole("button", { name: "К предпросмотру" }).click();
|
||||
await expect(preview).toBeVisible();
|
||||
await page.getByRole("button", { name: "К отправке" }).click();
|
||||
let sendAttempts = 0;
|
||||
let delivered: SentInvitation | null = null;
|
||||
await page.route("**/api/v1/organizations/*/invitations/*/send", async (route) => {
|
||||
|
||||
@@ -214,6 +214,13 @@ async function findSkillRow(section: Locator, name: string): Promise<Locator> {
|
||||
throw new Error(`The parsed need did not contain the expected skill ${name}.`);
|
||||
}
|
||||
|
||||
// The need form has five steps and saves only on the last one; "Далее" moves one step on.
|
||||
async function nextStep(page: Page, times = 1): Promise<void> {
|
||||
for (let index = 0; index < times; index += 1) {
|
||||
await page.getByRole("button", { name: "Далее", exact: true }).click();
|
||||
}
|
||||
}
|
||||
|
||||
function isResponse(response: Response, method: string, path: string, status: number): boolean {
|
||||
return (
|
||||
response.request().method() === method &&
|
||||
@@ -262,15 +269,32 @@ test.describe("employer needs", () => {
|
||||
await page.getByRole("link", { name: "Создать потребность" }).first().click();
|
||||
await expect(page.getByLabel("Название потребности")).toBeVisible();
|
||||
await expect(page.getByText("Вакансия для сохранения потребности не требуется.")).toBeVisible();
|
||||
await expect(page.getByLabel("Грейд")).toHaveValue("");
|
||||
await expect(page.getByLabel("База суммы")).toHaveValue("");
|
||||
await expect(
|
||||
page.getByText("Укажите обе суммы и выберите базу. Без явной базы диапазон не сохранится."),
|
||||
).toBeVisible();
|
||||
await expect(page.getByText("Шаг 1 из 5")).toBeVisible();
|
||||
// A step that needs a title does not let the employer leave it blank.
|
||||
await nextStep(page);
|
||||
await expect(page.getByLabel("Название потребности")).toHaveAttribute("aria-invalid", "true");
|
||||
await expect(page.getByLabel("Название потребности")).toBeFocused();
|
||||
await page.getByLabel("Название потребности").fill(`Payments backend ${suffix}`);
|
||||
// An unknown grade stays unknown: no grade radio is preselected.
|
||||
await expect(page.getByRole("radio", { name: "Не указан", exact: true })).toBeChecked();
|
||||
expect(pageErrors, `Browser page errors: ${pageErrors.join("; ")}`).toEqual([]);
|
||||
await page.getByLabel("Описание работы").fill(sourceText);
|
||||
expect(pageErrors, `Browser page errors: ${pageErrors.join("; ")}`).toEqual([]);
|
||||
// Focus follows the employer to the heading of each step, and back keeps the draft.
|
||||
await nextStep(page);
|
||||
await expect(
|
||||
page.getByRole("heading", { level: 2, name: "Навыки", exact: true }),
|
||||
).toBeFocused();
|
||||
await page.getByRole("button", { name: "Назад", exact: true }).click();
|
||||
await expect(page.getByRole("heading", { level: 2, name: "Роль и грейд" })).toBeFocused();
|
||||
await expect(page.getByLabel("Описание работы")).toHaveValue(sourceText);
|
||||
await nextStep(page, 3);
|
||||
await expect(page.getByRole("radio", { name: /После налога/ })).not.toBeChecked();
|
||||
await expect(page.getByRole("radio", { name: /До налога/ })).not.toBeChecked();
|
||||
await expect(
|
||||
page.getByText("Укажите обе суммы и выберите базу. Без явной базы диапазон не сохранится."),
|
||||
).toBeVisible();
|
||||
await nextStep(page);
|
||||
|
||||
const organizationNeedsPath = needCollectionPath(organization.id);
|
||||
const createResponsePromise = page.waitForResponse((response) =>
|
||||
@@ -289,6 +313,7 @@ test.describe("employer needs", () => {
|
||||
expect(created.readiness.missing_fields.map((field) => field.field)).toContain("salary");
|
||||
expect(created.recommendations.status).toBe("not_available");
|
||||
|
||||
await nextStep(page);
|
||||
const requiredSkills = page
|
||||
.getByRole("heading", { name: "Обязательные навыки" })
|
||||
.locator("xpath=..");
|
||||
@@ -302,6 +327,7 @@ test.describe("employer needs", () => {
|
||||
|
||||
const needId = created.id;
|
||||
const itemPath = needPath(organization.id, needId);
|
||||
await nextStep(page, 3);
|
||||
const firstSavePromise = page.waitForResponse((response) =>
|
||||
isResponse(response, "PATCH", itemPath, 200),
|
||||
);
|
||||
@@ -342,6 +368,8 @@ test.describe("employer needs", () => {
|
||||
|
||||
const firstWindowTitle = `Payments backend first ${suffix}`;
|
||||
await page.getByLabel("Название потребности").fill(firstWindowTitle);
|
||||
// An existing need can jump straight to the review step.
|
||||
await page.getByRole("button", { name: "К проверке и сохранению" }).click();
|
||||
const firstWindowSave = page.waitForResponse((response) =>
|
||||
isResponse(response, "PATCH", itemPath, 200),
|
||||
);
|
||||
@@ -353,6 +381,7 @@ test.describe("employer needs", () => {
|
||||
|
||||
const secondWindowDraft = `Payments backend second ${suffix}`;
|
||||
await secondPage.getByLabel("Название потребности").fill(secondWindowDraft);
|
||||
await secondPage.getByRole("button", { name: "К проверке и сохранению" }).click();
|
||||
const conflictResponsePromise = secondPage.waitForResponse((response) =>
|
||||
isResponse(response, "PATCH", itemPath, 412),
|
||||
);
|
||||
@@ -486,19 +515,23 @@ test.describe("employer needs", () => {
|
||||
await page.getByLabel("Название потребности").fill(`Manual Go developer ${suffix}`);
|
||||
await expect(page.getByLabel("Описание работы")).toHaveValue("");
|
||||
await page.getByLabel("Специализация").selectOption("backend");
|
||||
await page.getByLabel("Грейд").selectOption("junior");
|
||||
await page.getByRole("radio", { name: "Junior", exact: true }).check();
|
||||
await nextStep(page);
|
||||
|
||||
const requiredSkills = page
|
||||
.getByRole("heading", { name: "Обязательные навыки" })
|
||||
.locator("xpath=..");
|
||||
await requiredSkills.getByLabel("Добавить навык").fill("Go");
|
||||
await requiredSkills.getByRole("button", { name: "Добавить", exact: true }).click();
|
||||
await nextStep(page);
|
||||
const tasks = page.getByRole("heading", { name: "Задачи команды" }).locator("xpath=..");
|
||||
await tasks.getByLabel("Добавить задачу").fill("Развивать сервис уведомлений");
|
||||
await tasks.getByRole("button", { name: "Добавить", exact: true }).click();
|
||||
await nextStep(page);
|
||||
await page.getByLabel("От, рублей в месяц").fill("100000");
|
||||
await page.getByLabel("До, рублей в месяц").fill("130000");
|
||||
await page.getByLabel("База суммы").selectOption("net");
|
||||
await page.getByRole("radio", { name: /После налога/ }).check();
|
||||
await nextStep(page);
|
||||
|
||||
const createResponsePromise = page.waitForResponse((response) =>
|
||||
isResponse(response, "POST", collectionPath, 201),
|
||||
|
||||
@@ -48,6 +48,7 @@ export {
|
||||
matchGroupOrder,
|
||||
specializationCodes,
|
||||
specializationLabels,
|
||||
specializationShortLabels,
|
||||
stackCodes,
|
||||
stackLabels,
|
||||
workFormatCodes,
|
||||
|
||||
@@ -29,6 +29,23 @@ export const specializationLabels: Readonly<Record<SpecializationCode, string>>
|
||||
|
||||
export const specializationCodes = Object.keys(specializationLabels) as SpecializationCode[];
|
||||
|
||||
/**
|
||||
* Short names for the grade tag, for example BACKEND · MIDDLE. The tag is set
|
||||
* in capitals and never wraps, so a long specialization name would not fit a
|
||||
* phone; the full name stays in the heading of the card.
|
||||
*/
|
||||
export const specializationShortLabels: Readonly<Record<SpecializationCode, string>> = {
|
||||
backend: "Backend",
|
||||
frontend: "Frontend",
|
||||
mobile: "Mobile",
|
||||
network_engineer: "Network",
|
||||
devops_sre: "DevOps",
|
||||
data_analyst: "Data",
|
||||
ds_ml: "DS/ML",
|
||||
information_security: "InfoSec",
|
||||
qa: "QA",
|
||||
};
|
||||
|
||||
export const gradeLabels: Readonly<Record<GradeCode, string>> = {
|
||||
intern: "Стажер",
|
||||
junior: "Junior",
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
gap: var(--space-4);
|
||||
min-width: 0;
|
||||
padding: var(--space-4);
|
||||
border: var(--line-thin) solid var(--color-border-strong);
|
||||
border: var(--line-thin) solid var(--color-divider);
|
||||
border-radius: var(--radius-s);
|
||||
background: var(--color-surface);
|
||||
background: var(--color-canvas);
|
||||
}
|
||||
|
||||
.panel[hidden] {
|
||||
|
||||
@@ -1,24 +1,43 @@
|
||||
/* A result card: the content column and, from 768px, a column of actions.
|
||||
* Hover brightens the hairline; there is no shadow. */
|
||||
.card {
|
||||
display: grid;
|
||||
gap: var(--space-4);
|
||||
min-width: 0;
|
||||
padding: var(--space-4);
|
||||
border: var(--line-thin) solid var(--color-divider);
|
||||
border-inline-start: var(--space-1) solid var(--color-border-strong);
|
||||
border-radius: var(--radius-m);
|
||||
background: var(--color-surface);
|
||||
transition: border-color var(--duration-fast) var(--easing-standard);
|
||||
}
|
||||
|
||||
/* The confirmed and the unconfirmed state differ in the edge style and the
|
||||
* text of the badge, so the difference never relies on color alone. */
|
||||
.card[data-confirmed="false"] {
|
||||
border-inline-start-style: dashed;
|
||||
.card:hover {
|
||||
border-color: var(--color-border-hover);
|
||||
}
|
||||
|
||||
@media (width >= 48rem) {
|
||||
.card {
|
||||
grid-template-columns: minmax(0, 1fr) 13rem;
|
||||
column-gap: var(--space-5);
|
||||
padding: var(--space-5);
|
||||
}
|
||||
|
||||
.panels {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
}
|
||||
|
||||
.main {
|
||||
display: grid;
|
||||
gap: var(--space-3);
|
||||
align-content: start;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.header {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2) var(--space-4);
|
||||
gap: var(--space-1) var(--space-4);
|
||||
align-items: baseline;
|
||||
justify-content: space-between;
|
||||
min-width: 0;
|
||||
@@ -26,33 +45,67 @@
|
||||
|
||||
.specialization {
|
||||
margin: 0;
|
||||
overflow-wrap: anywhere;
|
||||
color: var(--color-text-strong);
|
||||
font-size: var(--font-size-l);
|
||||
font-weight: var(--font-weight-bold);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.handle {
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
font-size: var(--font-size-xs);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.status {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-1) var(--space-4);
|
||||
gap: var(--space-2) var(--space-4);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.caption {
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-xs);
|
||||
}
|
||||
|
||||
.salary,
|
||||
.stack {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-1) var(--space-3);
|
||||
align-items: baseline;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* Salary is mono 600 as in the design system; the word, not the hue, says
|
||||
* whether the expectations fit. Green 8.7:1 on the surface. */
|
||||
.salary > span:last-child {
|
||||
font-size: var(--font-size-m);
|
||||
}
|
||||
|
||||
.salary[data-fit="compatible"] > span:last-child {
|
||||
color: var(--color-success);
|
||||
}
|
||||
|
||||
.chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.facts {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(9rem, max-content) minmax(0, 1fr);
|
||||
gap: var(--space-2) var(--space-4);
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr));
|
||||
gap: var(--space-3) var(--space-4);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.facts dt {
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-xs);
|
||||
}
|
||||
|
||||
.facts dd {
|
||||
@@ -65,42 +118,94 @@
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
.sources {
|
||||
display: grid;
|
||||
/* "Why in the selection": the server's sources and gaps in mono on a nested
|
||||
* surface. The sign repeats the state; the words carry it. */
|
||||
.why {
|
||||
gap: var(--space-2);
|
||||
min-width: 0;
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-xs);
|
||||
line-height: 1.55;
|
||||
}
|
||||
|
||||
.sources-title {
|
||||
.why-title {
|
||||
margin: 0;
|
||||
font-size: var(--font-size-s);
|
||||
font-weight: var(--font-weight-bold);
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-xs);
|
||||
font-weight: var(--font-weight-medium);
|
||||
letter-spacing: var(--letter-spacing-label);
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.sources ul {
|
||||
.why-list {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
gap: var(--space-1);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.sources li {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-1) var(--space-3);
|
||||
align-items: center;
|
||||
.why-list li {
|
||||
display: grid;
|
||||
grid-template-columns: 1rem minmax(0, 1fr);
|
||||
column-gap: var(--space-2);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.source-label {
|
||||
font-weight: var(--font-weight-medium);
|
||||
.sign {
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.why-label {
|
||||
color: var(--color-text);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.why-text {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0 var(--space-3);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.why-state {
|
||||
color: var(--color-text-secondary);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.why-list li[data-state="supports"] .sign,
|
||||
.why-list li[data-state="supports"] .why-state {
|
||||
color: var(--color-success);
|
||||
}
|
||||
|
||||
.why-list li[data-state="gap"] .sign,
|
||||
.why-list li[data-state="gap"] .why-state {
|
||||
color: var(--color-danger);
|
||||
}
|
||||
|
||||
.why-list li[data-state="partial"] .sign,
|
||||
.why-list li[data-state="partial"] .why-state {
|
||||
color: var(--color-accent);
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2) var(--space-3);
|
||||
gap: var(--space-2);
|
||||
align-content: start;
|
||||
}
|
||||
|
||||
.actions > * {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
@media (width >= 48rem) {
|
||||
.actions {
|
||||
flex-flow: column nowrap;
|
||||
}
|
||||
|
||||
.actions > * {
|
||||
flex: none;
|
||||
}
|
||||
}
|
||||
|
||||
.panels {
|
||||
@@ -114,14 +219,6 @@
|
||||
padding: var(--space-3);
|
||||
}
|
||||
|
||||
.facts {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.facts dd + dt {
|
||||
padding-block-start: var(--space-2);
|
||||
}
|
||||
|
||||
.actions > * {
|
||||
flex: 1 1 100%;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import type { ReactNode } from "react";
|
||||
import { Mono, TrustLevel, type TrustLevelValue } from "../../../shared/ui";
|
||||
import type { MatchSearchStackTag } from "../../../shared/api/schemas";
|
||||
import { Card, Mono, Tag, TrustLevel, VisuallyHidden } from "../../../shared/ui";
|
||||
import type { MatchCardModel } from "../model/adapter";
|
||||
import { evidenceRows, type EvidenceRow } from "../model/explanation";
|
||||
import {
|
||||
@@ -8,17 +9,20 @@ import {
|
||||
salaryCompatibilityLabels,
|
||||
confirmationLabel,
|
||||
specializationLabels,
|
||||
specializationShortLabels,
|
||||
stackLabels,
|
||||
workFormatLabels,
|
||||
} from "../model/labels";
|
||||
import { shortHandle } from "../model/views";
|
||||
import styles from "./match-card.module.css";
|
||||
|
||||
const stateLevels: Readonly<Record<EvidenceRow["state"], TrustLevelValue>> = {
|
||||
supports: "confirmed",
|
||||
partial: "partial",
|
||||
declared_only: "claimed",
|
||||
gap: "none",
|
||||
// A row of the "why in the selection" block: a mono sign and the state in
|
||||
// words. The sign repeats the state; the words carry it.
|
||||
const stateSigns: Readonly<Record<EvidenceRow["state"], string>> = {
|
||||
supports: "+",
|
||||
partial: "±",
|
||||
declared_only: "?",
|
||||
gap: "−",
|
||||
};
|
||||
|
||||
const noValue = "Нет значения в карточке";
|
||||
@@ -31,100 +35,153 @@ type MatchCardViewProps = {
|
||||
card: MatchCardModel;
|
||||
/** Id of the heading, so the surrounding group can label the article. */
|
||||
headingId: string;
|
||||
/** Buttons and links under the card facts. */
|
||||
/** Technologies that the search asked for; a matching chip gets a dot. */
|
||||
matchedStack?: readonly MatchSearchStackTag[];
|
||||
/** Buttons and links in the action column. */
|
||||
actions?: ReactNode;
|
||||
/** Expandable panels under the actions. */
|
||||
/** Expandable panels under the card. */
|
||||
children?: ReactNode;
|
||||
};
|
||||
|
||||
/**
|
||||
* One search result: a candidate under one specialization. It prints the
|
||||
* confirmed category and the declared grade on separate lines, the safe card
|
||||
* context, and the server's templated sources and gaps. Nothing here is
|
||||
* calculated: the status comes from the group and the fields of the entry.
|
||||
* One search result: a candidate under one specialization. The grade tag and
|
||||
* the confirmed category and the declared grade are printed on separate
|
||||
* lines, so a claim never reads as a confirmation. Below sit the safe card
|
||||
* context, the technology chips, and the server's templated sources and gaps
|
||||
* in a "why in the selection" block. Nothing here is calculated: the status
|
||||
* comes from the group and the fields of the entry.
|
||||
*/
|
||||
export function MatchCardView({ card, headingId, actions, children }: MatchCardViewProps) {
|
||||
export function MatchCardView({
|
||||
card,
|
||||
headingId,
|
||||
matchedStack = [],
|
||||
actions,
|
||||
children,
|
||||
}: MatchCardViewProps) {
|
||||
const confirmed = card.confirmationStatus === "confirmed";
|
||||
const context = card.publicContext;
|
||||
const sources = evidenceRows(card);
|
||||
const shortSpecialization = specializationShortLabels[card.specialization];
|
||||
const compatibility = context.salaryCompatibility;
|
||||
|
||||
return (
|
||||
<article className={styles.card} data-confirmed={confirmed} aria-labelledby={headingId}>
|
||||
<header className={styles.header}>
|
||||
<h4 id={headingId} className={styles.specialization}>
|
||||
{specializationLabels[card.specialization]}
|
||||
</h4>
|
||||
<p className={styles.handle}>
|
||||
Кандидат <Mono>{shortHandle(card.candidateHandle)}</Mono>
|
||||
</p>
|
||||
</header>
|
||||
<div className={styles.status}>
|
||||
{card.category && card.strength ? (
|
||||
<TrustLevel
|
||||
level="confirmed"
|
||||
label={`Грейд подтвержден: ${gradeLabels[card.category.grade]}`}
|
||||
/>
|
||||
) : (
|
||||
<TrustLevel level="none" label="Грейд не подтвержден" />
|
||||
)}
|
||||
</div>
|
||||
<dl className={styles.facts}>
|
||||
<dt>Подтвержденная категория</dt>
|
||||
<dd>
|
||||
{card.category && card.strength
|
||||
? `${specializationLabels[card.category.specialization]}, ${gradeLabels[card.category.grade]}. ${confirmationLabel(card.category.basis, card.strength)}`
|
||||
: "Нет"}
|
||||
</dd>
|
||||
<dt>Заявленный кандидатом грейд</dt>
|
||||
<dd>{card.declaredGrade ? gradeLabels[card.declaredGrade] : "Не указан"}</dd>
|
||||
<dt>Технологии</dt>
|
||||
<dd>
|
||||
<div className={styles.main}>
|
||||
<header className={styles.header}>
|
||||
<h4 id={headingId} className={styles.specialization}>
|
||||
{specializationLabels[card.specialization]}
|
||||
</h4>
|
||||
<p className={styles.handle}>
|
||||
Кандидат <Mono>{shortHandle(card.candidateHandle)}</Mono>
|
||||
</p>
|
||||
</header>
|
||||
<div className={styles.status}>
|
||||
{card.category && card.strength ? (
|
||||
<>
|
||||
<Tag tone="grade">{`${shortSpecialization} · ${gradeLabels[card.category.grade]}`}</Tag>
|
||||
<TrustLevel
|
||||
level="confirmed"
|
||||
label={`Грейд подтвержден: ${gradeLabels[card.category.grade]}`}
|
||||
/>
|
||||
</>
|
||||
) : (
|
||||
<>
|
||||
<Tag>
|
||||
{card.declaredGrade
|
||||
? `Заявлено: ${gradeLabels[card.declaredGrade]}`
|
||||
: "Грейд не заявлен"}
|
||||
</Tag>
|
||||
<TrustLevel level="none" label="Грейд не подтвержден" />
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
<div className={styles.salary} data-fit={compatibility ?? undefined}>
|
||||
<span className={styles.caption}>Зарплатные ожидания</span>
|
||||
{compatibility ? (
|
||||
<Mono strong>{salaryCompatibilityLabels[compatibility]}</Mono>
|
||||
) : (
|
||||
<Unknown />
|
||||
)}
|
||||
</div>
|
||||
<div className={styles.stack}>
|
||||
<span className={styles.caption}>Технологии</span>
|
||||
{context.stack === null ? (
|
||||
<Unknown />
|
||||
) : context.stack.length === 0 ? (
|
||||
"Не названы"
|
||||
<span>Не названы</span>
|
||||
) : (
|
||||
context.stack.map((tag) => stackLabels[tag]).join(", ")
|
||||
<ul className={styles.chips}>
|
||||
{context.stack.map((tag) => {
|
||||
const matched = matchedStack.includes(tag);
|
||||
return (
|
||||
<li key={tag}>
|
||||
<Tag tone={matched ? "accent" : "stack"} dot={matched}>
|
||||
{stackLabels[tag]}
|
||||
{matched ? (
|
||||
<VisuallyHidden>, совпадает с условием поиска</VisuallyHidden>
|
||||
) : null}
|
||||
</Tag>
|
||||
</li>
|
||||
);
|
||||
})}
|
||||
</ul>
|
||||
)}
|
||||
</dd>
|
||||
<dt>Общий опыт</dt>
|
||||
<dd>
|
||||
{context.experienceBand ? experienceBandLabels[context.experienceBand] : <Unknown />}
|
||||
</dd>
|
||||
<dt>Форматы работы</dt>
|
||||
<dd>
|
||||
{context.workFormats === null ? (
|
||||
<Unknown />
|
||||
) : context.workFormats.length === 0 ? (
|
||||
"Не названы"
|
||||
</div>
|
||||
<dl className={styles.facts}>
|
||||
<div>
|
||||
<dt>Подтвержденная категория</dt>
|
||||
<dd>
|
||||
{card.category && card.strength
|
||||
? `${specializationLabels[card.category.specialization]}, ${gradeLabels[card.category.grade]}. ${confirmationLabel(card.category.basis, card.strength)}`
|
||||
: "Нет"}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Заявленный кандидатом грейд</dt>
|
||||
<dd>{card.declaredGrade ? gradeLabels[card.declaredGrade] : "Не указан"}</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Общий опыт</dt>
|
||||
<dd>
|
||||
{context.experienceBand ? experienceBandLabels[context.experienceBand] : <Unknown />}
|
||||
</dd>
|
||||
</div>
|
||||
<div>
|
||||
<dt>Форматы работы</dt>
|
||||
<dd>
|
||||
{context.workFormats === null ? (
|
||||
<Unknown />
|
||||
) : context.workFormats.length === 0 ? (
|
||||
"Не названы"
|
||||
) : (
|
||||
context.workFormats.map((format) => workFormatLabels[format]).join(", ")
|
||||
)}
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<Card as="section" tone="inset" className={styles.why} labelledBy={`${headingId}-why`}>
|
||||
<h5 id={`${headingId}-why`} className={styles["why-title"]}>
|
||||
Почему в подборке
|
||||
</h5>
|
||||
{sources.length > 0 ? (
|
||||
<ul className={styles["why-list"]}>
|
||||
{sources.map((item) => (
|
||||
<li key={item.code} data-state={item.state}>
|
||||
<span className={styles.sign} aria-hidden="true">
|
||||
{stateSigns[item.state]}
|
||||
</span>
|
||||
<span className={styles["why-text"]}>
|
||||
<span className={styles["why-label"]}>{item.label}</span>
|
||||
<span className={styles["why-state"]}>{item.stateLabel}</span>
|
||||
</span>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
context.workFormats.map((format) => workFormatLabels[format]).join(", ")
|
||||
<p className={styles.unknown}>Сервер не вернул пояснений по источникам.</p>
|
||||
)}
|
||||
</dd>
|
||||
<dt>Зарплатные ожидания</dt>
|
||||
<dd>
|
||||
{context.salaryCompatibility ? (
|
||||
salaryCompatibilityLabels[context.salaryCompatibility]
|
||||
) : (
|
||||
<Unknown />
|
||||
)}
|
||||
</dd>
|
||||
</dl>
|
||||
<section className={styles.sources} aria-label="Источники подтверждения и пробелы">
|
||||
<h5 className={styles["sources-title"]}>Источники подтверждения и пробелы</h5>
|
||||
{sources.length > 0 ? (
|
||||
<ul>
|
||||
{sources.map((item) => (
|
||||
<li key={item.code}>
|
||||
<span className={styles["source-label"]}>{item.label}</span>
|
||||
<TrustLevel level={stateLevels[item.state]} label={item.stateLabel} />
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
) : (
|
||||
<p className={styles.unknown}>Сервер не вернул пояснений по источникам.</p>
|
||||
)}
|
||||
</section>
|
||||
</Card>
|
||||
</div>
|
||||
{actions ? <div className={styles.actions}>{actions}</div> : null}
|
||||
{children ? <div className={styles.panels}>{children}</div> : null}
|
||||
</article>
|
||||
|
||||
@@ -8,6 +8,10 @@
|
||||
background: var(--color-canvas);
|
||||
}
|
||||
|
||||
.panel:focus-visible {
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.title {
|
||||
margin: 0;
|
||||
font-size: var(--font-size-m);
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
.form {
|
||||
display: grid;
|
||||
gap: var(--space-4);
|
||||
gap: var(--space-5);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.title {
|
||||
color: var(--color-text-strong);
|
||||
font-size: var(--font-size-l);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.field,
|
||||
.group {
|
||||
.field {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
min-width: 0;
|
||||
@@ -18,6 +17,8 @@
|
||||
|
||||
.field label,
|
||||
.group legend {
|
||||
color: var(--color-text);
|
||||
font-size: var(--font-size-s);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
@@ -25,12 +26,7 @@
|
||||
.field textarea {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: var(--space-3);
|
||||
border: var(--line-thin) solid var(--color-border-strong);
|
||||
border-radius: var(--radius-s);
|
||||
color: var(--color-text);
|
||||
background: var(--color-surface);
|
||||
font: inherit;
|
||||
line-height: var(--line-height-body);
|
||||
}
|
||||
|
||||
@@ -38,25 +34,33 @@
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.field input:focus-visible,
|
||||
.field textarea:focus-visible {
|
||||
outline: var(--line-strong) solid var(--color-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.field input[aria-invalid="true"],
|
||||
.field textarea[aria-invalid="true"] {
|
||||
border-color: var(--color-danger);
|
||||
}
|
||||
|
||||
/* A group of related fields: a mono legend over a hairline, no frame. */
|
||||
.group {
|
||||
padding: var(--space-4);
|
||||
border: var(--line-thin) solid var(--color-divider);
|
||||
border-radius: var(--radius-m);
|
||||
display: grid;
|
||||
gap: var(--space-4);
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
padding: var(--space-5) 0 0;
|
||||
border: 0;
|
||||
border-top: var(--line-thin) solid var(--color-divider);
|
||||
}
|
||||
|
||||
.group legend {
|
||||
padding: 0;
|
||||
color: var(--color-text-strong);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-m);
|
||||
font-weight: var(--font-weight-medium);
|
||||
}
|
||||
|
||||
.hint {
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
}
|
||||
|
||||
.representative {
|
||||
@@ -68,26 +72,11 @@
|
||||
border-bottom: var(--line-thin) solid var(--color-divider);
|
||||
}
|
||||
|
||||
.field-error,
|
||||
.action-error {
|
||||
.field-error {
|
||||
margin: 0;
|
||||
color: var(--color-danger);
|
||||
}
|
||||
|
||||
.action-error,
|
||||
.notice,
|
||||
.conflict {
|
||||
padding: var(--space-3);
|
||||
border-left: var(--line-strong) solid var(--color-accent);
|
||||
background: var(--color-canvas);
|
||||
}
|
||||
|
||||
.conflict {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.conflict h3 {
|
||||
font-weight: var(--font-weight-bold);
|
||||
font-size: var(--font-size-s);
|
||||
font-weight: var(--font-weight-medium);
|
||||
}
|
||||
|
||||
.actions {
|
||||
@@ -102,9 +91,3 @@
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
@media (width < 30rem) {
|
||||
.group {
|
||||
padding: var(--space-3);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ import {
|
||||
} from "../../../shared/api/endpoints/identity/identity";
|
||||
import { ApiRequestError } from "../../../shared/api";
|
||||
import type { Organization, OrganizationCreate, Session } from "../../../shared/api/schemas";
|
||||
import { Button, SavingStatus } from "../../../shared/ui";
|
||||
import { Button, Notice, SavingStatus } from "../../../shared/ui";
|
||||
import {
|
||||
buildCompanyCreateBody,
|
||||
buildCompanyUpdateBody,
|
||||
@@ -359,10 +359,10 @@ export function CompanyEditor({ organization, onSaved, onAccessLost }: CompanyEd
|
||||
<form className={styles.form} onSubmit={submit} noValidate>
|
||||
{creating ? <h2 className={styles.title}>Основные данные компании</h2> : null}
|
||||
{createRequestIsFrozen ? (
|
||||
<p className={styles.notice} role="status">
|
||||
<Notice tone="info" role="status">
|
||||
Запрос создания хранится только на этой странице. Не меняйте данные до подтверждения
|
||||
ответа.
|
||||
</p>
|
||||
</Notice>
|
||||
) : null}
|
||||
<div className={styles.field}>
|
||||
<label htmlFor={`${id}-name`}>Название компании</label>
|
||||
@@ -521,32 +521,42 @@ export function CompanyEditor({ organization, onSaved, onAccessLost }: CompanyEd
|
||||
</fieldset>
|
||||
|
||||
{conflict ? (
|
||||
<div className={styles.conflict} role="status">
|
||||
<h3>Компания изменилась</h3>
|
||||
<p>
|
||||
Черновик оставлен. Прочитайте текущие данные, проверьте изменения и подтвердите
|
||||
повторное сохранение.
|
||||
</p>
|
||||
<Button variant="secondary" isBusy={isSaving} onClick={() => void reloadCurrentVersion()}>
|
||||
Прочитать текущую версию
|
||||
</Button>
|
||||
</div>
|
||||
<Notice
|
||||
tone="info"
|
||||
role="status"
|
||||
title="Компания изменилась"
|
||||
action={
|
||||
<Button
|
||||
variant="secondary"
|
||||
isBusy={isSaving}
|
||||
onClick={() => void reloadCurrentVersion()}
|
||||
>
|
||||
Прочитать текущую версию
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
Черновик оставлен. Прочитайте текущие данные, проверьте изменения и подтвердите повторное
|
||||
сохранение.
|
||||
</Notice>
|
||||
) : null}
|
||||
{reviewRequired ? (
|
||||
<div className={styles.conflict} role="status">
|
||||
<p>
|
||||
Текущая версия загружена. Ваши измененные поля сохранены в черновике; проверьте их перед
|
||||
повторной отправкой.
|
||||
</p>
|
||||
<Button variant="secondary" onClick={() => setReviewRequired(false)}>
|
||||
Я проверил черновик
|
||||
</Button>
|
||||
</div>
|
||||
<Notice
|
||||
tone="info"
|
||||
role="status"
|
||||
action={
|
||||
<Button variant="secondary" onClick={() => setReviewRequired(false)}>
|
||||
Я проверил черновик
|
||||
</Button>
|
||||
}
|
||||
>
|
||||
Текущая версия загружена. Ваши измененные поля сохранены в черновике; проверьте их перед
|
||||
повторной отправкой.
|
||||
</Notice>
|
||||
) : null}
|
||||
{errorMessage ? (
|
||||
<p className={styles["action-error"]} role="alert">
|
||||
<Notice tone="danger" role="alert">
|
||||
{errorMessage}
|
||||
</p>
|
||||
</Notice>
|
||||
) : null}
|
||||
<div className={styles.actions}>
|
||||
<Button
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { emptyNeedForm, type NeedFormField } from "../../../entities/need";
|
||||
import {
|
||||
describeSalary,
|
||||
firstErrorStep,
|
||||
lastNeedStep,
|
||||
needStepOfField,
|
||||
needSteps,
|
||||
pendingSuggestionCount,
|
||||
} from "./steps";
|
||||
|
||||
describe("need editor steps", () => {
|
||||
it("ends with the review step, the only one that saves", () => {
|
||||
expect(needSteps.map((step) => step.id)).toEqual([
|
||||
"role",
|
||||
"skills",
|
||||
"tasks",
|
||||
"conditions",
|
||||
"review",
|
||||
]);
|
||||
expect(lastNeedStep).toBe(4);
|
||||
});
|
||||
|
||||
it("maps every form field to a step before the review", () => {
|
||||
const fields = Object.keys(needStepOfField) as NeedFormField[];
|
||||
expect(fields).toHaveLength(Object.keys(emptyNeedForm()).length);
|
||||
for (const field of fields) {
|
||||
expect(needStepOfField[field]).toBeLessThan(lastNeedStep);
|
||||
}
|
||||
});
|
||||
|
||||
it("opens the earliest step that holds an error", () => {
|
||||
expect(firstErrorStep({})).toBeNull();
|
||||
expect(firstErrorStep({ salary: "x", requiredSkills: "y" })).toBe(1);
|
||||
expect(firstErrorStep({ title: "x", salary: "y" })).toBe(0);
|
||||
expect(firstErrorStep({ title: "" })).toBeNull();
|
||||
});
|
||||
|
||||
it("counts only unconfirmed suggestions", () => {
|
||||
expect(pendingSuggestionCount(emptyNeedForm())).toBe(0);
|
||||
const form = {
|
||||
...emptyNeedForm(),
|
||||
grade: {
|
||||
status: "extracted" as const,
|
||||
value: "middle" as const,
|
||||
source: {
|
||||
origin: "extracted_from_text" as const,
|
||||
quote: null,
|
||||
extractedInVersion: 1,
|
||||
extractionVersion: "r1",
|
||||
},
|
||||
},
|
||||
};
|
||||
expect(pendingSuggestionCount(form)).toBe(1);
|
||||
});
|
||||
|
||||
it("writes a salary range with grouped thousands and the tax basis", () => {
|
||||
const text = describeSalary({
|
||||
from: 100000,
|
||||
to: 130000,
|
||||
currency: "RUB",
|
||||
period: "month",
|
||||
taxBasis: "net",
|
||||
});
|
||||
expect(text.replaceAll(/\s/g, " ")).toBe("от 100 000 до 130 000 ₽ в месяц, после налога");
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,105 @@
|
||||
import type { NeedFormField, NeedFormValues, NeedSalaryValue } from "../../../entities/need";
|
||||
|
||||
// The steps of the need editor. The order is the order of the form: who is
|
||||
// needed, which skills, what the team does, under which conditions, and a
|
||||
// final check before the save. Only the last step saves anything.
|
||||
|
||||
export type NeedStepId = "role" | "skills" | "tasks" | "conditions" | "review";
|
||||
|
||||
export type NeedStepDefinition = {
|
||||
id: NeedStepId;
|
||||
/** Short label in the stepper. */
|
||||
label: string;
|
||||
/** Heading of the step panel. */
|
||||
title: string;
|
||||
/** One line under the heading that says what the step asks for. */
|
||||
lead: string;
|
||||
};
|
||||
|
||||
export const needSteps: readonly NeedStepDefinition[] = [
|
||||
{
|
||||
id: "role",
|
||||
label: "Роль",
|
||||
title: "Роль и грейд",
|
||||
lead: "Назовите потребность и выберите специализацию и грейд. Описание работы можно вставить текстом: сервер предложит значения, а вы их подтвердите.",
|
||||
},
|
||||
{
|
||||
id: "skills",
|
||||
label: "Навыки",
|
||||
title: "Навыки",
|
||||
lead: "Разделите навыки на обязательные и желательные. Предложенное из текста станет данными потребности только после подтверждения.",
|
||||
},
|
||||
{
|
||||
id: "tasks",
|
||||
label: "Задачи",
|
||||
title: "Задачи и область",
|
||||
lead: "Опишите, чем займется специалист, и назовите область работы команды.",
|
||||
},
|
||||
{
|
||||
id: "conditions",
|
||||
label: "Условия",
|
||||
title: "Условия работы",
|
||||
lead: "Формат, место и вилка зарплаты. Без явной базы налога вилка не сохраняется.",
|
||||
},
|
||||
{
|
||||
id: "review",
|
||||
label: "Итог",
|
||||
title: "Проверка и сохранение",
|
||||
lead: "Просмотрите данные по шагам. Сохранение создает новую версию потребности.",
|
||||
},
|
||||
];
|
||||
|
||||
export const lastNeedStep = needSteps.length - 1;
|
||||
|
||||
/** The step that shows each field of the form. */
|
||||
export const needStepOfField: Readonly<Record<NeedFormField, number>> = {
|
||||
title: 0,
|
||||
vacancyId: 0,
|
||||
sourceText: 0,
|
||||
specialization: 0,
|
||||
grade: 0,
|
||||
requiredSkills: 1,
|
||||
desiredSkills: 1,
|
||||
tasks: 2,
|
||||
domain: 2,
|
||||
workFormats: 3,
|
||||
location: 3,
|
||||
salary: 3,
|
||||
};
|
||||
|
||||
/** Earliest step that holds a field with an error, or null when there is none. */
|
||||
export function firstErrorStep(errors: Partial<Record<NeedFormField, string>>): number | null {
|
||||
const steps = (Object.keys(errors) as NeedFormField[])
|
||||
.filter((field) => Boolean(errors[field]))
|
||||
.map((field) => needStepOfField[field]);
|
||||
return steps.length === 0 ? null : Math.min(...steps);
|
||||
}
|
||||
|
||||
/** Number of values that the server suggested and nobody confirmed yet. */
|
||||
export function pendingSuggestionCount(values: NeedFormValues): number {
|
||||
const scalars = [
|
||||
values.specialization,
|
||||
values.grade,
|
||||
values.domain,
|
||||
values.workFormats,
|
||||
values.location,
|
||||
values.salary,
|
||||
].filter((state) => state.status === "extracted").length;
|
||||
const lists = [...values.requiredSkills, ...values.desiredSkills, ...values.tasks].filter(
|
||||
(item) => item.status === "extracted",
|
||||
).length;
|
||||
return scalars + lists;
|
||||
}
|
||||
|
||||
const rubles = new Intl.NumberFormat("ru-RU", { maximumFractionDigits: 0 });
|
||||
|
||||
/** Whole rubles with a non-breaking thousands separator, for example "100 000". */
|
||||
export function formatRubles(value: number): string {
|
||||
return rubles.format(value);
|
||||
}
|
||||
|
||||
/** A salary range as one line, for example "от 100 000 до 130 000 ₽ в месяц, после налога". */
|
||||
export function describeSalary(salary: NeedSalaryValue): string {
|
||||
const basis = salary.taxBasis === "net" ? "после налога" : "до налога";
|
||||
return `от ${formatRubles(salary.from)} до ${formatRubles(salary.to)} ₽ в месяц, ${basis}`;
|
||||
}
|
||||
@@ -0,0 +1,262 @@
|
||||
import type { ReactNode } from "react";
|
||||
import type { Need, NeedFieldName } from "../../../shared/api/schemas";
|
||||
import type { NeedFieldState, NeedFormValues, NeedSkillList } from "../../../entities/need";
|
||||
import { Button, Card, Notice, Tag } from "../../../shared/ui";
|
||||
import styles from "./need-editor.module.css";
|
||||
|
||||
// Presentational parts of the need editor: field messages, the provenance of
|
||||
// a stored value, and the editable lists of skills and tasks. They hold no
|
||||
// state; the editor owns the draft and passes callbacks.
|
||||
|
||||
function labelForState(state: NeedFieldState<unknown>): string {
|
||||
switch (state.status) {
|
||||
case "unknown":
|
||||
return "Не указано";
|
||||
case "extracted":
|
||||
return "Предложено из текста";
|
||||
case "confirmed":
|
||||
return state.source?.origin === "extracted_from_text"
|
||||
? "Подтверждено"
|
||||
: "Подтверждено вручную";
|
||||
}
|
||||
}
|
||||
|
||||
/** The message under a field; the id is referenced by aria-describedby of the control. */
|
||||
export function FieldError({ id, children }: { id: string; children: ReactNode }) {
|
||||
return (
|
||||
<p className={styles["field-error"]} id={id}>
|
||||
{children}
|
||||
</p>
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Where a stored value came from: a status tag, the quote of the need text it
|
||||
* was taken from, and the version of the parsing rules. An unknown value shows nothing.
|
||||
*/
|
||||
export function ProvenanceNote({ state }: { state: NeedFieldState<unknown> }) {
|
||||
// An unknown value has no provenance; the empty control already says so.
|
||||
if (state.status === "unknown") return null;
|
||||
return (
|
||||
<div className={styles.provenance}>
|
||||
<Tag tone={state.status === "extracted" ? "accent" : "success"}>{labelForState(state)}</Tag>
|
||||
{state.source?.quote ? (
|
||||
<blockquote className={styles.quote}>{state.source.quote}</blockquote>
|
||||
) : null}
|
||||
{state.source?.extractionVersion ? (
|
||||
<p className={styles.meta}>Правила разбора: {state.source.extractionVersion}</p>
|
||||
) : null}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
/** The server's question about a field that is still unknown. */
|
||||
export function FieldQuestion({ need, field }: { need: Need | null; field: NeedFieldName }) {
|
||||
const missing = need?.readiness.missing_fields.find((item) => item.field === field);
|
||||
return missing ? <Notice tone="info">{missing.question}</Notice> : null;
|
||||
}
|
||||
|
||||
type SkillListProps = {
|
||||
id: string;
|
||||
title: string;
|
||||
list: NeedSkillList;
|
||||
items: NeedFormValues[NeedSkillList];
|
||||
error: string | undefined;
|
||||
disabled: boolean;
|
||||
onConfirm: (index: number) => void;
|
||||
onRename: (index: number, name: string) => void;
|
||||
onRemove: (index: number) => void;
|
||||
onMove: (index: number) => void;
|
||||
onAdd: (list: NeedSkillList, input: HTMLInputElement) => void;
|
||||
};
|
||||
|
||||
/** One list of skills: each row is editable, confirmable, movable, and removable. */
|
||||
export function SkillList({
|
||||
id,
|
||||
title,
|
||||
list,
|
||||
items,
|
||||
error,
|
||||
disabled,
|
||||
onConfirm,
|
||||
onRename,
|
||||
onRemove,
|
||||
onMove,
|
||||
onAdd,
|
||||
}: SkillListProps) {
|
||||
return (
|
||||
<section className={styles.list} aria-labelledby={`${id}-heading`}>
|
||||
<h3 id={`${id}-heading`} className={styles["list-title"]}>
|
||||
{title}
|
||||
</h3>
|
||||
{items.length === 0 ? <p className={styles.hint}>Навыки не указаны.</p> : null}
|
||||
<ul className={styles.items}>
|
||||
{items.map((item, index) => (
|
||||
<Card
|
||||
as="li"
|
||||
tone="inset"
|
||||
key={`${item.name.toLocaleLowerCase("ru-RU")}:${index}`}
|
||||
className={styles.item}
|
||||
>
|
||||
<div className={styles["item-main"]}>
|
||||
<label className={styles["sr-only"]} htmlFor={`${id}-${index}`}>
|
||||
Навык
|
||||
</label>
|
||||
<input
|
||||
id={`${id}-${index}`}
|
||||
className={styles["item-input"]}
|
||||
maxLength={100}
|
||||
value={item.name}
|
||||
disabled={disabled}
|
||||
onChange={(event) => onRename(index, event.currentTarget.value)}
|
||||
/>
|
||||
<Tag tone={item.status === "extracted" ? "accent" : "success"}>
|
||||
{item.status === "extracted" ? "Предложено" : "Подтверждено"}
|
||||
</Tag>
|
||||
</div>
|
||||
{item.stored?.source.quote ? (
|
||||
<blockquote className={styles.quote}>{item.stored.source.quote}</blockquote>
|
||||
) : null}
|
||||
{item.stored?.source.extractionVersion ? (
|
||||
<p className={styles.meta}>Правила разбора: {item.stored.source.extractionVersion}</p>
|
||||
) : null}
|
||||
<div className={styles["item-actions"]}>
|
||||
{item.status === "extracted" ? (
|
||||
<Button variant="quiet" disabled={disabled} onClick={() => onConfirm(index)}>
|
||||
Подтвердить
|
||||
</Button>
|
||||
) : null}
|
||||
<Button variant="quiet" disabled={disabled} onClick={() => onMove(index)}>
|
||||
{list === "requiredSkills" ? "Сделать желательным" : "Сделать обязательным"}
|
||||
</Button>
|
||||
<Button variant="quiet" disabled={disabled} onClick={() => onRemove(index)}>
|
||||
Удалить
|
||||
</Button>
|
||||
</div>
|
||||
</Card>
|
||||
))}
|
||||
</ul>
|
||||
<div className={styles["add-row"]}>
|
||||
<label htmlFor={`${id}-add`}>Добавить навык</label>
|
||||
<input
|
||||
id={`${id}-add`}
|
||||
maxLength={100}
|
||||
disabled={disabled}
|
||||
aria-invalid={Boolean(error) || undefined}
|
||||
aria-describedby={error ? `${id}-error` : undefined}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === "Enter") {
|
||||
event.preventDefault();
|
||||
onAdd(list, event.currentTarget);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
variant="secondary"
|
||||
disabled={disabled}
|
||||
onClick={(event) => {
|
||||
const input = event.currentTarget.parentElement?.querySelector("input");
|
||||
if (input instanceof HTMLInputElement) onAdd(list, input);
|
||||
}}
|
||||
>
|
||||
Добавить
|
||||
</Button>
|
||||
</div>
|
||||
{error ? <FieldError id={`${id}-error`}>{error}</FieldError> : null}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
|
||||
type TaskListProps = {
|
||||
id: string;
|
||||
items: NeedFormValues["tasks"];
|
||||
error: string | undefined;
|
||||
disabled: boolean;
|
||||
onConfirm: (index: number) => void;
|
||||
onEdit: (index: number, text: string) => void;
|
||||
onRemove: (index: number) => void;
|
||||
onAdd: (input: HTMLInputElement) => void;
|
||||
};
|
||||
|
||||
/** The tasks of the team, editable in the same way as a skill list. */
|
||||
export function TaskList({
|
||||
id,
|
||||
items,
|
||||
error,
|
||||
disabled,
|
||||
onConfirm,
|
||||
onEdit,
|
||||
onRemove,
|
||||
onAdd,
|
||||
}: TaskListProps) {
|
||||
return (
|
||||
<section className={styles.list} aria-labelledby={`${id}-heading`}>
|
||||
<h3 id={`${id}-heading`} className={styles["list-title"]}>
|
||||
Задачи команды
|
||||
</h3>
|
||||
{items.length === 0 ? <p className={styles.hint}>Задачи не указаны.</p> : null}
|
||||
<ul className={styles.items}>
|
||||
{items.map((item, index) => (
|
||||
<Card as="li" tone="inset" key={`${item.text}:${index}`} className={styles.item}>
|
||||
<div className={styles["item-main"]}>
|
||||
<label className={styles["sr-only"]} htmlFor={`${id}-${index}`}>
|
||||
Задача
|
||||
</label>
|
||||
<input
|
||||
id={`${id}-${index}`}
|
||||
className={styles["item-input"]}
|
||||
maxLength={300}
|
||||
value={item.text}
|
||||
disabled={disabled}
|
||||
onChange={(event) => onEdit(index, event.currentTarget.value)}
|
||||
/>
|
||||
<Tag tone={item.status === "extracted" ? "accent" : "success"}>
|
||||
{item.status === "extracted" ? "Предложено" : "Подтверждено"}
|
||||
</Tag>
|
||||
</div>
|
||||
{item.stored?.source.quote ? (
|
||||
<blockquote className={styles.quote}>{item.stored.source.quote}</blockquote>
|
||||
) : null}
|
||||
<div className={styles["item-actions"]}>
|
||||
{item.status === "extracted" ? (
|
||||
<Button variant="quiet" disabled={disabled} onClick={() => onConfirm(index)}>
|
||||
Подтвердить
|
||||
</Button>
|
||||
) : null}
|
||||
<Button variant="quiet" disabled={disabled} onClick={() => onRemove(index)}>
|
||||
Удалить
|
||||
</Button>
|
||||
</div>
|
||||
</Card>
|
||||
))}
|
||||
</ul>
|
||||
<div className={styles["add-row"]}>
|
||||
<label htmlFor={`${id}-add`}>Добавить задачу</label>
|
||||
<input
|
||||
id={`${id}-add`}
|
||||
maxLength={300}
|
||||
disabled={disabled}
|
||||
aria-invalid={Boolean(error) || undefined}
|
||||
aria-describedby={error ? `${id}-error` : undefined}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key === "Enter") {
|
||||
event.preventDefault();
|
||||
onAdd(event.currentTarget);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
<Button
|
||||
variant="secondary"
|
||||
disabled={disabled}
|
||||
onClick={(event) => {
|
||||
const input = event.currentTarget.parentElement?.querySelector("input");
|
||||
if (input instanceof HTMLInputElement) onAdd(input);
|
||||
}}
|
||||
>
|
||||
Добавить
|
||||
</Button>
|
||||
</div>
|
||||
{error ? <FieldError id={`${id}-error`}>{error}</FieldError> : null}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -4,155 +4,172 @@
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.intro,
|
||||
.hint,
|
||||
.meta,
|
||||
.provenance,
|
||||
.question {
|
||||
.intro {
|
||||
display: grid;
|
||||
gap: var(--space-1);
|
||||
max-width: 46rem;
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
.hint,
|
||||
.provenance,
|
||||
.question,
|
||||
.field-error,
|
||||
.action-error,
|
||||
.meta {
|
||||
margin: 0;
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
}
|
||||
|
||||
.group,
|
||||
.salary,
|
||||
.conflict,
|
||||
.recommendations,
|
||||
.list {
|
||||
/* The form and a sticky summary side by side once the work area is wide
|
||||
* enough; below that the summary follows the form. */
|
||||
.layout {
|
||||
display: grid;
|
||||
gap: var(--space-5);
|
||||
align-items: start;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.main,
|
||||
.aside {
|
||||
display: grid;
|
||||
gap: var(--space-4);
|
||||
min-width: 0;
|
||||
padding: var(--space-4);
|
||||
border: var(--line-thin) solid var(--color-divider);
|
||||
border-radius: var(--radius-m);
|
||||
}
|
||||
|
||||
.group legend,
|
||||
.work-formats legend {
|
||||
padding: 0 var(--space-2);
|
||||
font-weight: var(--font-weight-bold);
|
||||
@media (width >= 75rem) {
|
||||
.layout {
|
||||
grid-template-columns: minmax(0, 1fr) 19rem;
|
||||
}
|
||||
|
||||
.aside {
|
||||
position: sticky;
|
||||
top: var(--space-5);
|
||||
}
|
||||
}
|
||||
|
||||
.panels {
|
||||
gap: var(--space-5);
|
||||
padding: var(--space-4);
|
||||
}
|
||||
|
||||
@media (width >= 48rem) {
|
||||
.panels {
|
||||
padding: var(--space-5);
|
||||
}
|
||||
}
|
||||
|
||||
.panel {
|
||||
display: grid;
|
||||
gap: var(--space-5);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.panel[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.panel-head {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
padding-bottom: var(--space-4);
|
||||
border-bottom: var(--line-thin) solid var(--color-divider);
|
||||
}
|
||||
|
||||
.panel-title {
|
||||
color: var(--color-text-strong);
|
||||
font-size: var(--font-size-xl);
|
||||
}
|
||||
|
||||
.lead {
|
||||
max-width: 42rem;
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
}
|
||||
|
||||
.fields {
|
||||
display: grid;
|
||||
gap: var(--space-5);
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.field {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
align-content: start;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.field label,
|
||||
.add-row label,
|
||||
.skill-label {
|
||||
.field > label,
|
||||
.add-row > label,
|
||||
.chip-group > legend {
|
||||
color: var(--color-text);
|
||||
font-size: var(--font-size-s);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.field input,
|
||||
.field select,
|
||||
.field textarea,
|
||||
.item input,
|
||||
.field :is(input, select, textarea),
|
||||
.add-row input {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: var(--space-3);
|
||||
border: var(--line-thin) solid var(--color-border-strong);
|
||||
border-radius: var(--radius-s);
|
||||
color: var(--color-text);
|
||||
background: var(--color-surface);
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.add-row input {
|
||||
flex: 1 1 14rem;
|
||||
}
|
||||
|
||||
.field textarea {
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.field :is(input, select, textarea):focus-visible,
|
||||
.item input:focus-visible,
|
||||
.add-row input:focus-visible {
|
||||
outline: var(--line-strong) solid var(--color-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.field [aria-invalid="true"] {
|
||||
.field [aria-invalid="true"],
|
||||
.add-row [aria-invalid="true"] {
|
||||
border-color: var(--color-danger);
|
||||
}
|
||||
|
||||
.field-error {
|
||||
margin: 0;
|
||||
color: var(--color-danger);
|
||||
font-size: var(--font-size-s);
|
||||
font-weight: var(--font-weight-medium);
|
||||
}
|
||||
|
||||
.confirm-field {
|
||||
justify-self: start;
|
||||
}
|
||||
|
||||
.notice-title {
|
||||
color: var(--color-text-strong);
|
||||
font-size: 0.9375rem;
|
||||
}
|
||||
|
||||
/* Provenance of a stored value: a status tag and, when the server tied one,
|
||||
* the excerpt of the need text. */
|
||||
.provenance {
|
||||
display: grid;
|
||||
gap: var(--space-1);
|
||||
font-size: var(--font-size-s);
|
||||
gap: var(--space-2);
|
||||
justify-items: start;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.provenance p,
|
||||
.provenance blockquote,
|
||||
.item blockquote {
|
||||
.quote {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.provenance blockquote,
|
||||
.item blockquote {
|
||||
padding-inline-start: var(--space-3);
|
||||
border-inline-start: var(--line-strong) solid var(--color-divider);
|
||||
border-inline-start: var(--line-strong) solid var(--color-accent);
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.question {
|
||||
padding: var(--space-3);
|
||||
border-inline-start: var(--line-strong) solid var(--color-accent);
|
||||
background: var(--color-canvas);
|
||||
}
|
||||
|
||||
.field-error,
|
||||
.action-error {
|
||||
color: var(--color-danger);
|
||||
}
|
||||
|
||||
.work-formats {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
.list {
|
||||
display: grid;
|
||||
gap: var(--space-3);
|
||||
min-width: 0;
|
||||
padding: var(--space-3);
|
||||
border: var(--line-thin) solid var(--color-divider);
|
||||
border-radius: var(--radius-s);
|
||||
}
|
||||
|
||||
.work-formats label {
|
||||
display: inline-flex;
|
||||
gap: var(--space-2);
|
||||
align-items: center;
|
||||
.list-title {
|
||||
color: var(--color-text-strong);
|
||||
font-size: var(--font-size-m);
|
||||
}
|
||||
|
||||
.work-formats .provenance,
|
||||
.work-formats .question {
|
||||
flex-basis: 100%;
|
||||
}
|
||||
|
||||
.salary-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: var(--space-3);
|
||||
}
|
||||
|
||||
.actions,
|
||||
.add-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.list ul {
|
||||
.items {
|
||||
display: grid;
|
||||
gap: var(--space-3);
|
||||
margin: 0;
|
||||
@@ -161,42 +178,272 @@
|
||||
}
|
||||
|
||||
.item {
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.item-main {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: var(--space-3);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.item-input {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
border: var(--line-thin) solid var(--color-border-strong);
|
||||
}
|
||||
|
||||
.item-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0 var(--space-3);
|
||||
}
|
||||
|
||||
.add-row {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: var(--space-2);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.add-row > label {
|
||||
grid-column: 1 / -1;
|
||||
}
|
||||
|
||||
.sr-only {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip-path: inset(50%);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
/* Work format as filter chips: a native checkbox under a capsule. A checked
|
||||
* chip is blue with a check mark, so the state is not carried by color alone. */
|
||||
.chip-group {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
min-width: 0;
|
||||
padding: var(--space-3);
|
||||
border: var(--line-thin) solid var(--color-divider);
|
||||
border-radius: var(--radius-s);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.badge {
|
||||
width: fit-content;
|
||||
padding: var(--space-1) var(--space-2);
|
||||
border-radius: var(--radius-s);
|
||||
.chip-group > legend {
|
||||
padding: 0;
|
||||
margin-bottom: var(--space-2);
|
||||
}
|
||||
|
||||
.chip-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.chip {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
.chip input[type="checkbox"] {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.chip span {
|
||||
display: inline-flex;
|
||||
gap: 0.375rem;
|
||||
align-items: center;
|
||||
min-height: 2.5rem;
|
||||
padding: 0 var(--space-4);
|
||||
border: var(--line-thin) solid var(--color-border-strong);
|
||||
border-radius: var(--radius-pill);
|
||||
color: var(--color-text);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-s);
|
||||
font-weight: var(--font-weight-medium);
|
||||
background: var(--color-surface);
|
||||
transition:
|
||||
background-color var(--duration-fast) var(--easing-standard),
|
||||
border-color var(--duration-fast) var(--easing-standard);
|
||||
}
|
||||
|
||||
.chip span::before {
|
||||
content: "+";
|
||||
color: var(--color-text-secondary);
|
||||
background: var(--color-canvas);
|
||||
font-size: var(--font-size-s);
|
||||
}
|
||||
|
||||
.conflict {
|
||||
border-color: var(--color-accent);
|
||||
background: var(--color-canvas);
|
||||
.chip input:checked + span {
|
||||
border-color: var(--color-action);
|
||||
color: var(--color-on-action);
|
||||
background: var(--color-action);
|
||||
}
|
||||
|
||||
.meta {
|
||||
font-size: var(--font-size-s);
|
||||
.chip input:checked + span::before {
|
||||
content: "✓";
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.chip input:focus-visible + span {
|
||||
outline: var(--focus-ring-width) solid var(--color-focus-ring);
|
||||
outline-offset: var(--focus-ring-offset);
|
||||
}
|
||||
|
||||
.chip:hover input:not(:checked, :focus-visible) + span {
|
||||
background: var(--color-surface-tint-hover);
|
||||
}
|
||||
|
||||
.salary-box {
|
||||
gap: var(--space-3);
|
||||
}
|
||||
|
||||
.salary-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, minmax(0, 1fr));
|
||||
gap: var(--space-3);
|
||||
}
|
||||
|
||||
@media (width < 42rem) {
|
||||
.salary-grid {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
|
||||
.group,
|
||||
.salary,
|
||||
.conflict,
|
||||
.recommendations,
|
||||
.list {
|
||||
padding: var(--space-3);
|
||||
.salary-line {
|
||||
color: var(--color-text-strong);
|
||||
font-size: var(--font-size-l);
|
||||
}
|
||||
|
||||
.summary-salary {
|
||||
color: var(--color-text-strong);
|
||||
font-size: var(--font-size-m);
|
||||
}
|
||||
|
||||
.chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-3);
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.actions-side {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.eyebrow {
|
||||
color: var(--color-text-secondary);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-xs);
|
||||
font-weight: var(--font-weight-medium);
|
||||
letter-spacing: var(--letter-spacing-label);
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.summary-title {
|
||||
color: var(--color-text-strong);
|
||||
font-size: var(--font-size-l);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.summary-title[data-empty] {
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
.summary-facts {
|
||||
display: grid;
|
||||
gap: var(--space-3);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.summary-facts dt {
|
||||
margin-bottom: var(--space-1);
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-xs);
|
||||
}
|
||||
|
||||
.summary-facts dd {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.category-list {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.category-list li {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2) var(--space-3);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.review {
|
||||
display: grid;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.review-row {
|
||||
display: grid;
|
||||
grid-template-columns: 8rem minmax(0, 1fr);
|
||||
gap: var(--space-1) var(--space-4);
|
||||
align-items: start;
|
||||
padding: var(--space-3) 0;
|
||||
border-bottom: var(--line-thin) solid var(--color-divider);
|
||||
}
|
||||
|
||||
.review-row > dt {
|
||||
padding-top: var(--space-2);
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
}
|
||||
|
||||
.review-row > dd {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(0, 1fr) auto;
|
||||
gap: var(--space-1) var(--space-3);
|
||||
align-items: start;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.review-value {
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.review-list {
|
||||
display: grid;
|
||||
gap: var(--space-1);
|
||||
margin: 0;
|
||||
padding-inline-start: var(--space-4);
|
||||
}
|
||||
|
||||
@media (width < 30rem) {
|
||||
.review-row {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.review-row > dt {
|
||||
padding-top: 0;
|
||||
}
|
||||
}
|
||||
@@ -65,11 +65,45 @@ describe("NeedEditor", () => {
|
||||
expect(markup).toContain("Какой грейд нужен");
|
||||
expect(markup).toContain("в какой базе");
|
||||
expect(markup).toContain("Вакансия для сохранения потребности не требуется.");
|
||||
expect(markup).toMatch(
|
||||
/<select id="[^"]+-grade" aria-invalid="false"><option value="" selected="">Не указано/,
|
||||
// An unknown grade is a real choice, not a default: "not set" is the checked radio.
|
||||
expect(markup).toMatch(/type="radio"[^>]*checked=""[^>]*value="none"/);
|
||||
expect(markup).not.toMatch(
|
||||
/type="radio"[^>]*checked=""[^>]*value="(intern|junior|middle|senior)"/,
|
||||
);
|
||||
});
|
||||
|
||||
it("splits the form into five steps and opens only the first", () => {
|
||||
const markup = renderEditor(need);
|
||||
|
||||
expect(markup).toContain("Шаг 1 из 5");
|
||||
for (const label of ["Роль", "Навыки", "Задачи", "Условия", "Итог"]) {
|
||||
expect(markup).toContain(label);
|
||||
}
|
||||
for (const title of [
|
||||
"Роль и грейд",
|
||||
"Навыки",
|
||||
"Задачи и область",
|
||||
"Условия работы",
|
||||
"Проверка и сохранение",
|
||||
]) {
|
||||
expect(markup).toMatch(new RegExp(`<h2[^>]*tabindex="-1"[^>]*>${title}</h2>`, "i"));
|
||||
}
|
||||
// The other four steps stay mounted but hidden, so going back keeps the draft.
|
||||
expect(markup.match(/<section[^>]*hidden=""/g)).toHaveLength(4);
|
||||
expect(markup).toContain('aria-current="step"');
|
||||
expect(markup).toContain(">Далее<");
|
||||
expect(markup).not.toContain(">Назад<");
|
||||
expect(markup).not.toContain("Сохранить изменения");
|
||||
});
|
||||
|
||||
it("shows the live summary and the recommendation status next to the form", () => {
|
||||
const markup = renderEditor(need);
|
||||
|
||||
expect(markup).toContain("Сводка потребности");
|
||||
expect(markup).toContain("Ждут подтверждения:");
|
||||
expect(markup).toContain("Категории");
|
||||
});
|
||||
|
||||
it("shows pending recommendation status without fabricating categories", () => {
|
||||
const pending: Need = {
|
||||
...need,
|
||||
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,107 @@
|
||||
import { useId } from "react";
|
||||
import type { NeedFormValues } from "../../../entities/need";
|
||||
import { Card, Mono, Tag } from "../../../shared/ui";
|
||||
import { describeSalary, pendingSuggestionCount } from "../model/steps";
|
||||
import styles from "./need-editor.module.css";
|
||||
|
||||
const specializationLabels: Readonly<Record<string, string>> = {
|
||||
backend: "Backend",
|
||||
frontend: "Frontend",
|
||||
mobile: "Мобильная разработка",
|
||||
network_engineer: "Сетевые технологии",
|
||||
devops_sre: "DevOps/SRE",
|
||||
data_analyst: "Аналитика данных",
|
||||
ds_ml: "DS/ML",
|
||||
information_security: "Информационная безопасность",
|
||||
qa: "QA",
|
||||
};
|
||||
|
||||
const gradeLabels: Readonly<Record<string, string>> = {
|
||||
intern: "Стажер",
|
||||
junior: "Junior",
|
||||
middle: "Middle",
|
||||
senior: "Senior",
|
||||
};
|
||||
|
||||
type NeedSummaryProps = {
|
||||
values: NeedFormValues;
|
||||
};
|
||||
|
||||
/**
|
||||
* A live card of the need as it stands in the form, shaped like the cards the
|
||||
* employer later reads in search: the role and grade tag, the stack chips, and
|
||||
* the salary in mono. It reads the draft only and sends nothing.
|
||||
*/
|
||||
export function NeedSummary({ values }: NeedSummaryProps) {
|
||||
const headingId = useId();
|
||||
const specialization =
|
||||
values.specialization.status === "unknown"
|
||||
? null
|
||||
: (specializationLabels[values.specialization.value] ?? values.specialization.value);
|
||||
const grade =
|
||||
values.grade.status === "unknown"
|
||||
? null
|
||||
: (gradeLabels[values.grade.value] ?? values.grade.value);
|
||||
const pending = pendingSuggestionCount(values);
|
||||
const title = values.title.trim();
|
||||
|
||||
return (
|
||||
<Card as="section" labelledBy={headingId}>
|
||||
<p className={styles.eyebrow}>Сводка потребности</p>
|
||||
<h2 id={headingId} className={styles["summary-title"]} data-empty={title === "" || undefined}>
|
||||
{title === "" ? "Название не задано" : title}
|
||||
</h2>
|
||||
<div className={styles.chips}>
|
||||
{specialization || grade ? (
|
||||
<Tag tone="grade">{[specialization, grade].filter(Boolean).join(" · ")}</Tag>
|
||||
) : (
|
||||
<Tag>Роль не выбрана</Tag>
|
||||
)}
|
||||
{pending > 0 ? <Tag tone="accent">{`Ждут подтверждения: ${pending}`}</Tag> : null}
|
||||
</div>
|
||||
{values.salary.status === "unknown" ? (
|
||||
<p className={styles.meta}>Вилка не указана</p>
|
||||
) : (
|
||||
<p className={styles["summary-salary"]}>
|
||||
<Mono strong>{describeSalary(values.salary.value)}</Mono>
|
||||
</p>
|
||||
)}
|
||||
<dl className={styles["summary-facts"]}>
|
||||
<div>
|
||||
<dt>Обязательные</dt>
|
||||
<dd>
|
||||
{values.requiredSkills.length === 0 ? (
|
||||
<span className={styles.meta}>Не указаны</span>
|
||||
) : (
|
||||
<span className={styles.chips}>
|
||||
{values.requiredSkills.map((skill, index) => (
|
||||
<Tag key={`${skill.name}:${index}`} tone="stack">
|
||||
{skill.name}
|
||||
</Tag>
|
||||
))}
|
||||
</span>
|
||||
)}
|
||||
</dd>
|
||||
</div>
|
||||
{values.desiredSkills.length > 0 ? (
|
||||
<div>
|
||||
<dt>Желательные</dt>
|
||||
<dd>
|
||||
<span className={styles.chips}>
|
||||
{values.desiredSkills.map((skill, index) => (
|
||||
<Tag key={`${skill.name}:${index}`}>{skill.name}</Tag>
|
||||
))}
|
||||
</span>
|
||||
</dd>
|
||||
</div>
|
||||
) : null}
|
||||
<div>
|
||||
<dt>Задач</dt>
|
||||
<dd>
|
||||
<Mono>{values.tasks.length}</Mono>
|
||||
</dd>
|
||||
</div>
|
||||
</dl>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
/* The search card: the basis of the search, the selects, a row of filter
|
||||
* chips, and the action. It sits above the result and stays on screen as the
|
||||
* working state of the search. */
|
||||
.form {
|
||||
display: grid;
|
||||
gap: var(--space-5);
|
||||
@@ -8,50 +11,62 @@
|
||||
background: var(--color-surface);
|
||||
}
|
||||
|
||||
@media (width >= 48rem) {
|
||||
.form {
|
||||
padding: var(--space-5);
|
||||
}
|
||||
}
|
||||
|
||||
.basis {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr));
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr));
|
||||
gap: var(--space-4);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.field {
|
||||
display: grid;
|
||||
gap: var(--space-1);
|
||||
gap: var(--space-2);
|
||||
align-content: start;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.field label,
|
||||
.group legend {
|
||||
color: var(--color-text);
|
||||
font-size: var(--font-size-s);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.field select {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
min-height: 2.75rem;
|
||||
padding: var(--space-2) var(--space-3);
|
||||
border: var(--line-thin) solid var(--color-border-strong);
|
||||
border-radius: var(--radius-s);
|
||||
color: var(--color-text);
|
||||
background: var(--color-surface);
|
||||
}
|
||||
|
||||
.field select:focus-visible {
|
||||
outline: var(--line-strong) solid var(--color-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.hint {
|
||||
margin: 0;
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
font-size: var(--font-size-xs);
|
||||
}
|
||||
|
||||
.chip-groups {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-4) var(--space-6);
|
||||
min-width: 0;
|
||||
padding-top: var(--space-4);
|
||||
border-top: var(--line-thin) solid var(--color-divider);
|
||||
}
|
||||
|
||||
.group {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
align-content: start;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
@@ -62,31 +77,93 @@
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.choices {
|
||||
.chip-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-1) var(--space-4);
|
||||
}
|
||||
|
||||
.choice {
|
||||
display: inline-flex;
|
||||
gap: var(--space-2);
|
||||
align-items: center;
|
||||
min-height: 2.75rem;
|
||||
}
|
||||
|
||||
.choice input {
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
/* A filter chip is a native checkbox under a capsule. An applied chip is
|
||||
* blue with a check mark, so the state is not carried by color alone. */
|
||||
.chip {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.chip input[type="checkbox"] {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
accent-color: var(--color-action);
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.chip span {
|
||||
display: inline-flex;
|
||||
gap: 0.375rem;
|
||||
align-items: center;
|
||||
min-height: 2.25rem;
|
||||
padding: 0 var(--space-4);
|
||||
border: var(--line-thin) solid var(--color-border-strong);
|
||||
border-radius: var(--radius-pill);
|
||||
color: var(--color-text);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-s);
|
||||
font-weight: var(--font-weight-medium);
|
||||
background: var(--color-canvas);
|
||||
transition:
|
||||
background-color var(--duration-fast) var(--easing-standard),
|
||||
border-color var(--duration-fast) var(--easing-standard);
|
||||
}
|
||||
|
||||
.chip span::before {
|
||||
content: "+";
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
.chip input:checked + span {
|
||||
border-color: var(--color-action);
|
||||
color: var(--color-on-action);
|
||||
background: var(--color-action);
|
||||
}
|
||||
|
||||
.chip input:checked + span::before {
|
||||
content: "✓";
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.chip input:focus-visible + span {
|
||||
outline: var(--focus-ring-width) solid var(--color-focus-ring);
|
||||
outline-offset: var(--focus-ring-offset);
|
||||
}
|
||||
|
||||
.chip:hover input:not(:checked, :focus-visible) + span {
|
||||
background: var(--color-surface-tint-hover);
|
||||
}
|
||||
|
||||
.footer {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-4) var(--space-5);
|
||||
align-items: end;
|
||||
justify-content: space-between;
|
||||
padding-top: var(--space-4);
|
||||
border-top: var(--line-thin) solid var(--color-divider);
|
||||
}
|
||||
|
||||
.notes {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
flex: 1 1 24rem;
|
||||
max-width: 42rem;
|
||||
}
|
||||
|
||||
.quota {
|
||||
margin: 0;
|
||||
padding: var(--space-3);
|
||||
border-inline-start: var(--space-1) solid var(--color-accent);
|
||||
background: var(--color-canvas);
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
}
|
||||
|
||||
@@ -98,8 +175,8 @@
|
||||
}
|
||||
|
||||
@media (width < 30rem) {
|
||||
.form {
|
||||
padding: var(--space-3);
|
||||
.actions {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.actions > * {
|
||||
|
||||
@@ -59,7 +59,7 @@ export function MatchFilterForm({
|
||||
|
||||
return (
|
||||
<form className={styles.form} onSubmit={handleSubmit} aria-label="Поиск кандидатов">
|
||||
{basis}
|
||||
<div className={styles.basis}>{basis}</div>
|
||||
<div className={styles.grid}>
|
||||
<div className={styles.field}>
|
||||
<label htmlFor={`${ids}-specialization`}>Специализация</label>
|
||||
@@ -138,13 +138,13 @@ export function MatchFilterForm({
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className={styles.grid}>
|
||||
<div className={styles["chip-groups"]}>
|
||||
<fieldset className={styles.group}>
|
||||
<legend>Технологии в карточке</legend>
|
||||
<p className={styles.hint}>Нужны все отмеченные технологии.</p>
|
||||
<div className={styles.choices}>
|
||||
<div className={styles["chip-row"]}>
|
||||
{stackCodes.map((code) => (
|
||||
<label key={code} className={styles.choice}>
|
||||
<label key={code} className={styles.chip}>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={value.stack.includes(code)}
|
||||
@@ -155,7 +155,7 @@ export function MatchFilterForm({
|
||||
)
|
||||
}
|
||||
/>
|
||||
{stackLabels[code]}
|
||||
<span>{stackLabels[code]}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
@@ -163,9 +163,9 @@ export function MatchFilterForm({
|
||||
<fieldset className={styles.group}>
|
||||
<legend>Формат работы</legend>
|
||||
<p className={styles.hint}>Достаточно одного общего формата.</p>
|
||||
<div className={styles.choices}>
|
||||
<div className={styles["chip-row"]}>
|
||||
{workFormatCodes.map((code) => (
|
||||
<label key={code} className={styles.choice}>
|
||||
<label key={code} className={styles.chip}>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={value.workFormats.includes(code)}
|
||||
@@ -181,7 +181,7 @@ export function MatchFilterForm({
|
||||
)
|
||||
}
|
||||
/>
|
||||
{workFormatLabels[code]}
|
||||
<span>{workFormatLabels[code]}</span>
|
||||
</label>
|
||||
))}
|
||||
</div>
|
||||
@@ -189,39 +189,45 @@ export function MatchFilterForm({
|
||||
<fieldset className={styles.group}>
|
||||
<legend>Зарплатные ожидания</legend>
|
||||
<p className={styles.hint}>Сумма кандидата недоступна, только совместимость.</p>
|
||||
<label className={styles.choice}>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={value.salaryCompatible}
|
||||
onChange={(event) => set("salaryCompatible", event.currentTarget.checked)}
|
||||
/>
|
||||
Только совместимые ожидания
|
||||
</label>
|
||||
<div className={styles["chip-row"]}>
|
||||
<label className={styles.chip}>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={value.salaryCompatible}
|
||||
onChange={(event) => set("salaryCompatible", event.currentTarget.checked)}
|
||||
/>
|
||||
<span>Только совместимые ожидания</span>
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
<p id={quotaId} className={styles.quota}>
|
||||
Поиск расходует квоту просмотров карточек: каждый впервые показанный кандидат считается
|
||||
одним просмотром. Кандидаты, уже показанные в текущем окне, повторно не списываются.
|
||||
</p>
|
||||
{blockedReason ? (
|
||||
<p id={blockedId} className={styles.hint}>
|
||||
{blockedReason}
|
||||
</p>
|
||||
) : null}
|
||||
<div className={styles.actions}>
|
||||
<Button
|
||||
type="submit"
|
||||
isBusy={isSearching}
|
||||
aria-describedby={blockedReason ? `${quotaId} ${blockedId}` : quotaId}
|
||||
aria-disabled={isSearching || blockedReason !== null ? true : undefined}
|
||||
>
|
||||
{isSearching ? "Ищем..." : "Найти кандидатов"}
|
||||
</Button>
|
||||
{active > 0 ? (
|
||||
<Button variant="quiet" onClick={() => onChange({ ...emptyFilterDraft })}>
|
||||
Сбросить фильтры
|
||||
<div className={styles.footer}>
|
||||
<div className={styles.notes}>
|
||||
<p id={quotaId} className={styles.quota}>
|
||||
Поиск расходует квоту просмотров карточек: каждый впервые показанный кандидат считается
|
||||
одним просмотром. Кандидаты, уже показанные в текущем окне, повторно не списываются.
|
||||
</p>
|
||||
{blockedReason ? (
|
||||
<p id={blockedId} className={styles.hint}>
|
||||
{blockedReason}
|
||||
</p>
|
||||
) : null}
|
||||
</div>
|
||||
<div className={styles.actions}>
|
||||
{active > 0 ? (
|
||||
<Button variant="quiet" onClick={() => onChange({ ...emptyFilterDraft })}>
|
||||
Сбросить фильтры
|
||||
</Button>
|
||||
) : null}
|
||||
<Button
|
||||
type="submit"
|
||||
isBusy={isSearching}
|
||||
aria-describedby={blockedReason ? `${quotaId} ${blockedId}` : quotaId}
|
||||
aria-disabled={isSearching || blockedReason !== null ? true : undefined}
|
||||
>
|
||||
{isSearching ? "Ищем..." : "Найти кандидатов"}
|
||||
</Button>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
);
|
||||
|
||||
@@ -12,20 +12,10 @@
|
||||
}
|
||||
|
||||
.selector label {
|
||||
font-size: var(--font-size-s);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.selector select {
|
||||
min-height: 2.75rem;
|
||||
padding: var(--space-2) var(--space-3);
|
||||
border: var(--line-strong) solid var(--color-border-strong);
|
||||
border-radius: var(--radius-s);
|
||||
color: var(--color-text);
|
||||
background: var(--color-surface);
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.selector select:focus-visible {
|
||||
outline: var(--focus-ring-width) solid var(--color-focus-ring);
|
||||
outline-offset: var(--focus-ring-offset);
|
||||
border: var(--line-thin) solid var(--color-border-strong);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { invitationFieldOrder } from "./validate";
|
||||
import { invitationStepOfField, invitationSteps, previewStepIndex, sendStepIndex } from "./steps";
|
||||
|
||||
describe("invitation steps", () => {
|
||||
it("runs terms, package, preview, send", () => {
|
||||
expect(invitationSteps.map((step) => step.id)).toEqual(["terms", "package", "preview", "send"]);
|
||||
expect(previewStepIndex).toBe(2);
|
||||
expect(sendStepIndex).toBe(3);
|
||||
});
|
||||
|
||||
it("places every field on the terms or the package step", () => {
|
||||
for (const field of invitationFieldOrder) {
|
||||
expect([0, 1]).toContain(invitationStepOfField(field));
|
||||
}
|
||||
expect(invitationStepOfField("channel")).toBe(0);
|
||||
expect(invitationStepOfField("taxBasis")).toBe(0);
|
||||
expect(invitationStepOfField("package.bonus")).toBe(1);
|
||||
expect(invitationStepOfField("responsePeriodDays")).toBe(1);
|
||||
});
|
||||
});
|
||||
@@ -0,0 +1,53 @@
|
||||
import type { InvitationField } from "./validate";
|
||||
|
||||
// The steps of the invitation form. The terms and the package are filled in,
|
||||
// the preview shows them as the candidate will see them, and only the last
|
||||
// step sends. A field belongs to the step that holds its control, so an issue
|
||||
// found at any moment can open the right step.
|
||||
|
||||
export type InvitationStepId = "terms" | "package" | "preview" | "send";
|
||||
|
||||
export type InvitationStepDefinition = {
|
||||
id: InvitationStepId;
|
||||
/** Short label in the stepper. */
|
||||
label: string;
|
||||
/** Heading of the step panel. */
|
||||
title: string;
|
||||
/** One line under the heading. */
|
||||
lead: string;
|
||||
};
|
||||
|
||||
export const invitationSteps: readonly InvitationStepDefinition[] = [
|
||||
{
|
||||
id: "terms",
|
||||
label: "Условия",
|
||||
title: "Условия приглашения",
|
||||
lead: "Роль, задачи, формат работы, способ связи и вилка. Кандидат увидит все это до решения.",
|
||||
},
|
||||
{
|
||||
id: "package",
|
||||
label: "Пакет",
|
||||
title: "Пакет и срок ответа",
|
||||
lead: "Для каждого условия выберите, предусмотрено ли оно. Пропустить условие нельзя.",
|
||||
},
|
||||
{
|
||||
id: "preview",
|
||||
label: "Просмотр",
|
||||
title: "Предпросмотр",
|
||||
lead: "Условия глазами кандидата. Предпросмотр ничего не отправляет.",
|
||||
},
|
||||
{
|
||||
id: "send",
|
||||
label: "Отправка",
|
||||
title: "Отправка",
|
||||
lead: "Последняя проверка перед доставкой в кабинет кандидата.",
|
||||
},
|
||||
];
|
||||
|
||||
export const previewStepIndex = 2;
|
||||
export const sendStepIndex = 3;
|
||||
|
||||
/** The step that holds the control of a field. */
|
||||
export function invitationStepOfField(field: InvitationField): number {
|
||||
return field === "responsePeriodDays" || field.startsWith("package.") ? 1 : 0;
|
||||
}
|
||||
@@ -4,24 +4,6 @@
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.fields {
|
||||
display: grid;
|
||||
gap: var(--space-5);
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.visually-hidden {
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
height: 1px;
|
||||
overflow: hidden;
|
||||
clip-path: inset(50%);
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.intro,
|
||||
.hint {
|
||||
margin: 0;
|
||||
@@ -29,46 +11,114 @@
|
||||
line-height: var(--line-height-body);
|
||||
}
|
||||
|
||||
.hint {
|
||||
font-size: var(--font-size-s);
|
||||
}
|
||||
|
||||
.intro {
|
||||
max-width: 46rem;
|
||||
}
|
||||
|
||||
/* The list of issues stays above the step: its fields may sit on another one.
|
||||
* The danger color is the stripe and the heading; the 1px frame stays quiet. */
|
||||
.issue-summary {
|
||||
min-width: 0;
|
||||
padding: var(--space-4);
|
||||
border: var(--line-strong) solid var(--color-danger);
|
||||
border-radius: var(--radius-m);
|
||||
background: var(--color-surface);
|
||||
padding: var(--space-3) var(--space-4);
|
||||
border: var(--line-thin) solid var(--color-divider);
|
||||
border-left: var(--line-strong) solid var(--color-danger);
|
||||
border-radius: var(--radius-s);
|
||||
background: var(--color-canvas);
|
||||
}
|
||||
|
||||
.issue-summary h2 {
|
||||
margin: 0;
|
||||
font-size: var(--font-size-l);
|
||||
color: var(--color-danger);
|
||||
font-size: var(--font-size-m);
|
||||
}
|
||||
|
||||
.issue-summary ul {
|
||||
margin: var(--space-3) 0 0;
|
||||
margin: var(--space-2) 0 0;
|
||||
padding-left: var(--space-5);
|
||||
}
|
||||
|
||||
.panels {
|
||||
gap: var(--space-5);
|
||||
padding: var(--space-4);
|
||||
}
|
||||
|
||||
@media (width >= 48rem) {
|
||||
.panels {
|
||||
padding: var(--space-5);
|
||||
}
|
||||
}
|
||||
|
||||
.panel {
|
||||
display: grid;
|
||||
gap: var(--space-5);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.panel[hidden] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.panel-head {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
padding-bottom: var(--space-4);
|
||||
border-bottom: var(--line-thin) solid var(--color-divider);
|
||||
}
|
||||
|
||||
.panel-title {
|
||||
color: var(--color-text-strong);
|
||||
font-size: var(--font-size-xl);
|
||||
}
|
||||
|
||||
.lead {
|
||||
max-width: 42rem;
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
}
|
||||
|
||||
.fields {
|
||||
display: grid;
|
||||
gap: var(--space-6);
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
/* A group of related fields: a mono legend over a hairline, no frame. */
|
||||
.group {
|
||||
display: grid;
|
||||
gap: var(--space-4);
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
padding: var(--space-4);
|
||||
border: var(--line-thin) solid var(--color-divider);
|
||||
border-radius: var(--radius-m);
|
||||
padding: var(--space-5) 0 0;
|
||||
border: 0;
|
||||
border-top: var(--line-thin) solid var(--color-divider);
|
||||
}
|
||||
|
||||
.group:first-child {
|
||||
padding-top: 0;
|
||||
border-top: 0;
|
||||
}
|
||||
|
||||
.group > legend {
|
||||
max-width: 100%;
|
||||
padding: 0 var(--space-2);
|
||||
font-size: var(--font-size-l);
|
||||
font-weight: var(--font-weight-bold);
|
||||
padding: 0;
|
||||
color: var(--color-text-strong);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-m);
|
||||
font-weight: var(--font-weight-medium);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.row {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
|
||||
gap: var(--space-3);
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(100%, 12rem), 1fr));
|
||||
gap: var(--space-4);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
@@ -79,108 +129,220 @@
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.field > label {
|
||||
.field > label,
|
||||
.chip-group > legend {
|
||||
color: var(--color-text);
|
||||
font-size: var(--font-size-s);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.field input,
|
||||
.field select,
|
||||
.field textarea {
|
||||
box-sizing: border-box;
|
||||
.field :is(input:not([type="checkbox"], [type="radio"]), select, textarea) {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
min-height: 2.75rem;
|
||||
padding: var(--space-3);
|
||||
border: var(--line-thin) solid var(--color-border-strong);
|
||||
border-radius: var(--radius-s);
|
||||
color: var(--color-text);
|
||||
background: var(--color-surface);
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.field textarea {
|
||||
resize: vertical;
|
||||
}
|
||||
|
||||
.field :is(input, select, textarea):focus-visible,
|
||||
.choice input:focus-visible {
|
||||
outline: var(--line-strong) solid var(--color-focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.field [aria-invalid="true"] {
|
||||
border-color: var(--color-danger);
|
||||
}
|
||||
|
||||
.choices {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-3) var(--space-5);
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
padding: var(--space-3);
|
||||
border: var(--line-thin) solid var(--color-divider);
|
||||
border-radius: var(--radius-s);
|
||||
}
|
||||
|
||||
.choices > legend {
|
||||
padding: 0 var(--space-2);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.choice {
|
||||
display: inline-flex;
|
||||
gap: var(--space-2);
|
||||
align-items: center;
|
||||
min-height: 2.75rem;
|
||||
}
|
||||
|
||||
.field-error,
|
||||
.form-error {
|
||||
margin: 0;
|
||||
color: var(--color-danger);
|
||||
font-weight: var(--font-weight-bold);
|
||||
font-size: var(--font-size-s);
|
||||
font-weight: var(--font-weight-medium);
|
||||
line-height: var(--line-height-body);
|
||||
}
|
||||
|
||||
.notice,
|
||||
.stale {
|
||||
.notice {
|
||||
margin: 0;
|
||||
padding: var(--space-3);
|
||||
border-inline-start: var(--line-strong) solid var(--color-accent);
|
||||
padding: var(--space-3) var(--space-4);
|
||||
border: var(--line-thin) solid var(--color-divider);
|
||||
border-left: var(--line-strong) solid var(--color-accent);
|
||||
border-radius: var(--radius-s);
|
||||
background: var(--color-canvas);
|
||||
line-height: var(--line-height-body);
|
||||
}
|
||||
|
||||
.form-error {
|
||||
padding: var(--space-3) var(--space-4);
|
||||
border: var(--line-thin) solid var(--color-danger);
|
||||
border-radius: var(--radius-s);
|
||||
background: var(--color-canvas);
|
||||
}
|
||||
|
||||
/* Work format as filter chips: a native checkbox under a capsule. A checked
|
||||
* chip is blue with a check mark, so the state is not carried by color alone. */
|
||||
.chip-group {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.chip-group > legend {
|
||||
padding: 0;
|
||||
margin-bottom: var(--space-2);
|
||||
}
|
||||
|
||||
.chip-row {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.chip {
|
||||
position: relative;
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
.chip input[type="checkbox"] {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.chip span {
|
||||
display: inline-flex;
|
||||
gap: 0.375rem;
|
||||
align-items: center;
|
||||
min-height: 2.5rem;
|
||||
padding: 0 var(--space-4);
|
||||
border: var(--line-thin) solid var(--color-border-strong);
|
||||
border-radius: var(--radius-pill);
|
||||
color: var(--color-text);
|
||||
font-family: var(--font-mono);
|
||||
font-size: var(--font-size-s);
|
||||
font-weight: var(--font-weight-medium);
|
||||
background: var(--color-surface);
|
||||
transition:
|
||||
background-color var(--duration-fast) var(--easing-standard),
|
||||
border-color var(--duration-fast) var(--easing-standard);
|
||||
}
|
||||
|
||||
.chip span::before {
|
||||
content: "+";
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
.chip input:checked + span {
|
||||
border-color: var(--color-action);
|
||||
color: var(--color-on-action);
|
||||
background: var(--color-action);
|
||||
}
|
||||
|
||||
.chip input:checked + span::before {
|
||||
content: "✓";
|
||||
color: inherit;
|
||||
}
|
||||
|
||||
.chip input:focus-visible + span {
|
||||
outline: var(--focus-ring-width) solid var(--color-focus-ring);
|
||||
outline-offset: var(--focus-ring-offset);
|
||||
}
|
||||
|
||||
.chip:hover input:not(:checked, :focus-visible) + span {
|
||||
background: var(--color-surface-tint-hover);
|
||||
}
|
||||
|
||||
.package {
|
||||
display: grid;
|
||||
gap: var(--space-3);
|
||||
grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr));
|
||||
}
|
||||
|
||||
.package-item {
|
||||
align-content: start;
|
||||
}
|
||||
|
||||
.preview {
|
||||
display: grid;
|
||||
gap: var(--space-4);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.send {
|
||||
display: grid;
|
||||
gap: var(--space-4);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.send-facts {
|
||||
display: grid;
|
||||
gap: var(--space-3);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.send-facts > div {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(7rem, 10rem) minmax(0, 1fr);
|
||||
gap: var(--space-1) var(--space-4);
|
||||
align-items: baseline;
|
||||
}
|
||||
|
||||
.send-facts dt {
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
}
|
||||
|
||||
.send-facts dd {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2) var(--space-3);
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.send-role {
|
||||
color: var(--color-text-strong);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.consequences {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
margin: 0;
|
||||
padding-inline-start: var(--space-5);
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-3);
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.choices > .field,
|
||||
.choices > .field-error {
|
||||
flex-basis: 100%;
|
||||
.actions-side {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.issue-summary:focus,
|
||||
.preview:focus,
|
||||
.notice:focus,
|
||||
.form-error:focus {
|
||||
outline: var(--line-strong) solid var(--color-focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
@media (width < 42rem) {
|
||||
.group {
|
||||
padding: var(--space-3);
|
||||
@media (width < 36rem) {
|
||||
.send-facts > div {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -21,17 +21,7 @@
|
||||
.selector select {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: var(--space-3);
|
||||
border: var(--line-thin) solid var(--color-border-strong);
|
||||
border-radius: var(--radius-s);
|
||||
color: var(--color-text);
|
||||
background: var(--color-surface);
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.selector select:focus-visible {
|
||||
outline: var(--line-strong) solid var(--color-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.workspace {
|
||||
@@ -80,9 +70,16 @@
|
||||
gap: var(--space-3);
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
padding: var(--space-4);
|
||||
border: var(--line-thin) solid var(--color-divider);
|
||||
border-radius: var(--radius-m);
|
||||
}
|
||||
|
||||
.card-title {
|
||||
color: var(--color-text-strong);
|
||||
font-size: var(--font-size-l);
|
||||
}
|
||||
|
||||
.hint {
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
}
|
||||
|
||||
.load-more {
|
||||
@@ -104,3 +101,7 @@
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
.data {
|
||||
gap: var(--space-5);
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import { paths } from "../../../shared/config/paths";
|
||||
import {
|
||||
Button,
|
||||
ButtonLink,
|
||||
Card,
|
||||
EmptyState,
|
||||
ErrorState,
|
||||
ForbiddenState,
|
||||
@@ -193,10 +194,13 @@ function CompanyDetails({
|
||||
Обновить профиль
|
||||
</Button>
|
||||
</div>
|
||||
<Section
|
||||
title="Статус проверки"
|
||||
description="Уровень и основание устанавливает сервер. Их нельзя изменить через форму компании."
|
||||
>
|
||||
<Card as="section" labelledBy="company-verification-title">
|
||||
<h2 id="company-verification-title" className={styles["card-title"]}>
|
||||
Статус проверки
|
||||
</h2>
|
||||
<p className={styles.hint}>
|
||||
Уровень и основание устанавливает сервер. Их нельзя изменить через форму компании.
|
||||
</p>
|
||||
<div className={styles.verification}>
|
||||
<TrustLevel
|
||||
level={organizationTrustLevel[organization.verification.level]}
|
||||
@@ -209,22 +213,25 @@ function CompanyDetails({
|
||||
<dd>{formatDate(organization.verification.changed_at)}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
</Section>
|
||||
<Section title="Данные компании">
|
||||
</Card>
|
||||
<Card as="section" labelledBy="company-data-title" tone="panel" className={styles.data}>
|
||||
<h2 id="company-data-title" className={styles["card-title"]}>
|
||||
Данные компании
|
||||
</h2>
|
||||
<CompanyEditor
|
||||
key={organization.id}
|
||||
organization={organization}
|
||||
onSaved={onSaved}
|
||||
onAccessLost={onAccessLost}
|
||||
/>
|
||||
</Section>
|
||||
</Card>
|
||||
<CandidateCardPreview card={organization.candidate_card} />
|
||||
<div className={styles["next-step"]}>
|
||||
<Card as="div" className={styles["next-step"]}>
|
||||
<p>Профиль компании сохранен. Можно перейти к разделу потребностей.</p>
|
||||
<ButtonLink to={paths.employer.needs} variant="secondary">
|
||||
Перейти к потребностям
|
||||
</ButtonLink>
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.content {
|
||||
display: grid;
|
||||
gap: var(--space-6);
|
||||
gap: var(--space-5);
|
||||
min-width: 0;
|
||||
max-width: 56rem;
|
||||
}
|
||||
@@ -8,30 +8,29 @@
|
||||
.entry,
|
||||
.summary {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
gap: var(--space-3);
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.entry {
|
||||
padding: var(--space-4);
|
||||
border: var(--line-thin) solid var(--color-divider);
|
||||
border-radius: var(--radius-m);
|
||||
background: var(--color-surface);
|
||||
}
|
||||
|
||||
.fact {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(9rem, 14rem) minmax(0, 1fr);
|
||||
gap: var(--space-1) var(--space-4);
|
||||
align-items: baseline;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.fact > dt {
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
}
|
||||
|
||||
.fact > dd {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2) var(--space-3);
|
||||
align-items: center;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
overflow-wrap: anywhere;
|
||||
@@ -43,43 +42,30 @@
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.result-head {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2) var(--space-4);
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.title {
|
||||
color: var(--color-text-strong);
|
||||
font-size: var(--font-size-xl);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.title:focus {
|
||||
outline: var(--line-strong) solid var(--color-focus-ring);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.state {
|
||||
display: inline-block;
|
||||
padding: var(--space-1) var(--space-3);
|
||||
border: var(--line-strong) solid var(--color-accent);
|
||||
border-radius: var(--radius-pill);
|
||||
font-weight: var(--font-weight-bold);
|
||||
.title:focus-visible {
|
||||
outline-offset: 4px;
|
||||
}
|
||||
|
||||
.hint {
|
||||
margin: 0;
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
line-height: var(--line-height-body);
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
margin: 0;
|
||||
font-size: var(--font-size-l);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.notice {
|
||||
margin: 0;
|
||||
padding: var(--space-3);
|
||||
border-inline-start: var(--line-strong) solid var(--color-accent);
|
||||
background: var(--color-canvas);
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
@@ -90,8 +76,4 @@
|
||||
.fact {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.entry {
|
||||
padding: var(--space-3);
|
||||
}
|
||||
}
|
||||
@@ -85,9 +85,16 @@ describe("invitation compose page", () => {
|
||||
}
|
||||
// The specialization of the search entry is preselected; nothing else is.
|
||||
expect(html).toMatch(/<option value="backend" selected="">Backend<\/option>/);
|
||||
expect(html).not.toMatch(/type="radio"[^>]*checked=""/);
|
||||
expect(html).toContain("Показать предпросмотр");
|
||||
expect(html).toContain("Отправить приглашение");
|
||||
// The only preselected choice is the default response period; every package
|
||||
// condition and the grade stay unanswered.
|
||||
expect(html.match(/type="radio"[^>]*checked=""/g)).toHaveLength(1);
|
||||
expect(html).toMatch(/type="radio"[^>]*checked=""[^>]*value="7"/);
|
||||
// Four steps; the terms and the package are mounted, the first one is open.
|
||||
expect(html).toContain("Шаг 1 из 4");
|
||||
expect(html).toContain(">Далее<");
|
||||
expect(html).not.toContain("Отправить приглашение");
|
||||
expect(html).not.toContain("Показать предпросмотр");
|
||||
expect(html.match(/<section[^>]*hidden=""/g)).toHaveLength(3);
|
||||
expect(html).not.toContain("Так приглашение увидит кандидат");
|
||||
expect(html).not.toContain('role="alert"');
|
||||
});
|
||||
|
||||
@@ -20,14 +20,18 @@ import { paths } from "../../../shared/config";
|
||||
import {
|
||||
Button,
|
||||
ButtonLink,
|
||||
Card,
|
||||
EmptyState,
|
||||
ErrorState,
|
||||
ForbiddenState,
|
||||
isAccessDenied,
|
||||
LoadingState,
|
||||
Mono,
|
||||
Notice,
|
||||
Page,
|
||||
StatusView,
|
||||
Tag,
|
||||
type TagTone,
|
||||
} from "../../../shared/ui";
|
||||
import {
|
||||
formatServerMoment,
|
||||
@@ -69,6 +73,28 @@ function specializationOf(value: string | null): SpecializationCode | "" {
|
||||
|
||||
type OrganizationQuery = UseQueryResult<Organization, ApiRequestError>;
|
||||
|
||||
/** Tone of the state tag: pending and neutral states are plain, outcomes carry color. */
|
||||
function stateTone(state: OrganizationInvitation["state"]): TagTone {
|
||||
switch (state) {
|
||||
case "accepted":
|
||||
case "interview_scheduled":
|
||||
case "interviewed":
|
||||
case "terms_agreed":
|
||||
return "success";
|
||||
case "declined":
|
||||
case "expired":
|
||||
case "withdrawn":
|
||||
case "cancelled_by_candidate":
|
||||
case "no_deal":
|
||||
return "danger";
|
||||
case "counter":
|
||||
case "negotiation":
|
||||
return "accent";
|
||||
default:
|
||||
return "neutral";
|
||||
}
|
||||
}
|
||||
|
||||
/** What the preview shows while the company card is not available. */
|
||||
function cardFallbackOf(organization: OrganizationQuery) {
|
||||
if (organization.isPending) return <LoadingState label="Загружаем карточку компании..." />;
|
||||
@@ -111,51 +137,52 @@ function SentInvitation({
|
||||
|
||||
return (
|
||||
<section className={styles.result} aria-labelledby="invitation-result-title">
|
||||
<h2 id="invitation-result-title" ref={headingRef} tabIndex={-1} className={styles.title}>
|
||||
{invitation.state === "delivered" ? "Приглашение доставлено" : "Приглашение уже отправлено"}
|
||||
</h2>
|
||||
<dl className={styles.summary}>
|
||||
<div className={styles.fact}>
|
||||
<dt>Состояние</dt>
|
||||
<dd>
|
||||
<strong className={styles.state} data-state={invitation.state}>
|
||||
{invitationStateLabels[invitation.state]}
|
||||
</strong>
|
||||
</dd>
|
||||
<Card as="div" tone="raised">
|
||||
<div className={styles["result-head"]}>
|
||||
<h2 id="invitation-result-title" ref={headingRef} tabIndex={-1} className={styles.title}>
|
||||
{invitation.state === "delivered"
|
||||
? "Приглашение доставлено"
|
||||
: "Приглашение уже отправлено"}
|
||||
</h2>
|
||||
<span data-state={invitation.state}>
|
||||
<Tag tone={stateTone(invitation.state)}>{invitationStateLabels[invitation.state]}</Tag>
|
||||
</span>
|
||||
</div>
|
||||
{invitation.delivered_at ? (
|
||||
<dl className={styles.summary}>
|
||||
{invitation.delivered_at ? (
|
||||
<div className={styles.fact}>
|
||||
<dt>Доставлено</dt>
|
||||
<dd>
|
||||
<time dateTime={invitation.delivered_at}>
|
||||
{formatServerMoment(invitation.delivered_at)}
|
||||
</time>
|
||||
</dd>
|
||||
</div>
|
||||
) : null}
|
||||
{invitation.response_deadline_at ? (
|
||||
<div className={styles.fact}>
|
||||
<dt>Кандидат может ответить до</dt>
|
||||
<dd data-term="deadline">
|
||||
<time dateTime={invitation.response_deadline_at}>
|
||||
{formatServerMoment(invitation.response_deadline_at)}
|
||||
</time>
|
||||
</dd>
|
||||
</div>
|
||||
) : null}
|
||||
<div className={styles.fact}>
|
||||
<dt>Доставлено</dt>
|
||||
<dd>
|
||||
<time dateTime={invitation.delivered_at}>
|
||||
{formatServerMoment(invitation.delivered_at)}
|
||||
</time>
|
||||
</dd>
|
||||
<dt>Версия условий</dt>
|
||||
<dd>{invitation.terms_version}</dd>
|
||||
</div>
|
||||
) : null}
|
||||
{invitation.response_deadline_at ? (
|
||||
<div className={styles.fact}>
|
||||
<dt>Кандидат может ответить до</dt>
|
||||
<dd data-term="deadline">
|
||||
<time dateTime={invitation.response_deadline_at}>
|
||||
{formatServerMoment(invitation.response_deadline_at)}
|
||||
</time>
|
||||
</dd>
|
||||
<dt>Зарплатный индикатор</dt>
|
||||
<dd>{salaryFitLabels[invitation.salary_fit]}</dd>
|
||||
</div>
|
||||
) : null}
|
||||
<div className={styles.fact}>
|
||||
<dt>Версия условий</dt>
|
||||
<dd>{invitation.terms_version}</dd>
|
||||
</div>
|
||||
<div className={styles.fact}>
|
||||
<dt>Зарплатный индикатор</dt>
|
||||
<dd>{salaryFitLabels[invitation.salary_fit]}</dd>
|
||||
</div>
|
||||
</dl>
|
||||
<p className={styles.hint}>
|
||||
Срок ответа задал сервер при доставке; письмо кандидату его не сдвигает. Контакты кандидата
|
||||
появятся только после принятия приглашения.
|
||||
</p>
|
||||
</dl>
|
||||
<p className={styles.hint}>
|
||||
Срок ответа задал сервер при доставке; письмо кандидату его не сдвигает. Контакты
|
||||
кандидата появятся только после принятия приглашения.
|
||||
</p>
|
||||
</Card>
|
||||
{invitation.state === "accepted" ? (
|
||||
<InvitationContacts
|
||||
accountId={accountId}
|
||||
@@ -246,25 +273,27 @@ function InvitationWorkspace({
|
||||
});
|
||||
|
||||
const header = (
|
||||
<dl className={styles.entry}>
|
||||
<div className={styles.fact}>
|
||||
<dt>Кандидат</dt>
|
||||
<dd>
|
||||
<Mono>{shortHandle(candidateHandle)}</Mono>
|
||||
{specialization ? `, ${specializationLabels[specialization]}` : null}
|
||||
</dd>
|
||||
</div>
|
||||
<div className={styles.fact}>
|
||||
<dt>Компания</dt>
|
||||
<dd>{organization.organization.name}</dd>
|
||||
</div>
|
||||
{need.data ? (
|
||||
<Card as="div" tone="raised">
|
||||
<dl className={styles.entry}>
|
||||
<div className={styles.fact}>
|
||||
<dt>Потребность</dt>
|
||||
<dd>{`${need.data.title}, версия требований ${need.data.requirements_version}`}</dd>
|
||||
<dt>Кандидат</dt>
|
||||
<dd>
|
||||
<Mono>{shortHandle(candidateHandle)}</Mono>
|
||||
{specialization ? <Tag tone="grade">{specializationLabels[specialization]}</Tag> : null}
|
||||
</dd>
|
||||
</div>
|
||||
) : null}
|
||||
</dl>
|
||||
<div className={styles.fact}>
|
||||
<dt>Компания</dt>
|
||||
<dd>{organization.organization.name}</dd>
|
||||
</div>
|
||||
{need.data ? (
|
||||
<div className={styles.fact}>
|
||||
<dt>Потребность</dt>
|
||||
<dd>{`${need.data.title}, версия требований ${need.data.requirements_version}`}</dd>
|
||||
</div>
|
||||
) : null}
|
||||
</dl>
|
||||
</Card>
|
||||
);
|
||||
|
||||
if (sent) {
|
||||
@@ -382,9 +411,9 @@ function InvitationWorkspace({
|
||||
<>
|
||||
{header}
|
||||
{draft ? (
|
||||
<p className={styles.notice} role="status">
|
||||
<Notice tone="info" role="status">
|
||||
{`Открыт сохраненный черновик, версия ${draft.version}. Он еще не отправлен.`}
|
||||
</p>
|
||||
</Notice>
|
||||
) : null}
|
||||
<InvitationForm
|
||||
organizationId={organizationId}
|
||||
|
||||
@@ -9,16 +9,26 @@
|
||||
}
|
||||
|
||||
.role {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
padding: var(--space-4) 0 var(--space-4) var(--space-4);
|
||||
border-left: var(--line-strong) solid var(--color-accent);
|
||||
gap: var(--space-3);
|
||||
}
|
||||
|
||||
.role-head {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2) var(--space-3);
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.steps li::marker {
|
||||
color: var(--color-accent);
|
||||
font-family: var(--font-mono);
|
||||
}
|
||||
|
||||
.role-title {
|
||||
margin: 0;
|
||||
color: var(--color-text-strong);
|
||||
font-size: var(--font-size-l);
|
||||
font-weight: var(--font-weight-bold);
|
||||
line-height: var(--line-height-snug);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Page, Section, TextLink } from "../../../shared/ui";
|
||||
import { Card, Page, Section, TextLink } from "../../../shared/ui";
|
||||
import {
|
||||
demonstrationItems,
|
||||
guideAccounts,
|
||||
@@ -49,8 +49,10 @@ export function JuryGuidePage() {
|
||||
>
|
||||
<ol className={styles.roles}>
|
||||
{guideRoles.map((role, index) => (
|
||||
<li key={role.title} className={styles.role}>
|
||||
<h3 className={styles["role-title"]}>{role.title}</h3>
|
||||
<Card as="li" key={role.title} className={styles.role}>
|
||||
<div className={styles["role-head"]}>
|
||||
<h3 className={styles["role-title"]}>{role.title}</h3>
|
||||
</div>
|
||||
<p className={styles.account}>
|
||||
Логин: <code>{role.account}</code>
|
||||
</p>
|
||||
@@ -62,7 +64,7 @@ export function JuryGuidePage() {
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
</li>
|
||||
</Card>
|
||||
))}
|
||||
</ol>
|
||||
</Section>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
.content {
|
||||
display: grid;
|
||||
gap: var(--space-6);
|
||||
gap: var(--space-5);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
@@ -11,71 +11,47 @@
|
||||
max-width: 28rem;
|
||||
}
|
||||
|
||||
.selector label,
|
||||
.basis legend {
|
||||
.selector label {
|
||||
font-size: var(--font-size-s);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.selector select {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
min-height: 2.75rem;
|
||||
padding: var(--space-2) var(--space-3);
|
||||
border: var(--line-thin) solid var(--color-border-strong);
|
||||
border-radius: var(--radius-s);
|
||||
color: var(--color-text);
|
||||
background: var(--color-surface);
|
||||
}
|
||||
|
||||
.selector select:focus-visible {
|
||||
outline: var(--line-strong) solid var(--color-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.workspace {
|
||||
display: grid;
|
||||
gap: var(--space-6);
|
||||
gap: var(--space-5);
|
||||
align-items: start;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
/* The basis of the search: the segmented choice and, beside it on a wide
|
||||
* screen, the need picker. */
|
||||
.basis {
|
||||
display: grid;
|
||||
gap: var(--space-3);
|
||||
gap: var(--space-3) var(--space-5);
|
||||
align-items: end;
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.basis legend {
|
||||
padding: 0;
|
||||
}
|
||||
@media (width >= 48rem) {
|
||||
.basis {
|
||||
grid-template-columns: auto minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.choices {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-1) var(--space-4);
|
||||
}
|
||||
|
||||
.choice {
|
||||
display: inline-flex;
|
||||
gap: var(--space-2);
|
||||
align-items: center;
|
||||
min-height: 2.75rem;
|
||||
}
|
||||
|
||||
.choice input {
|
||||
width: 1.25rem;
|
||||
height: 1.25rem;
|
||||
margin: 0;
|
||||
accent-color: var(--color-action);
|
||||
.basis > p {
|
||||
align-self: center;
|
||||
}
|
||||
}
|
||||
|
||||
.hint {
|
||||
margin: 0;
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
font-size: var(--font-size-xs);
|
||||
}
|
||||
|
||||
.results {
|
||||
@@ -84,21 +60,6 @@
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.idle {
|
||||
margin: 0;
|
||||
padding: var(--space-5);
|
||||
border: var(--line-thin) dashed var(--color-border-strong);
|
||||
border-radius: var(--radius-m);
|
||||
background: var(--color-surface);
|
||||
}
|
||||
|
||||
.load-more {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
@media (width >= 64rem) {
|
||||
.workspace {
|
||||
grid-template-columns: minmax(19rem, 24rem) minmax(0, 1fr);
|
||||
}
|
||||
.results:focus-visible {
|
||||
outline-offset: 4px;
|
||||
}
|
||||
@@ -16,7 +16,9 @@ import {
|
||||
isAccessDenied,
|
||||
LoadingState,
|
||||
Page,
|
||||
SegmentedControl,
|
||||
StatusView,
|
||||
type SegmentedOption,
|
||||
} from "../../../shared/ui";
|
||||
import { formatRetryAfter, searchMatches } from "../../../entities/match";
|
||||
import {
|
||||
@@ -40,6 +42,11 @@ import styles from "./matches-page.module.css";
|
||||
const needPickerLimit = 100;
|
||||
type BasisMode = "need" | "bank";
|
||||
|
||||
const basisOptions: readonly SegmentedOption<BasisMode>[] = [
|
||||
{ value: "need", label: "По потребности" },
|
||||
{ value: "bank", label: "По всем профилям" },
|
||||
];
|
||||
|
||||
type SearchVariables = {
|
||||
request: MatchSearchRequest;
|
||||
sentFilters: ReturnType<typeof filtersFromDraft>;
|
||||
@@ -184,28 +191,14 @@ function MatchWorkspace({ session, organization, initialNeedId }: WorkspaceProps
|
||||
isSearching={search.isPending}
|
||||
blockedReason={blockedReason}
|
||||
basis={
|
||||
<fieldset className={styles.basis}>
|
||||
<legend>Основание поиска</legend>
|
||||
<div className={styles.choices}>
|
||||
<label className={styles.choice}>
|
||||
<input
|
||||
type="radio"
|
||||
name="match-basis"
|
||||
checked={mode === "need"}
|
||||
onChange={() => setBasisChoice("need")}
|
||||
/>
|
||||
По потребности
|
||||
</label>
|
||||
<label className={styles.choice}>
|
||||
<input
|
||||
type="radio"
|
||||
name="match-basis"
|
||||
checked={mode === "bank"}
|
||||
onChange={() => setBasisChoice("bank")}
|
||||
/>
|
||||
По всем профилям
|
||||
</label>
|
||||
</div>
|
||||
<div className={styles.basis}>
|
||||
<SegmentedControl
|
||||
legend="Основание поиска"
|
||||
name="match-basis"
|
||||
options={basisOptions}
|
||||
value={mode}
|
||||
onChange={setBasisChoice}
|
||||
/>
|
||||
{mode === "need" ? (
|
||||
<div className={styles.selector}>
|
||||
<label htmlFor="match-need">Потребность</label>
|
||||
@@ -242,7 +235,7 @@ function MatchWorkspace({ session, organization, initialNeedId }: WorkspaceProps
|
||||
показывается отдельной записью.
|
||||
</p>
|
||||
)}
|
||||
</fieldset>
|
||||
</div>
|
||||
}
|
||||
/>
|
||||
<div className={styles.results} ref={resultRef} tabIndex={-1}>
|
||||
@@ -261,10 +254,10 @@ function MatchWorkspace({ session, organization, initialNeedId }: WorkspaceProps
|
||||
/>
|
||||
) : null}
|
||||
{search.isIdle ? (
|
||||
<p className={styles.idle}>
|
||||
Поиск еще не запускался. Задайте условия и нажмите «Найти кандидатов»: выдача появится
|
||||
здесь, а перезагрузка страницы не повторяет поиск сама.
|
||||
</p>
|
||||
<EmptyState
|
||||
title="Поиск еще не запускался"
|
||||
description="Задайте условия и нажмите «Найти кандидатов»: выдача появится здесь, а перезагрузка страницы не повторяет поиск сама."
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -15,23 +15,14 @@
|
||||
}
|
||||
|
||||
.selector label {
|
||||
font-size: var(--font-size-s);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.selector select {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: var(--space-3);
|
||||
border: var(--line-thin) solid var(--color-border-strong);
|
||||
border-radius: var(--radius-s);
|
||||
color: var(--color-text);
|
||||
background: var(--color-surface);
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.selector select:focus-visible {
|
||||
outline: var(--line-strong) solid var(--color-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.actions {
|
||||
@@ -39,3 +30,9 @@
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.workspace {
|
||||
display: grid;
|
||||
gap: var(--space-4);
|
||||
min-width: 0;
|
||||
}
|
||||
@@ -16,7 +16,6 @@ import {
|
||||
ForbiddenState,
|
||||
LoadingState,
|
||||
Page,
|
||||
Section,
|
||||
} from "../../../shared/ui";
|
||||
import {
|
||||
activeNeedOrganizations,
|
||||
@@ -354,7 +353,7 @@ export function NeedEditorPage() {
|
||||
/>
|
||||
) : null}
|
||||
{owner && !selectedOrganizationDenied ? (
|
||||
<Section title={needId ? "Редактирование" : "Создание потребности"}>
|
||||
<div className={styles.workspace}>
|
||||
{needId && needQuery.isError && isAccessLoss(needQuery.error) ? (
|
||||
<ForbiddenState
|
||||
title="Потребность недоступна"
|
||||
@@ -388,7 +387,7 @@ export function NeedEditorPage() {
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
</Section>
|
||||
</div>
|
||||
) : null}
|
||||
</>
|
||||
) : null}
|
||||
|
||||
@@ -26,17 +26,7 @@
|
||||
.selector select {
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
padding: var(--space-3);
|
||||
border: var(--line-thin) solid var(--color-border-strong);
|
||||
border-radius: var(--radius-s);
|
||||
color: var(--color-text);
|
||||
background: var(--color-surface);
|
||||
font: inherit;
|
||||
}
|
||||
|
||||
.selector select:focus-visible {
|
||||
outline: var(--line-strong) solid var(--color-accent);
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.list {
|
||||
@@ -46,13 +36,13 @@
|
||||
}
|
||||
|
||||
.card {
|
||||
display: grid;
|
||||
gap: var(--space-3);
|
||||
min-width: 0;
|
||||
padding: var(--space-4);
|
||||
border: var(--line-thin) solid var(--color-divider);
|
||||
border-radius: var(--radius-m);
|
||||
background: var(--color-surface);
|
||||
}
|
||||
|
||||
.chips {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.card-heading {
|
||||
@@ -65,26 +55,11 @@
|
||||
|
||||
.card-heading h3 {
|
||||
margin: 0;
|
||||
color: var(--color-text-strong);
|
||||
overflow-wrap: anywhere;
|
||||
font-size: var(--font-size-l);
|
||||
}
|
||||
|
||||
.complete,
|
||||
.incomplete {
|
||||
max-width: 100%;
|
||||
overflow-wrap: anywhere;
|
||||
font-size: var(--font-size-s);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.complete {
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
.incomplete {
|
||||
color: var(--color-text);
|
||||
}
|
||||
|
||||
.facts {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(8rem, max-content) minmax(0, 1fr);
|
||||
@@ -139,8 +114,4 @@
|
||||
.facts dd + dt {
|
||||
padding-block-start: var(--space-2);
|
||||
}
|
||||
|
||||
.card {
|
||||
padding: var(--space-3);
|
||||
}
|
||||
}
|
||||
@@ -9,12 +9,15 @@ import { paths } from "../../../shared/config/paths";
|
||||
import {
|
||||
Button,
|
||||
ButtonLink,
|
||||
Card,
|
||||
EmptyState,
|
||||
ErrorState,
|
||||
ForbiddenState,
|
||||
LoadingState,
|
||||
Mono,
|
||||
Page,
|
||||
Section,
|
||||
Tag,
|
||||
} from "../../../shared/ui";
|
||||
import {
|
||||
activeNeedOrganizations,
|
||||
@@ -68,17 +71,33 @@ function displayDecision<T extends string>(
|
||||
|
||||
function NeedCard({ item, organizationId }: { item: NeedSummary; organizationId: string }) {
|
||||
const missingCount = item.readiness.missing_fields.length;
|
||||
const specialization =
|
||||
item.specialization.status === "unknown" || item.specialization.value === null
|
||||
? null
|
||||
: (specializationLabels[item.specialization.value] ?? item.specialization.value);
|
||||
const grade =
|
||||
item.grade.status === "unknown" || item.grade.value === null
|
||||
? null
|
||||
: (gradeLabels[item.grade.value] ?? item.grade.value);
|
||||
return (
|
||||
<article className={styles.card}>
|
||||
<Card as="article" className={styles.card}>
|
||||
<div className={styles["card-heading"]}>
|
||||
<h3>{item.title}</h3>
|
||||
<span
|
||||
className={item.readiness.status === "complete" ? styles.complete : styles.incomplete}
|
||||
>
|
||||
{item.readiness.status === "complete"
|
||||
? "Данные заполнены"
|
||||
: `Не хватает данных: ${missingCount}`}
|
||||
</span>
|
||||
{item.readiness.status === "complete" ? (
|
||||
<Tag tone="success">Данные заполнены</Tag>
|
||||
) : (
|
||||
<Tag tone="accent">{`Не хватает данных: ${missingCount}`}</Tag>
|
||||
)}
|
||||
</div>
|
||||
<div className={styles.chips}>
|
||||
{specialization || grade ? (
|
||||
<Tag tone="grade">{[specialization, grade].filter(Boolean).join(" · ")}</Tag>
|
||||
) : (
|
||||
<Tag>Роль не указана</Tag>
|
||||
)}
|
||||
{item.specialization.status === "extracted" || item.grade.status === "extracted" ? (
|
||||
<Tag tone="accent">Есть предложения из текста</Tag>
|
||||
) : null}
|
||||
</div>
|
||||
<dl className={styles.facts}>
|
||||
<dt>Специализация</dt>
|
||||
@@ -86,7 +105,9 @@ function NeedCard({ item, organizationId }: { item: NeedSummary; organizationId:
|
||||
<dt>Грейд</dt>
|
||||
<dd>{displayDecision(item.grade, gradeLabels)}</dd>
|
||||
<dt>Версия</dt>
|
||||
<dd>{item.version}</dd>
|
||||
<dd>
|
||||
<Mono>{item.version}</Mono>
|
||||
</dd>
|
||||
</dl>
|
||||
{missingCount > 0 ? (
|
||||
<ul className={styles.missing}>
|
||||
@@ -103,7 +124,7 @@ function NeedCard({ item, organizationId }: { item: NeedSummary; organizationId:
|
||||
Подобрать кандидатов
|
||||
</ButtonLink>
|
||||
</div>
|
||||
</article>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,43 +1,11 @@
|
||||
.notice {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2) var(--space-3);
|
||||
align-items: baseline;
|
||||
padding: var(--space-4) var(--space-5);
|
||||
border: var(--line-thin) dashed var(--color-border-strong);
|
||||
border-radius: var(--radius-m);
|
||||
background: var(--color-surface);
|
||||
}
|
||||
|
||||
.tag {
|
||||
padding: 0 var(--space-2);
|
||||
border: var(--line-thin) solid var(--color-accent);
|
||||
border-radius: var(--radius-pill);
|
||||
color: var(--color-accent);
|
||||
font-size: var(--font-size-xs);
|
||||
font-weight: var(--font-weight-bold);
|
||||
letter-spacing: var(--letter-spacing-label);
|
||||
text-transform: uppercase;
|
||||
}
|
||||
|
||||
.plan {
|
||||
display: grid;
|
||||
gap: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.plan li {
|
||||
display: grid;
|
||||
grid-template-columns: 2.5rem minmax(0, 1fr);
|
||||
gap: var(--space-3);
|
||||
padding: var(--space-3) 0;
|
||||
border-bottom: var(--line-thin) solid var(--color-divider);
|
||||
font-size: var(--font-size-l);
|
||||
margin: 0;
|
||||
padding-inline-start: var(--space-5);
|
||||
line-height: var(--line-height-snug);
|
||||
}
|
||||
|
||||
.plan li > :first-child {
|
||||
.plan li::marker {
|
||||
color: var(--color-accent);
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Mono, Page, Section } from "../../../shared/ui";
|
||||
import { Card, Notice, Page, Section, Tag } from "../../../shared/ui";
|
||||
import { areaLabels, screens, type ScreenId } from "../model/screens";
|
||||
import styles from "./placeholder-page.module.css";
|
||||
|
||||
@@ -8,7 +8,8 @@ type PlaceholderPageProps = {
|
||||
|
||||
/**
|
||||
* Honest stand-in for a screen that a later task implements. It names the
|
||||
* screen and lists what is planned, without imitating working features.
|
||||
* screen and lists what is planned, without imitating working features. The
|
||||
* planned items are not a sequence, so they are a plain list.
|
||||
*/
|
||||
export function PlaceholderPage({ screen }: PlaceholderPageProps) {
|
||||
const plan = screens[screen];
|
||||
@@ -19,19 +20,17 @@ export function PlaceholderPage({ screen }: PlaceholderPageProps) {
|
||||
eyebrow={areaLabels[plan.area]}
|
||||
width={plan.area === "employer" ? "wide" : "narrow"}
|
||||
>
|
||||
<p className={styles.notice}>
|
||||
<span className={styles.tag}>Заготовка</span>
|
||||
<Notice tone="neutral" title={<Tag>Заготовка</Tag>}>
|
||||
Экран будет реализован в одной из следующих задач. Сейчас здесь нет данных и действий.
|
||||
</p>
|
||||
</Notice>
|
||||
<Section title="Что здесь появится" headingLevel={2}>
|
||||
<ol className={styles.plan}>
|
||||
{plan.planned.map((item, index) => (
|
||||
<li key={item}>
|
||||
<Mono>{String(index + 1).padStart(2, "0")}</Mono>
|
||||
<span>{item}</span>
|
||||
</li>
|
||||
))}
|
||||
</ol>
|
||||
<Card as="div">
|
||||
<ul className={styles.plan}>
|
||||
{plan.planned.map((item) => (
|
||||
<li key={item}>{item}</li>
|
||||
))}
|
||||
</ul>
|
||||
</Card>
|
||||
</Section>
|
||||
</Page>
|
||||
);
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
/* The preview sits in a card of its own screen, so it adds no frame:
|
||||
* the company card and the terms article carry their own hairlines. */
|
||||
.root {
|
||||
display: grid;
|
||||
gap: var(--space-4);
|
||||
min-width: 0;
|
||||
padding: var(--space-4);
|
||||
border: var(--line-strong) solid var(--color-accent);
|
||||
border-radius: var(--radius-m);
|
||||
background: var(--color-canvas);
|
||||
}
|
||||
|
||||
.heading {
|
||||
@@ -85,7 +83,6 @@
|
||||
}
|
||||
|
||||
@media (width < 36rem) {
|
||||
.root,
|
||||
.terms {
|
||||
padding: var(--space-3);
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@
|
||||
|
||||
.title {
|
||||
margin: 0;
|
||||
color: var(--color-text-strong);
|
||||
font-size: var(--font-size-xl);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.title:focus-visible {
|
||||
@@ -17,16 +17,14 @@
|
||||
.basis {
|
||||
display: grid;
|
||||
grid-template-columns: minmax(9rem, max-content) minmax(0, 1fr);
|
||||
gap: var(--space-2) var(--space-4);
|
||||
gap: var(--space-3) var(--space-4);
|
||||
align-items: baseline;
|
||||
margin: 0;
|
||||
padding: var(--space-3) var(--space-4);
|
||||
border: var(--line-thin) solid var(--color-divider);
|
||||
border-radius: var(--radius-s);
|
||||
background: var(--color-surface);
|
||||
}
|
||||
|
||||
.basis dt {
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
}
|
||||
|
||||
.basis dd {
|
||||
@@ -44,82 +42,20 @@
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.filter {
|
||||
padding: var(--space-1) var(--space-3);
|
||||
border: var(--line-thin) solid var(--color-border-strong);
|
||||
border-radius: var(--radius-pill);
|
||||
background: var(--color-canvas);
|
||||
font-size: var(--font-size-s);
|
||||
overflow-wrap: anywhere;
|
||||
.filters li {
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.notice {
|
||||
margin: 0;
|
||||
padding: var(--space-3) var(--space-4);
|
||||
border-inline-start: var(--space-1) solid var(--color-accent);
|
||||
background: var(--color-surface);
|
||||
}
|
||||
|
||||
.notice[data-kind="truncated"] {
|
||||
border-inline-start-style: double;
|
||||
/* The grade tag never wraps; a long applied filter wraps inside its tag. */
|
||||
.filters li > span[data-tone] {
|
||||
max-width: 100%;
|
||||
white-space: normal;
|
||||
}
|
||||
|
||||
.switcher {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
min-width: 0;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
}
|
||||
|
||||
.switcher legend {
|
||||
padding: 0;
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.views {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.view {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.view input {
|
||||
position: absolute;
|
||||
inset: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
opacity: 0;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.view span {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
min-height: 2.75rem;
|
||||
padding: var(--space-2) var(--space-4);
|
||||
border: var(--line-strong) solid var(--color-border-strong);
|
||||
border-radius: var(--radius-pill);
|
||||
background: var(--color-surface);
|
||||
font-weight: var(--font-weight-medium);
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.view input:checked + span {
|
||||
border-color: var(--color-accent);
|
||||
color: var(--color-on-accent);
|
||||
background: var(--color-accent);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.view input:focus-visible + span {
|
||||
outline: var(--focus-ring-width) solid var(--color-focus-ring);
|
||||
outline-offset: var(--focus-ring-offset);
|
||||
}
|
||||
|
||||
.hint {
|
||||
@@ -134,27 +70,28 @@
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.group + .group {
|
||||
padding-top: var(--space-4);
|
||||
border-top: var(--line-thin) solid var(--color-divider);
|
||||
}
|
||||
|
||||
.group-heading {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-1) var(--space-3);
|
||||
align-items: baseline;
|
||||
gap: var(--space-2) var(--space-3);
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.group-title {
|
||||
margin: 0;
|
||||
color: var(--color-text-strong);
|
||||
font-size: var(--font-size-l);
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.group-count {
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
}
|
||||
|
||||
.group-description {
|
||||
margin: 0;
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
}
|
||||
|
||||
.cards {
|
||||
@@ -179,6 +116,7 @@
|
||||
@media (width < 30rem) {
|
||||
.basis {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
gap: var(--space-1);
|
||||
}
|
||||
|
||||
.basis dd + dt {
|
||||
|
||||
@@ -2,6 +2,7 @@ import { renderToString } from "react-dom/server";
|
||||
import { MemoryRouter } from "react-router-dom";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import type { MatchSearchModel } from "../../../entities/match";
|
||||
import type { MatchSearchFilters } from "../../../shared/api/schemas";
|
||||
import {
|
||||
backendHandle,
|
||||
emptyMatchModelFixture,
|
||||
@@ -14,7 +15,11 @@ const organizationId = "0199b4f2-7c1e-7d3a-9f00-aabbccddee01";
|
||||
|
||||
function render(
|
||||
result: MatchSearchModel,
|
||||
props: { stale?: boolean; needTitle?: string | null } = {},
|
||||
props: {
|
||||
stale?: boolean;
|
||||
needTitle?: string | null;
|
||||
sentFilters?: MatchSearchFilters | undefined;
|
||||
} = {},
|
||||
): string {
|
||||
return renderToString(
|
||||
<MemoryRouter>
|
||||
@@ -22,7 +27,7 @@ function render(
|
||||
accountId="0199b4f2-7c1e-7d3a-9f00-aabbccddee02"
|
||||
organizationId={organizationId}
|
||||
result={result}
|
||||
sentFilters={undefined}
|
||||
sentFilters={props.sentFilters}
|
||||
needTitle={props.needTitle ?? null}
|
||||
stale={props.stale ?? false}
|
||||
/>
|
||||
@@ -157,4 +162,25 @@ describe("match list", () => {
|
||||
expect(render(matchModelFixture(), { stale: true })).toContain("Условия поиска изменены");
|
||||
expect(render(matchModelFixture())).not.toContain("Условия поиска изменены");
|
||||
});
|
||||
|
||||
it("tags the grade as a category and explains why the entry is in the selection", () => {
|
||||
const html = render(matchModelFixture());
|
||||
|
||||
expect(html).toContain(">Backend · Middle<");
|
||||
expect(html).toContain("Почему в подборке");
|
||||
// A claim is not shown as a category: the declared grade is a plain tag.
|
||||
expect(html).toMatch(/>Заявлено: [^<]+</);
|
||||
});
|
||||
|
||||
it("marks the technologies that the search asked for, in words as well as a dot", () => {
|
||||
const plain = render(matchModelFixture());
|
||||
// A need result does not echo its filters, so the request's own are used.
|
||||
const asked = render(
|
||||
matchModelFixture({ source: { kind: "need", need_id: needId, requirements_version: 1 } }),
|
||||
{ sentFilters: { stack: ["go"] } },
|
||||
);
|
||||
|
||||
expect(plain).not.toContain("совпадает с условием поиска");
|
||||
expect(asked).toContain("совпадает с условием поиска");
|
||||
});
|
||||
});
|
||||
@@ -18,9 +18,18 @@ import {
|
||||
type MatchSearchModel,
|
||||
type SpecializationView,
|
||||
} from "../../../entities/match";
|
||||
import type { MatchSearchFilters } from "../../../shared/api/schemas";
|
||||
import type { MatchSearchFilters, MatchSearchStackTag } from "../../../shared/api/schemas";
|
||||
import { paths } from "../../../shared/config";
|
||||
import { Button, ButtonLink, EmptyState } from "../../../shared/ui";
|
||||
import {
|
||||
Button,
|
||||
ButtonLink,
|
||||
Card,
|
||||
EmptyState,
|
||||
Notice,
|
||||
SegmentedControl,
|
||||
Tag,
|
||||
type SegmentedOption,
|
||||
} from "../../../shared/ui";
|
||||
import styles from "./match-list.module.css";
|
||||
|
||||
type MatchListProps = {
|
||||
@@ -41,6 +50,7 @@ const closedEntry: EntryState = { explanation: false, cardRequested: false, card
|
||||
|
||||
type EntryProps = {
|
||||
card: MatchCardModel;
|
||||
matchedStack: readonly MatchSearchStackTag[];
|
||||
state: EntryState;
|
||||
accountId: string;
|
||||
organizationId: string;
|
||||
@@ -48,7 +58,15 @@ type EntryProps = {
|
||||
onChange: (next: EntryState) => void;
|
||||
};
|
||||
|
||||
function Entry({ card, state, accountId, organizationId, needId, onChange }: EntryProps) {
|
||||
function Entry({
|
||||
card,
|
||||
matchedStack,
|
||||
state,
|
||||
accountId,
|
||||
organizationId,
|
||||
needId,
|
||||
onChange,
|
||||
}: EntryProps) {
|
||||
const ids = useId();
|
||||
const headingId = `${ids}-heading`;
|
||||
const explanationId = `${ids}-explanation`;
|
||||
@@ -60,8 +78,20 @@ function Entry({ card, state, accountId, organizationId, needId, onChange }: Ent
|
||||
<MatchCardView
|
||||
card={card}
|
||||
headingId={headingId}
|
||||
matchedStack={matchedStack}
|
||||
actions={
|
||||
<>
|
||||
<ButtonLink
|
||||
to={paths.employer.inviteCandidate({
|
||||
organizationId,
|
||||
candidateHandle: card.candidateHandle,
|
||||
specialization: card.specialization,
|
||||
needId,
|
||||
})}
|
||||
aria-label={`Пригласить кандидата ${short}, ${specialization}`}
|
||||
>
|
||||
Пригласить
|
||||
</ButtonLink>
|
||||
<Button
|
||||
variant="secondary"
|
||||
aria-expanded={state.explanation}
|
||||
@@ -80,17 +110,6 @@ function Entry({ card, state, accountId, organizationId, needId, onChange }: Ent
|
||||
>
|
||||
{state.cardOpen ? "Закрыть карточку" : "Открыть карточку"}
|
||||
</Button>
|
||||
<ButtonLink
|
||||
to={paths.employer.inviteCandidate({
|
||||
organizationId,
|
||||
candidateHandle: card.candidateHandle,
|
||||
specialization: card.specialization,
|
||||
needId,
|
||||
})}
|
||||
aria-label={`Пригласить кандидата ${short}, ${specialization}`}
|
||||
>
|
||||
Пригласить
|
||||
</ButtonLink>
|
||||
</>
|
||||
}
|
||||
>
|
||||
@@ -111,6 +130,7 @@ function Entry({ card, state, accountId, organizationId, needId, onChange }: Ent
|
||||
type GroupProps = {
|
||||
group: MatchGroup;
|
||||
cards: readonly MatchCardModel[];
|
||||
matchedStack: readonly MatchSearchStackTag[];
|
||||
entryStates: Readonly<Record<string, EntryState>>;
|
||||
accountId: string;
|
||||
organizationId: string;
|
||||
@@ -121,6 +141,7 @@ type GroupProps = {
|
||||
function Group({
|
||||
group,
|
||||
cards,
|
||||
matchedStack,
|
||||
entryStates,
|
||||
accountId,
|
||||
organizationId,
|
||||
@@ -134,7 +155,7 @@ function Group({
|
||||
<h3 id={headingId} className={styles["group-title"]}>
|
||||
{groupLabels[group]}
|
||||
</h3>
|
||||
<span className={styles["group-count"]}>{`Записей: ${cards.length}`}</span>
|
||||
<Tag>{`Записей: ${cards.length}`}</Tag>
|
||||
</div>
|
||||
<p className={styles["group-description"]}>{groupDescriptions[group]}</p>
|
||||
{cards.length === 0 ? (
|
||||
@@ -147,6 +168,7 @@ function Group({
|
||||
<li key={key}>
|
||||
<Entry
|
||||
card={card}
|
||||
matchedStack={matchedStack}
|
||||
state={entryStates[key] ?? closedEntry}
|
||||
accountId={accountId}
|
||||
organizationId={organizationId}
|
||||
@@ -162,6 +184,14 @@ function Group({
|
||||
);
|
||||
}
|
||||
|
||||
/** The technologies the search asked for, so a card can mark the chips that match. */
|
||||
function stackOfSearch(
|
||||
source: MatchSearchModel["source"],
|
||||
sentFilters: MatchSearchFilters | undefined,
|
||||
): readonly MatchSearchStackTag[] {
|
||||
return (source.kind === "bank" ? source.filters.stack : sentFilters?.stack) ?? [];
|
||||
}
|
||||
|
||||
/**
|
||||
* The result of one search: the basis and the filters it ran with, a notice
|
||||
* when the output is only part of the ranked result, a switch between the
|
||||
@@ -188,6 +218,7 @@ export function MatchList({
|
||||
}, [result]);
|
||||
|
||||
const applied = appliedFiltersOf(result.source, sentFilters);
|
||||
const matchedStack = stackOfSearch(result.source, sentFilters);
|
||||
const specializations = specializationsInResult(result.cards);
|
||||
const activeView: SpecializationView =
|
||||
view !== allSpecializationsView && !specializations.includes(view)
|
||||
@@ -195,6 +226,13 @@ export function MatchList({
|
||||
: view;
|
||||
const visible = cardsForView(result.cards, activeView);
|
||||
const needId = result.source.kind === "need" ? result.source.needId : undefined;
|
||||
const viewOptions: SegmentedOption<SpecializationView>[] = [
|
||||
allSpecializationsView as SpecializationView,
|
||||
...specializations,
|
||||
].map((option) => ({
|
||||
value: option,
|
||||
label: option === allSpecializationsView ? "Все специализации" : specializationLabels[option],
|
||||
}));
|
||||
|
||||
const basis =
|
||||
result.source.kind === "need"
|
||||
@@ -206,36 +244,38 @@ export function MatchList({
|
||||
<h2 ref={headingRef} tabIndex={-1} className={styles.title}>
|
||||
Результат поиска
|
||||
</h2>
|
||||
<dl className={styles.basis}>
|
||||
<dt>Основание</dt>
|
||||
<dd>{basis}</dd>
|
||||
<dt>Текущие фильтры</dt>
|
||||
<dd>
|
||||
{applied.length === 0 ? (
|
||||
"Не заданы"
|
||||
) : (
|
||||
<ul className={styles.filters}>
|
||||
{applied.map((item) => (
|
||||
<li key={item.label} className={styles.filter}>
|
||||
{`${item.label}: ${item.value}`}
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</dd>
|
||||
</dl>
|
||||
<Card as="div" tone="raised">
|
||||
<dl className={styles.basis}>
|
||||
<dt>Основание</dt>
|
||||
<dd>{basis}</dd>
|
||||
<dt>Текущие фильтры</dt>
|
||||
<dd>
|
||||
{applied.length === 0 ? (
|
||||
"Не заданы"
|
||||
) : (
|
||||
<ul className={styles.filters}>
|
||||
{applied.map((item) => (
|
||||
<li key={item.label}>
|
||||
<Tag tone="stack">{`${item.label}: ${item.value}`}</Tag>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
)}
|
||||
</dd>
|
||||
</dl>
|
||||
</Card>
|
||||
{stale ? (
|
||||
<p className={styles.notice} role="status">
|
||||
<Notice tone="info" role="status">
|
||||
Условия поиска изменены после этого результата. Нажмите «Найти кандидатов», чтобы обновить
|
||||
выдачу.
|
||||
</p>
|
||||
</Notice>
|
||||
) : null}
|
||||
{result.truncated ? (
|
||||
<p className={styles.notice} data-kind="truncated">
|
||||
<Notice tone="neutral">
|
||||
Показана часть выдачи; квота просмотров или предел группы. Остальные кандидаты не
|
||||
показаны, их число сервер не сообщает. Сузьте фильтры, чтобы увидеть меньше записей
|
||||
целиком.
|
||||
</p>
|
||||
</Notice>
|
||||
) : null}
|
||||
{result.cards.length === 0 ? (
|
||||
<EmptyState
|
||||
@@ -267,33 +307,19 @@ export function MatchList({
|
||||
) : (
|
||||
<>
|
||||
{specializations.length > 1 ? (
|
||||
<fieldset className={styles.switcher}>
|
||||
<legend>Представление по специализациям</legend>
|
||||
<div className={styles.views}>
|
||||
{([allSpecializationsView, ...specializations] as SpecializationView[]).map(
|
||||
(option) => (
|
||||
<label key={option} className={styles.view}>
|
||||
<input
|
||||
type="radio"
|
||||
name={switcherId}
|
||||
value={option}
|
||||
checked={activeView === option}
|
||||
onChange={() => setView(option)}
|
||||
/>
|
||||
<span>
|
||||
{option === allSpecializationsView
|
||||
? "Все специализации"
|
||||
: specializationLabels[option]}
|
||||
</span>
|
||||
</label>
|
||||
),
|
||||
)}
|
||||
</div>
|
||||
<div className={styles.switcher}>
|
||||
<SegmentedControl
|
||||
legend="Представление по специализациям"
|
||||
name={switcherId}
|
||||
options={viewOptions}
|
||||
value={activeView}
|
||||
onChange={setView}
|
||||
/>
|
||||
<p className={styles.hint}>
|
||||
Один кандидат может быть в нескольких специализациях. Подтверждение не переносится
|
||||
между ними: у каждой записи свой статус и своя группа.
|
||||
</p>
|
||||
</fieldset>
|
||||
</div>
|
||||
) : null}
|
||||
<p className={styles.hint} role="status">
|
||||
{`Показано записей: ${visible.length}`}
|
||||
@@ -303,6 +329,7 @@ export function MatchList({
|
||||
key={group}
|
||||
group={group}
|
||||
cards={visible.filter((card) => card.group === group)}
|
||||
matchedStack={matchedStack}
|
||||
entryStates={entryStates}
|
||||
accountId={accountId}
|
||||
organizationId={organizationId}
|
||||
|
||||
Reference in new issue
Block a user