// PEP-119: what a person sees. «Продакт» (the default for everyone) shows the result and what // is needed from them; «Инженер» shows everything — terminals, code, checks, spend. The choice // is the user's own and is remembered. import type { Db } from "@peppa/db"; import { m as tr } from "@peppa/shared/i18n"; import { getSetting, setSetting } from "./settings.ts"; export const UI_MODES = ["product", "engineer"] as const; export type UiMode = (typeof UI_MODES)[number]; export const UI_MODE_NAMES: Record = { product: tr("Продакт"), engineer: tr("Инженер") }; const key = (userId: number) => `ui.mode:${userId}`; export async function getUiMode(db: Db, userId: number): Promise { return (await getSetting(db, key(userId))) === "engineer" ? "engineer" : "product"; } export async function setUiMode(db: Db, userId: number, mode: string): Promise { const m: UiMode = mode === "engineer" ? "engineer" : "product"; await setSetting(db, key(userId), m); return m; } /** Project tabs a product manager sees; the rest belong to «Инженер». */ export const PRODUCT_PROJECT_TABS = ["board", "epics", "bugs"] as const;