@@ -22,13 +22,7 @@ import { TFileContent, MonthlyMetric, Activity } from '@/lib/definitions'
2222import { isValidFileContent } from '@/lib/utils'
2323import { pocketbase } from '@/lib/pocketbase'
2424
25- export const ImportReport = ( {
26- show,
27- children
28- } : {
29- show : boolean
30- children : React . ReactElement
31- } ) => {
25+ export const ImportReport = ( { children } : { children : React . ReactElement } ) => {
3226 const [ loading , setLoading ] = useState < boolean > ( false )
3327 const [ reportName , setReportName ] = useState < string > ( )
3428 const [ reportContent , setReportContent ] = useState < TFileContent | null > ( null )
@@ -117,49 +111,45 @@ export const ImportReport = ({
117111 }
118112
119113 return (
120- < >
121- { show ? (
122- < AlertDialog >
123- < AlertDialogTrigger asChild > { children } </ AlertDialogTrigger >
124- < AlertDialogContent >
125- < AlertDialogHeader >
126- < AlertDialogTitle > Import new report ?</ AlertDialogTitle >
127- </ AlertDialogHeader >
128-
129- < div className = 'flex flex-col gap-4' >
130- < div className = 'flex flex-col gap-2' >
131- < Label htmlFor = 'name' > Report Name</ Label >
132- < Input
133- id = 'name'
134- name = 'name'
135- className = 'flex h-10 w-full rounded-md border border-input px-3 py-2 text-sm'
136- type = 'text'
137- onChange = { ( e ) => setReportName ( e . target . value ) }
138- placeholder = 'Name of report'
139- />
140- </ div >
141-
142- < div className = 'flex flex-col gap-2' >
143- < Label htmlFor = 'report' > Report File</ Label >
144- < Input
145- id = 'report'
146- name = 'report'
147- className = 'flex h-10 w-full rounded-md border border-input px-3 py-2 text-sm'
148- type = 'file'
149- onChange = { handleFileChange }
150- />
151- </ div >
152- </ div >
153-
154- < AlertDialogFooter >
155- < AlertDialogCancel > Cancel</ AlertDialogCancel >
156- < AlertDialogAction onClick = { handleSubmit } >
157- { loading ? 'Loading...' : 'Import Report' }
158- </ AlertDialogAction >
159- </ AlertDialogFooter >
160- </ AlertDialogContent >
161- </ AlertDialog >
162- ) : null }
163- </ >
114+ < AlertDialog >
115+ < AlertDialogTrigger asChild > { children } </ AlertDialogTrigger >
116+ < AlertDialogContent >
117+ < AlertDialogHeader >
118+ < AlertDialogTitle > Import new report ?</ AlertDialogTitle >
119+ </ AlertDialogHeader >
120+
121+ < div className = 'flex flex-col gap-4' >
122+ < div className = 'flex flex-col gap-2' >
123+ < Label htmlFor = 'name' > Report Name</ Label >
124+ < Input
125+ id = 'name'
126+ name = 'name'
127+ className = 'flex h-10 w-full rounded-md border border-input px-3 py-2 text-sm'
128+ type = 'text'
129+ onChange = { ( e ) => setReportName ( e . target . value ) }
130+ placeholder = 'Name of report'
131+ />
132+ </ div >
133+
134+ < div className = 'flex flex-col gap-2' >
135+ < Label htmlFor = 'report' > Report File</ Label >
136+ < Input
137+ id = 'report'
138+ name = 'report'
139+ className = 'flex h-10 w-full rounded-md border border-input px-3 py-2 text-sm'
140+ type = 'file'
141+ onChange = { handleFileChange }
142+ />
143+ </ div >
144+ </ div >
145+
146+ < AlertDialogFooter >
147+ < AlertDialogCancel > Cancel</ AlertDialogCancel >
148+ < AlertDialogAction onClick = { handleSubmit } >
149+ { loading ? 'Loading...' : 'Import Report' }
150+ </ AlertDialogAction >
151+ </ AlertDialogFooter >
152+ </ AlertDialogContent >
153+ </ AlertDialog >
164154 )
165155}
0 commit comments