import React, { useState } from 'react'; import { AuthenticatedLayout } from '../layout/AuthenticatedLayout'; import { Button } from '../ui/button'; import { Card, CardContent, CardHeader, CardTitle } from '../ui/card'; import { Input } from '../ui/input'; import { Label } from '../ui/label'; import { Textarea } from '../ui/textarea'; import { Badge } from '../ui/badge'; import { toast } from "sonner@2.0.3"; import { Save, Eye, Send, Check, X, History, GripVertical, Link } from 'lucide-react'; import { InternalLinkPicker } from '../landing-pages/InternalLinkPicker'; import { MediaPicker } from '../landing-pages/MediaPicker'; import { PreviewModal } from '../landing-pages/PreviewModal'; import { VersionHistory } from '../landing-pages/VersionHistory'; import { AuditDrawer } from '../landing-pages/AuditDrawer'; import { Route } from '../../types/routes'; interface AboutUsEditorProps { onNavigate: (route: Route) => void; onLogout: () => void; user: any; } interface HeroData { imageUrl?: string; imageAlt?: string; headline: string; subtext: string; cta: { label: string; internalHref: string; }; } interface StatData { value: number; suffix: string; label: string; } interface TeamMember { title: string; imageUrl?: string; imageAlt?: string; body: string; } export function AboutUsEditor({ onNavigate, onLogout, user }: AboutUsEditorProps) { const [status, setStatus] = useState<'draft' | 'in_review' | 'changes_requested' | 'approved' | 'published'>('published'); const [isLinkPickerOpen, setIsLinkPickerOpen] = useState(false); const [isPreviewOpen, setIsPreviewOpen] = useState(false); const [isVersionHistoryOpen, setIsVersionHistoryOpen] = useState(false); const [isAuditOpen, setIsAuditOpen] = useState(false); // Form data const [hero, setHero] = useState({ headline: '', subtext: '', cta: { label: '', internalHref: '' } }); const [stats, setStats] = useState([ { value: 27187, suffix: '+', label: 'LEADERS DEVELOPED' }, { value: 15510, suffix: '+', label: 'CORPORATE CLIENTS' }, { value: 1240, suffix: '+', label: 'COUNTRIES SERVED' } ]); const [teamMembers, setTeamMembers] = useState([ { title: '', body: '' }, { title: '', body: '' }, { title: '', body: '' }, { title: '', body: '' } ]); const breadcrumbs = [ { label: "Admin", href: "/dashboard" }, { label: "Landing Pages", href: "/landing-pages" }, { label: "About Us" } ]; const handleSaveDraft = () => { toast.success("Saved as draft."); }; const handleSubmitForApproval = () => { setStatus('in_review'); toast.success("Submitted for approval."); }; const handleApprove = () => { setStatus('approved'); toast.success("Approved."); }; const handleRequestChanges = () => { setStatus('changes_requested'); toast.success("Changes requested."); }; const handlePublish = () => { setStatus('published'); toast.success("Published."); }; const handleUnpublish = () => { setStatus('draft'); toast.success("Unpublished."); }; const handleLinkSelect = (link: { href: string; title: string }) => { setHero(prev => ({ ...prev, cta: { ...prev.cta, internalHref: link.href } })); }; const validateCTA = (cta: { label: string; internalHref: string }) => { if (cta.label && !cta.internalHref) return "CTA requires both text and destination."; if (!cta.label && cta.internalHref) return "CTA requires both text and destination."; return null; }; const getStatusBadgeVariant = () => { switch (status) { case 'published': return 'default'; case 'approved': return 'secondary'; case 'in_review': return 'outline'; case 'changes_requested': return 'destructive'; default: return 'secondary'; } }; const getStatusLabel = () => { switch (status) { case 'draft': return 'Draft'; case 'in_review': return 'In Review'; case 'changes_requested': return 'Changes Requested'; case 'approved': return 'Approved'; case 'published': return 'Published'; default: return 'Draft'; } }; const canEdit = status !== 'in_review'; const canApprove = user.role === 'Super Admin' && status === 'in_review'; const canPublish = user.role === 'Super Admin' && status === 'approved'; const renderHeader = () => (

About Us Page

{getStatusLabel()}
{status === 'draft' && ( )} {canApprove && ( <> )} {canPublish && ( )} {status === 'published' && ( )}
); const renderRightRail = () => (

Page Information

URL: /about-us
Last published: 2024-01-13 16:45
Last editor: Marketing Team

Actions

); const renderHeroSection = () => ( Hero Section {/* Background Image */}
{}} recommendedSize="1440×600px" required />
{/* Headline */}
setHero(prev => ({ ...prev, headline: e.target.value }))} placeholder="Enter hero headline" disabled={!canEdit} required />
{/* Subtext */}