"use client"; import { createContext, useContext, useMemo, type ReactNode } from "react"; import { wording, type WordMode, type Words } from "@peppa/shared/wording"; import { useLocale } from "@/components/I18n"; const Ctx = createContext("product"); /** PEP-123: the layout tells client components which view the user chose («Продакт» / «Инженер»). */ export function WordsProvider({ mode, children }: { mode: WordMode; children: ReactNode }) { return {children}; } /** Words of the current view for client components; server components call `words()` from lib/auth. */ export function useWords(): Words { const mode = useContext(Ctx); const locale = useLocale(); return useMemo(() => wording(mode, locale), [mode, locale]); }