import { createFileRoute, Link } from "@tanstack/react-router"; import { useQuery, useQueryClient } from "@tanstack/react-query"; import { AudioLines, LogOut, Bot, Code2, ExternalLink, FolderGit2 } from "lucide-react"; import { supabase } from "@/integrations/supabase/client"; import { useAuth, displayName } from "@/hooks/use-auth"; import { SignIn } from "@/components/sign-in"; import { NAV } from "@/components/app-header"; export const Route = createFileRoute("/profile")({ head: () => ({ meta: [ { title: "Your Profile — Codesynux" }, { name: "description", content: "Sign in to Codesynux to talk with Echo, run autonomous agents, scan security and deploy to the cloud." }, { property: "og:title", content: "Codesynux — Autonomous AI Platform" }, { property: "og:description", content: "Live voice agents, autonomous systems, security scans and cloud deployment in one place." }, { property: "og:type", content: "website" }, { name: "twitter:card", content: "summary_large_image" }, ], }), component: Profile, }); function Profile() { const { user, ready } = useAuth(); const qc = useQueryClient(); const stats = useQuery({ queryKey: ["profile-stats", user?.id], enabled: !!user, queryFn: async () => { const [c, b] = await Promise.all([ supabase.from("voice_conversations").select("id", { count: "exact", head: true }), supabase.from("voice_builds").select("id", { count: "exact", head: true }), ]); return { calls: c.count ?? 0, builds: b.count ?? 0 }; }, }); if (!ready) return
Loading…
; if (!user) return ; const name = displayName(user); const signOut = async () => { await qc.cancelQueries(); qc.clear(); await supabase.auth.signOut(); }; return (
{name[0]?.toUpperCase()}

Profile

Welcome, {name}

{user.email}

Talk to EchoStart a live voice call and build websites by speaking
{NAV.map((n) => (

{n.label}

{n.note}

))}
); } function Stat({ label, value }: { label: string; value: number | undefined }) { return (

{value ?? "—"}

{label}

); } function Projects({ userId }: { userId: string }) { const q = useQuery({ queryKey: ["profile-projects", userId], queryFn: async () => { const { data, error } = await supabase.from("voice_builds").select("id, session_id, prompt, created_at, deployed_url").order("created_at", { ascending: false }).limit(200); if (error) throw error; const map = new Map(); for (const b of data ?? []) { const p = map.get(b.session_id); if (p) { p.versions++; p.title = b.prompt; p.url ??= b.deployed_url; } else map.set(b.session_id, { session: b.session_id, title: b.prompt, updated: b.created_at, versions: 1, url: b.deployed_url }); } return [...map.values()]; }, }); return (

Websites built

New project
{q.isLoading ?

Loading your projects…

: !q.data?.length ?

No projects yet. Ask Echo or the agent to build a website and it will be saved here automatically.

:
{q.data.map((p) => (

{p.title}

{p.versions} version{p.versions > 1 ? "s" : ""} · {new Date(p.updated).toLocaleString()}

Continue Preview, code & history {p.url && Live }
))}
}
); }