feat: add assessment, privacy and support flows
This commit is contained in:
1 parent
ee3738ee73
commit
e4f24fa202
339 files changed
+56454
-1126
No files matched your search
@@ -0,0 +1 @@
|
||||
export { NeedEditor, type NeedEditorProps } from "./ui/need-editor";
|
||||
@@ -0,0 +1,202 @@
|
||||
.form {
|
||||
display: grid;
|
||||
gap: var(--space-5);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.intro,
|
||||
.hint,
|
||||
.meta,
|
||||
.provenance,
|
||||
.question {
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
.hint,
|
||||
.provenance,
|
||||
.question,
|
||||
.field-error,
|
||||
.action-error,
|
||||
.meta {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.group,
|
||||
.salary,
|
||||
.conflict,
|
||||
.recommendations,
|
||||
.list {
|
||||
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);
|
||||
}
|
||||
|
||||
.field {
|
||||
display: grid;
|
||||
gap: var(--space-2);
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
.field label,
|
||||
.add-row label,
|
||||
.skill-label {
|
||||
font-weight: var(--font-weight-bold);
|
||||
}
|
||||
|
||||
.field input,
|
||||
.field select,
|
||||
.field textarea,
|
||||
.item input,
|
||||
.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"] {
|
||||
border-color: var(--color-danger);
|
||||
}
|
||||
|
||||
.provenance {
|
||||
display: grid;
|
||||
gap: var(--space-1);
|
||||
font-size: var(--font-size-s);
|
||||
}
|
||||
|
||||
.provenance p,
|
||||
.provenance blockquote,
|
||||
.item blockquote {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.provenance blockquote,
|
||||
.item blockquote {
|
||||
padding-inline-start: var(--space-3);
|
||||
border-inline-start: var(--line-strong) solid var(--color-divider);
|
||||
color: var(--color-text-secondary);
|
||||
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;
|
||||
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;
|
||||
}
|
||||
|
||||
.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 {
|
||||
display: grid;
|
||||
gap: var(--space-3);
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.item {
|
||||
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);
|
||||
}
|
||||
|
||||
.badge {
|
||||
width: fit-content;
|
||||
padding: var(--space-1) var(--space-2);
|
||||
border-radius: var(--radius-s);
|
||||
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);
|
||||
}
|
||||
|
||||
.meta {
|
||||
font-size: var(--font-size-s);
|
||||
}
|
||||
|
||||
@media (width < 42rem) {
|
||||
.salary-grid {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
}
|
||||
|
||||
.group,
|
||||
.salary,
|
||||
.conflict,
|
||||
.recommendations,
|
||||
.list {
|
||||
padding: var(--space-3);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { fileURLToPath } from "node:url";
|
||||
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parse as parseYaml } from "yaml";
|
||||
import { getGetCurrentSessionQueryKey } from "../../../shared/api/endpoints/identity/identity";
|
||||
import type { Need, Session } from "../../../shared/api/schemas";
|
||||
import { Need as NeedSchema } from "../../../shared/api/schemas";
|
||||
import { NeedEditor } from "./need-editor";
|
||||
|
||||
type ExampleMap = Record<string, { value?: unknown } | undefined>;
|
||||
const bundlePath = fileURLToPath(
|
||||
new URL("../../../../../api/core/openapi.bundle.yml", import.meta.url),
|
||||
);
|
||||
const examples = (
|
||||
parseYaml(readFileSync(bundlePath, "utf8")) as { components: { examples: ExampleMap } }
|
||||
).components.examples;
|
||||
|
||||
function contractExample(name: string): unknown {
|
||||
const value = examples[name]?.value;
|
||||
if (value === undefined) throw new Error(`Missing contract example ${name}.`);
|
||||
return value;
|
||||
}
|
||||
|
||||
const need = NeedSchema.parse(contractExample("NeedExtractedWithUnknownSkill")) as Need;
|
||||
const session: Session = {
|
||||
account: {
|
||||
id: "01928f7a-1a2b-7c3d-8e4f-5a6b7c8d9e01",
|
||||
email: "owner@example.test",
|
||||
email_verified: true,
|
||||
scenario: "employer",
|
||||
onboarding_step: "completed",
|
||||
created_at: "2026-10-06T09:00:00Z",
|
||||
},
|
||||
csrf_token: "abcdefghijklmnopqrstuvwxyz123456",
|
||||
};
|
||||
|
||||
function renderEditor(value: Need): string {
|
||||
const queryClient = new QueryClient({
|
||||
defaultOptions: { queries: { retry: false } },
|
||||
});
|
||||
queryClient.setQueryData(getGetCurrentSessionQueryKey(), session);
|
||||
return renderToStaticMarkup(
|
||||
<QueryClientProvider client={queryClient}>
|
||||
<NeedEditor
|
||||
accountId={session.account.id}
|
||||
organizationId={value.organization_id}
|
||||
session={session}
|
||||
need={value}
|
||||
onCreated={() => undefined}
|
||||
onSaved={() => undefined}
|
||||
onAccessLost={() => undefined}
|
||||
/>
|
||||
</QueryClientProvider>,
|
||||
);
|
||||
}
|
||||
|
||||
describe("NeedEditor", () => {
|
||||
it("keeps parser suggestions reviewable and asks about unknown critical fields", () => {
|
||||
const markup = renderEditor(need);
|
||||
|
||||
expect(markup).toContain("Предложено из текста");
|
||||
expect(markup).toContain("Подтвердить предложение");
|
||||
expect(markup).toContain("Какой грейд нужен");
|
||||
expect(markup).toContain("в какой базе");
|
||||
expect(markup).toContain("Вакансия для сохранения потребности не требуется.");
|
||||
expect(markup).toMatch(
|
||||
/<select id="[^"]+-grade" aria-invalid="false"><option value="" selected="">Не указано/,
|
||||
);
|
||||
});
|
||||
|
||||
it("shows pending recommendation status without fabricating categories", () => {
|
||||
const pending: Need = {
|
||||
...need,
|
||||
recommendations: {
|
||||
status: "pending",
|
||||
requirements_version: need.requirements_version,
|
||||
policy_version: null,
|
||||
algorithm_version: null,
|
||||
computed_at: null,
|
||||
categories: [],
|
||||
},
|
||||
};
|
||||
const markup = renderEditor(pending);
|
||||
|
||||
expect(markup).toContain("Рекомендации пока не рассчитаны.");
|
||||
expect(markup).not.toContain("Категории рассчитаны по подтвержденным требованиям.");
|
||||
});
|
||||
});
|
||||
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user