From 68284b37fa40167a9320e7d856d5305cfbb337ce Mon Sep 17 00:00:00 2001 From: Mary Hipp Date: Tue, 5 Nov 2024 09:13:40 -0500 Subject: [PATCH] remove opacity logic from WavyLine, add badge explaining disabled state, add translations --- invokeai/frontend/web/public/locales/en.json | 1 + .../web/src/common/components/WavyLine.tsx | 11 ++- .../components/ParamDenoisingStrength.tsx | 73 +++++++++++-------- 3 files changed, 50 insertions(+), 35 deletions(-) diff --git a/invokeai/frontend/web/public/locales/en.json b/invokeai/frontend/web/public/locales/en.json index ed017d1695..61a095f357 100644 --- a/invokeai/frontend/web/public/locales/en.json +++ b/invokeai/frontend/web/public/locales/en.json @@ -997,6 +997,7 @@ "controlNetControlMode": "Control Mode", "copyImage": "Copy Image", "denoisingStrength": "Denoising Strength", + "noRasterLayers": "No Raster Layers", "downloadImage": "Download Image", "general": "General", "guidance": "Guidance", diff --git a/invokeai/frontend/web/src/common/components/WavyLine.tsx b/invokeai/frontend/web/src/common/components/WavyLine.tsx index e51dfa49f6..10da0f45de 100644 --- a/invokeai/frontend/web/src/common/components/WavyLine.tsx +++ b/invokeai/frontend/web/src/common/components/WavyLine.tsx @@ -1,7 +1,6 @@ - -const WavyLine = ({ waviness, isDisabled }: {waviness: number, isDisabled: boolean}) => { - const width = 60; // Width of the SVG - const height = 28; // Height of the SVG +const WavyLine = ({ waviness }: { waviness: number }) => { + const width = 40; // Width of the SVG + const height = 14; // Height of the SVG const segments = 5; // Number of segments in the line (more segments = smoother wave) // Calculate the path dynamically based on waviness @@ -26,8 +25,8 @@ const WavyLine = ({ waviness, isDisabled }: {waviness: number, isDisabled: boole }; return ( - - + + ); }; diff --git a/invokeai/frontend/web/src/features/controlLayers/components/ParamDenoisingStrength.tsx b/invokeai/frontend/web/src/features/controlLayers/components/ParamDenoisingStrength.tsx index b46d652f65..41fdb1cf7c 100644 --- a/invokeai/frontend/web/src/features/controlLayers/components/ParamDenoisingStrength.tsx +++ b/invokeai/frontend/web/src/features/controlLayers/components/ParamDenoisingStrength.tsx @@ -1,12 +1,12 @@ -import { CompositeNumberInput, CompositeSlider, FormControl, FormLabel } from '@invoke-ai/ui-library'; +import { Badge, Box, CompositeNumberInput, CompositeSlider, Flex, FormControl, FormLabel } from '@invoke-ai/ui-library'; import { useAppDispatch, useAppSelector } from 'app/store/storeHooks'; import { InformationalPopover } from 'common/components/InformationalPopover/InformationalPopover'; +import WavyLine from 'common/components/WavyLine'; import { selectImg2imgStrength, setImg2imgStrength } from 'features/controlLayers/store/paramsSlice'; +import { selectCanvasSlice } from 'features/controlLayers/store/selectors'; import { selectImg2imgStrengthConfig } from 'features/system/store/configSlice'; import { memo, useCallback } from 'react'; import { useTranslation } from 'react-i18next'; -import { selectCanvasSlice } from '../store/selectors'; -import WavyLine from '../../../common/components/WavyLine'; const marks = [0, 0.5, 1]; @@ -14,10 +14,11 @@ export const ParamDenoisingStrength = memo(() => { const img2imgStrength = useAppSelector(selectImg2imgStrength); const dispatch = useAppDispatch(); const isEnabled = useAppSelector( - (s) => selectCanvasSlice(s).rasterLayers.entities.length > 0 && selectCanvasSlice(s).rasterLayers.entities.some(layer => layer.isEnabled) + (s) => + selectCanvasSlice(s).rasterLayers.entities.length > 0 && + selectCanvasSlice(s).rasterLayers.entities.some((layer) => layer.isEnabled) ); - const onChange = useCallback( (v: number) => { dispatch(setImg2imgStrength(v)); @@ -29,30 +30,44 @@ export const ParamDenoisingStrength = memo(() => { const { t } = useTranslation(); return ( - - - {`${t('parameters.denoisingStrength')}`} - - - - + + + + {`${t('parameters.denoisingStrength')}`} + + + + + + {isEnabled ? ( + <> + + + + ) : ( + + + {t('common.disabled')} - {t('parameters.noRasterLayers')} + + + )} ); });