fix: Progress Bar being broken

This commit is contained in:
blessedcoolant 2023-07-02 18:49:24 +12:00
parent a6334750cb
commit f399b36ae6
4 changed files with 61 additions and 32 deletions

View File

@ -43,6 +43,21 @@ export default function NodeInvokeButton(props: InvokeButton) {
return ( return (
<Box style={{ flexGrow: 4 }} position="relative"> <Box style={{ flexGrow: 4 }} position="relative">
<Box style={{ position: 'relative' }}> <Box style={{ position: 'relative' }}>
{!isReady && (
<Box
borderRadius="base"
style={{
position: 'absolute',
bottom: '0',
left: '0',
right: '0',
height: '100%',
overflow: 'clip',
}}
>
<ProgressBar />
</Box>
)}
{iconButton ? ( {iconButton ? (
<IAIIconButton <IAIIconButton
aria-label={t('parameters.invoke')} aria-label={t('parameters.invoke')}
@ -56,6 +71,12 @@ export default function NodeInvokeButton(props: InvokeButton) {
tooltipProps={{ placement: 'bottom' }} tooltipProps={{ placement: 'bottom' }}
colorScheme="accent" colorScheme="accent"
id="invoke-button" id="invoke-button"
_disabled={{
background: 'none',
_hover: {
background: 'none',
},
}}
{...rest} {...rest}
/> />
) : ( ) : (
@ -69,25 +90,17 @@ export default function NodeInvokeButton(props: InvokeButton) {
colorScheme="accent" colorScheme="accent"
id="invoke-button" id="invoke-button"
fontWeight={700} fontWeight={700}
_disabled={{
background: 'none',
_hover: {
background: 'none',
},
}}
{...rest} {...rest}
> >
Invoke Invoke
</IAIButton> </IAIButton>
)} )}
{!isReady && (
<Box
style={{
position: 'absolute',
bottom: '0',
left: '0',
right: '0',
height: '15%',
overflow: 'clip',
}}
>
<ProgressBar />
</Box>
)}
</Box> </Box>
</Box> </Box>
); );

View File

@ -46,6 +46,22 @@ export default function InvokeButton(props: InvokeButton) {
return ( return (
<Box style={{ flexGrow: 4 }} position="relative"> <Box style={{ flexGrow: 4 }} position="relative">
<Box style={{ position: 'relative' }}> <Box style={{ position: 'relative' }}>
{!isReady && (
<Box
borderRadius="base"
style={{
position: 'absolute',
bottom: '0',
left: '0',
right: '0',
height: '100%',
overflow: 'clip',
}}
{...rest}
>
<ProgressBar />
</Box>
)}
{iconButton ? ( {iconButton ? (
<IAIIconButton <IAIIconButton
aria-label={t('parameters.invoke')} aria-label={t('parameters.invoke')}
@ -59,6 +75,12 @@ export default function InvokeButton(props: InvokeButton) {
tooltipProps={{ placement: 'top' }} tooltipProps={{ placement: 'top' }}
colorScheme="accent" colorScheme="accent"
id="invoke-button" id="invoke-button"
_disabled={{
background: 'none',
_hover: {
background: 'none',
},
}}
{...rest} {...rest}
/> />
) : ( ) : (
@ -72,25 +94,17 @@ export default function InvokeButton(props: InvokeButton) {
colorScheme="accent" colorScheme="accent"
id="invoke-button" id="invoke-button"
fontWeight={700} fontWeight={700}
_disabled={{
background: 'none',
_hover: {
background: 'none',
},
}}
{...rest} {...rest}
> >
Invoke Invoke
</IAIButton> </IAIButton>
)} )}
{!isReady && (
<Box
style={{
position: 'absolute',
bottom: '0',
left: '0',
right: '0',
height: '15%',
overflow: 'clip',
}}
>
<ProgressBar />
</Box>
)}
</Box> </Box>
</Box> </Box>
); );

View File

@ -35,6 +35,7 @@ const ProgressBar = () => {
aria-label={t('accessibility.invokeProgressBar')} aria-label={t('accessibility.invokeProgressBar')}
isIndeterminate={isProcessing && !currentStatusHasSteps} isIndeterminate={isProcessing && !currentStatusHasSteps}
height="full" height="full"
colorScheme="accent"
/> />
); );
}; };

View File

@ -3,25 +3,26 @@ import {
createMultiStyleConfigHelpers, createMultiStyleConfigHelpers,
defineStyle, defineStyle,
} from '@chakra-ui/styled-system'; } from '@chakra-ui/styled-system';
import { mode } from '@chakra-ui/theme-tools';
const { defineMultiStyleConfig, definePartsStyle } = const { defineMultiStyleConfig, definePartsStyle } =
createMultiStyleConfigHelpers(parts.keys); createMultiStyleConfigHelpers(parts.keys);
const invokeAIFilledTrack = defineStyle((_props) => ({ const invokeAIFilledTrack = defineStyle((_props) => ({
bg: 'accent.600', bg: 'accent.500',
// TODO: the animation is nice but looks weird bc it is substantially longer than each step // TODO: the animation is nice but looks weird bc it is substantially longer than each step
// so we get to 100% long before it finishes // so we get to 100% long before it finishes
// transition: 'width 0.2s ease-in-out', // transition: 'width 0.2s ease-in-out',
_indeterminate: { _indeterminate: {
bgGradient: bgGradient:
'linear(to-r, transparent 0%, accent.600 50%, transparent 100%);', 'linear(to-r, transparent 0%, accent.500 50%, transparent 100%);',
}, },
})); }));
const invokeAITrack = defineStyle((_props) => { const invokeAITrack = defineStyle((_props) => {
const { colorScheme: c } = _props;
return { return {
bg: 'none', bg: mode(`${c}.200`, `${c}.700`)(_props),
borderBottomRadius: '5px',
}; };
}); });