2026-01-26 17:08:26 +02:00
|
|
|
"use client";
|
|
|
|
|
|
|
|
|
|
import { AssistantRuntimeProvider } from "@assistant-ui/react";
|
2026-03-24 02:23:05 +05:30
|
|
|
import { ThinkingStepsDataUI } from "@/components/assistant-ui/thinking-steps";
|
2026-01-26 18:39:59 +02:00
|
|
|
import { Navbar } from "@/components/homepage/navbar";
|
2026-02-13 01:34:43 -08:00
|
|
|
import { ReportPanel } from "@/components/report-panel/report-panel";
|
2026-02-09 16:49:11 -08:00
|
|
|
import { Spinner } from "@/components/ui/spinner";
|
2026-01-26 17:08:26 +02:00
|
|
|
import { usePublicChat } from "@/hooks/use-public-chat";
|
|
|
|
|
import { usePublicChatRuntime } from "@/hooks/use-public-chat-runtime";
|
|
|
|
|
import { PublicChatFooter } from "./public-chat-footer";
|
2026-02-02 20:08:38 +02:00
|
|
|
import { PublicChatNotFound } from "./public-chat-not-found";
|
2026-01-26 17:08:26 +02:00
|
|
|
import { PublicThread } from "./public-thread";
|
|
|
|
|
|
|
|
|
|
interface PublicChatViewProps {
|
|
|
|
|
shareToken: string;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function PublicChatView({ shareToken }: PublicChatViewProps) {
|
|
|
|
|
const { data, isLoading, error } = usePublicChat(shareToken);
|
|
|
|
|
const runtime = usePublicChatRuntime({ data });
|
|
|
|
|
|
2026-03-21 22:16:48 +05:30
|
|
|
const navbarScrolledBg = "bg-main-panel/80 backdrop-blur-md border border-border/30 shadow-lg";
|
|
|
|
|
|
2026-01-26 17:08:26 +02:00
|
|
|
if (isLoading) {
|
|
|
|
|
return (
|
2026-03-21 22:16:48 +05:30
|
|
|
<main className="min-h-screen bg-main-panel text-foreground overflow-x-hidden">
|
|
|
|
|
<Navbar scrolledBgClassName={navbarScrolledBg} />
|
2026-01-26 18:39:59 +02:00
|
|
|
<div className="flex h-screen items-center justify-center">
|
2026-02-08 12:39:06 +05:30
|
|
|
<Spinner size="lg" className="text-muted-foreground" />
|
2026-01-26 18:39:59 +02:00
|
|
|
</div>
|
|
|
|
|
</main>
|
2026-01-26 17:08:26 +02:00
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (error || !data) {
|
2026-02-02 20:08:38 +02:00
|
|
|
return <PublicChatNotFound />;
|
2026-01-26 17:08:26 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
2026-03-21 22:16:48 +05:30
|
|
|
<main className="min-h-screen bg-main-panel text-foreground overflow-x-hidden">
|
|
|
|
|
<Navbar scrolledBgClassName={navbarScrolledBg} />
|
2026-01-26 18:39:59 +02:00
|
|
|
<AssistantRuntimeProvider runtime={runtime}>
|
2026-03-24 02:23:05 +05:30
|
|
|
<ThinkingStepsDataUI />
|
2026-02-11 18:50:57 +05:30
|
|
|
<div className="flex h-screen pt-16 overflow-hidden">
|
|
|
|
|
<div className="flex-1 flex flex-col min-w-0 overflow-hidden">
|
|
|
|
|
<PublicThread footer={<PublicChatFooter shareToken={shareToken} />} />
|
|
|
|
|
</div>
|
|
|
|
|
<ReportPanel />
|
2026-01-26 18:39:59 +02:00
|
|
|
</div>
|
|
|
|
|
</AssistantRuntimeProvider>
|
|
|
|
|
</main>
|
2026-01-26 17:08:26 +02:00
|
|
|
);
|
|
|
|
|
}
|