Skip to content

Commit b878a78

Browse files
authored
Merge pull request #15 from devops-actions/copilot/fix-14
Hide upload panel after successful CSV upload
2 parents f73bf6b + 4285fb5 commit b878a78

1 file changed

Lines changed: 32 additions & 30 deletions

File tree

src/App.tsx

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -219,37 +219,39 @@ function App() {
219219
</p>
220220
</header>
221221

222-
<Card className="mb-8">
223-
<div
224-
className={`p-6 text-center ${isDragging ? 'bg-secondary/50' : ''} transition-colors duration-200`}
225-
onDragOver={handleDragOver}
226-
onDragLeave={handleDragLeave}
227-
onDrop={handleDrop}
228-
>
229-
<div className="mb-4">
230-
<Upload size={48} weight="thin" className="mx-auto text-muted-foreground" />
222+
{!(data && data.length > 0) && (
223+
<Card className="mb-8">
224+
<div
225+
className={`p-6 text-center ${isDragging ? 'bg-secondary/50' : ''} transition-colors duration-200`}
226+
onDragOver={handleDragOver}
227+
onDragLeave={handleDragLeave}
228+
onDrop={handleDrop}
229+
>
230+
<div className="mb-4">
231+
<Upload size={48} weight="thin" className="mx-auto text-muted-foreground" />
232+
</div>
233+
234+
<h2 className="text-xl font-medium mb-2">Upload CSV File</h2>
235+
<p className="text-muted-foreground mb-4 max-w-md mx-auto">
236+
{isDragging
237+
? "Drop your file here..."
238+
: "Upload your GitHub Copilot premium requests usage CSV export to visualize the data. Drag and drop or select a file."}
239+
</p>
240+
241+
<Button onClick={handleButtonClick} className="cursor-pointer">
242+
Select CSV File
243+
</Button>
244+
<input
245+
ref={fileInputRef}
246+
id="csv-upload"
247+
type="file"
248+
accept=".csv"
249+
onChange={handleFileUpload}
250+
className="hidden"
251+
/>
231252
</div>
232-
233-
<h2 className="text-xl font-medium mb-2">Upload CSV File</h2>
234-
<p className="text-muted-foreground mb-4 max-w-md mx-auto">
235-
{isDragging
236-
? "Drop your file here..."
237-
: "Upload your GitHub Copilot premium requests usage CSV export to visualize the data. Drag and drop or select a file."}
238-
</p>
239-
240-
<Button onClick={handleButtonClick} className="cursor-pointer">
241-
Select CSV File
242-
</Button>
243-
<input
244-
ref={fileInputRef}
245-
id="csv-upload"
246-
type="file"
247-
accept=".csv"
248-
onChange={handleFileUpload}
249-
className="hidden"
250-
/>
251-
</div>
252-
</Card>
253+
</Card>
254+
)}
253255

254256
{data && data.length > 0 && (
255257
<div className="space-y-8">

0 commit comments

Comments
 (0)