fix(ui): disable opacity slider fully when no valid entity selected

This commit is contained in:
psychedelicious 2024-08-28 09:00:55 +10:00
parent 263a0ef5b4
commit 20b563c4cb

View File

@ -134,7 +134,11 @@ export const SelectedEntityOpacity = memo(() => {
return ( return (
<Popover> <Popover>
<FormControl w="min-content" gap={2}> <FormControl
w="min-content"
gap={2}
isDisabled={selectedEntityIdentifier === null || selectedEntityIdentifier.type === 'ip_adapter'}
>
<FormLabel m={0}>{t('controlLayers.opacity')}</FormLabel> <FormLabel m={0}>{t('controlLayers.opacity')}</FormLabel>
<PopoverAnchor> <PopoverAnchor>
<NumberInput <NumberInput
@ -152,7 +156,6 @@ export const SelectedEntityOpacity = memo(() => {
onKeyDown={onKeyDown} onKeyDown={onKeyDown}
clampValueOnBlur={false} clampValueOnBlur={false}
variant="outline" variant="outline"
isDisabled={selectedEntityIdentifier === null || selectedEntityIdentifier.type === 'ip_adapter'}
> >
<NumberInputField paddingInlineEnd={7} /> <NumberInputField paddingInlineEnd={7} />
<PopoverTrigger> <PopoverTrigger>
@ -164,6 +167,7 @@ export const SelectedEntityOpacity = memo(() => {
position="absolute" position="absolute"
insetInlineEnd={0} insetInlineEnd={0}
h="full" h="full"
isDisabled={selectedEntityIdentifier === null || selectedEntityIdentifier.type === 'ip_adapter'}
/> />
</PopoverTrigger> </PopoverTrigger>
</NumberInput> </NumberInput>
@ -181,6 +185,7 @@ export const SelectedEntityOpacity = memo(() => {
marks={marks} marks={marks}
formatValue={formatSliderValue} formatValue={formatSliderValue}
alwaysShowMarks alwaysShowMarks
isDisabled={selectedEntityIdentifier === null || selectedEntityIdentifier.type === 'ip_adapter'}
/> />
</PopoverBody> </PopoverBody>
</PopoverContent> </PopoverContent>