import { connection } from 'next/server'; import { Suspense } from 'react'; import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { getTodos, getUser } from './api'; export async function UserProfile() { await connection(); try { const user = await getUser(); if (!user) return null; return (
{user.email?.[0]?.toUpperCase() || 'U'}

User ID: {user.id}

{user.email}

); } catch (e) { return null; } } export async function TodoList() { await connection(); try { const todos = await getTodos(); return (
{todos.length === 0 ? (

No todos found.

) : ( todos.map((todo: any) => (
{todo.completed ? '✓' : '⚡'}

{todo.title}

{new Date(todo.createdAt).toLocaleDateString()}

)) )}
); } catch (e) { return

Failed to load todos.

; } } export function UserProfileSkeleton() { return (
); } export function TodoListSkeleton() { return (
{[1, 2, 3].map(i => (
))}
); }