import { createFileRoute, Link } from "@tanstack/react-router";import { LinkIcon, PlusIcon } from "lucide-react"; import { NoActiveThreadState } from "../components/NoActiveThreadState";import { Button } from "../components/ui/button";import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "../components/ui/empty";import { SidebarInset, SidebarTrigger } from "../components/ui/sidebar";import { useEnvironments } from "../state/environments";import { APP_DISPLAY_NAME } from "~/branding";import { hasCloudPublicConfig } from "~/cloud/publicConfig"; function ChatIndexRouteView() { const { authGateState } = Route.useRouteContext(); const { environments } = useEnvironments(); if (authGateState.status === "hosted-static" && environments.length === 0) { return <HostedStaticOnboardingState />; } return <NoActiveThreadState />;} export const Route = createFileRoute("/_chat/")({ component: ChatIndexRouteView,}); function HostedStaticOnboardingState() { const cloudEnabled = hasCloudPublicConfig(); return ( <SidebarInset className="h-dvh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground"> <div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-background"> <header className="border-b border-border px-3 py-2 sm:px-5 sm:py-3"> <div className="flex items-center gap-2"> <SidebarTrigger className="size-7 shrink-0 md:hidden" /> <span className="text-sm font-medium text-foreground md:text-muted-foreground/60"> {APP_DISPLAY_NAME} </span> </div> </header> <Empty className="flex-1"> <div className="w-full max-w-xl rounded-3xl border border-border/55 bg-card/20 px-8 py-12 shadow-sm/5"> <EmptyHeader className="max-w-none"> <div className="mx-auto mb-5 flex size-11 items-center justify-center rounded-xl border border-border/70 bg-background/70 text-muted-foreground"> <LinkIcon className="size-5" /> </div> <EmptyTitle className="text-foreground text-xl"> Connect an environment to get started </EmptyTitle> <EmptyDescription className="mt-2 text-sm leading-relaxed text-muted-foreground/78"> {cloudEnabled ? "Sign in to T3 Connect to connect a linked environment through its managed tunnel, or add a reachable backend manually." : "Add a reachable backend manually to start working from this browser."} </EmptyDescription> <div className="mt-6 flex justify-center"> <Button render={<Link to="/settings/connections" />} size="sm"> <PlusIcon className="size-4" /> {cloudEnabled ? "Open Connections" : "Add environment"} </Button> </div> </EmptyHeader> </div> </Empty> </div> </SidebarInset> );}
import { createFileRoute, Link } from "@tanstack/react-router";
import { LinkIcon, PlusIcon } from "lucide-react";
import { NoActiveThreadState } from "../components/NoActiveThreadState";
import { Button } from "../components/ui/button";
import { Empty, EmptyDescription, EmptyHeader, EmptyTitle } from "../components/ui/empty";
import { SidebarInset, SidebarTrigger } from "../components/ui/sidebar";
import { useEnvironments } from "../state/environments";
import { APP_DISPLAY_NAME } from "~/branding";
import { hasCloudPublicConfig } from "~/cloud/publicConfig";
function ChatIndexRouteView() {
const { authGateState } = Route.useRouteContext();
const { environments } = useEnvironments();
if (authGateState.status === "hosted-static" && environments.length === 0) {
return <HostedStaticOnboardingState />;
}
return <NoActiveThreadState />;
}
export const Route = createFileRoute("/_chat/")({
component: ChatIndexRouteView,
});
function HostedStaticOnboardingState() {
const cloudEnabled = hasCloudPublicConfig();
return (
<SidebarInset className="h-dvh min-h-0 overflow-hidden overscroll-y-none bg-background text-foreground">
<div className="flex min-h-0 min-w-0 flex-1 flex-col overflow-x-hidden bg-background">
<header className="border-b border-border px-3 py-2 sm:px-5 sm:py-3">
<div className="flex items-center gap-2">
<SidebarTrigger className="size-7 shrink-0 md:hidden" />
<span className="text-sm font-medium text-foreground md:text-muted-foreground/60">
{APP_DISPLAY_NAME}
</span>
</div>
</header>
<Empty className="flex-1">
<div className="w-full max-w-xl rounded-3xl border border-border/55 bg-card/20 px-8 py-12 shadow-sm/5">
<EmptyHeader className="max-w-none">
<div className="mx-auto mb-5 flex size-11 items-center justify-center rounded-xl border border-border/70 bg-background/70 text-muted-foreground">
<LinkIcon className="size-5" />
</div>
<EmptyTitle className="text-foreground text-xl">
Connect an environment to get started
</EmptyTitle>
<EmptyDescription className="mt-2 text-sm leading-relaxed text-muted-foreground/78">
{cloudEnabled
? "Sign in to T3 Connect to connect a linked environment through its managed tunnel, or add a reachable backend manually."
: "Add a reachable backend manually to start working from this browser."}
</EmptyDescription>
<div className="mt-6 flex justify-center">
<Button render={<Link to="/settings/connections" />} size="sm">
<PlusIcon className="size-4" />
{cloudEnabled ? "Open Connections" : "Add environment"}
</Button>
</div>
</EmptyHeader>
</div>
</Empty>
</div>
</SidebarInset>
);
}