feat: add STATIC_WEBSITE_ONLY mode

This commit is contained in:
Li Xin
2025-05-02 21:09:31 +08:00
parent f89e07ac95
commit e46b243edd
3 changed files with 37 additions and 9 deletions

View File

@@ -8,10 +8,11 @@ import Link from "next/link";
import { AuroraText } from "~/components/magicui/aurora-text";
import { FlickeringGrid } from "~/components/magicui/flickering-grid";
import { Button } from "~/components/ui/button";
import { env } from "~/env";
export function Jumbotron() {
return (
<section className="relative flex h-[95vh] w-full flex-col items-center justify-center pb-15">
<section className="flex h-[95vh] w-full flex-col items-center justify-center pb-15">
<FlickeringGrid
id="deer-hero-bg"
className={`absolute inset-0 z-0 [mask-image:radial-gradient(800px_circle_at_center,white,transparent)]`}
@@ -45,16 +46,35 @@ export function Jumbotron() {
</p>
<div className="flex gap-6">
<Button className="hidden text-lg md:flex md:w-42" size="lg" asChild>
<Link href="/chat">
<Link
target={
env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY ? "_blank" : undefined
}
href={
env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY
? "https://github.com/bytedance/deer-flow"
: "/chat"
}
>
Get Started <ChevronRight />
</Link>
</Button>
<Button className="w-42 text-lg" size="lg" variant="outline" asChild>
<Link href="https://github.com/bytedance/deer-flow" target="_blank">
<GithubFilled />
Learn More
</Link>
</Button>
{!env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY && (
<Button
className="w-42 text-lg"
size="lg"
variant="outline"
asChild
>
<Link
href="https://github.com/bytedance/deer-flow"
target="_blank"
>
<GithubFilled />
Learn More
</Link>
</Button>
)}
</div>
</div>
<div className="absolute bottom-8 flex text-xs opacity-50">

View File

@@ -4,6 +4,8 @@
import { useSearchParams } from "next/navigation";
import { useMemo } from "react";
import { env } from "~/env";
import { extractReplayIdFromSearchParams } from "./get-replay-id";
export function useReplay() {
@@ -12,5 +14,8 @@ export function useReplay() {
() => extractReplayIdFromSearchParams(searchParams.toString()),
[searchParams],
);
return { isReplay: replayId != null, replayId };
return {
isReplay: replayId != null || env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY,
replayId,
};
}

View File

@@ -20,6 +20,7 @@ export const env = createEnv({
*/
client: {
NEXT_PUBLIC_API_URL: z.string().optional(),
NEXT_PUBLIC_STATIC_WEBSITE_ONLY: z.boolean().optional(),
},
/**
@@ -29,6 +30,8 @@ export const env = createEnv({
runtimeEnv: {
NODE_ENV: process.env.NODE_ENV,
NEXT_PUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,
NEXT_PUBLIC_STATIC_WEBSITE_ONLY:
process.env.NEXT_PUBLIC_STATIC_WEBSITE_ONLY === "true",
},
/**
* Run `build` or `dev` with `SKIP_ENV_VALIDATION` to skip env validation. This is especially