mirror of
https://github.com/CJackHwang/ds2api.git
synced 2026-05-22 17:07:46 +08:00
feat(webui): support backup file export and import
This commit is contained in:
@@ -6,7 +6,9 @@ export default function BackupSection({
|
||||
setImportMode,
|
||||
importing,
|
||||
onLoadExportData,
|
||||
onDownloadExportFile,
|
||||
onImport,
|
||||
onImportFileChange,
|
||||
importText,
|
||||
setImportText,
|
||||
exportData,
|
||||
@@ -23,6 +25,27 @@ export default function BackupSection({
|
||||
<Download className="w-4 h-4" />
|
||||
{t('settings.loadExport')}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={onDownloadExportFile}
|
||||
className="px-3 py-2 rounded-lg bg-secondary border border-border hover:bg-secondary/80 text-sm flex items-center gap-2"
|
||||
>
|
||||
<Download className="w-4 h-4" />
|
||||
{t('settings.downloadExport')}
|
||||
</button>
|
||||
<label className="px-3 py-2 rounded-lg bg-secondary border border-border hover:bg-secondary/80 text-sm flex items-center gap-2 cursor-pointer">
|
||||
<Upload className="w-4 h-4" />
|
||||
{t('settings.chooseImportFile')}
|
||||
<input
|
||||
type="file"
|
||||
accept=".json,application/json"
|
||||
className="hidden"
|
||||
onChange={(e) => {
|
||||
onImportFileChange(e.target.files?.[0] || null)
|
||||
e.target.value = ''
|
||||
}}
|
||||
/>
|
||||
</label>
|
||||
<select
|
||||
value={importMode}
|
||||
onChange={(e) => setImportMode(e.target.value)}
|
||||
|
||||
Reference in New Issue
Block a user