Files
deer-flow/frontend/src/components/workspace/welcome.tsx

58 lines
1.6 KiB
TypeScript
Raw Normal View History

2026-01-20 14:06:47 +08:00
"use client";
2026-02-02 08:43:37 +08:00
import { useSearchParams } from "next/navigation";
import { useEffect } from "react";
2026-02-02 08:43:37 +08:00
2026-01-20 14:06:47 +08:00
import { useI18n } from "@/core/i18n/hooks";
2026-01-17 19:46:02 +08:00
import { cn } from "@/lib/utils";
let waved = false;
2026-01-17 19:46:02 +08:00
export function Welcome({ className }: { className?: string }) {
2026-01-20 14:06:47 +08:00
const { t } = useI18n();
2026-02-02 08:43:37 +08:00
const searchParams = useSearchParams();
useEffect(() => {
waved = true;
}, []);
2026-01-17 19:46:02 +08:00
return (
<div
className={cn(
"mx-auto flex w-full flex-col items-center justify-center gap-2 px-8 py-4 text-center",
className,
)}
>
2026-02-02 08:43:37 +08:00
<div className="text-2xl font-bold">
{searchParams.get("mode") === "skill" ? (
`${t.welcome.createYourOwnSkill}`
) : (
<div className="flex items-center gap-2">
<div className={cn("inline-block", !waved ? "animate-wave" : "")}>
👋
</div>
<div>{t.welcome.greeting}</div>
</div>
)}
2026-02-02 08:43:37 +08:00
</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="whitespace-pre">{t.welcome.description}</pre>
) : (
<p>{t.welcome.description}</p>
)}
</div>
)}
2026-01-17 19:46:02 +08:00
</div>
);
}