import { createFileRoute, Link } from "@tanstack/react-router";
import { queryOptions, useSuspenseQuery } from "@tanstack/react-query";
import { Suspense, useState } from "react";
import { AudioLines, ArrowLeft } from "lucide-react";
import { supabase } from "@/integrations/supabase/client";
import { SitePreview } from "@/components/site-preview";
const sessionQuery = (id: string) =>
queryOptions({
queryKey: ["session", id],
queryFn: async () => {
const [conv, builds] = await Promise.all([
supabase.from("voice_conversations").select("started_at, voice_messages(position, role, content)").eq("session_id", id).maybeSingle(),
supabase.from("voice_builds").select("id, prompt, html, created_at, deployed_url").eq("session_id", id).order("created_at"),
]);
if (conv.error) throw conv.error;
if (builds.error) throw builds.error;
return { conversation: conv.data, builds: builds.data ?? [] };
},
});
export const Route = createFileRoute("/session/$id")({
head: () => ({
meta: [
{ title: "Echo session — conversation & live preview" },
{ name: "description", content: "Read an Echo voice conversation and run the website Echo built during it." },
{ property: "og:title", content: "Echo session — conversation & live preview" },
{ property: "og:description", content: "A shared Echo voice session with its full dialogue and live website preview." },
{ property: "og:type", content: "article" },
{ name: "twitter:card", content: "summary" },
],
}),
component: SessionPage,
});
function SessionPage() {
const { id } = Route.useParams();
return (
This session isn't available. Sign in with the account that made it — it appears once the call is saved.
; return ({m.role === "user" ? "visitor" : "echo"} {m.content}
)) :The dialogue appears after the call ends.
}{build.prompt}
No website was built in this session.
}