mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): update settings modal
This commit is contained in:
parent
dc976cd665
commit
d00d29d6b5
@ -532,7 +532,9 @@
|
|||||||
"resetWebUIDesc2": "If images aren't showing up in the gallery or something else isn't working, please try resetting before submitting an issue on GitHub.",
|
"resetWebUIDesc2": "If images aren't showing up in the gallery or something else isn't working, please try resetting before submitting an issue on GitHub.",
|
||||||
"resetComplete": "Web UI has been reset. Refresh the page to reload.",
|
"resetComplete": "Web UI has been reset. Refresh the page to reload.",
|
||||||
"consoleLogLevel": "Log Level",
|
"consoleLogLevel": "Log Level",
|
||||||
"shouldLogToConsole": "Console Logging"
|
"shouldLogToConsole": "Console Logging",
|
||||||
|
"developer": "Developer",
|
||||||
|
"general": "General"
|
||||||
},
|
},
|
||||||
"toast": {
|
"toast": {
|
||||||
"serverError": "Server Error",
|
"serverError": "Server Error",
|
||||||
|
@ -16,13 +16,23 @@ type IAISelectProps = SelectProps & {
|
|||||||
validValues:
|
validValues:
|
||||||
| Array<number | string>
|
| Array<number | string>
|
||||||
| Array<{ key: string; value: string | number }>;
|
| Array<{ key: string; value: string | number }>;
|
||||||
|
horizontal?: boolean;
|
||||||
|
spaceEvenly?: boolean;
|
||||||
};
|
};
|
||||||
/**
|
/**
|
||||||
* Customized Chakra FormControl + Select multi-part component.
|
* Customized Chakra FormControl + Select multi-part component.
|
||||||
*/
|
*/
|
||||||
const IAISelect = (props: IAISelectProps) => {
|
const IAISelect = (props: IAISelectProps) => {
|
||||||
const { label, isDisabled, validValues, tooltip, tooltipProps, ...rest } =
|
const {
|
||||||
props;
|
label,
|
||||||
|
isDisabled,
|
||||||
|
validValues,
|
||||||
|
tooltip,
|
||||||
|
tooltipProps,
|
||||||
|
horizontal,
|
||||||
|
spaceEvenly,
|
||||||
|
...rest
|
||||||
|
} = props;
|
||||||
return (
|
return (
|
||||||
<FormControl
|
<FormControl
|
||||||
isDisabled={isDisabled}
|
isDisabled={isDisabled}
|
||||||
@ -32,10 +42,28 @@ const IAISelect = (props: IAISelectProps) => {
|
|||||||
e.nativeEvent.stopPropagation();
|
e.nativeEvent.stopPropagation();
|
||||||
e.nativeEvent.cancelBubble = true;
|
e.nativeEvent.cancelBubble = true;
|
||||||
}}
|
}}
|
||||||
|
sx={
|
||||||
|
horizontal
|
||||||
|
? {
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'row',
|
||||||
|
alignItems: 'center',
|
||||||
|
justifyContent: 'space-between',
|
||||||
|
gap: 4,
|
||||||
|
}
|
||||||
|
: {}
|
||||||
|
}
|
||||||
>
|
>
|
||||||
{label && <FormLabel>{label}</FormLabel>}
|
{label && (
|
||||||
|
<FormLabel sx={spaceEvenly ? { flexBasis: 0, flexGrow: 1 } : {}}>
|
||||||
|
{label}
|
||||||
|
</FormLabel>
|
||||||
|
)}
|
||||||
<Tooltip label={tooltip} {...tooltipProps}>
|
<Tooltip label={tooltip} {...tooltipProps}>
|
||||||
<Select {...rest}>
|
<Select
|
||||||
|
{...rest}
|
||||||
|
rootProps={{ sx: spaceEvenly ? { flexBasis: 0, flexGrow: 1 } : {} }}
|
||||||
|
>
|
||||||
{validValues.map((opt) => {
|
{validValues.map((opt) => {
|
||||||
return typeof opt === 'string' || typeof opt === 'number' ? (
|
return typeof opt === 'string' || typeof opt === 'number' ? (
|
||||||
<IAIOption key={opt} value={opt}>
|
<IAIOption key={opt} value={opt}>
|
||||||
|
@ -86,6 +86,7 @@ const modalSectionStyles: ChakraProps['sx'] = {
|
|||||||
gap: 2,
|
gap: 2,
|
||||||
p: 4,
|
p: 4,
|
||||||
bg: 'base.900',
|
bg: 'base.900',
|
||||||
|
borderRadius: 'base',
|
||||||
};
|
};
|
||||||
|
|
||||||
type SettingsModalProps = {
|
type SettingsModalProps = {
|
||||||
@ -170,15 +171,20 @@ const SettingsModal = ({ children }: SettingsModalProps) => {
|
|||||||
isOpen={isSettingsModalOpen}
|
isOpen={isSettingsModalOpen}
|
||||||
onClose={onSettingsModalClose}
|
onClose={onSettingsModalClose}
|
||||||
size="xl"
|
size="xl"
|
||||||
|
isCentered
|
||||||
>
|
>
|
||||||
<ModalOverlay />
|
<ModalOverlay />
|
||||||
<ModalContent paddingInlineEnd={4}>
|
<ModalContent paddingInlineEnd={4}>
|
||||||
<ModalHeader>{t('common.settingsLabel')}</ModalHeader>
|
<ModalHeader>{t('common.settingsLabel')}</ModalHeader>
|
||||||
<ModalCloseButton />
|
<ModalCloseButton />
|
||||||
<ModalBody>
|
<ModalBody>
|
||||||
<Grid gap={4}>
|
<Flex sx={{ gap: 4, flexDirection: 'column' }}>
|
||||||
<Flex sx={modalSectionStyles}>
|
<Flex sx={modalSectionStyles}>
|
||||||
|
<Heading size="sm">{t('settings.general')}</Heading>
|
||||||
|
|
||||||
<IAISelect
|
<IAISelect
|
||||||
|
horizontal
|
||||||
|
spaceEvenly
|
||||||
label={t('settings.displayInProgress')}
|
label={t('settings.displayInProgress')}
|
||||||
validValues={IN_PROGRESS_IMAGE_TYPES}
|
validValues={IN_PROGRESS_IMAGE_TYPES}
|
||||||
value={shouldDisplayInProgressType}
|
value={shouldDisplayInProgressType}
|
||||||
@ -233,15 +239,15 @@ const SettingsModal = ({ children }: SettingsModalProps) => {
|
|||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Flex sx={modalSectionStyles}>
|
<Flex sx={modalSectionStyles}>
|
||||||
<Heading size="sm" style={{ fontWeight: 'bold' }}>
|
<Heading size="sm">{t('settings.developer')}</Heading>
|
||||||
Developer
|
|
||||||
</Heading>
|
|
||||||
<IAISwitch
|
<IAISwitch
|
||||||
label={t('settings.shouldLogToConsole')}
|
label={t('settings.shouldLogToConsole')}
|
||||||
isChecked={shouldLogToConsole}
|
isChecked={shouldLogToConsole}
|
||||||
onChange={handleLogToConsoleChanged}
|
onChange={handleLogToConsoleChanged}
|
||||||
/>
|
/>
|
||||||
<IAISelect
|
<IAISelect
|
||||||
|
horizontal
|
||||||
|
spaceEvenly
|
||||||
isDisabled={!shouldLogToConsole}
|
isDisabled={!shouldLogToConsole}
|
||||||
label={t('settings.consoleLogLevel')}
|
label={t('settings.consoleLogLevel')}
|
||||||
onChange={handleLogLevelChanged}
|
onChange={handleLogLevelChanged}
|
||||||
@ -265,7 +271,7 @@ const SettingsModal = ({ children }: SettingsModalProps) => {
|
|||||||
<Text>{t('settings.resetWebUIDesc1')}</Text>
|
<Text>{t('settings.resetWebUIDesc1')}</Text>
|
||||||
<Text>{t('settings.resetWebUIDesc2')}</Text>
|
<Text>{t('settings.resetWebUIDesc2')}</Text>
|
||||||
</Flex>
|
</Flex>
|
||||||
</Grid>
|
</Flex>
|
||||||
</ModalBody>
|
</ModalBody>
|
||||||
|
|
||||||
<ModalFooter>
|
<ModalFooter>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user