'use client' import { useState } from 'react' import Link from 'next/link' import { Button } from '@/components/ui/button' import { Upload, Rocket, Plus, Edit2, Trash2, Eye, Globe, Clock, AlertCircle, CheckCircle, } from 'lucide-react' interface PortfolioItem { id: number name: string domain: string status: 'active' | 'inactive' | 'deploying' | 'failed' url?: string uploadedAt: string lastUpdated: string } interface PortfolioDashboardProps { portfolios?: PortfolioItem[] onEdit?: (id: number) => void onDelete?: (id: number) => void onDeploy?: (id: number) => void onUpload?: (id: number) => void } const defaultPortfolios: PortfolioItem[] = [ { id: 1, name: 'Personal Website', domain: 'myportfolio.com', status: 'active', url: 'https://myportfolio.com', uploadedAt: '2025-10-15', lastUpdated: '2025-10-17', }, { id: 2, name: 'Design Showcase', domain: 'designs.myportfolio.com', status: 'inactive', uploadedAt: '2025-10-10', lastUpdated: '2025-10-10', }, ] export default function PortfolioDashboard({ portfolios = defaultPortfolios, onEdit = () => {}, onDelete = () => {}, onDeploy = () => {}, onUpload = () => {}, }: PortfolioDashboardProps) { const [view, setView] = useState<'grid' | 'list'>('grid') const [selectedPortfolio, setSelectedPortfolio] = useState(null) const getStatusBadge = (status: string) => { const statusConfig = { active: { bg: 'bg-green-100', text: 'text-green-800', icon: CheckCircle, label: 'Active', }, inactive: { bg: 'bg-gray-100', text: 'text-gray-800', icon: Clock, label: 'Inactive', }, deploying: { bg: 'bg-blue-100', text: 'text-blue-800', icon: Rocket, label: 'Deploying', }, failed: { bg: 'bg-red-100', text: 'text-red-800', icon: AlertCircle, label: 'Failed', }, } const config = statusConfig[status as keyof typeof statusConfig] const Icon = config.icon return (
{config.label}
) } return (
{/* Header */}

Portfolio Management

Manage and monitor your hosted portfolios

{/* Stats */}

Total Portfolios

{portfolios.length}

Active

{portfolios.filter((p) => p.status === 'active').length}

Inactive

{portfolios.filter((p) => p.status === 'inactive').length}

Failed

{portfolios.filter((p) => p.status === 'failed').length}

{/* Content */}
{portfolios.length === 0 ? (

No portfolios yet

Create your first portfolio to get started

) : view === 'grid' ? ( /* Grid View */
{portfolios.map((portfolio) => (
setSelectedPortfolio(portfolio.id)} >
{getStatusBadge(portfolio.status)}

{portfolio.name}

{portfolio.domain}

Uploaded: {new Date(portfolio.uploadedAt).toLocaleDateString()}

Last Updated: {new Date(portfolio.lastUpdated).toLocaleDateString()}

{portfolio.url && portfolio.status === 'active' && ( )}
))}
) : ( /* List View */
{portfolios.map((portfolio) => (
setSelectedPortfolio(portfolio.id)} >

{portfolio.name}

{getStatusBadge(portfolio.status)}

{portfolio.domain}

{portfolio.url && portfolio.status === 'active' && ( )}
))}
)}
) }