diff --git a/app/[locale]/shared/[token]/page-client.tsx b/app/[locale]/shared/[token]/page-client.tsx index 5625a95..6692b60 100644 --- a/app/[locale]/shared/[token]/page-client.tsx +++ b/app/[locale]/shared/[token]/page-client.tsx @@ -188,7 +188,6 @@ export function SharedEmailPageClient({ return tShared("sharedMailbox") } })()} - showCta={true} ctaText={tShared("createOwnEmail")} /> diff --git a/app/[locale]/shared/[token]/page.tsx b/app/[locale]/shared/[token]/page.tsx index 960d4f1..b584ef6 100644 --- a/app/[locale]/shared/[token]/page.tsx +++ b/app/[locale]/shared/[token]/page.tsx @@ -1,4 +1,3 @@ -import { getTranslations } from "next-intl/server" import { getSharedEmail, getSharedEmailMessages } from "@/lib/shared-data" import { SharedErrorPage } from "@/components/emails/shared-error-page" import { SharedEmailPageClient } from "./page-client" @@ -12,7 +11,6 @@ interface PageProps { export default async function SharedEmailPage({ params }: PageProps) { const { token } = await params - const tShared = await getTranslations("emails.shared") // 服务端获取数据 const email = await getSharedEmail(token) @@ -20,11 +18,11 @@ export default async function SharedEmailPage({ params }: PageProps) { if (!email) { return ( ) } diff --git a/app/[locale]/shared/message/[token]/page-client.tsx b/app/[locale]/shared/message/[token]/page-client.tsx index b75cc8e..1043fba 100644 --- a/app/[locale]/shared/message/[token]/page-client.tsx +++ b/app/[locale]/shared/message/[token]/page-client.tsx @@ -37,7 +37,6 @@ export function SharedMessagePageClient({ message }: SharedMessagePageClientProp : message.emailExpiresAt ? `${tShared("expiresAt")}: ${new Date(message.emailExpiresAt).toLocaleString()}` : tShared("sharedMessage")} - showCta={true} ctaText={tShared("createOwnEmail")} /> diff --git a/app/[locale]/shared/message/[token]/page.tsx b/app/[locale]/shared/message/[token]/page.tsx index 353ad7d..c345eab 100644 --- a/app/[locale]/shared/message/[token]/page.tsx +++ b/app/[locale]/shared/message/[token]/page.tsx @@ -1,4 +1,3 @@ -import { getTranslations } from "next-intl/server" import { getSharedMessage } from "@/lib/shared-data" import { SharedErrorPage } from "@/components/emails/shared-error-page" import { SharedMessagePageClient } from "./page-client" @@ -12,7 +11,6 @@ interface PageProps { export default async function SharedMessagePage({ params }: PageProps) { const { token } = await params - const tShared = await getTranslations("emails.shared") // 服务端获取数据 const message = await getSharedMessage(token) @@ -20,11 +18,11 @@ export default async function SharedMessagePage({ params }: PageProps) { if (!message) { return ( ) } diff --git a/app/components/emails/shared-error-page.tsx b/app/components/emails/shared-error-page.tsx index d4cacbb..72bd1a0 100644 --- a/app/components/emails/shared-error-page.tsx +++ b/app/components/emails/shared-error-page.tsx @@ -1,34 +1,48 @@ "use client" +import { useTranslations } from "next-intl" import { AlertCircle } from "lucide-react" import { Card } from "@/components/ui/card" import { BrandHeader } from "@/components/ui/brand-header" import { FloatingLanguageSwitcher } from "@/components/layout/floating-language-switcher" interface SharedErrorPageProps { - title: string - subtitle: string - error: string - description: string - ctaText: string + titleKey: string + subtitleKey: string + errorKey: string + descriptionKey: string + ctaTextKey: string } -export function SharedErrorPage({ title, subtitle, error, description, ctaText }: SharedErrorPageProps) { +export function SharedErrorPage({ + titleKey, + subtitleKey, + errorKey, + descriptionKey, + ctaTextKey, +}: SharedErrorPageProps) { + const tShared = useTranslations("emails.shared") + + const resolvedTitle = tShared(titleKey) + const resolvedSubtitle = tShared(subtitleKey) + const resolvedError = tShared(errorKey) + const resolvedDescription = tShared(descriptionKey) + const resolvedCtaText = tShared(ctaTextKey) + return ( -
+
-
+
-

{error}

+

{resolvedError}

- {description} + {resolvedDescription}

@@ -37,4 +51,4 @@ export function SharedErrorPage({ title, subtitle, error, description, ctaText }
) -} \ No newline at end of file +} diff --git a/app/components/ui/brand-header.tsx b/app/components/ui/brand-header.tsx index 078185f..e603549 100644 --- a/app/components/ui/brand-header.tsx +++ b/app/components/ui/brand-header.tsx @@ -8,28 +8,24 @@ import { ExternalLink, Mail } from "lucide-react" interface BrandHeaderProps { title?: string subtitle?: string - showCta?: boolean ctaText?: string - ctaHref?: string } -export function BrandHeader({ - title, +export function BrandHeader({ + title, subtitle, - showCta = true, ctaText, - ctaHref = "https://moemail.app" }: BrandHeaderProps) { const t = useTranslations("emails.shared.brand") - + const displayTitle = title || t("title") const displaySubtitle = subtitle || t("subtitle") const displayCtaText = ctaText || t("cta") return (
-
@@ -47,32 +43,32 @@ export function BrandHeader({ d="M4 8h24v16H4V8z" className="fill-primary/20" /> - + {/* 信封边框 */} - + {/* @ 符号 */} - + {/* 折线装饰 */} - + {/* 装饰点 */} - + {/* 底部装饰线 */}
- {showCta && ( -
- -
- )} +
+ +
) }