- 公开页(/share、/public、/roundtable-share)新增 ?theme= 与 deerflow:set-theme postMessage 两种外部主题指定方式,经 usePublicEmbedTheme 接成 next-themes forcedTheme,不写 localStorage - 排行榜入口从欢迎语旁移到 workspace-header 左上角应用名旁 - 新增 docs/embed-public-pages-theme.md 嵌入主题使用文档 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
75 lines
2.2 KiB
TypeScript
75 lines
2.2 KiB
TypeScript
"use client";
|
|
|
|
import { useSearchParams } from "next/navigation";
|
|
import { useEffect, useMemo } from "react";
|
|
|
|
import { useI18n } from "@/core/i18n/hooks";
|
|
import { cn } from "@/lib/utils";
|
|
|
|
import { AuroraText } from "../ui/aurora-text";
|
|
|
|
let waved = false;
|
|
|
|
export function Welcome({
|
|
className,
|
|
mode,
|
|
}: {
|
|
className?: string;
|
|
mode?: "ultra" | "pro" | "thinking" | "flash";
|
|
}) {
|
|
const { t } = useI18n();
|
|
const searchParams = useSearchParams();
|
|
const isUltra = useMemo(() => mode === "ultra", [mode]);
|
|
const colors = useMemo(() => {
|
|
if (isUltra) {
|
|
return ["#efefbb", "#e9c665", "#e3a812"];
|
|
}
|
|
return ["var(--color-foreground)"];
|
|
}, [isUltra]);
|
|
useEffect(() => {
|
|
waved = true;
|
|
}, []);
|
|
return (
|
|
<div
|
|
className={cn(
|
|
"mx-auto flex w-full flex-col items-center justify-center gap-2 px-8 py-4 text-center",
|
|
className,
|
|
)}
|
|
>
|
|
<div className="text-[26px] font-medium tracking-tight text-foreground/85">
|
|
{searchParams.get("mode") === "skill" ? (
|
|
`✨ ${t.welcome.createYourOwnSkill} ✨`
|
|
) : (
|
|
<div className="flex items-center gap-2.5">
|
|
<div className={cn("inline-block text-2xl", !waved ? "animate-wave" : "")}>
|
|
{isUltra ? "🚀" : "👋"}
|
|
</div>
|
|
<AuroraText colors={colors}>{t.welcome.greeting}</AuroraText>
|
|
</div>
|
|
)}
|
|
</div>
|
|
{searchParams.get("mode") === "skill" ? (
|
|
<div className="text-muted-foreground text-sm">
|
|
{/* {t.welcome.createYourOwnSkillDescription.includes("\n") ? (
|
|
<pre className="font-sans whitespace-pre">
|
|
{t.welcome.createYourOwnSkillDescription}
|
|
</pre>
|
|
) : (
|
|
<p>{t.welcome.createYourOwnSkillDescription}</p>
|
|
)} */}
|
|
</div>
|
|
) : (
|
|
<div className="text-muted-foreground text-sm">
|
|
{/* {t.welcome.description.includes("\n") ? (
|
|
<pre className="font-sans whitespace-pre">
|
|
{t.welcome.description}
|
|
</pre>
|
|
) : (
|
|
<p>{t.welcome.description}</p>
|
|
)} */}
|
|
</div>
|
|
)}
|
|
</div>
|
|
);
|
|
}
|