diff --git a/src/app/app/dashboard/templates/page.tsx b/src/app/app/dashboard/templates/page.tsx index e98be61..65ff8cf 100644 --- a/src/app/app/dashboard/templates/page.tsx +++ b/src/app/app/dashboard/templates/page.tsx @@ -1,12 +1,14 @@ "use client"; +import { useState } from "react"; import { useTranslations } from "next-intl"; import { motion } from "framer-motion"; import { useRouter } from "next/navigation"; -import Image from "next/image"; +import Image, { StaticImageData } from "next/image"; import { useResumeStore } from "@/store/useResumeStore"; import { Card, CardContent } from "@/components/ui/card"; import { Button } from "@/components/ui/button"; +import { Dialog, DialogContent, DialogTitle } from "@/components/ui/dialog"; import classic from "@/assets/images/template-cover/classic.png"; import modern from "@/assets/images/template-cover/modern.png"; @@ -16,11 +18,11 @@ import timeline from "@/assets/images/template-cover/timeline.png"; import { cn } from "@/lib/utils"; import { DEFAULT_TEMPLATES } from "@/config"; -const templateImages: { [key: string]: any } = { +const templateImages: Record = { classic, modern, "left-right": leftRight, - timeline + timeline, }; const container = { @@ -28,20 +30,24 @@ const container = { show: { opacity: 1, transition: { - staggerChildren: 0.1 - } - } + staggerChildren: 0.1, + }, + }, }; const item = { hidden: { opacity: 0, y: 20 }, - show: { opacity: 1, y: 0 } + show: { opacity: 1, y: 0 }, }; -export default function TemplatesPage() { +const TemplatesPage = () => { const t = useTranslations("dashboard.templates"); const router = useRouter(); const createResume = useResumeStore((state) => state.createResume); + const [previewTemplate, setPreviewTemplate] = useState<{ + id: string; + open: boolean; + } | null>(null); const handleCreateResume = (templateId: string) => { const template = DEFAULT_TEMPLATES.find((t) => t.id === templateId); @@ -58,12 +64,12 @@ export default function TemplatesPage() { themeColor: template.colorScheme.primary, sectionSpacing: template.spacing.sectionGap, paragraphSpacing: template.spacing.itemGap, - pagePadding: template.spacing.contentPadding + pagePadding: template.spacing.contentPadding, }, basic: { ...resume.basic, - layout: template.basic.layout - } + layout: template.basic.layout, + }, }); } @@ -81,7 +87,7 @@ export default function TemplatesPage() { variants={container} initial="hidden" animate="show" - className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-6" + className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8" > {DEFAULT_TEMPLATES.map((template) => { const templateKey = @@ -90,34 +96,59 @@ export default function TemplatesPage() { - -
- {t(`${templateKey}.name`)} -
+ +
+
+
+ + {t(`${templateKey}.name`)} + +
+
+ +
+
+ {t(`${templateKey}.name`)} +
+
+ +
+
-

- {t(`${templateKey}.name`)} -

-

+

{t(`${templateKey}.description`)}

-
+ +
+ @@ -128,7 +159,63 @@ export default function TemplatesPage() { ); })} + + { + if (!open) setPreviewTemplate(null); + }} + > + {previewTemplate && ( + +
+
+ + {t( + `${ + previewTemplate.id === "left-right" + ? "leftRight" + : previewTemplate.id + }.name` + )} + +
+
+
+ {t( +
+
+
+ +
+
+
+ )} +
); -} +}; + +export default TemplatesPage; diff --git a/src/i18n/locales/en.json b/src/i18n/locales/en.json index c704df3..501fe23 100644 --- a/src/i18n/locales/en.json +++ b/src/i18n/locales/en.json @@ -147,6 +147,7 @@ "templates": { "title": "Templates", "useTemplate": "Use Template", + "preview": "Preview", "switchTemplate": "Switch Template", "classic": { "name": "Classic", diff --git a/src/i18n/locales/zh.json b/src/i18n/locales/zh.json index ddb7365..b41ec11 100644 --- a/src/i18n/locales/zh.json +++ b/src/i18n/locales/zh.json @@ -150,6 +150,7 @@ "templates": { "title": "模板", "useTemplate": "使用此模板", + "preview": "预览", "switchTemplate": "切换模版", "classic": { "name": "经典模板",