feat(frontend): redesign the employer cabinet with step-by-step need and invitation forms

This commit is contained in:
shira committed 2026-10-10 03:01:36 +03:00
1 parent a0869d81a1
commit 15590d127c
45 files changed
+3600 -1983

No files matched your search

+1
View File
@@ -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%;
}
+138 -81
View File
@@ -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);