'use client' import { useState, useEffect } from 'react' import Link from 'next/link' import { useRedirectIfNotAuth } from '@/utils/auth' import { UserProfile, Session, getSessions, } from '@/utils/api' export default function ActivityPage() { const userInfo = useRedirectIfNotAuth() as UserProfile | null; const [sessions, setSessions] = useState([]) const [isLoading, setIsLoading] = useState(true) const fetchSessions = async () => { try { const fetchedSessions = await getSessions(); setSessions(fetchedSessions); } catch (error) { console.error('Failed to fetch conversations:', error) } finally { setIsLoading(false) } } useEffect(() => { fetchSessions() }, []) if (!userInfo) { return (

Loading...

) } const getGreeting = () => { const hour = new Date().getHours() if (hour < 12) return 'Good morning' if (hour < 18) return 'Good afternoon' return 'Good evening' } return (

{getGreeting()}, {userInfo.display_name}

Your Past Activity

{isLoading ? (

Loading conversations...

) : sessions.length > 0 ? (
{sessions.map((session) => (

{session.title || `Conversation - ${new Date(session.started_at * 1000).toLocaleDateString()}`}

{new Date(session.started_at * 1000).toLocaleString()}
Conversation ))}
) : (

No conversations yet. Start a conversation in the desktop app to see your activity here.

💡 Tip: Use the desktop app to have AI-powered conversations that will appear here automatically.
)}
) }