1- 'use client' ;
2-
3- import { downloadAllEvidenceZip } from '@/lib/evidence-download' ;
4- import {
5- Button ,
6- Popover ,
7- PopoverContent ,
8- PopoverDescription ,
9- PopoverHeader ,
10- PopoverTitle ,
11- PopoverTrigger ,
12- Switch ,
13- } from '@trycompai/design-system' ;
14- import { ArrowDown } from '@trycompai/design-system/icons' ;
1+ import { Section , Stack } from '@trycompai/design-system' ;
152import { Download } from 'lucide-react' ;
163import Image from 'next/image' ;
17- import { useParams } from 'next/navigation' ;
18- import { useState } from 'react' ;
19- import { toast } from 'sonner' ;
204
215interface AuditorViewProps {
226 initialContent : Record < string , string > ;
@@ -35,84 +19,34 @@ export function AuditorView({
3519 cSuite,
3620 reportSignatory,
3721} : AuditorViewProps ) {
38- const params = useParams ( ) ;
39- const orgId = params . orgId as string ;
40- const [ isDownloading , setIsDownloading ] = useState ( false ) ;
41- const [ includeJson , setIncludeJson ] = useState ( false ) ;
42- const [ isPopoverOpen , setIsPopoverOpen ] = useState ( false ) ;
43-
44- const handleDownloadAllEvidence = async ( ) => {
45- setIsDownloading ( true ) ;
46- try {
47- await downloadAllEvidenceZip ( {
48- organizationName,
49- includeJson,
50- } ) ;
51- toast . success ( 'Evidence package downloaded successfully' ) ;
52- setIsPopoverOpen ( false ) ;
53- } catch ( err ) {
54- toast . error ( 'Failed to download evidence. Please try again.' ) ;
55- console . error ( 'Evidence download error:' , err ) ;
56- } finally {
57- setIsDownloading ( false ) ;
58- }
59- } ;
60-
6122 return (
62- < div className = "flex flex-col gap-10" >
63- { /* Header */ }
64- < div className = "flex items-center justify-between" >
65- < div className = "flex items-center gap-4" >
23+ < Stack gap = "xl" >
24+ < Section title = "Company Information" >
25+ < div className = "grid gap-6 sm:grid-cols-2 lg:grid-cols-4" >
6626 { logoUrl && (
67- < a
68- href = { logoUrl }
69- download = { `${ organizationName . replace ( / [ ^ a - z A - Z 0 - 9 ] / g, '_' ) } _logo` }
70- className = "group relative h-14 w-14 shrink-0 overflow-hidden rounded-lg border bg-background transition-all hover:shadow-md"
71- title = "Download logo"
72- >
73- < Image src = { logoUrl } alt = { `${ organizationName } logo` } fill className = "object-contain" />
74- < div className = "absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 transition-opacity group-hover:opacity-100" >
75- < Download className = "h-4 w-4 text-white" />
76- </ div >
77- </ a >
27+ < InfoCell
28+ label = "Logo"
29+ className = "lg:border-r lg:border-border lg:pr-6"
30+ value = {
31+ < a
32+ href = { logoUrl }
33+ download = { `${ organizationName . replace ( / [ ^ a - z A - Z 0 - 9 ] / g, '_' ) } _logo` }
34+ className = "group relative block h-14 w-14 overflow-hidden rounded-lg border bg-background transition-all hover:shadow-md"
35+ title = "Download logo"
36+ >
37+ < Image
38+ src = { logoUrl }
39+ alt = { `${ organizationName } logo` }
40+ fill
41+ className = "object-contain"
42+ />
43+ < div className = "absolute inset-0 flex items-center justify-center bg-black/50 opacity-0 transition-opacity group-hover:opacity-100" >
44+ < Download className = "h-4 w-4 text-white" />
45+ </ div >
46+ </ a >
47+ }
48+ />
7849 ) }
79- < div >
80- < h1 className = "text-foreground text-xl font-semibold tracking-tight" >
81- { organizationName }
82- </ h1 >
83- < p className = "text-muted-foreground text-sm" > Company Overview</ p >
84- </ div >
85- </ div >
86-
87- { /* Download All Evidence Button */ }
88- < Popover open = { isPopoverOpen } onOpenChange = { setIsPopoverOpen } >
89- < PopoverTrigger style = { { cursor : 'pointer' } } >
90- < Button variant = "outline" > Export All Evidence</ Button >
91- </ PopoverTrigger >
92- < PopoverContent align = "end" side = "bottom" sideOffset = { 8 } >
93- < PopoverHeader >
94- < PopoverTitle > Export Options</ PopoverTitle >
95- < PopoverDescription > Download all task evidence as ZIP</ PopoverDescription >
96- </ PopoverHeader >
97- < div className = "flex items-center justify-between gap-3 py-1" >
98- < span className = "text-sm" > Include raw JSON files</ span >
99- < Switch checked = { includeJson } onCheckedChange = { ( checked ) => setIncludeJson ( checked ) } />
100- </ div >
101- < Button
102- iconLeft = { < ArrowDown /> }
103- onClick = { handleDownloadAllEvidence }
104- disabled = { isDownloading }
105- width = "full"
106- >
107- { isDownloading ? 'Preparing…' : 'Export' }
108- </ Button >
109- </ PopoverContent >
110- </ Popover >
111- </ div >
112-
113- { /* Company Information */ }
114- < Section title = "Company Information" >
115- < div className = "grid gap-6 sm:grid-cols-2 lg:grid-cols-3" >
11650 < InfoCell
11751 label = "Employees"
11852 value = { employeeCount || '—' }
@@ -126,13 +60,9 @@ export function AuditorView({
12660 < div >
12761 < div className = "flex items-baseline gap-2" >
12862 < span className = "font-medium" > { reportSignatory . fullName } </ span >
129- < span className = "text-muted-foreground text-xs" >
130- { reportSignatory . jobTitle }
131- </ span >
132- </ div >
133- < div className = "text-muted-foreground text-xs mt-0.5" >
134- { reportSignatory . email }
63+ < span className = "text-muted-foreground text-xs" > { reportSignatory . jobTitle } </ span >
13564 </ div >
65+ < div className = "text-muted-foreground text-xs mt-0.5" > { reportSignatory . email } </ div >
13666 </ div >
13767 ) : (
13868 '—'
@@ -141,7 +71,6 @@ export function AuditorView({
14171 />
14272 < InfoCell
14373 label = "Executive Team"
144- className = "sm:col-span-2 lg:col-span-1"
14574 value = {
14675 cSuite . length > 0 ? (
14776 < div className = "space-y-1" >
@@ -160,9 +89,8 @@ export function AuditorView({
16089 </ div >
16190 </ Section >
16291
163- { /* Business Overview */ }
16492 < Section title = "Business Overview" >
165- < div className = "space-y-6 ">
93+ < Stack gap = "lg ">
16694 < ContentRow
16795 title = "Company Background & Overview of Operations"
16896 content = { initialContent [ 'Company Background & Overview of Operations' ] }
@@ -172,15 +100,13 @@ export function AuditorView({
172100 content = { initialContent [ 'Types of Services Provided' ] }
173101 />
174102 < ContentRow title = "Mission & Vision" content = { initialContent [ 'Mission & Vision' ] } />
175- </ div >
103+ </ Stack >
176104 </ Section >
177105
178- { /* System Architecture */ }
179106 < Section title = "System Architecture" >
180107 < ContentRow title = "System Description" content = { initialContent [ 'System Description' ] } />
181108 </ Section >
182109
183- { /* Third Party Dependencies */ }
184110 < Section title = "Third Party Dependencies" >
185111 < div className = "grid gap-6 lg:grid-cols-2" >
186112 < ContentRow title = "Critical Vendors" content = { initialContent [ 'Critical Vendors' ] } />
@@ -190,20 +116,7 @@ export function AuditorView({
190116 />
191117 </ div >
192118 </ Section >
193- </ div >
194- ) ;
195- }
196-
197- function Section ( { title, children } : { title : string ; children : React . ReactNode } ) {
198- return (
199- < div className = "space-y-4" >
200- < div className = "flex items-center gap-3 border-b border-border pb-2" >
201- < h2 className = "text-xs font-medium uppercase tracking-wider text-muted-foreground" >
202- { title }
203- </ h2 >
204- </ div >
205- { children }
206- </ div >
119+ </ Stack >
207120 ) ;
208121}
209122
@@ -217,7 +130,7 @@ function InfoCell({
217130 className ?: string ;
218131} ) {
219132 return (
220- < div className = { className || '' } >
133+ < div className = { className } >
221134 < div className = "text-[11px] font-medium uppercase tracking-wider text-muted-foreground mb-1.5" >
222135 { label }
223136 </ div >
@@ -233,9 +146,7 @@ function ContentRow({ title, content }: { title: string; content?: string }) {
233146 < div className = "space-y-1.5" >
234147 < h3 className = "text-sm font-medium text-foreground" > { title } </ h3 >
235148 { hasContent ? (
236- < p className = "text-sm leading-relaxed text-muted-foreground whitespace-pre-wrap" >
237- { content }
238- </ p >
149+ < p className = "text-sm leading-relaxed text-muted-foreground whitespace-pre-wrap" > { content } </ p >
239150 ) : (
240151 < p className = "text-xs text-muted-foreground/50" > Not yet available</ p >
241152 ) }
0 commit comments