feat(frontend): add cabinet shells, brand tokens, and state primitives

This commit is contained in:
shira committed 2026-10-06 01:09:08 +03:00
1 parent dda3825786
commit 0e2a3b02ab
85 files changed
+3313 -113

No files matched your search

View File
Whitespace-only changes.
@@ -0,0 +1 @@
export { CandidateShell } from "./ui/candidate-shell";
@@ -0,0 +1,52 @@
/* Mobile first: base rules target 360px; wider screens add layout. */
.shell {
min-height: 100vh;
}
.header {
position: sticky;
z-index: 10;
top: 0;
display: grid;
gap: var(--space-1);
padding: var(--space-2) var(--gutter) 0;
border-bottom: var(--line-thin) solid var(--color-divider);
background: var(--color-surface);
}
/* The strip scrolls sideways; padding keeps focus rings inside the clip. */
.nav {
margin-inline: calc(-1 * var(--gutter));
overflow-x: auto;
overscroll-behavior-x: contain;
scrollbar-width: thin;
}
.list {
display: flex;
gap: var(--space-1);
width: max-content;
margin: 0;
padding: var(--space-1) var(--gutter) var(--space-2);
list-style: none;
}
@media (width >= 64rem) {
.header {
grid-template-columns: auto 1fr;
gap: var(--space-6);
align-items: center;
padding-block: var(--space-2);
}
.nav {
margin-inline: 0;
overflow-x: visible;
}
.list {
justify-content: flex-end;
width: auto;
padding: 0;
}
}
@@ -0,0 +1,42 @@
import { Outlet } from "react-router-dom";
import { paths } from "../../../shared/config";
import { BrandLogo, MainRegion, NavItem, SkipLink } from "../../../shared/ui";
import styles from "./candidate-shell.module.css";
const navigation = [
{ to: paths.candidate.root, label: "Главная", end: true },
{ to: paths.candidate.profile, label: "Профиль", end: false },
{ to: paths.candidate.assessment, label: "Тест", end: false },
{ to: paths.candidate.results, label: "Результаты", end: false },
{ to: paths.candidate.invitations, label: "Приглашения", end: false },
{ to: paths.candidate.privacy, label: "Приватность", end: false },
] as const;
/**
* Candidate cabinet layout, designed for phones first: a compact header and
* a horizontally scrollable section strip that becomes one row on desktop.
*/
export function CandidateShell() {
return (
<div className={styles.shell}>
<SkipLink />
<header className={styles.header}>
<BrandLogo to={paths.candidate.root} context="Кабинет кандидата" />
<nav className={styles.nav} aria-label="Разделы кабинета кандидата">
<ul className={styles.list}>
{navigation.map((item) => (
<li key={item.to}>
<NavItem to={item.to} end={item.end}>
{item.label}
</NavItem>
</li>
))}
</ul>
</nav>
</header>
<MainRegion>
<Outlet />
</MainRegion>
</div>
);
}
@@ -0,0 +1 @@
export { EmployerShell } from "./ui/employer-shell";
@@ -0,0 +1,76 @@
/* Desktop first: base rules target 1024px and wider; narrow screens adapt. */
.shell {
display: grid;
grid-template-columns: 17rem minmax(0, 1fr);
min-height: 100vh;
}
/* Dark region: violet fails on graphite (2.49:1), so text, links, and the
* focus ring switch to checked light values here. */
.sidebar {
--color-focus-ring: var(--palette-white);
position: sticky;
top: 0;
display: flex;
flex-direction: column;
gap: var(--space-6);
height: 100vh;
padding: var(--space-4) var(--space-4) var(--space-6);
color: var(--palette-light);
background: var(--palette-graphite);
}
.nav {
border-top: var(--line-thin) solid var(--palette-graphite-soft);
padding-top: var(--space-4);
}
.list {
display: grid;
gap: var(--space-1);
margin: 0;
padding: 0;
list-style: none;
}
.list a {
width: 100%;
}
.main {
min-width: 0;
}
@media (width < 64rem) {
.shell {
grid-template-columns: minmax(0, 1fr);
grid-template-rows: auto 1fr;
}
.sidebar {
z-index: 10;
gap: var(--space-1);
height: auto;
padding: var(--space-2) var(--gutter) 0;
}
.nav {
margin-inline: calc(-1 * var(--gutter));
padding-top: 0;
border-top: 0;
overflow-x: auto;
overscroll-behavior-x: contain;
scrollbar-width: thin;
}
.list {
display: flex;
width: max-content;
padding: var(--space-1) var(--gutter) var(--space-2);
}
.list a {
width: auto;
}
}
@@ -0,0 +1,41 @@
import { Outlet } from "react-router-dom";
import { paths } from "../../../shared/config";
import { BrandLogo, MainRegion, NavItem, SkipLink } from "../../../shared/ui";
import styles from "./employer-shell.module.css";
const navigation = [
{ to: paths.employer.company, label: "Компания и команда" },
{ to: paths.employer.needs, label: "Потребности" },
{ to: paths.employer.candidates, label: "Кандидаты" },
{ to: paths.employer.invitations, label: "Приглашения" },
] as const;
/**
* Employer cabinet layout, designed for desktop first: a graphite sidebar
* with vertical navigation next to a wide work area. Below 1024px the
* sidebar turns into a top bar with a scrollable section strip.
*/
export function EmployerShell() {
return (
<div className={styles.shell}>
<SkipLink />
<header className={styles.sidebar}>
<BrandLogo tone="dark" to={paths.employer.root} context="Кабинет работодателя" />
<nav className={styles.nav} aria-label="Разделы кабинета работодателя">
<ul className={styles.list}>
{navigation.map((item) => (
<li key={item.to}>
<NavItem to={item.to} tone="dark">
{item.label}
</NavItem>
</li>
))}
</ul>
</nav>
</header>
<MainRegion className={styles.main}>
<Outlet />
</MainRegion>
</div>
);
}
@@ -0,0 +1 @@
export { PublicShell } from "./ui/public-shell";
@@ -0,0 +1,42 @@
.shell {
display: grid;
grid-template-rows: auto 1fr auto;
min-height: 100vh;
}
.header {
display: flex;
flex-wrap: wrap;
gap: var(--space-2) var(--space-5);
align-items: center;
justify-content: space-between;
padding: var(--space-3) var(--gutter);
border-bottom: var(--line-thin) solid var(--color-divider);
background: var(--color-surface);
}
.nav {
display: flex;
flex-wrap: wrap;
gap: var(--space-1);
margin: 0 calc(-1 * var(--space-3));
padding: 0;
list-style: none;
}
.main {
width: 100%;
}
.footer {
display: flex;
flex-wrap: wrap;
gap: var(--space-2) var(--space-5);
align-items: center;
justify-content: space-between;
padding: var(--space-4) var(--gutter);
border-top: var(--line-thin) solid var(--color-divider);
color: var(--color-text-secondary);
font-size: var(--font-size-s);
background: var(--color-surface);
}
@@ -0,0 +1,36 @@
import { Outlet } from "react-router-dom";
import { paths } from "../../../shared/config";
import { BrandLogo, MainRegion, NavItem, SkipLink, TextLink } from "../../../shared/ui";
import styles from "./public-shell.module.css";
/** Layout of public pages: sign-in, registration, email confirmation, support. */
export function PublicShell() {
return (
<div className={styles.shell}>
<SkipLink />
<header className={styles.header}>
<BrandLogo />
<nav aria-label="Публичные разделы">
<ul className={styles.nav}>
<li>
<NavItem to={paths.login}>Вход</NavItem>
</li>
<li>
<NavItem to={paths.register}>Регистрация</NavItem>
</li>
<li>
<NavItem to={paths.support}>Поддержка</NavItem>
</li>
</ul>
</nav>
</header>
<MainRegion className={styles.main}>
<Outlet />
</MainRegion>
<footer className={styles.footer}>
<p>Lincodex. Каркас интерфейса: пользовательские сценарии в разработке.</p>
<TextLink to={paths.status}>Технический статус</TextLink>
</footer>
</div>
);
}
@@ -0,0 +1 @@
export { SystemStatus } from "./ui/system-status";
@@ -0,0 +1,21 @@
.result {
display: flex;
flex-wrap: wrap;
gap: var(--space-4);
align-items: center;
justify-content: space-between;
padding: var(--space-5);
border: var(--line-thin) solid var(--color-divider);
border-radius: var(--radius-m);
background: var(--color-surface);
}
.facts {
display: grid;
grid-template-columns: max-content minmax(0, 1fr);
gap: var(--space-1) var(--space-4);
}
.facts dt {
color: var(--color-text-secondary);
}
@@ -0,0 +1,50 @@
import { useGetHealthz } from "../../../shared/api/endpoints/health/health";
import { Button, Mono, QueryView, Section } from "../../../shared/ui";
import styles from "./system-status.module.css";
const timeFormat = new Intl.DateTimeFormat("ru-RU", {
hour: "2-digit",
minute: "2-digit",
second: "2-digit",
});
/**
* Technical API liveness check. It shows only that the API process answers
* /healthz; it says nothing about product workflows.
*/
export function SystemStatus() {
const query = useGetHealthz();
return (
<Section
title="Ответ API"
description="Проверка /api/v1/healthz. Это технический сигнал, а не проверка пользовательских сценариев."
>
<QueryView query={query} loadingLabel="Проверяем API...">
{(health) => (
<div className={styles.result}>
<dl className={styles.facts}>
<dt>Статус</dt>
<dd>
<Mono strong>{health.status}</Mono>
</dd>
<dt>Проверено</dt>
<dd>
<Mono>{timeFormat.format(query.dataUpdatedAt)}</Mono>
</dd>
</dl>
<Button
variant="secondary"
isBusy={query.isFetching}
onClick={() => {
void query.refetch();
}}
>
{query.isFetching ? "Проверяем..." : "Проверить снова"}
</Button>
</div>
)}
</QueryView>
</Section>
);
}