feat(platform): add the notification inbox and deterministic match search

This commit is contained in:
shira committed 2026-10-09 13:14:46 +03:00
1 parent 5edff21d2d
commit 0b11021b16
169 files changed
+17083 -443

No files matched your search

@@ -0,0 +1 @@
export { CandidateNotificationsPage, EmployerNotificationsPage } from "./ui/notifications-pages";
@@ -0,0 +1,44 @@
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { renderToString } from "react-dom/server";
import { MemoryRouter } from "react-router-dom";
import { describe, expect, it } from "vitest";
import { getGetCurrentSessionQueryKey } from "../../../shared/api/endpoints/identity/identity";
import type { Session } from "../../../shared/api/schemas";
import { CandidateNotificationsPage, EmployerNotificationsPage } from "./notifications-pages";
function render(scenario: "candidate" | "employer", element: React.ReactElement): string {
const queryClient = new QueryClient();
const session: Session = {
account: {
id: "11111111-1111-4111-8111-111111111111",
email: "person@example.test",
email_verified: true,
scenario,
onboarding_step: "completed",
created_at: "2026-10-07T12:00:00Z",
},
csrf_token: "A".repeat(43),
};
queryClient.setQueryData(getGetCurrentSessionQueryKey(), session);
return renderToString(
<QueryClientProvider client={queryClient}>
<MemoryRouter>{element}</MemoryRouter>
</QueryClientProvider>,
);
}
describe("notification pages", () => {
it("name the cabinet and carry the single h1", () => {
const candidate = render("candidate", <CandidateNotificationsPage />);
expect(candidate).toContain("Кабинет кандидата");
expect(candidate.match(/<h1/g)).toHaveLength(1);
const employer = render("employer", <EmployerNotificationsPage />);
expect(employer).toContain("Кабинет работодателя");
expect(employer.match(/<h1/g)).toHaveLength(1);
});
it("refuse the other cabinet's account instead of loading its inbox", () => {
expect(render("employer", <CandidateNotificationsPage />)).toContain("кабинету другого типа");
expect(render("candidate", <EmployerNotificationsPage />)).toContain("кабинета работодателя");
});
});
@@ -0,0 +1,21 @@
import { NotificationInbox, OrganizationNotificationInbox } from "../../../features/notifications";
import { Page } from "../../../shared/ui";
const lead =
"Платформа сообщает здесь о событиях в вашем кабинете. Письмо на почту ничего не заменяет и ничему не мешает: список здесь - основной источник. Текст берется из текущих данных, поэтому после смены доступа он может исчезнуть.";
export function CandidateNotificationsPage() {
return (
<Page title="Уведомления" eyebrow="Кабинет кандидата" lead={lead}>
<NotificationInbox scope={{ kind: "candidate" }} />
</Page>
);
}
export function EmployerNotificationsPage() {
return (
<Page title="Уведомления" eyebrow="Кабинет работодателя" lead={lead} width="wide">
<OrganizationNotificationInbox />
</Page>
);
}