2024-09-24 09:27:49 +02:00
|
|
|
// settingsUtils.ts
|
|
|
|
|
|
|
|
// Export the current settings as a JSON file
|
|
|
|
export const exportSettings = (settings: any) => {
|
|
|
|
const blob = new Blob([JSON.stringify(settings)], { type: 'application/json' });
|
|
|
|
const link = document.createElement('a');
|
|
|
|
link.href = URL.createObjectURL(blob);
|
|
|
|
link.download = 'settings.json';
|
|
|
|
link.click();
|
|
|
|
};
|
|
|
|
|
|
|
|
// Import settings from a JSON file
|
|
|
|
export const importSettings = (file: File, applySettings: (settings: any) => void) => {
|
|
|
|
const reader = new FileReader();
|
|
|
|
reader.onload = (e) => {
|
|
|
|
const content = e.target?.result as string;
|
|
|
|
const importedSettings = JSON.parse(content);
|
|
|
|
applySettings(importedSettings);
|
|
|
|
};
|
|
|
|
reader.readAsText(file);
|
|
|
|
};
|
2024-09-26 14:38:59 +02:00
|
|
|
|
2024-09-24 09:27:49 +02:00
|
|
|
|