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 Profile {user.email} {n.label} {n.note}Welcome, {name}
{value ?? "—"}
{label}
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.
:{p.title}
{p.versions} version{p.versions > 1 ? "s" : ""} · {new Date(p.updated).toLocaleString()}