import React, { useState } from 'react'; import { Link, useNavigate } from 'react-router-dom'; import { Button } from '../../ui/button'; import { Input } from '../../ui/input'; import { Label } from '../../ui/label'; import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, } from '../../ui/card'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '../../ui/tabs'; import { Badge } from '../../ui/badge'; import { Alert, AlertDescription, AlertTitle } from '../../ui/alert'; import { Checkbox } from '../../ui/checkbox'; import { RadioGroup, RadioGroupItem } from '../../ui/radio-group'; import { Switch } from '../../ui/switch'; import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '../../ui/select'; import { Textarea } from '../../ui/textarea'; import { Progress } from '../../ui/progress'; import { Separator } from '../../ui/separator'; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from '../../ui/table'; import { Settings, User, Mail, Phone, Calendar, Search, Menu, ChevronRight, Home, Users, Plus, Trash2, Archive, ArrowRightLeft, History, PanelRight, FileEdit, Filter, Clock, Map, Bell, } from 'lucide-react'; import { Slider } from '../../ui/slider'; import { toast } from 'sonner'; import { ThemeToggle } from '../../brand/theme-toggle'; import { LanguageSelector } from '../../brand/language-selector'; import { MapShowcase } from '../../examples/MapShowcase'; import { Header } from '../../layout/header'; import { Sidebar } from '../../layout/sidebar'; import { Dialog, DialogTrigger, DialogContent, DialogHeader, DialogTitle, DialogDescription, DialogFooter, } from '../../ui/dialog'; import { AlertDialog, AlertDialogTrigger, AlertDialogContent, AlertDialogHeader, AlertDialogTitle, AlertDialogDescription, AlertDialogFooter, AlertDialogAction, AlertDialogCancel, } from '../../ui/alert-dialog'; import { PageHeader } from '../../ui/page-header'; import { useOptionalLayout } from '../../../contexts/LayoutContext'; import { useTheme } from '../../../contexts/ThemeContext'; import { useTeamMembers, useDashboardStore } from '../../../features/home'; import { useTranslation } from 'react-i18next'; import { SectionErrorBoundary } from '../../shared/error-boundary'; import { Skeleton } from '../../ui/skeleton'; /** * Comprehensive Showcase and Template Content component. * * @description * This component serves as a living kitchen-sink demonstration of the Xertica UI * Design System. It showcases almost every UI primitive (Cards, Tabs, Forms, * Tables, Dialogs, etc.) and layout variation (Header flexibility, Sidebar * toggling). It's primarily used for development, testing, and as a starting * point for new pages. * * @ai-rules * 1. Reference: Use this component as the primary source of truth for "how to compose" complex layouts in this library. * 2. Layout: Adjusts its own padding based on the `useLayout` context's sidebar state. * 3. Interaction: All showcase interactive elements (buttons, forms) use simple `toast` feedback or local state toggles. */ export function TemplateContent() { const { t } = useTranslation(); const layout = useOptionalLayout(); const { disableDarkMode } = useTheme(); const [localSidebarExpanded, setLocalSidebarExpanded] = useState(false); const [localSidebarWidth, setLocalSidebarWidth] = useState(280); const sidebarExpanded = layout?.sidebarExpanded ?? localSidebarExpanded; const sidebarWidth = layout?.sidebarWidth ?? localSidebarWidth; const setSidebarWidth = layout?.setSidebarWidth ?? setLocalSidebarWidth; const toggleSidebar = layout?.toggleSidebar ?? (() => setLocalSidebarExpanded(value => !value)); const navigate = useNavigate(); // Server state const { data: teamMembers = [], isLoading: teamLoading } = useTeamMembers(); // Client-side UI state (Zustand) const progress = useDashboardStore(s => s.progress); const setProgress = useDashboardStore(s => s.setProgress); const sliderValue = useDashboardStore(s => s.sliderValue); const setSliderValue = useDashboardStore(s => s.setSliderValue); const switchEnabled = useDashboardStore(s => s.switchEnabled); const toggleSwitch = useDashboardStore(s => s.toggleSwitch); // Local UI-only toggles (no global relevance) const [showSidebarUser, setShowSidebarUser] = useState(true); const [showSidebarSettings, setShowSidebarSettings] = useState(true); const [showSidebarLogout, setShowSidebarLogout] = useState(true); // Header State const [showHeaderActions, setShowHeaderActions] = useState(true); const [showHeaderBreadcrumbs, setShowHeaderBreadcrumbs] = useState(true); const handleFormSubmit = (e: React.FormEvent) => { e.preventDefault(); toast.success(t('templates.formSubmitSuccess')); }; return (
{/* Sticky Header */}
}, { label: t('templates.breadcrumb') }, ]} renderLink={(href, props) => } /> {/* Content area */}
{/* Page header */} {/* Page Header Example */}

{t('templates.headerWithBreadcrumbs.sectionTitle')}

{t('templates.headerWithBreadcrumbs.cardTitle')} {t('templates.headerWithBreadcrumbs.cardDescription')}
, }, { label: t('templates.headerWithBreadcrumbs.breadcrumbs.settings'), href: '#', icon: , }, { label: t('templates.headerWithBreadcrumbs.breadcrumbs.users'), href: '#', icon: , }, { label: t('templates.headerWithBreadcrumbs.breadcrumbs.accessProfile') }, ]} showLanguageSelector={true} showThemeToggle={true} />

{t('templates.headerWithBreadcrumbs.exampleContentTitle')}

{t('templates.headerWithBreadcrumbs.exampleContentDescriptionPart1')} Header {t('templates.headerWithBreadcrumbs.exampleContentDescriptionPart2')}

{/* Alert Examples */}

{t('templates.sections.alerts')}

{t('templates.alerts.infoTitle')} {t('templates.alerts.infoDescription')} {t('templates.alerts.errorTitle')} {t('templates.alerts.errorDescription')} {t('templates.alerts.successTitle')} {t('templates.alerts.successDescription')} {t('templates.alerts.warningTitle')} {t('templates.alerts.warningDescription')}
{/* Cards & Tabs */}

{t('templates.sections.cardsAndTabs')}

{t('templates.tabs.overview')} {t('templates.tabs.forms')} {t('templates.tabs.data')} {t('templates.tabs.settings')} {/* Overview Tab */}
{t('stats.totalUsers')} {t('stats.last30Days')}
1,234 +12%
{t('stats.totalRevenue')} {t('stats.currentMonth')}
$ 45.2k +8%
{t('stats.conversionRate')} {t('stats.currentWeek')}
3.2% -2%
{t('templates.overview.progressTitle')} {t('templates.overview.progressDescription')}
{progress}%
{sliderValue[0]}%
{/* Forms Tab */} {t('templates.forms.registrationTitle')} {t('templates.forms.registrationDescription')}