From 6dd5a0d54a88bc31e92695d1678a8e697d0c9693 Mon Sep 17 00:00:00 2001 From: TakuyaYagam1 Date: Sun, 11 Oct 2026 22:53:01 +0300 Subject: [PATCH] fix(frontend): keep candidate progress beside forms --- .../e2e/questionnaire-catalog-visual.spec.ts | 12 + .../assessment/ui/assessment-page.module.css | 2 +- .../pages/assessment/ui/assessment-page.tsx | 371 +++++++++--------- .../pages/profile/ui/profile-page.module.css | 15 - .../src/pages/profile/ui/profile-page.tsx | 13 +- .../questionnaire/ui/questionnaire-page.tsx | 10 +- .../src/widgets/candidate-next-step/index.ts | 1 + .../ui/candidate-journey-layout.module.css | 22 ++ .../ui/candidate-journey-layout.tsx | 17 + .../ui/candidate-journey-progress.tsx | 2 +- 10 files changed, 259 insertions(+), 206 deletions(-) delete mode 100644 frontend/src/pages/profile/ui/profile-page.module.css create mode 100644 frontend/src/widgets/candidate-next-step/ui/candidate-journey-layout.module.css create mode 100644 frontend/src/widgets/candidate-next-step/ui/candidate-journey-layout.tsx diff --git a/frontend/e2e/questionnaire-catalog-visual.spec.ts b/frontend/e2e/questionnaire-catalog-visual.spec.ts index 136662a..8ae6489 100644 --- a/frontend/e2e/questionnaire-catalog-visual.spec.ts +++ b/frontend/e2e/questionnaire-catalog-visual.spec.ts @@ -133,6 +133,14 @@ test("shows the populated specialization catalog on desktop and mobile", async ( ).toHaveCount(1); await specialization.selectOption("backend"); await expect(page.getByText(/Проверка опубликована для уровней:/)).toBeVisible(); + const progress = page.getByRole("region", { name: "Профиль, анкета и тест", exact: true }); + const answers = page.getByRole("region", { name: "Ответы кандидата", exact: true }); + await expect(progress).toBeVisible(); + await expect(answers).toBeVisible(); + const desktopProgress = await progress.boundingBox(); + const desktopAnswers = await answers.boundingBox(); + if (!desktopProgress || !desktopAnswers) throw new Error("Candidate sections must be visible"); + expect(desktopProgress.x + desktopProgress.width).toBeLessThanOrEqual(desktopAnswers.x); await page.screenshot({ path: testInfo.outputPath("questionnaire-catalog-desktop.png"), fullPage: true, @@ -140,6 +148,10 @@ test("shows the populated specialization catalog on desktop and mobile", async ( await page.setViewportSize({ width: 390, height: 844 }); await expect(specialization).toBeVisible(); + const mobileProgress = await progress.boundingBox(); + const mobileAnswers = await answers.boundingBox(); + if (!mobileProgress || !mobileAnswers) throw new Error("Candidate sections must be visible"); + expect(mobileProgress.y + mobileProgress.height).toBeLessThanOrEqual(mobileAnswers.y); await page.screenshot({ path: testInfo.outputPath("questionnaire-catalog-mobile.png"), fullPage: true, diff --git a/frontend/src/pages/assessment/ui/assessment-page.module.css b/frontend/src/pages/assessment/ui/assessment-page.module.css index 3f0aa96..478cc9b 100644 --- a/frontend/src/pages/assessment/ui/assessment-page.module.css +++ b/frontend/src/pages/assessment/ui/assessment-page.module.css @@ -7,7 +7,7 @@ min-width: 0; } -@media (width >= 64rem) { +@media (width >= 80rem) { .layout { grid-template-columns: minmax(0, 1fr) 20rem; } diff --git a/frontend/src/pages/assessment/ui/assessment-page.tsx b/frontend/src/pages/assessment/ui/assessment-page.tsx index f6737ed..c6a3259 100644 --- a/frontend/src/pages/assessment/ui/assessment-page.tsx +++ b/frontend/src/pages/assessment/ui/assessment-page.tsx @@ -44,7 +44,10 @@ import { useAssessmentQuestionnaire, } from "../../../entities/assessment"; import { newIdempotencyKey } from "../../../features/answer-assessment"; -import { CandidateJourneyProgress } from "../../../widgets/candidate-next-step"; +import { + CandidateJourneyLayout, + CandidateJourneyProgress, +} from "../../../widgets/candidate-next-step"; import { SignalNoticeDialog, SignalNoticeSummary, @@ -490,191 +493,199 @@ export function AssessmentPage() { lead="Выберите доступную проверку. Уровень из анкеты - это ваша самооценка; результат определяет только сервер после прохождения." width="wide" > - -
- -
-

Полная проверка

-

- Доступность проверки -

-

Состояние и ограничения загружаются с сервера.

-
- {(availability.isPending && !availability.data) || - (questionnaire.isPending && !questionnaire.data) ? ( -
- - -
- ) : !data || !questionnaire.data ? ( - void (!data ? availability.refetch() : questionnaire.refetch())} - title="Не удалось загрузить состояние проверки" - /> - ) : data.specializations.length === 0 ? ( - Открыть анкету} - /> - ) : ( - <> -
- - + }> +
+ +
+

Полная проверка

+

+ Доступность проверки +

+

Состояние и ограничения загружаются с сервера.

+
+ {(availability.isPending && !availability.data) || + (questionnaire.isPending && !questionnaire.data) ? ( +
+ +
- {questionnaireSpecialization && grade?.status !== "active_attempt" ? ( - - ) : null} - {grade?.status !== "active_attempt" ? ( -

- Доступность уровня не зависит от выбранного языка. При создании сервер проверит, - опубликованы ли подходящие задания. -

- ) : null} - {specialization && grade && statusTag ? ( -
-
- - {`${specializationLabels[specialization.specialization]} · ${gradeLabels[grade.grade]}`} - - - {statusTag.label} - -
-

{gradeStatusDescription(grade)}

- -
- {activeAttemptId && grade.status === "active_attempt" ? ( - - Продолжить текущую попытку - - ) : grade.status === "available" ? ( - - ) : null} -
+ ) : !data || !questionnaire.data ? ( + void (!data ? availability.refetch() : questionnaire.refetch())} + title="Не удалось загрузить состояние проверки" + /> + ) : data.specializations.length === 0 ? ( + Открыть анкету} + /> + ) : ( + <> +
+ +
- ) : null} - {pendingCreate && pendingCreate.body.kind !== "demo_express" ? ( -

- Данные отправки зафиксированы до подтверждения. Если связь прервалась, повторите - ее с тем же ключом. -

- ) : null} - {formError ? ( -
- Открыть согласие C3 - ) : null - } - > -

{formError}

-
-
- ) : null} - - )} - - {signalNotice.checkError ? ( -
- -

{signalNotice.checkError}

-
-
- ) : null} - - - -
+ + +
+
); diff --git a/frontend/src/pages/profile/ui/profile-page.module.css b/frontend/src/pages/profile/ui/profile-page.module.css deleted file mode 100644 index 6395a2d..0000000 --- a/frontend/src/pages/profile/ui/profile-page.module.css +++ /dev/null @@ -1,15 +0,0 @@ -.summary { - display: grid; - gap: var(--space-5); - align-items: start; -} - -.summary > * { - min-width: 0; -} - -@media (width >= 64rem) { - .summary { - grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); - } -} diff --git a/frontend/src/pages/profile/ui/profile-page.tsx b/frontend/src/pages/profile/ui/profile-page.tsx index a97d279..f209020 100644 --- a/frontend/src/pages/profile/ui/profile-page.tsx +++ b/frontend/src/pages/profile/ui/profile-page.tsx @@ -1,8 +1,10 @@ import { EditProfile } from "../../../features/edit-profile"; import { Page } from "../../../shared/ui"; -import { CandidateJourneyProgress } from "../../../widgets/candidate-next-step"; +import { + CandidateJourneyLayout, + CandidateJourneyProgress, +} from "../../../widgets/candidate-next-step"; import { CandidateProfilePreview } from "../../../widgets/candidate-profile-preview"; -import styles from "./profile-page.module.css"; export function ProfilePage() { return ( @@ -11,11 +13,10 @@ export function ProfilePage() { lead="Управляйте своими сведениями и проверяйте, какие данные подтверждены оценкой." width="wide" > -
- + }> -
- + + ); } diff --git a/frontend/src/pages/questionnaire/ui/questionnaire-page.tsx b/frontend/src/pages/questionnaire/ui/questionnaire-page.tsx index 9b60d70..b6b9430 100644 --- a/frontend/src/pages/questionnaire/ui/questionnaire-page.tsx +++ b/frontend/src/pages/questionnaire/ui/questionnaire-page.tsx @@ -1,6 +1,9 @@ import { FillQuestionnaire } from "../../../features/fill-questionnaire"; import { Page } from "../../../shared/ui"; -import { CandidateJourneyProgress } from "../../../widgets/candidate-next-step"; +import { + CandidateJourneyLayout, + CandidateJourneyProgress, +} from "../../../widgets/candidate-next-step"; export function QuestionnairePage() { return ( @@ -9,8 +12,9 @@ export function QuestionnairePage() { lead="Укажите специализации и условия поиска. Самооценка не становится подтвержденной категорией." width="wide" > - - + }> + + ); } diff --git a/frontend/src/widgets/candidate-next-step/index.ts b/frontend/src/widgets/candidate-next-step/index.ts index 5f851e2..5ac4b87 100644 --- a/frontend/src/widgets/candidate-next-step/index.ts +++ b/frontend/src/widgets/candidate-next-step/index.ts @@ -1,2 +1,3 @@ export { CandidateNextStep } from "./ui/candidate-next-step"; export { CandidateJourneyProgress } from "./ui/candidate-journey-progress"; +export { CandidateJourneyLayout } from "./ui/candidate-journey-layout"; diff --git a/frontend/src/widgets/candidate-next-step/ui/candidate-journey-layout.module.css b/frontend/src/widgets/candidate-next-step/ui/candidate-journey-layout.module.css new file mode 100644 index 0000000..eb67edf --- /dev/null +++ b/frontend/src/widgets/candidate-next-step/ui/candidate-journey-layout.module.css @@ -0,0 +1,22 @@ +.layout { + display: grid; + gap: var(--space-5); + align-items: start; + min-width: 0; +} + +.progress, +.content { + min-width: 0; +} + +.content { + display: grid; + gap: var(--space-5); +} + +@media (width >= 64rem) { + .layout { + grid-template-columns: minmax(15rem, 18rem) minmax(0, 1fr); + } +} diff --git a/frontend/src/widgets/candidate-next-step/ui/candidate-journey-layout.tsx b/frontend/src/widgets/candidate-next-step/ui/candidate-journey-layout.tsx new file mode 100644 index 0000000..86e24c1 --- /dev/null +++ b/frontend/src/widgets/candidate-next-step/ui/candidate-journey-layout.tsx @@ -0,0 +1,17 @@ +import type { ReactNode } from "react"; +import styles from "./candidate-journey-layout.module.css"; + +export function CandidateJourneyLayout({ + progress, + children, +}: { + progress: ReactNode; + children: ReactNode; +}) { + return ( +
+ +
{children}
+
+ ); +} diff --git a/frontend/src/widgets/candidate-next-step/ui/candidate-journey-progress.tsx b/frontend/src/widgets/candidate-next-step/ui/candidate-journey-progress.tsx index afb0e72..b89464c 100644 --- a/frontend/src/widgets/candidate-next-step/ui/candidate-journey-progress.tsx +++ b/frontend/src/widgets/candidate-next-step/ui/candidate-journey-progress.tsx @@ -70,7 +70,7 @@ export function CandidateJourneyProgress() { : 2; return ( - +

Профиль, анкета и тест