|
| 1 | +'use client'; |
| 2 | + |
| 3 | +import { Download } from 'lucide-react'; |
| 4 | +import Image from 'next/image'; |
| 5 | + |
| 6 | +interface AuditorViewProps { |
| 7 | + initialContent: Record<string, string>; |
| 8 | + organizationName: string; |
| 9 | + logoUrl: string | null; |
| 10 | + employeeCount: string | null; |
| 11 | + cSuite: { name: string; title: string }[]; |
| 12 | + reportSignatory: { fullName: string; jobTitle: string; email: string } | null; |
| 13 | +} |
| 14 | + |
| 15 | +export function AuditorView({ |
| 16 | + initialContent, |
| 17 | + organizationName, |
| 18 | + logoUrl, |
| 19 | + employeeCount, |
| 20 | + cSuite, |
| 21 | + reportSignatory, |
| 22 | +}: AuditorViewProps) { |
| 23 | + return ( |
| 24 | + <div className="flex flex-col gap-10"> |
| 25 | + {/* Header */} |
| 26 | + <div className="flex items-center gap-4"> |
| 27 | + {logoUrl && ( |
| 28 | + <a |
| 29 | + href={logoUrl} |
| 30 | + download={`${organizationName.replace(/[^a-zA-Z0-9]/g, '_')}_logo`} |
| 31 | + className="group relative h-14 w-14 shrink-0 overflow-hidden rounded-lg border bg-background transition-all hover:shadow-md" |
| 32 | + title="Download logo" |
| 33 | + > |
| 34 | + <Image src={logoUrl} alt={`${organizationName} logo`} fill className="object-contain" /> |
| 35 | + <div className="absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 transition-opacity group-hover:opacity-100"> |
| 36 | + <Download className="h-4 w-4 text-white" /> |
| 37 | + </div> |
| 38 | + </a> |
| 39 | + )} |
| 40 | + <div> |
| 41 | + <h1 className="text-foreground text-xl font-semibold tracking-tight"> |
| 42 | + {organizationName} |
| 43 | + </h1> |
| 44 | + <p className="text-muted-foreground text-sm">Company Overview</p> |
| 45 | + </div> |
| 46 | + </div> |
| 47 | + |
| 48 | + {/* Company Information */} |
| 49 | + <Section title="Company Information"> |
| 50 | + <div className="grid gap-6 sm:grid-cols-2 lg:grid-cols-3"> |
| 51 | + <InfoCell |
| 52 | + label="Employees" |
| 53 | + value={employeeCount || '—'} |
| 54 | + className="lg:border-r lg:border-border lg:pr-6" |
| 55 | + /> |
| 56 | + <InfoCell |
| 57 | + label="Report Signatory" |
| 58 | + className="lg:border-r lg:border-border lg:pr-6" |
| 59 | + value={ |
| 60 | + reportSignatory ? ( |
| 61 | + <div> |
| 62 | + <div className="flex items-baseline gap-2"> |
| 63 | + <span className="font-medium">{reportSignatory.fullName}</span> |
| 64 | + <span className="text-muted-foreground text-xs"> |
| 65 | + {reportSignatory.jobTitle} |
| 66 | + </span> |
| 67 | + </div> |
| 68 | + <div className="text-muted-foreground text-xs mt-0.5"> |
| 69 | + {reportSignatory.email} |
| 70 | + </div> |
| 71 | + </div> |
| 72 | + ) : ( |
| 73 | + '—' |
| 74 | + ) |
| 75 | + } |
| 76 | + /> |
| 77 | + <InfoCell |
| 78 | + label="Executive Team" |
| 79 | + className="sm:col-span-2 lg:col-span-1" |
| 80 | + value={ |
| 81 | + cSuite.length > 0 ? ( |
| 82 | + <div className="space-y-1"> |
| 83 | + {cSuite.map((exec, i) => ( |
| 84 | + <div key={i} className="flex items-baseline gap-2 text-sm"> |
| 85 | + <span className="font-medium">{exec.name}</span> |
| 86 | + <span className="text-muted-foreground text-xs">{exec.title}</span> |
| 87 | + </div> |
| 88 | + ))} |
| 89 | + </div> |
| 90 | + ) : ( |
| 91 | + '—' |
| 92 | + ) |
| 93 | + } |
| 94 | + /> |
| 95 | + </div> |
| 96 | + </Section> |
| 97 | + |
| 98 | + {/* Business Overview */} |
| 99 | + <Section title="Business Overview"> |
| 100 | + <div className="space-y-6"> |
| 101 | + <ContentRow |
| 102 | + title="Company Background & Overview of Operations" |
| 103 | + content={initialContent['Company Background & Overview of Operations']} |
| 104 | + /> |
| 105 | + <ContentRow |
| 106 | + title="Types of Services Provided" |
| 107 | + content={initialContent['Types of Services Provided']} |
| 108 | + /> |
| 109 | + <ContentRow title="Mission & Vision" content={initialContent['Mission & Vision']} /> |
| 110 | + </div> |
| 111 | + </Section> |
| 112 | + |
| 113 | + {/* System Architecture */} |
| 114 | + <Section title="System Architecture"> |
| 115 | + <ContentRow title="System Description" content={initialContent['System Description']} /> |
| 116 | + </Section> |
| 117 | + |
| 118 | + {/* Third Party Dependencies */} |
| 119 | + <Section title="Third Party Dependencies"> |
| 120 | + <div className="grid gap-6 lg:grid-cols-2"> |
| 121 | + <ContentRow title="Critical Vendors" content={initialContent['Critical Vendors']} /> |
| 122 | + <ContentRow |
| 123 | + title="Subservice Organizations" |
| 124 | + content={initialContent['Subservice Organizations']} |
| 125 | + /> |
| 126 | + </div> |
| 127 | + </Section> |
| 128 | + </div> |
| 129 | + ); |
| 130 | +} |
| 131 | + |
| 132 | +function Section({ title, children }: { title: string; children: React.ReactNode }) { |
| 133 | + return ( |
| 134 | + <div className="space-y-4"> |
| 135 | + <div className="flex items-center gap-3 border-b border-border pb-2"> |
| 136 | + <h2 className="text-xs font-medium uppercase tracking-wider text-muted-foreground"> |
| 137 | + {title} |
| 138 | + </h2> |
| 139 | + </div> |
| 140 | + {children} |
| 141 | + </div> |
| 142 | + ); |
| 143 | +} |
| 144 | + |
| 145 | +function InfoCell({ |
| 146 | + label, |
| 147 | + value, |
| 148 | + className, |
| 149 | +}: { |
| 150 | + label: string; |
| 151 | + value: React.ReactNode; |
| 152 | + className?: string; |
| 153 | +}) { |
| 154 | + return ( |
| 155 | + <div className={className || ''}> |
| 156 | + <div className="text-[11px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5"> |
| 157 | + {label} |
| 158 | + </div> |
| 159 | + <div className="text-sm text-foreground">{value}</div> |
| 160 | + </div> |
| 161 | + ); |
| 162 | +} |
| 163 | + |
| 164 | +function ContentRow({ title, content }: { title: string; content?: string }) { |
| 165 | + const hasContent = content?.trim().length; |
| 166 | + |
| 167 | + return ( |
| 168 | + <div className="space-y-1.5"> |
| 169 | + <h3 className="text-sm font-medium text-foreground">{title}</h3> |
| 170 | + {hasContent ? ( |
| 171 | + <p className="text-sm leading-relaxed text-muted-foreground whitespace-pre-wrap"> |
| 172 | + {content} |
| 173 | + </p> |
| 174 | + ) : ( |
| 175 | + <p className="text-xs text-muted-foreground/50">Not yet available</p> |
| 176 | + )} |
| 177 | + </div> |
| 178 | + ); |
| 179 | +} |
0 commit comments