-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
"Complement saves" can be added by modifying the `getComplementarySaves` method in G3RRSAV
- Loading branch information
1 parent
04c06dc
commit b689d3d
Showing
7 changed files
with
148 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
import { | ||
Button, | ||
DialogContent, | ||
DialogTitle, | ||
ModalClose, | ||
ModalDialog, | ||
Stack, | ||
Typography | ||
} from '@mui/joy'; | ||
import { SAVClass } from 'src/types/SAVTypes/util'; | ||
|
||
export function waitForPluginSelection( | ||
setSpecifySave: React.Dispatch<React.SetStateAction<{ | ||
supportedSaveTypes: SAVClass[]; | ||
plugins: string[]; | ||
onSelect?: (plugin: string) => void; | ||
} | null>> | ||
): Promise<SAVClass | undefined> { | ||
return new Promise((resolve) => { | ||
setSpecifySave((prevState) => { | ||
if (!prevState) { | ||
throw new Error("SpecifySave state is unexpectedly null."); | ||
} | ||
|
||
return { | ||
...prevState, | ||
onSelect: (selectedPlugin: string) => { | ||
resolve( | ||
prevState.supportedSaveTypes.find( | ||
(item) => item.saveTypeID === selectedPlugin | ||
) | ||
); | ||
setSpecifySave(null); // Close the modal after selection | ||
}, | ||
}; | ||
}); | ||
}); | ||
} | ||
|
||
|
||
interface SelectPluginProps { | ||
plugins: string[]; | ||
onPluginClick: (plugin: string) => void; | ||
} | ||
|
||
export const SelectPlugin = ({ | ||
plugins, | ||
onPluginClick, | ||
}: SelectPluginProps) => { | ||
return ( | ||
<ModalDialog | ||
sx={{ | ||
minWidth: 400, | ||
maxWidth: '80%', | ||
borderRadius: 'lg', | ||
padding: 2, | ||
zIndex: 2000 // High zIndex to overlay it over everything | ||
}} | ||
> | ||
<ModalClose /> | ||
<DialogTitle>Complementary Plugins</DialogTitle> | ||
<DialogContent> | ||
<Typography>Select a plugin to proceed:</Typography> | ||
<Stack spacing={2} mt={2}> | ||
{plugins.map((plugin, index) => ( | ||
<Button | ||
key={index} | ||
onClick={() => onPluginClick(plugin)} | ||
variant="soft" | ||
color="primary" | ||
> | ||
{plugin} | ||
</Button> | ||
))} | ||
</Stack> | ||
</DialogContent> | ||
</ModalDialog> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters