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
@@ -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