feat(frontend): list the company invitations in the employer cabinet

This commit is contained in:
shira committed 2026-10-10 18:05:25 +03:00
1 parent 84454116f2
commit d8abaae85b
23 files changed
+1349 -222

No files matched your search

+19 -7
View File
@@ -2,10 +2,10 @@
[Русский](README.md) | English
A React and TypeScript SPA built with Vite and organized using FSD. Registration, email confirmation, sign-in, consent settings, the candidate profile and questionnaire, candidate assessment, company profiles, employer needs, and support cases use the API. A manual assessment request creates a support case and displays its current state; the screen does not present it as an assessment result. The result history and result page use the API. Candidate search, the employer's read of an anonymous card, and sending an invitation from a search result use the API. The candidate reads incoming invitations, accepts them with a choice of contacts, and declines them; the company's invitation list remains a placeholder.
A React and TypeScript SPA built with Vite and organized using FSD. Registration, email confirmation, sign-in, consent settings, the candidate profile and questionnaire, candidate assessment, company profiles, employer needs, and support cases use the API. A manual assessment request creates a support case and displays its current state; the screen does not present it as an assessment result. The result history and result page use the API. Candidate search, the employer's read of an anonymous card, and sending an invitation from a search result use the API. The candidate reads incoming invitations, accepts them with a choice of contacts, and declines them. The owner of a company sees the list of its invitations with their states.
- `src/app/` starts the application: the route tree (`router/`), the query client (`providers/`), global styles, and the route error page.
- `src/pages/` holds public pages, sign-in and registration, candidate profile and questionnaire, assessment results, company and employer needs pages, candidate search, the invitation to a candidate, the candidate's incoming invitations, support cases, technical status, and remaining placeholders.
- `src/pages/` holds public pages, sign-in and registration, candidate profile and questionnaire, assessment results, company and employer needs pages, candidate search, the invitation to a candidate, the company's invitation list, the candidate's incoming invitations, support cases, and technical status.
- `src/widgets/` holds shells: `public-shell`, `candidate-shell`, `employer-shell`, the result history widget `assessment-history`, the search result widget `match-list`, the invitation preview `invitation-preview`, and the technical `system-status` widget.
- `src/entities/` holds entity models, including `need` (see [Need entity](#need-entity)), `company`, and `invitation`; `src/features/` holds user actions and forms.
- `src/shared/ui/` holds design tokens, fonts, the wordmark, and primitives; `src/shared/config/` holds route paths; `src/shared/api/` holds the API client with generated endpoints, Zod schemas, and MSW mocks.
@@ -17,11 +17,11 @@ From the repository root, `make -C frontend dev` starts development and `make -C
## Routes
| Group | Paths | Shell |
| --------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
| Public | `/`, `/login`, `/register`, `/verify-email`, `/support`, `/status` | `PublicShell` |
| Candidate | `/candidate` with `onboarding`, `profile`, `questionnaire`, `assessment`, `results`, `results/:attemptId`, `invitations`, `invitations/:invitationId`, `privacy`, `support/cases`, `support/cases/new`, `support/cases/manual-assessment`, and `support/cases/:caseId` | `CandidateShell` |
| Employer | `/employer` redirects to `/employer/company`; `/employer/company`, `/employer/needs`, `/employer/needs/new`, `/employer/needs/:needId`, `/employer/candidates`, `/employer/invitations/new`, `/employer/support/cases`, `/employer/support/cases/new`, `/employer/support/cases/:caseId` | `EmployerShell` |
| Group | Paths | Shell |
| --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------- |
| Public | `/`, `/login`, `/register`, `/verify-email`, `/support`, `/status` | `PublicShell` |
| Candidate | `/candidate` with `onboarding`, `profile`, `questionnaire`, `assessment`, `results`, `results/:attemptId`, `invitations`, `invitations/:invitationId`, `privacy`, `support/cases`, `support/cases/new`, `support/cases/manual-assessment`, and `support/cases/:caseId` | `CandidateShell` |
| Employer | `/employer` redirects to `/employer/company`; `/employer/company`, `/employer/needs`, `/employer/needs/new`, `/employer/needs/:needId`, `/employer/candidates`, `/employer/invitations`, `/employer/invitations/new`, `/employer/support/cases`, `/employer/support/cases/new`, `/employer/support/cases/:caseId` | `EmployerShell` |
Each group has its own not-found page. Paths are defined once in `shared/config/paths.ts`. The router uses React Router data APIs (`createBrowserRouter`): a route-level error boundary, loader redirects, and later `lazy` code splitting for cabinets. Loaders do not fetch data; server data belongs to TanStack Query. Cabinet boundaries read the current session and direct guests to sign-in. `/support` sends a signed-in user to the support area for their account or to sign-in. Need pages pass `organization_id` in the query string, but the client checks the current owner directory and the server authorizes every request.
@@ -161,6 +161,18 @@ Checks. Unit tests cover parsing and labels (`entities/match`), the request buil
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.
## Company invitations
`/employer/invitations` (`pages/employer-invitations`) shows the company's invitations from `GET /organizations/{org_id}/invitations`: drafts and sent ones, newest first, in cursor pages ("Показать еще"). The company comes from `organization_id` in the address, otherwise the first company where the account is the owner; with several companies a picker sits above the list. Owner rights are checked against the current organization directory, and other roles are refused.
- Row. The heading is the role title; the state tag names the state in words and its tone repeats the meaning (draft is neutral, waiting for an answer is accented, accepted is a success, declined, expired, and withdrawn are danger). Below: the candidate only as the shortened alias (`entities/match/model/views.ts`), the salary range, the basis (a need with its requirements version or a direct invitation), the creation and last change dates, the response deadline, and the contact access (the contact kinds while `available`, "Доступ закрыт" while `closed`). The list response holds no name or contact value, and the screen shows none.
- Dates. The list summary has no delivery moment, so the screen shows creation and the last change, both in UTC through `formatServerMoment`.
- Filter. A `SegmentedControl` with "Все", "Ожидают ответа", "Приняты", "Закрыты", and "Черновики" works on the client over the loaded pages, because the API has no state filter yet (`entities/invitation/model/list-groups.ts`: every state of the contract belongs to exactly one group). When no loaded item is in a group but more pages remain, the screen does not claim the group is empty and offers to load the next pages.
- Links. A draft and a sent invitation open the same route `/employer/invitations/new` with `organization_id`, `candidate_handle`, and `invitation_id`: for a draft it opens the form with the saved terms, for a sent one the state, the deadline, the terms, and, after an acceptance, the contacts. The company has no separate invitation page.
- States. Loading (message and skeleton), an empty list with a link to "Кандидаты", an error with retry, a 401/403 or 404 refusal without retry, and a refresh error above an already loaded list.
Checks. Unit tests: state groups and tones, the list adapter on MSW (page size, cursor, contract check, a 403 refusal), the list markup (every state with its tone, the filter, empty states, draft and sent links, no contact values), and the page (loading, empty, error with retry, refusal, another company). The Playwright spec `e2e/acceptance-path.spec.ts` opens the owner's screen after three invitations are sent and checks three delivered invitations without candidate contacts.
## Candidate incoming invitations
`/candidate/invitations` (`pages/candidate-invitations`) shows the incoming invitations: a cursor-paged list from `GET /me/invitations`, newest first, which records no view. `/candidate/invitations/:invitationId` opens one invitation. The contract is in the [API](../api/README.en.md#invitations-and-contact-grants).