feat: add graceful public chat not found page

This commit is contained in:
CREDO23 2026-02-02 20:08:38 +02:00
parent 3cf8647d50
commit 8d9dfc7aa4
4 changed files with 42 additions and 11 deletions

View file

@ -0,0 +1,30 @@
"use client";
import { Link2Off } from "lucide-react";
import Link from "next/link";
import { useTranslations } from "next-intl";
import { Navbar } from "@/components/homepage/navbar";
export function PublicChatNotFound() {
const t = useTranslations("public_chat");
return (
<main className="min-h-screen bg-linear-to-b from-gray-50 to-gray-100 text-gray-900 dark:from-black dark:to-gray-900 dark:text-white overflow-x-hidden">
<Navbar />
<div className="flex h-screen flex-col items-center justify-center gap-6 px-4 text-center">
<div className="flex h-16 w-16 items-center justify-center rounded-full bg-muted">
<Link2Off className="h-8 w-8 text-muted-foreground" />
</div>
<div className="flex flex-col gap-2">
<h1 className="text-2xl font-semibold">{t("not_found_title")}</h1>
<p className="text-muted-foreground">
<Link href="/login" className="text-primary underline hover:text-primary/80">
{t("click_here")}
</Link>{" "}
{t("sign_in_prompt")}
</p>
</div>
</div>
</main>
);
}

View file

@ -10,6 +10,7 @@ import { ScrapeWebpageToolUI } from "@/components/tool-ui/scrape-webpage";
import { usePublicChat } from "@/hooks/use-public-chat";
import { usePublicChatRuntime } from "@/hooks/use-public-chat-runtime";
import { PublicChatFooter } from "./public-chat-footer";
import { PublicChatNotFound } from "./public-chat-not-found";
import { PublicThread } from "./public-thread";
interface PublicChatViewProps {
@ -32,17 +33,7 @@ export function PublicChatView({ shareToken }: PublicChatViewProps) {
}
if (error || !data) {
return (
<main className="min-h-screen bg-linear-to-b from-gray-50 to-gray-100 text-gray-900 dark:from-black dark:to-gray-900 dark:text-white overflow-x-hidden">
<Navbar />
<div className="flex h-screen flex-col items-center justify-center gap-4 px-4 text-center">
<h1 className="text-2xl font-semibold">Chat not found</h1>
<p className="text-muted-foreground">
This chat may have been removed or is no longer public.
</p>
</div>
</main>
);
return <PublicChatNotFound />;
}
return (