feat(cv): redesign document editing with revision-safe letters and writing tools

This commit is contained in:
cesnimda
2026-10-25 22:44:14 +01:00
parent 01e10996c5
commit 2bfaf6c14b
57 changed files with 2859 additions and 118 deletions
@@ -10,6 +10,7 @@ import { applyCvTheme, CvTheme, CvVariantSettings, normalizeCvLanguage, SECTION_
import { useConfirm } from "../../confirm";
import { useI18n } from "../../i18n/I18nProvider";
import CvTemplateGallery from "../CvTemplateGallery";
import CvTemplatePreviewDialog from "./CvTemplatePreviewDialog";
const FONTS = [
"'Segoe UI', Roboto, Arial, sans-serif", "Arial, Helvetica, sans-serif", "Georgia, 'Times New Roman', serif",
@@ -30,11 +31,14 @@ export default function CvCustomizeTab({ mode, settings, update, themes, section
const { t } = useI18n();
const { confirm } = useConfirm();
const id = useId();
const [candidate, setCandidate] = useState<CvTheme | null>(null);
const activeTheme = themes.find(theme => theme.id === settings.themeId);
const supports = (setting: string) => !activeTheme?.supportedSettings?.length || activeTheme.supportedSettings.includes(setting);
const sidebarSections = settings.sidebarSections ?? ["contact", "skills", "languages"];
const layout = settings.layout ?? activeTheme?.layout;
const selectTemplate = async (theme: CvTheme) => {
if (theme.available === false) return;
setCandidate(null);
const next = applyCvTheme(settings, theme.id);
const resetsOverrides = Object.entries(next).some(([key, value]) => value === null && settings[key as keyof CvVariantSettings] != null);
if (resetsOverrides && !await confirm({ title: t("cvEditorChangeTemplateTitle"), message: t("cvEditorChangeTemplateMessage"), confirmLabel: t("cvEditorApplyTemplate") })) return;
@@ -47,7 +51,8 @@ export default function CvCustomizeTab({ mode, settings, update, themes, section
if (mode === "template") return <Stack spacing={1.5}>
<Typography component="h3" variant="subtitle2">{t("cvEditorTemplate")}</Typography>
<Typography variant="body2" color="text.secondary">{t("cvEditorThemeHelp")}</Typography>
<CvTemplateGallery themes={themes} selectedId={settings.themeId} onSelect={selectTemplate} />
<CvTemplateGallery themes={themes} selectedId={settings.themeId} onSelect={setCandidate} />
{candidate && <CvTemplatePreviewDialog key={candidate.id} theme={candidate} onClose={() => setCandidate(null)} onApply={selectTemplate} />}
</Stack>;
return <Stack spacing={2.5}>