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