Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@etothepii/satisfactory-file-parser": "^2.0.1",
"@mantine/colors-generator": "^7.13.4",
"@mantine/core": "7.13.4",
"@mantine/dropzone": "^7.13.4",
"@mantine/hooks": "7.13.4",
"@mantine/modals": "^7.13.4",
"@mantine/notifications": "^7.13.4",
Expand Down Expand Up @@ -92,4 +93,4 @@
"vitest": "^2.1.4"
},
"packageManager": "npm@10.8.3"
}
}
1 change: 1 addition & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Center, Loader, MantineProvider, Modal } from '@mantine/core';
import '@mantine/core/styles.css';
import '@mantine/dropzone/styles.css';
import { Notifications } from '@mantine/notifications';
import '@mantine/notifications/styles.css';

Expand Down
48 changes: 30 additions & 18 deletions src/recipes/savegame/ImportSavegameRecipesModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@ import {
Button,
Checkbox,
Divider,
FileButton,
Group,
Modal,
Progress,
Stack,
Text,
ThemeIcon,
Tooltip,
} from '@mantine/core';
import { Dropzone } from '@mantine/dropzone';
import { useDisclosure } from '@mantine/hooks';
import { notifications } from '@mantine/notifications';
import { IconCloudUpload } from '@tabler/icons-react';
Expand Down Expand Up @@ -83,26 +85,36 @@ export function ImportSavegameRecipesModal(props: IImportSavegameModalProps) {
description="If checked, imported recipes will be set as default for this game: new factories will have these recipes selected by default"
/>

<FileButton
onChange={file => {
if (!file) {
return;
}
<Dropzone
onDrop={files => {
if (!files[0]) return;

handleImport(file);
handleImport(files[0]);
}}
multiple={false}
loading={importing}
style={{
borderColor: 'var(--mantine-color-satisfactory-orange-5)',
}}
validator={file => {
if (file.name && file.name.split('.').pop() === 'sav') {
return null;
}
return {
code: 'invalid-file-type',
message: 'Only accepts Satisfactory .sav files',
};
}}
accept=".sav"
>
{props => (
<Button
{...props}
leftSection={<IconCloudUpload size={16} />}
loading={importing}
>
Select Savegame
</Button>
)}
</FileButton>
<Group justify="center" gap="md">
<ThemeIcon variant="transparent" c="satisfactory-orange">
<IconCloudUpload size={20} />
</ThemeIcon>
<Text size="md" c="satisfactory-orange">
Click to upload or drag a save file here
</Text>
</Group>
</Dropzone>

{importing && (
<>
Expand Down