Spaces:
Runtime error
Runtime error
File size: 3,745 Bytes
40fe69e 445c3cc 40fe69e d30af0c 40fe69e 445c3cc d30af0c 445c3cc d30af0c 445c3cc d30af0c 445c3cc d30af0c 40fe69e d30af0c 445c3cc 40fe69e d30af0c 445c3cc d30af0c 40fe69e 445c3cc d30af0c 445c3cc 40fe69e d30af0c 445c3cc 40fe69e d30af0c 445c3cc d30af0c 40fe69e 445c3cc d30af0c 445c3cc 40fe69e d30af0c 445c3cc d30af0c 445c3cc d30af0c 445c3cc d30af0c 445c3cc 40fe69e bd603dd 40fe69e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 | import { FileJson, FileSpreadsheet, Image } from 'lucide-react'
import { t } from '../lib/i18n'
import type { Lang } from '../lib/types'
interface Props {
lang: Lang
open: boolean
onClose: () => void
onExportPng: () => void
onExportJson: () => void
onExportCsv: () => void
canExportPng: boolean
canExportData: boolean
}
export function ExportSheet({
lang,
open,
onClose,
onExportPng,
onExportJson,
onExportCsv,
canExportPng,
canExportData,
}: Props) {
if (!open) return null
return (
<>
<button
type="button"
className="overlay-enter fixed inset-0 z-50 bg-black/40 backdrop-blur-sm"
aria-label="Close"
onClick={onClose}
/>
<div
className="sheet-enter fixed inset-x-0 bottom-0 z-50 rounded-t-[1.75rem] bg-[var(--surface)] shadow-2xl ring-1 ring-[var(--hairline)]"
style={{ paddingBottom: 'max(1.25rem, env(safe-area-inset-bottom))' }}
>
<div className="flex justify-center pt-3 pb-1">
<div className="h-1 w-9 rounded-full bg-[var(--hairline)]" />
</div>
<h2 className="px-5 pb-3 pt-2 text-center text-[17px] font-semibold text-[var(--text)]">
{t(lang, 'export')}
</h2>
<div className="mx-4 overflow-hidden rounded-2xl border border-[var(--hairline)] bg-[var(--surface-2)]">
<button
type="button"
disabled={!canExportPng}
className="flex min-h-[52px] w-full items-center gap-4 px-4 text-left transition-colors duration-150 disabled:opacity-40 active:bg-[var(--surface-active)]"
onClick={() => { onExportPng(); onClose() }}
>
<span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-[var(--info-light)]">
<Image size={18} className="text-[var(--info)]" />
</span>
<span className="text-[15px] font-medium text-[var(--text)]">{t(lang, 'exportPng')}</span>
</button>
<div className="ml-[3.25rem] h-px bg-[var(--hairline)]" />
<button
type="button"
disabled={!canExportData}
className="flex min-h-[52px] w-full items-center gap-4 px-4 text-left transition-colors duration-150 disabled:opacity-40 active:bg-[var(--surface-active)]"
onClick={() => { onExportJson(); onClose() }}
>
<span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-[var(--warning-light)]">
<FileJson size={18} className="text-[var(--warning)]" />
</span>
<span className="text-[15px] font-medium text-[var(--text)]">{t(lang, 'exportJson')}</span>
</button>
<div className="ml-[3.25rem] h-px bg-[var(--hairline)]" />
<button
type="button"
disabled={!canExportData}
className="flex min-h-[52px] w-full items-center gap-4 px-4 text-left transition-colors duration-150 disabled:opacity-40 active:bg-[var(--surface-active)]"
onClick={() => { onExportCsv(); onClose() }}
>
<span className="flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-[var(--success-light)]">
<FileSpreadsheet size={18} className="text-[var(--success)]" />
</span>
<span className="text-[15px] font-medium text-[var(--text)]">{t(lang, 'exportCsv')}</span>
</button>
</div>
<div className="mx-4 mt-2.5">
<button
type="button"
className="ct-btn-secondary min-h-[50px] text-[15px]"
onClick={onClose}
>
{t(lang, 'cancel')}
</button>
</div>
</div>
</>
)
}
|