'use client';
/**
* Dashboard Page
*
* Protected page that displays user information and account details
*/
import { useAuth } from '@/lib/contexts/AuthContext';
import { useRouter } from 'next/navigation';
import { useEffect } from 'react';
import { Button } from '@/components/ui/button';
import Link from 'next/link';
export default function DashboardPage() {
const { user, isAuthenticated, isLoading, logout } = useAuth();
const router = useRouter();
// Redirect to home if not authenticated
useEffect(() => {
if (!isLoading && !isAuthenticated) {
router.push('/');
}
}, [isLoading, isAuthenticated, router]);
if (isLoading) {
return (
);
}
if (!isAuthenticated || !user) {
return null;
}
const handleLogout = async () => {
await logout();
router.push('/');
};
return (
{/* Header */}
ThrillWiki
|
Dashboard
{/* Main Content */}
Welcome, {user.username}!
Manage your account and view your activity
{/* User Profile Card */}
{user.username.charAt(0).toUpperCase()}
{user.username}
{user.email}
User ID:
{user.id}
Email Verified:
{user.email_verified ? 'β Yes' : 'β No'}
Account Status:
Active
{/* Activity Section */}
Quick Actions
Recent Activity
No recent activity to display
Start exploring to see your activity here!
{/* Feature Preview */}
Coming Soon
More features are being developed including park browsing, ride reviews, and social features.
πΊοΈ Interactive Maps
Explore parks with interactive maps
π Statistics
Track your coaster count and stats
π₯ Social Features
Connect with other enthusiasts
);
}