fix: add import UI to desktop settings page (refs #26)
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 2m38s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 37s
Deploy to Staging / Verify Staging (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 6s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
All checks were successful
Deploy to Staging / Build Images (pull_request) Successful in 2m38s
Deploy to Staging / Deploy to Staging (pull_request) Successful in 37s
Deploy to Staging / Verify Staging (pull_request) Successful in 7s
Deploy to Staging / Notify Staging Ready (pull_request) Successful in 6s
Deploy to Staging / Notify Staging Failure (pull_request) Has been skipped
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -14,6 +14,8 @@ import { useVehicles } from '../features/vehicles/hooks/useVehicles';
|
|||||||
import { useTheme } from '../shared-minimal/theme/ThemeContext';
|
import { useTheme } from '../shared-minimal/theme/ThemeContext';
|
||||||
import { DeleteAccountDialog } from '../features/settings/components/DeleteAccountDialog';
|
import { DeleteAccountDialog } from '../features/settings/components/DeleteAccountDialog';
|
||||||
import { PendingDeletionBanner } from '../features/settings/components/PendingDeletionBanner';
|
import { PendingDeletionBanner } from '../features/settings/components/PendingDeletionBanner';
|
||||||
|
import { ImportButton } from '../features/settings/components/ImportButton';
|
||||||
|
import { ImportDialog } from '../features/settings/components/ImportDialog';
|
||||||
import {
|
import {
|
||||||
Box,
|
Box,
|
||||||
Typography,
|
Typography,
|
||||||
@@ -64,6 +66,8 @@ export const SettingsPage: React.FC = () => {
|
|||||||
const [editedDisplayName, setEditedDisplayName] = useState('');
|
const [editedDisplayName, setEditedDisplayName] = useState('');
|
||||||
const [editedNotificationEmail, setEditedNotificationEmail] = useState('');
|
const [editedNotificationEmail, setEditedNotificationEmail] = useState('');
|
||||||
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
const [deleteDialogOpen, setDeleteDialogOpen] = useState(false);
|
||||||
|
const [importDialogOpen, setImportDialogOpen] = useState(false);
|
||||||
|
const [selectedFile, setSelectedFile] = useState<File | null>(null);
|
||||||
const exportMutation = useExportUserData();
|
const exportMutation = useExportUserData();
|
||||||
|
|
||||||
// Initialize edit form when profile loads or edit mode starts
|
// Initialize edit form when profile loads or edit mode starts
|
||||||
@@ -112,6 +116,16 @@ export const SettingsPage: React.FC = () => {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const handleImportFileSelected = (file: File) => {
|
||||||
|
setSelectedFile(file);
|
||||||
|
setImportDialogOpen(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleImportClose = () => {
|
||||||
|
setImportDialogOpen(false);
|
||||||
|
setSelectedFile(null);
|
||||||
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Box sx={{ py: 2 }}>
|
<Box sx={{ py: 2 }}>
|
||||||
<Typography variant="h4" sx={{ fontWeight: 700, color: 'text.primary', mb: 4 }}>
|
<Typography variant="h4" sx={{ fontWeight: 700, color: 'text.primary', mb: 4 }}>
|
||||||
@@ -444,9 +458,20 @@ export const SettingsPage: React.FC = () => {
|
|||||||
<ListItemIcon>
|
<ListItemIcon>
|
||||||
<StorageIcon />
|
<StorageIcon />
|
||||||
</ListItemIcon>
|
</ListItemIcon>
|
||||||
|
<ListItemText
|
||||||
|
primary="Import Data"
|
||||||
|
secondary="Upload and restore your vehicle data from a backup"
|
||||||
|
/>
|
||||||
|
<ListItemSecondaryAction>
|
||||||
|
<ImportButton onFileSelected={handleImportFileSelected} />
|
||||||
|
</ListItemSecondaryAction>
|
||||||
|
</ListItem>
|
||||||
|
<Divider />
|
||||||
|
<ListItem>
|
||||||
<ListItemText
|
<ListItemText
|
||||||
primary="Export Data"
|
primary="Export Data"
|
||||||
secondary="Download your vehicle and fuel log data"
|
secondary="Download your vehicle and fuel log data"
|
||||||
|
sx={{ pl: 7 }}
|
||||||
/>
|
/>
|
||||||
<ListItemSecondaryAction>
|
<ListItemSecondaryAction>
|
||||||
<MuiButton
|
<MuiButton
|
||||||
@@ -636,6 +661,11 @@ export const SettingsPage: React.FC = () => {
|
|||||||
</Box>
|
</Box>
|
||||||
|
|
||||||
<DeleteAccountDialog open={deleteDialogOpen} onClose={() => setDeleteDialogOpen(false)} />
|
<DeleteAccountDialog open={deleteDialogOpen} onClose={() => setDeleteDialogOpen(false)} />
|
||||||
|
<ImportDialog
|
||||||
|
isOpen={importDialogOpen}
|
||||||
|
onClose={handleImportClose}
|
||||||
|
file={selectedFile}
|
||||||
|
/>
|
||||||
</Box>
|
</Box>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user