fix(ui): show collapse labels only if not default value

This commit is contained in:
psychedelicious 2023-10-31 21:55:46 -05:00
parent 94055ae54a
commit 6c66adcd90
3 changed files with 10 additions and 14 deletions

View File

@ -16,15 +16,13 @@ const ParamDynamicPromptsCollapse = () => {
() =>
createSelector(stateSelector, ({ dynamicPrompts }) => {
const count = dynamicPrompts.prompts.length;
if (count === 1) {
return t('dynamicPrompts.promptsWithCount_one', {
count,
});
} else {
if (count > 1) {
return t('dynamicPrompts.promptsWithCount_other', {
count,
});
}
return;
}),
[t]
);

View File

@ -28,9 +28,7 @@ export default function ParamAdvancedCollapse() {
const activeLabel = useMemo(() => {
const activeLabel: string[] = [];
if (shouldUseCpuNoise) {
activeLabel.push(t('parameters.cpuNoise'));
} else {
if (!shouldUseCpuNoise) {
activeLabel.push(t('parameters.gpuNoise'));
}

View File

@ -4,12 +4,13 @@ import { RootState, stateSelector } from 'app/store/store';
import { useAppSelector } from 'app/store/storeHooks';
import { defaultSelectorOptions } from 'app/store/util/defaultMemoizeOptions';
import IAICollapse from 'common/components/IAICollapse';
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
import { useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import ParamHrfHeight from './ParamHrfHeight';
import ParamHrfStrength from './ParamHrfStrength';
import ParamHrfToggle from './ParamHrfToggle';
import ParamHrfWidth from './ParamHrfWidth';
import ParamHrfHeight from './ParamHrfHeight';
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
const selector = createSelector(
stateSelector,
@ -22,15 +23,14 @@ const selector = createSelector(
);
export default function ParamHrfCollapse() {
const { t } = useTranslation();
const isHRFFeatureEnabled = useFeatureStatus('hrf').isFeatureEnabled;
const { hrfEnabled } = useAppSelector(selector);
const activeLabel = useMemo(() => {
if (hrfEnabled) {
return 'On';
} else {
return 'Off';
return t('common.on');
}
}, [hrfEnabled]);
}, [t, hrfEnabled]);
if (!isHRFFeatureEnabled) {
return null;