use button as a file picker

This commit is contained in:
2025-08-16 11:34:34 -04:00
parent f747a82322
commit e7de213c18
2 changed files with 60 additions and 6 deletions

View File

@@ -7,6 +7,7 @@ import { Dialog, DialogContent, DialogFooter, DialogHeader, DialogTitle } from '
import { Input } from '@/components/ui/input'
import { Card } from '@/components/ui/card'
import { RecurrencePicker } from '@/components/recurrence-picker'
import { IcsFilePicker } from '@/components/ics-file-picker'
import { addEvent, deleteEvent, getAllEvents, clearEvents, getDB } from '@/lib/db'
import { parseICS, generateICS } from '@/lib/ical'
@@ -248,18 +249,13 @@ export default function HomePage() {
{/* Control Toolbar */}
<div className="flex flex-wrap gap-2 mb-4">
<Button onClick={() => setDialogOpen(true)}>Add Event</Button>
<IcsFilePicker onFileSelect={handleImport} variant='secondary'>Import .ics</IcsFilePicker>
{events.length > 0 && (
<>
<Button variant="secondary" onClick={handleExport}>Export .ics</Button>
<Button variant="destructive" onClick={handleClearAll}>Clear All</Button>
</>
)}
<label className="cursor-pointer">
<span className="px-3 py-2 bg-blue-500 text-white rounded">Import .ics</span>
<input type="file" accept=".ics" hidden onChange={e => {
if (e.target.files?.length) handleImport(e.target.files[0])
}} />
</label>
</div>
{/* Event List */}