feat: add assessment, privacy and support flows

This commit is contained in:
TakuyaYagam1 committed 2026-10-08 08:08:25 +03:00
1 parent ee3738ee73
commit e4f24fa202
339 files changed
+56454 -1126

No files matched your search

@@ -0,0 +1 @@
export { SupportEntry, type SupportEntryProps } from "./ui/support-entry";
@@ -0,0 +1,36 @@
import { renderToStaticMarkup } from "react-dom/server";
import { MemoryRouter } from "react-router-dom";
import { describe, expect, it } from "vitest";
import { SupportEntry } from "./support-entry";
describe("SupportEntry", () => {
it("keeps support navigation on the fixed path and never puts object IDs in the URL", () => {
const markup = renderToStaticMarkup(
<MemoryRouter>
<SupportEntry
context={{ type: "assessment_attempt", id: "4c0ce905-a668-4f5d-961b-dc90fc4b684d" }}
/>
</MemoryRouter>,
);
expect(markup).toContain('href="/support"');
expect(markup).not.toContain("4c0ce905");
expect(markup).toContain("Поддержка");
});
it("drops runtime context values outside the allowlist", () => {
const markup = renderToStaticMarkup(
<MemoryRouter>
<SupportEntry
context={{
type: "assessment_attempt",
id: "4c0ce905-a668-4f5d-961b-dc90fc4b684d",
}}
/>
</MemoryRouter>,
);
expect(markup).toContain('href="/support"');
expect(markup).not.toContain("search=");
});
});
@@ -0,0 +1,25 @@
import type { ReactNode } from "react";
import { parseSupportCaseContext } from "../../../entities/support-case";
import type { SupportCaseObjectReference } from "../../../shared/api/schemas";
import { paths } from "../../../shared/config";
import { ButtonLink } from "../../../shared/ui";
export type SupportEntryProps = {
context?: SupportCaseObjectReference | undefined;
children?: ReactNode;
variant?: "primary" | "secondary" | "quiet" | undefined;
};
/** A support entry link carries only an allowlisted object reference in router state. */
export function SupportEntry({ context, children = "Поддержка", variant }: SupportEntryProps) {
const safeContext = context ? parseSupportCaseContext(context) : null;
return (
<ButtonLink
to={paths.support}
state={safeContext ? { supportContext: safeContext } : undefined}
{...(variant ? { variant } : {})}
>
{children}
</ButtonLink>
);
}