fix(frontend): refresh the landing page, keep the employer sidebar full height, and align the candidate home
This commit is contained in:
1 parent
ac57c05aca
commit
a5990d3fc6
12 files changed
+460
-51
No files matched your search
@@ -438,6 +438,28 @@ test.describe("candidate home states with a stubbed API", () => {
|
||||
await captureReviewScreenshots(page, "candidate-home-category");
|
||||
});
|
||||
|
||||
test("states one confirmed category in every block when the availability read has none", async ({
|
||||
page,
|
||||
}) => {
|
||||
await mockCandidateApi(page, {
|
||||
step: "candidate_consents",
|
||||
profileVersion: 1,
|
||||
declared: { specialization: "backend", grade: "junior" },
|
||||
results: [realResult("confirmed")],
|
||||
});
|
||||
await page.goto("/candidate");
|
||||
|
||||
await expect(page.getByRole("heading", { name: "Категория получена" })).toBeVisible();
|
||||
await expect(page.getByText("Подтверждено тестом: Junior").first()).toBeVisible();
|
||||
await expect(page.getByText("Есть подтвержденная категория")).toBeVisible();
|
||||
await expect(page.getByText("Уровень подтвержден: Backend, Junior.")).toBeVisible();
|
||||
await expect(page.getByRole("heading", { name: "Подтвердите уровень тестом" })).toHaveCount(0);
|
||||
await expect(page.getByText("Пока не подтверждена")).toHaveCount(0);
|
||||
await expect(page.getByText("Еще не пройден")).toHaveCount(0);
|
||||
await expect(page.getByText(/Сохраненный шаг аккаунта/)).toHaveCount(0);
|
||||
await expect(page.getByRole("alert")).toHaveCount(0);
|
||||
});
|
||||
|
||||
test("shows an open card and an active search status exactly as the API returns them", async ({
|
||||
page,
|
||||
}) => {
|
||||
|
||||
@@ -241,10 +241,15 @@ describe("product readiness", () => {
|
||||
expect(html).not.toContain("Начать полную проверку");
|
||||
});
|
||||
|
||||
it("presents the root page as a scaffold, not as a working product", async () => {
|
||||
it("describes the working cabinets on the root page without the scaffold label", async () => {
|
||||
const html = await renderHtml("/");
|
||||
|
||||
expect(html).toContain("Сейчас доступен только каркас интерфейса");
|
||||
expect(html).toContain("Регистрация, вход и основные сценарии кабинетов уже работают");
|
||||
expect(html).not.toContain("каркас");
|
||||
expect(html).not.toContain("Пустой каркас");
|
||||
expect(html).toContain("Пока не готово");
|
||||
expect(html).toMatch(/<a[^>]*href="\/login"[^>]*>Войти<\/a>/);
|
||||
expect(html).toMatch(/<a[^>]*href="\/register"[^>]*>Зарегистрироваться<\/a>/);
|
||||
// The API liveness check lives on the technical page, not on the landing.
|
||||
expect(html).not.toContain("healthz");
|
||||
expect(html).toMatch(/<a[^>]*href="\/status"[^>]*>Технический статус<\/a>/);
|
||||
|
||||
@@ -2,6 +2,7 @@ import { describe, expect, it, vi } from "vitest";
|
||||
import { ApiRequestError, networkErrorCode } from "../../../shared/api";
|
||||
import type {
|
||||
AssessmentAvailability,
|
||||
AssessmentResultHistoryPage,
|
||||
CandidateProfile,
|
||||
CandidateQuestionnaire,
|
||||
} from "../../../shared/api/schemas";
|
||||
@@ -36,29 +37,35 @@ const availability = {
|
||||
{ specialization: "backend", confirmed_grade: null, active_attempt_id: null, grades: [] },
|
||||
],
|
||||
} as AssessmentAvailability;
|
||||
const results = {
|
||||
items: [],
|
||||
page: { has_more: false, next_cursor: null },
|
||||
} as AssessmentResultHistoryPage;
|
||||
|
||||
function apiError(status: number) {
|
||||
return new ApiRequestError({ status, code: networkErrorCode, title: "Failed." });
|
||||
}
|
||||
|
||||
describe("combineJourneyReads", () => {
|
||||
it("stays pending until all three reads arrive", () => {
|
||||
it("stays pending until all four reads arrive", () => {
|
||||
const state = combineJourneyReads(
|
||||
"candidate_profile",
|
||||
read("success", profile),
|
||||
read("pending"),
|
||||
read("success", availability),
|
||||
read("success", results),
|
||||
);
|
||||
|
||||
expect(state).toEqual({ status: "pending" });
|
||||
});
|
||||
|
||||
it("builds the journey from the three reads", () => {
|
||||
it("builds the journey from the four reads", () => {
|
||||
const state = combineJourneyReads(
|
||||
"candidate_assessment",
|
||||
read("success", profile),
|
||||
read("success", questionnaire),
|
||||
read("success", availability),
|
||||
read("success", results),
|
||||
);
|
||||
|
||||
expect(state.status).toBe("success");
|
||||
@@ -75,6 +82,20 @@ describe("combineJourneyReads", () => {
|
||||
read("error", undefined, failure),
|
||||
read("success", questionnaire),
|
||||
read("success", availability),
|
||||
read("success", results),
|
||||
);
|
||||
|
||||
expect(state).toMatchObject({ status: "error", error: failure });
|
||||
});
|
||||
|
||||
it("fails when the results read fails, so a confirmed category is never hidden", () => {
|
||||
const failure = apiError(500);
|
||||
const state = combineJourneyReads(
|
||||
"candidate_assessment",
|
||||
read("success", profile),
|
||||
read("success", questionnaire),
|
||||
read("success", availability),
|
||||
read("error", undefined, failure),
|
||||
);
|
||||
|
||||
expect(state).toMatchObject({ status: "error", error: failure });
|
||||
@@ -90,6 +111,7 @@ describe("combineJourneyReads", () => {
|
||||
read("error", undefined, apiError(500), failedProfile),
|
||||
read("success", questionnaire, null, okQuestionnaire),
|
||||
read("error", undefined, denied, failedAvailability),
|
||||
read("success", results),
|
||||
);
|
||||
|
||||
expect(state.status).toBe("error");
|
||||
|
||||
@@ -28,6 +28,9 @@ type CandidateProfileVersion = Pick<CandidateProfile, "version">;
|
||||
|
||||
const homeQueryPrefix = ["candidate-home"] as const;
|
||||
|
||||
/** Largest page the results list accepts; see ListMyAssessmentResults. */
|
||||
const homeResultsPageSize = 50;
|
||||
|
||||
/** Account-scoped keys: a response for one account never fills another's cache. */
|
||||
export const candidateHomeQueryKeys = {
|
||||
root: homeQueryPrefix,
|
||||
@@ -117,12 +120,17 @@ export function useCandidateAvailabilityRead(session: Session | undefined) {
|
||||
);
|
||||
}
|
||||
|
||||
/** Newest real result only: the home screen links to the full history. */
|
||||
/**
|
||||
* The first page of real results, newest first. The home screen shows its
|
||||
* first item as the last result and reads the current category of each
|
||||
* specialization from the newest decision in the same page. The page size is
|
||||
* the maximum of the list endpoint; the full history stays on the results page.
|
||||
*/
|
||||
export function useCandidateLatestResultRead(session: Session | undefined) {
|
||||
return useHomeQuery<AssessmentResultHistoryPage>(
|
||||
session,
|
||||
candidateHomeQueryKeys.latestResult,
|
||||
(signal) => listMyAssessmentResults({ limit: 1 }, { signal }),
|
||||
(signal) => listMyAssessmentResults({ limit: homeResultsPageSize }, { signal }),
|
||||
AssessmentResultHistoryPage,
|
||||
);
|
||||
}
|
||||
@@ -154,18 +162,21 @@ function isAccessError(error: unknown): boolean {
|
||||
}
|
||||
|
||||
/**
|
||||
* Joins the three reads that the next step depends on. One failed read fails
|
||||
* the whole state, because a step chosen from partial data could send the
|
||||
* candidate to a form they already completed. A denied read wins over other
|
||||
* failures so that the forbidden state is shown instead of a retry.
|
||||
* Joins the four reads that the next step depends on: the profile version,
|
||||
* the questionnaire, the assessment availability, and the first page of
|
||||
* results. One failed read fails the whole state, because a step chosen from
|
||||
* partial data could send the candidate to a form they already completed, or
|
||||
* hide a confirmed category. A denied read wins over other failures so that
|
||||
* the forbidden state is shown instead of a retry.
|
||||
*/
|
||||
export function combineJourneyReads(
|
||||
savedStep: CandidateJourney["savedStep"],
|
||||
profile: ReadResult<CandidateProfileVersion>,
|
||||
questionnaire: ReadResult<CandidateQuestionnaire>,
|
||||
availability: ReadResult<AssessmentAvailability>,
|
||||
results: ReadResult<AssessmentResultHistoryPage>,
|
||||
): CandidateJourneyState {
|
||||
const reads = [profile, questionnaire, availability];
|
||||
const reads = [profile, questionnaire, availability, results];
|
||||
const failed = reads.filter((read) => read.status === "error");
|
||||
if (failed.length > 0) {
|
||||
const denied = failed.find((read) => isAccessError(read.error));
|
||||
@@ -178,7 +189,12 @@ export function combineJourneyReads(
|
||||
},
|
||||
};
|
||||
}
|
||||
if (profile.data === undefined || questionnaire.data === undefined || !availability.data) {
|
||||
if (
|
||||
profile.data === undefined ||
|
||||
questionnaire.data === undefined ||
|
||||
!availability.data ||
|
||||
results.data === undefined
|
||||
) {
|
||||
return { status: "pending" };
|
||||
}
|
||||
return {
|
||||
@@ -188,6 +204,7 @@ export function combineJourneyReads(
|
||||
profileVersion: profile.data.version,
|
||||
questionnaire: questionnaire.data,
|
||||
availability: availability.data,
|
||||
results: results.data,
|
||||
}),
|
||||
};
|
||||
}
|
||||
@@ -197,6 +214,13 @@ export function useCandidateJourney(session: Session | undefined): CandidateJour
|
||||
const profile = useCandidateProfileRead(session);
|
||||
const questionnaire = useCandidateQuestionnaireRead(session);
|
||||
const availability = useCandidateAvailabilityRead(session);
|
||||
const results = useCandidateLatestResultRead(session);
|
||||
if (!session) return { status: "pending" };
|
||||
return combineJourneyReads(session.account.onboarding_step, profile, questionnaire, availability);
|
||||
return combineJourneyReads(
|
||||
session.account.onboarding_step,
|
||||
profile,
|
||||
questionnaire,
|
||||
availability,
|
||||
results,
|
||||
);
|
||||
}
|
||||
@@ -54,12 +54,49 @@ function questionnaire(
|
||||
};
|
||||
}
|
||||
|
||||
type ResultRow = CandidateJourneyInput["results"]["items"][number];
|
||||
|
||||
/**
|
||||
* One real result as the results list returns it. A v2 result carries the
|
||||
* category decision with the grade in force when the attempt ended; a legacy
|
||||
* result carries none.
|
||||
*/
|
||||
function resultRow(
|
||||
specialization: SpecializationCode,
|
||||
options: { grade?: GradeCode | null; decidedAt?: string; legacy?: boolean } = {},
|
||||
): ResultRow {
|
||||
const grade = options.grade ?? null;
|
||||
const decision = options.legacy
|
||||
? {}
|
||||
: {
|
||||
category_decision: {
|
||||
status: grade ? "assigned" : "not_eligible",
|
||||
previous_confirmed_grade: null,
|
||||
current_confirmed_grade: grade,
|
||||
method: grade ? "demo_basic_pass_mark" : null,
|
||||
source: grade ? "synthetic_demo" : null,
|
||||
calibration_status: "uncalibrated",
|
||||
},
|
||||
};
|
||||
return {
|
||||
kind: "root",
|
||||
attempt_id: "0199b4f2-7c1e-7d3a-9f00-aabbccddee10",
|
||||
specialization,
|
||||
outcome: grade ? "confirmed" : "not_confirmed",
|
||||
confirmed_grade: grade,
|
||||
previous_confirmed_grade: null,
|
||||
decided_at: options.decidedAt ?? "2026-10-08T10:00:00Z",
|
||||
...decision,
|
||||
} as unknown as ResultRow;
|
||||
}
|
||||
|
||||
function input(overrides: Partial<CandidateJourneyInput> = {}): CandidateJourneyInput {
|
||||
return {
|
||||
savedStep: "candidate_consents",
|
||||
profileVersion: 0,
|
||||
questionnaire: questionnaire([]),
|
||||
availability: { specializations: [] },
|
||||
results: { items: [] },
|
||||
...overrides,
|
||||
};
|
||||
}
|
||||
@@ -197,6 +234,115 @@ describe("buildCandidateJourney next step", () => {
|
||||
});
|
||||
});
|
||||
|
||||
// Regression: the availability read reported no confirmed grade for a candidate
|
||||
// whose newest result confirmed Junior, so the next step said "take the test"
|
||||
// while the result block said the category was confirmed.
|
||||
describe("buildCandidateJourney confirmed category", () => {
|
||||
it("confirms the category from the newest result when the availability read has none", () => {
|
||||
const journey = buildCandidateJourney(
|
||||
input({
|
||||
savedStep: "candidate_consents",
|
||||
profileVersion: 1,
|
||||
questionnaire: questionnaire([["backend", "junior"]]),
|
||||
availability: { specializations: [availabilityRow("backend")] },
|
||||
results: { items: [resultRow("backend", { grade: "junior" })] },
|
||||
}),
|
||||
);
|
||||
|
||||
expect(journey.nextStep).toEqual({ kind: "result" });
|
||||
expect(journey.confirmed.map((standing) => standing.specialization)).toEqual(["backend"]);
|
||||
expect(journey.standings[0]).toMatchObject({
|
||||
declaredGrade: "junior",
|
||||
confirmedGrade: "junior",
|
||||
});
|
||||
expect(journey.hasResults).toBe(true);
|
||||
});
|
||||
|
||||
it("keeps the grade of the availability read when both sources name one", () => {
|
||||
const journey = buildCandidateJourney(
|
||||
input({
|
||||
profileVersion: 1,
|
||||
questionnaire: questionnaire([["backend", "middle"]]),
|
||||
availability: { specializations: [availabilityRow("backend", { confirmed: "middle" })] },
|
||||
results: { items: [resultRow("backend", { grade: "junior" })] },
|
||||
}),
|
||||
);
|
||||
|
||||
expect(journey.standings[0]?.confirmedGrade).toBe("middle");
|
||||
});
|
||||
|
||||
it("takes the grade in force from the newest decision, whatever the order of the page", () => {
|
||||
const journey = buildCandidateJourney(
|
||||
input({
|
||||
profileVersion: 1,
|
||||
questionnaire: questionnaire([["backend", "senior"]]),
|
||||
results: {
|
||||
items: [
|
||||
resultRow("backend", { grade: "junior", decidedAt: "2026-10-01T10:00:00Z" }),
|
||||
resultRow("backend", { grade: "senior", decidedAt: "2026-10-08T10:00:00Z" }),
|
||||
],
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
expect(journey.standings[0]?.confirmedGrade).toBe("senior");
|
||||
});
|
||||
|
||||
it("does not revive an older grade behind a newer decision that confirms none", () => {
|
||||
const journey = buildCandidateJourney(
|
||||
input({
|
||||
profileVersion: 1,
|
||||
questionnaire: questionnaire([["backend", "junior"]]),
|
||||
results: {
|
||||
items: [
|
||||
resultRow("backend", { grade: "junior", decidedAt: "2026-10-01T10:00:00Z" }),
|
||||
resultRow("backend", { grade: null, decidedAt: "2026-10-08T10:00:00Z" }),
|
||||
],
|
||||
},
|
||||
}),
|
||||
);
|
||||
|
||||
expect(journey.confirmed).toEqual([]);
|
||||
expect(journey.nextStep).toEqual({ kind: "assessment" });
|
||||
});
|
||||
|
||||
it("ignores legacy results that carry no category decision", () => {
|
||||
const journey = buildCandidateJourney(
|
||||
input({
|
||||
profileVersion: 1,
|
||||
questionnaire: questionnaire([["backend", "junior"]]),
|
||||
availability: { specializations: [availabilityRow("backend")] },
|
||||
results: { items: [resultRow("backend", { grade: "junior", legacy: true })] },
|
||||
}),
|
||||
);
|
||||
|
||||
expect(journey.confirmed).toEqual([]);
|
||||
expect(journey.hasResults).toBe(true);
|
||||
expect(journey.nextStep).toEqual({ kind: "assessment" });
|
||||
});
|
||||
|
||||
it("keeps a confirmed category visible when the questionnaire no longer lists it", () => {
|
||||
const journey = buildCandidateJourney(
|
||||
input({
|
||||
profileVersion: 1,
|
||||
questionnaire: questionnaire([]),
|
||||
results: { items: [resultRow("qa", { grade: "junior" })] },
|
||||
}),
|
||||
);
|
||||
|
||||
expect(journey.standings).toEqual([
|
||||
{
|
||||
specialization: "qa",
|
||||
declaredGrade: null,
|
||||
confirmedGrade: "junior",
|
||||
activeAttemptId: null,
|
||||
canStartAttempt: false,
|
||||
},
|
||||
]);
|
||||
expect(journey.nextStep).toEqual({ kind: "result" });
|
||||
});
|
||||
});
|
||||
|
||||
describe("summarizeVisibility", () => {
|
||||
function settings(overrides: {
|
||||
publication?: Partial<PrivacySettings["publication"]>;
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import type {
|
||||
Account,
|
||||
AssessmentAvailability,
|
||||
AssessmentResultHistoryPage,
|
||||
CandidateQuestionnaire,
|
||||
GradeCode,
|
||||
PrivacySettings,
|
||||
@@ -50,28 +51,64 @@ export type CandidateJourneyInput = {
|
||||
profileVersion: number;
|
||||
questionnaire: Pick<CandidateQuestionnaire, "version" | "specializations">;
|
||||
availability: Pick<AssessmentAvailability, "specializations">;
|
||||
/** The first page of the candidate's real results, newest first. */
|
||||
results: Pick<AssessmentResultHistoryPage, "items">;
|
||||
};
|
||||
|
||||
export type CandidateJourney = {
|
||||
savedStep: OnboardingStep;
|
||||
profileSaved: boolean;
|
||||
questionnaireSaved: boolean;
|
||||
/** True when the candidate has at least one real assessment result. */
|
||||
hasResults: boolean;
|
||||
standings: readonly SpecializationStanding[];
|
||||
/** Standings whose grade an assessment confirmed. */
|
||||
confirmed: readonly SpecializationStanding[];
|
||||
nextStep: CandidateNextStep;
|
||||
};
|
||||
|
||||
function buildStandings(input: CandidateJourneyInput): SpecializationStanding[] {
|
||||
type ResultItem = AssessmentResultHistoryPage["items"][number];
|
||||
|
||||
/**
|
||||
* Grade in force for each specialization, read from the newest result of that
|
||||
* specialization. A v2 result records the grade in force when its attempt
|
||||
* ended, so the newest decision is the current category. A legacy result has
|
||||
* no decision and yields no grade; a result that confirms no grade leaves the
|
||||
* specialization unconfirmed. Older results never override a newer decision.
|
||||
*/
|
||||
export function currentGradesFromResults(
|
||||
results: readonly ResultItem[],
|
||||
): Map<SpecializationCode, GradeCode> {
|
||||
// The server lists results newest first; sorting here keeps the rule local.
|
||||
const newestFirst = [...results].sort((left, right) =>
|
||||
right.decided_at.localeCompare(left.decided_at),
|
||||
);
|
||||
const grades = new Map<SpecializationCode, GradeCode>();
|
||||
const decided = new Set<SpecializationCode>();
|
||||
for (const result of newestFirst) {
|
||||
if (decided.has(result.specialization)) continue;
|
||||
decided.add(result.specialization);
|
||||
const grade = result.category_decision?.current_confirmed_grade ?? null;
|
||||
if (grade !== null) grades.set(result.specialization, grade);
|
||||
}
|
||||
return grades;
|
||||
}
|
||||
|
||||
function buildStandings(
|
||||
input: CandidateJourneyInput,
|
||||
resultGrades: ReadonlyMap<SpecializationCode, GradeCode>,
|
||||
): SpecializationStanding[] {
|
||||
const standings = new Map<SpecializationCode, SpecializationStanding>();
|
||||
|
||||
// The availability list is the server's view of the questionnaire
|
||||
// specializations; the questionnaire adds the declared grade.
|
||||
// specializations; the questionnaire adds the declared grade. The current
|
||||
// confirmed grade comes from the availability read when it has one, and from
|
||||
// the newest result of the specialization otherwise.
|
||||
for (const item of input.availability.specializations) {
|
||||
standings.set(item.specialization, {
|
||||
specialization: item.specialization,
|
||||
declaredGrade: null,
|
||||
confirmedGrade: item.confirmed_grade,
|
||||
confirmedGrade: item.confirmed_grade ?? resultGrades.get(item.specialization) ?? null,
|
||||
activeAttemptId: item.active_attempt_id,
|
||||
canStartAttempt: item.grades.some((grade) => grade.status === "available"),
|
||||
});
|
||||
@@ -81,11 +118,23 @@ function buildStandings(input: CandidateJourneyInput): SpecializationStanding[]
|
||||
standings.set(item.specialization, {
|
||||
specialization: item.specialization,
|
||||
declaredGrade: item.self_assessed_grade,
|
||||
confirmedGrade: existing?.confirmedGrade ?? null,
|
||||
confirmedGrade: existing?.confirmedGrade ?? resultGrades.get(item.specialization) ?? null,
|
||||
activeAttemptId: existing?.activeAttemptId ?? null,
|
||||
canStartAttempt: existing?.canStartAttempt ?? false,
|
||||
});
|
||||
}
|
||||
// A result can name a specialization that the current questionnaire no
|
||||
// longer lists. Its confirmed grade is still a fact, so it stays visible.
|
||||
for (const [specialization, grade] of resultGrades) {
|
||||
if (standings.has(specialization)) continue;
|
||||
standings.set(specialization, {
|
||||
specialization,
|
||||
declaredGrade: null,
|
||||
confirmedGrade: grade,
|
||||
activeAttemptId: null,
|
||||
canStartAttempt: false,
|
||||
});
|
||||
}
|
||||
return [...standings.values()];
|
||||
}
|
||||
|
||||
@@ -95,22 +144,26 @@ function buildStandings(input: CandidateJourneyInput): SpecializationStanding[]
|
||||
* only input because the server advances it only when the profile or the
|
||||
* questionnaire is saved from the matching step, so a saved profile can sit
|
||||
* behind an earlier stored step. Presence of saved data therefore decides
|
||||
* between the profile, the questionnaire, and the test.
|
||||
* between the profile, the questionnaire, and the test. Facts about the
|
||||
* category and the test come only from the availability and results reads.
|
||||
*
|
||||
* The client invents no category, grade, or threshold: a category exists only
|
||||
* when the availability read returns a confirmed grade.
|
||||
* when the availability read or the newest result returns a confirmed grade.
|
||||
*/
|
||||
export function buildCandidateJourney(input: CandidateJourneyInput): CandidateJourney {
|
||||
const standings = buildStandings(input);
|
||||
const resultGrades = currentGradesFromResults(input.results.items);
|
||||
const standings = buildStandings(input, resultGrades);
|
||||
const confirmed = standings.filter((standing) => standing.confirmedGrade !== null);
|
||||
const profileSaved = input.profileVersion > 0;
|
||||
const questionnaireSaved =
|
||||
input.questionnaire.version > 0 && input.questionnaire.specializations.length > 0;
|
||||
const hasResults = input.results.items.length > 0;
|
||||
|
||||
return {
|
||||
savedStep: input.savedStep,
|
||||
profileSaved,
|
||||
questionnaireSaved,
|
||||
hasResults,
|
||||
standings,
|
||||
confirmed,
|
||||
nextStep: chooseNextStep({ profileSaved, questionnaireSaved, standings, confirmed }),
|
||||
|
||||
@@ -253,4 +253,59 @@ describe("candidate home", () => {
|
||||
expect(html).not.toContain("Подтверждено тестом:");
|
||||
expect(html).toContain("Пока не подтверждена");
|
||||
});
|
||||
|
||||
// Regression: the availability read had no confirmed grade while the newest
|
||||
// result confirmed Junior. Every block must then state the same category.
|
||||
it("states one confirmed category in every block when the availability read has none", () => {
|
||||
const html = render({
|
||||
step: "candidate_consents",
|
||||
profileVersion: 1,
|
||||
declared: { specialization: "backend", grade: "junior" },
|
||||
results: [
|
||||
{
|
||||
attempt_id: attemptId,
|
||||
kind: "root",
|
||||
specialization: "backend",
|
||||
target_grade: "junior",
|
||||
root_attempt_id: null,
|
||||
chain_deadline: null,
|
||||
task_language: "go",
|
||||
mode: "demo_basic",
|
||||
versions: {},
|
||||
outcome: "confirmed",
|
||||
not_determined_reason: null,
|
||||
confirmed_grade: "junior",
|
||||
previous_confirmed_grade: null,
|
||||
category_decision: {
|
||||
status: "assigned",
|
||||
previous_confirmed_grade: null,
|
||||
current_confirmed_grade: "junior",
|
||||
method: "demo_basic_pass_mark",
|
||||
source: "synthetic_demo",
|
||||
calibration_status: "uncalibrated",
|
||||
},
|
||||
strength: null,
|
||||
calibration_status: "uncalibrated",
|
||||
limitations: ["demo_bank"],
|
||||
uncertainty: null,
|
||||
basic_score: null,
|
||||
practices: [],
|
||||
gaps: [],
|
||||
durations: {},
|
||||
next_steps: [],
|
||||
decided_at: "2026-10-08T10:00:00Z",
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
expect(html).toContain("Категория получена");
|
||||
expect(html).toContain("Подтверждено тестом: Junior");
|
||||
expect(html).toContain("Есть подтвержденная категория");
|
||||
expect(html).toContain("Уровень подтвержден: Backend, Junior.");
|
||||
expect(html).not.toContain("Подтвердите уровень тестом");
|
||||
expect(html).not.toContain("Пока не подтверждена");
|
||||
expect(html).not.toContain("Еще не пройден");
|
||||
expect(html).not.toContain("Появятся после теста");
|
||||
expect(html).not.toContain("Сохраненный шаг аккаунта");
|
||||
});
|
||||
});
|
||||
@@ -125,9 +125,10 @@ function LatestResultSection() {
|
||||
|
||||
/**
|
||||
* Candidate home: the next step and links to available actions, then the
|
||||
* last assessment result and the current visibility of the profile. The
|
||||
* independent blocks fail on their own, so one failed read never hides the
|
||||
* next step.
|
||||
* last assessment result and the current visibility of the profile. The next
|
||||
* step, the standings, and the actions read the same results as the last
|
||||
* result block, so they never disagree with it. The visibility block fails on
|
||||
* its own and never hides the next step.
|
||||
*/
|
||||
export function CandidateHomePage() {
|
||||
return (
|
||||
|
||||
@@ -64,12 +64,41 @@
|
||||
color: var(--color-text-secondary);
|
||||
}
|
||||
|
||||
.state {
|
||||
width: fit-content;
|
||||
padding: 0 var(--space-2);
|
||||
border: var(--line-thin) dashed var(--color-border-strong);
|
||||
border-radius: var(--radius-pill);
|
||||
font-size: var(--font-size-xs);
|
||||
.features {
|
||||
display: grid;
|
||||
gap: var(--space-1);
|
||||
margin: var(--space-2) 0 0;
|
||||
padding: 0;
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
list-style: none;
|
||||
}
|
||||
|
||||
.features li {
|
||||
position: relative;
|
||||
padding-left: var(--space-3);
|
||||
}
|
||||
|
||||
/* Short accent rule in place of bullets, matching the corner connector. */
|
||||
.features li::before {
|
||||
position: absolute;
|
||||
top: 0.7em;
|
||||
left: 0;
|
||||
width: 0.5rem;
|
||||
height: var(--line-thin);
|
||||
background: var(--color-accent);
|
||||
content: "";
|
||||
}
|
||||
|
||||
.actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: var(--space-2);
|
||||
}
|
||||
|
||||
.help {
|
||||
color: var(--color-text-secondary);
|
||||
font-size: var(--font-size-s);
|
||||
}
|
||||
|
||||
@media (width >= 48rem) {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { Link } from "react-router-dom";
|
||||
import { paths } from "../../../shared/config";
|
||||
import { Page, Section, TextLink } from "../../../shared/ui";
|
||||
import { ButtonLink, Page, Section, TextLink } from "../../../shared/ui";
|
||||
import styles from "./welcome-page.module.css";
|
||||
|
||||
const cabinets = [
|
||||
@@ -8,26 +8,39 @@ const cabinets = [
|
||||
to: paths.candidate.root,
|
||||
title: "Кабинет кандидата",
|
||||
format: "Для телефона",
|
||||
summary: "Профиль, тест, результаты, приглашения и настройки приватности.",
|
||||
summary: "Профиль и анкета, тест на подтверждение уровня, результаты и настройки видимости.",
|
||||
features: [
|
||||
"Заявленный уровень из анкеты показан отдельно от подтвержденной категории.",
|
||||
"Категория появляется только по результату теста. Демонстрационный результат помечен как демонстрационный.",
|
||||
"Согласия, публикация карточки, статус поиска, уведомления и обращения в поддержку.",
|
||||
],
|
||||
},
|
||||
{
|
||||
to: paths.employer.root,
|
||||
title: "Кабинет работодателя",
|
||||
format: "Для компьютера",
|
||||
summary: "Компания и команда, потребности, подбор кандидатов и приглашения.",
|
||||
summary:
|
||||
"Компания и статус ее проверки, потребности, поиск кандидатов и составление приглашений.",
|
||||
features: [
|
||||
"Данные компании и статус ее проверки.",
|
||||
"Потребности с требованиями, по которым ведется поиск.",
|
||||
"Поиск кандидатов: заявленный уровень и подтвержденная категория показаны раздельно.",
|
||||
"Составление приглашения с предпросмотром того, что увидит кандидат.",
|
||||
],
|
||||
},
|
||||
] as const;
|
||||
|
||||
/**
|
||||
* Public start page. It states plainly that only the interface scaffold
|
||||
* exists, so it cannot be mistaken for a working product.
|
||||
* Public start page. It describes the cabinets that work now and names the
|
||||
* screens that are still placeholders, so the page makes no promise the
|
||||
* product does not keep.
|
||||
*/
|
||||
export function WelcomePage() {
|
||||
return (
|
||||
<Page
|
||||
title="Протокол подтвержденных навыков"
|
||||
eyebrow="Lincodex"
|
||||
lead="Сейчас доступен только каркас интерфейса: навигация, общие состояния экранов и оформление. Вход, регистрация и рабочие сценарии кабинетов появятся в следующих задачах."
|
||||
lead="Регистрация, вход и основные сценарии кабинетов уже работают. Заявленный уровень остается самооценкой: подтвержденную категорию присваивает только результат теста."
|
||||
>
|
||||
<Section title="Кабинеты">
|
||||
<ul className={styles.cabinets}>
|
||||
@@ -37,18 +50,33 @@ export function WelcomePage() {
|
||||
<span className={styles.format}>{cabinet.format}</span>
|
||||
<span className={styles["card-title"]}>{cabinet.title}</span>
|
||||
<span className={styles.summary}>{cabinet.summary}</span>
|
||||
<span className={styles.state}>Пустой каркас</span>
|
||||
<ul className={styles.features}>
|
||||
{cabinet.features.map((feature) => (
|
||||
<li key={feature}>{feature}</li>
|
||||
))}
|
||||
</ul>
|
||||
</Link>
|
||||
</li>
|
||||
))}
|
||||
</ul>
|
||||
</Section>
|
||||
<Section title="Публичные страницы">
|
||||
<Section title="Пока не готово">
|
||||
<p>
|
||||
Заготовки: <TextLink to={paths.login}>вход</TextLink>,{" "}
|
||||
<TextLink to={paths.register}>регистрация</TextLink>,{" "}
|
||||
<TextLink to={paths.verifyEmail}>подтверждение почты</TextLink> и{" "}
|
||||
<TextLink to={paths.support}>поддержка</TextLink>.
|
||||
Входящие приглашения кандидата, их принятие и список приглашений, отправленных компанией,
|
||||
пока заготовки: эти экраны не показывают данных и не выполняют действий.
|
||||
</p>
|
||||
</Section>
|
||||
<Section title="Вход и регистрация">
|
||||
<div className={styles.actions}>
|
||||
<ButtonLink to={paths.login}>Войти</ButtonLink>
|
||||
<ButtonLink to={paths.register} variant="secondary">
|
||||
Зарегистрироваться
|
||||
</ButtonLink>
|
||||
</div>
|
||||
<p className={styles.help}>
|
||||
Подтверждение почты и повторная отправка письма находятся на странице{" "}
|
||||
<TextLink to={paths.verifyEmail}>подтверждения почты</TextLink>. Вопросы о работе сервиса
|
||||
задайте в <TextLink to={paths.support}>поддержке</TextLink>.
|
||||
</p>
|
||||
</Section>
|
||||
</Page>
|
||||
|
||||
@@ -104,6 +104,10 @@ function describeNextStep(journey: CandidateJourney, step: NextStep): StepView {
|
||||
|
||||
function NextStepCard({ journey }: { journey: CandidateJourney }) {
|
||||
const view = describeNextStep(journey, journey.nextStep);
|
||||
// The stored onboarding step is not advanced after the first saves, so it
|
||||
// describes progress only until a real result exists. Once a test has
|
||||
// produced a result, showing "consents" would contradict the result blocks.
|
||||
const showSavedStep = !journey.hasResults;
|
||||
return (
|
||||
<section className={styles.card} aria-labelledby="next-step-title">
|
||||
<p className={styles["card-eyebrow"]}>Следующий шаг</p>
|
||||
@@ -119,12 +123,18 @@ function NextStepCard({ journey }: { journey: CandidateJourney }) {
|
||||
</ButtonLink>
|
||||
) : null}
|
||||
</div>
|
||||
<p className={styles.note}>
|
||||
Сохраненный шаг аккаунта: <strong>{onboardingStepLabels[journey.savedStep]}</strong>.
|
||||
{view.mentionsOptionalFsp
|
||||
? " Привязка ФСП ID необязательна: путь до категории проходит через анкету и тест."
|
||||
: null}
|
||||
</p>
|
||||
{showSavedStep || view.mentionsOptionalFsp ? (
|
||||
<p className={styles.note}>
|
||||
{showSavedStep ? (
|
||||
<>
|
||||
Сохраненный шаг аккаунта: <strong>{onboardingStepLabels[journey.savedStep]}</strong>.
|
||||
</>
|
||||
) : null}
|
||||
{view.mentionsOptionalFsp
|
||||
? " Привязка ФСП ID необязательна: путь до категории проходит через анкету и тест."
|
||||
: null}
|
||||
</p>
|
||||
) : null}
|
||||
</section>
|
||||
);
|
||||
}
|
||||
@@ -192,7 +202,9 @@ function sectionLinks(journey: CandidateJourney): SectionLink[] {
|
||||
? "Есть подтвержденная категория"
|
||||
: hasActiveAttempt
|
||||
? "Есть незавершенная попытка"
|
||||
: "Еще не пройден";
|
||||
: journey.hasResults
|
||||
? "Пройден, категории пока нет"
|
||||
: "Еще не пройден";
|
||||
|
||||
return [
|
||||
{
|
||||
@@ -215,7 +227,11 @@ function sectionLinks(journey: CandidateJourney): SectionLink[] {
|
||||
},
|
||||
{
|
||||
label: "Результаты",
|
||||
status: hasConfirmed ? "Есть категория" : "Появятся после теста",
|
||||
status: hasConfirmed
|
||||
? "Есть категория"
|
||||
: journey.hasResults
|
||||
? "Есть результат, категории пока нет"
|
||||
: "Появятся после теста",
|
||||
to: paths.candidate.results,
|
||||
linkLabel: "Результаты и история",
|
||||
},
|
||||
@@ -255,8 +271,9 @@ function AvailableActions({ journey }: { journey: CandidateJourney }) {
|
||||
/**
|
||||
* The main block of the candidate home: the next step, the declared and the
|
||||
* confirmed level side by side, and links to the available actions. Everything
|
||||
* comes from one read of the profile, the questionnaire, and the assessment
|
||||
* availability; a failed read shows an error instead of a guessed step.
|
||||
* comes from one read of the profile, the questionnaire, the assessment
|
||||
* availability, and the results; a failed read shows an error instead of a
|
||||
* guessed step.
|
||||
*/
|
||||
export function CandidateNextStep() {
|
||||
const session = useGetCurrentSession();
|
||||
|
||||
@@ -1,8 +1,14 @@
|
||||
/* Desktop first: base rules target 1024px and wider; narrow screens adapt. */
|
||||
|
||||
/* The graphite rail is painted by the container, not by the sidebar alone:
|
||||
* the sidebar is sticky and only one viewport tall, while the container spans
|
||||
* the whole page, so the rail stays dark on long pages. */
|
||||
.shell {
|
||||
display: grid;
|
||||
grid-template-columns: 17rem minmax(0, 1fr);
|
||||
min-height: 100vh;
|
||||
background: linear-gradient(var(--palette-graphite), var(--palette-graphite)) left top / 17rem
|
||||
100% no-repeat;
|
||||
}
|
||||
|
||||
/* Dark region: violet fails on graphite (2.49:1), so text, links, and the
|
||||
@@ -46,6 +52,7 @@
|
||||
.shell {
|
||||
grid-template-columns: minmax(0, 1fr);
|
||||
grid-template-rows: auto 1fr;
|
||||
background: none;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
|
||||
Reference in new issue
Block a user