Skip to content

Commit 637960d

Browse files
fix(ui): remove unused setting, fix missing translation for alerts
1 parent d2ab668 commit 637960d

File tree

9 files changed

+21
-61
lines changed

9 files changed

+21
-61
lines changed

invokeai/frontend/web/public/locales/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2035,6 +2035,7 @@
20352035
"events": "Events",
20362036
"queue": "Queue",
20372037
"metadata": "Metadata"
2038-
}
2038+
},
2039+
"showSendingToAlerts": "Alert When Sending to Different View"
20392040
}
20402041
}

invokeai/frontend/web/src/features/controlLayers/components/HUD/CanvasSendingToGalleryAlert.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import {
1717
} from 'features/controlLayers/components/CanvasRightPanel';
1818
import { useImageViewer } from 'features/gallery/components/ImageViewer/useImageViewer';
1919
import { useCurrentDestination } from 'features/queue/hooks/useCurrentDestination';
20-
import { selectShowSendToAlerts, showSendToAlertsChanged } from 'features/system/store/systemSlice';
20+
import { selectShowSendingToAlerts, showSendingToAlertsChanged } from 'features/system/store/systemSlice';
2121
import { setActiveTab } from 'features/ui/store/uiSlice';
2222
import { AnimatePresence, motion } from 'framer-motion';
2323
import type { PropsWithChildren, ReactNode } from 'react';
@@ -116,10 +116,10 @@ const AlertWrapper = ({
116116
}) => {
117117
const { t } = useTranslation();
118118
const dispatch = useAppDispatch();
119-
const showSendToAlerts = useAppSelector(selectShowSendToAlerts);
119+
const showSendToAlerts = useAppSelector(selectShowSendingToAlerts);
120120
const isHovered = useBoolean(false);
121121
const onClickDontShowMeThese = useCallback(() => {
122-
dispatch(showSendToAlertsChanged(false));
122+
dispatch(showSendingToAlertsChanged(false));
123123
isHovered.setFalse();
124124
}, [dispatch, isHovered]);
125125

invokeai/frontend/web/src/features/gallery/components/ImageViewer/useImageViewer.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
import { buildUseBoolean } from 'common/hooks/useBoolean';
22
import { useMemo } from 'react';
33

4-
const hook = buildUseBoolean(true);
5-
const useImageViewerState = hook[0];
6-
7-
export const $imageViewerState = hook[1];
4+
const [useImageViewerState, $imageViewerState] = buildUseBoolean(true);
85

96
export const useImageViewer = () => {
107
const imageViewerState = useImageViewerState();

invokeai/frontend/web/src/features/queue/hooks/useCurrentDestination.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import { useGetCurrentQueueItemQuery } from "services/api/endpoints/queue";
2-
1+
import { useGetCurrentQueueItemQuery } from 'services/api/endpoints/queue';
32

43
export const useCurrentDestination = () => {
54
const { destination } = useGetCurrentQueueItemQuery(undefined, {

invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsModal.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@ import { useRefreshAfterResetModal } from 'features/system/components/SettingsMo
2424
import { SettingsDeveloperLogIsEnabled } from 'features/system/components/SettingsModal/SettingsDeveloperLogIsEnabled';
2525
import { SettingsDeveloperLogLevel } from 'features/system/components/SettingsModal/SettingsDeveloperLogLevel';
2626
import { SettingsDeveloperLogNamespaces } from 'features/system/components/SettingsModal/SettingsDeveloperLogNamespaces';
27-
import { SettingsShowSendToToasts } from 'features/system/components/SettingsModal/SettingsShowSendToAlerts';
28-
import { SettingsShowSendToAlerts } from 'features/system/components/SettingsModal/SettingsShowSendToToasts';
27+
import { SettingsShowSendingToDifferentViewAlerts } from 'features/system/components/SettingsModal/SettingsShowSendingToDifferentViewAlerts';
2928
import { useClearIntermediates } from 'features/system/components/SettingsModal/useClearIntermediates';
3029
import { StickyScrollable } from 'features/system/components/StickyScrollable';
3130
import {
@@ -177,8 +176,7 @@ const SettingsModal = ({ config = defaultConfig }: SettingsModalProps) => {
177176
<FormLabel>{t('settings.confirmOnDelete')}</FormLabel>
178177
<Switch isChecked={shouldConfirmOnDelete} onChange={handleChangeShouldConfirmOnDelete} />
179178
</FormControl>
180-
<SettingsShowSendToAlerts />
181-
<SettingsShowSendToToasts />
179+
<SettingsShowSendingToDifferentViewAlerts />
182180
</StickyScrollable>
183181

184182
<StickyScrollable title={t('settings.generation')}>

invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsShowSendToToasts.tsx

Lines changed: 0 additions & 28 deletions
This file was deleted.

invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsShowSendToAlerts.tsx renamed to invokeai/frontend/web/src/features/system/components/SettingsModal/SettingsShowSendingToDifferentViewAlerts.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
import { FormControl, FormLabel, Switch } from '@invoke-ai/ui-library';
22
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
3-
import { selectShowSendToToasts, showSendToToastsChanged } from 'features/system/store/systemSlice';
3+
import { selectShowSendingToAlerts, showSendingToAlertsChanged } from 'features/system/store/systemSlice';
44
import type { ChangeEvent } from 'react';
55
import { memo, useCallback } from 'react';
66
import { useTranslation } from 'react-i18next';
77

8-
export const SettingsShowSendToToasts = memo(() => {
8+
export const SettingsShowSendingToDifferentViewAlerts = memo(() => {
99
const dispatch = useAppDispatch();
1010
const { t } = useTranslation();
1111

12-
const isChecked = useAppSelector(selectShowSendToToasts);
12+
const isChecked = useAppSelector(selectShowSendingToAlerts);
1313
const onChange = useCallback(
1414
(e: ChangeEvent<HTMLInputElement>) => {
15-
dispatch(showSendToToastsChanged(e.target.checked));
15+
dispatch(showSendingToAlertsChanged(e.target.checked));
1616
},
1717
[dispatch]
1818
);
1919

2020
return (
2121
<FormControl>
22-
<FormLabel>{t('settings.showAlertsIfLost')}</FormLabel>
22+
<FormLabel>{t('system.showSendingToAlerts')}</FormLabel>
2323
<Switch isChecked={isChecked} onChange={onChange} />
2424
</FormControl>
2525
);
2626
});
2727

28-
SettingsShowSendToToasts.displayName = 'SettingsShowSendToToasts';
28+
SettingsShowSendingToDifferentViewAlerts.displayName = 'SettingsShowSendingToDifferentViewAlerts';

invokeai/frontend/web/src/features/system/store/systemSlice.ts

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ const initialSystemState: SystemState = {
1919
logIsEnabled: true,
2020
logLevel: 'debug',
2121
logNamespaces: [...zLogNamespace.options],
22-
showSendToAlerts: true,
23-
showSendToToasts: true,
22+
showSendingToDifferentViewAlerts: true,
2423
};
2524

2625
export const systemSlice = createSlice({
@@ -58,11 +57,8 @@ export const systemSlice = createSlice({
5857
setShouldEnableInformationalPopovers(state, action: PayloadAction<boolean>) {
5958
state.shouldEnableInformationalPopovers = action.payload;
6059
},
61-
showSendToAlertsChanged: (state, action: PayloadAction<boolean>) => {
62-
state.showSendToAlerts = action.payload;
63-
},
64-
showSendToToastsChanged: (state, action: PayloadAction<boolean>) => {
65-
state.showSendToToasts = action.payload;
60+
showSendingToAlertsChanged: (state, action: PayloadAction<boolean>) => {
61+
state.showSendingToDifferentViewAlerts = action.payload;
6662
},
6763
},
6864
});
@@ -77,8 +73,7 @@ export const {
7773
shouldUseNSFWCheckerChanged,
7874
shouldUseWatermarkerChanged,
7975
setShouldEnableInformationalPopovers,
80-
showSendToAlertsChanged,
81-
showSendToToastsChanged,
76+
showSendingToAlertsChanged,
8277
} = systemSlice.actions;
8378

8479
/* eslint-disable-next-line @typescript-eslint/no-explicit-any */
@@ -113,5 +108,4 @@ export const selectSystemShouldAntialiasProgressImage = createSystemSelector(
113108
export const selectSystemShouldEnableInformationalPopovers = createSystemSelector(
114109
(system) => system.shouldEnableInformationalPopovers
115110
);
116-
export const selectShowSendToAlerts = createSystemSelector((s) => s.showSendToAlerts);
117-
export const selectShowSendToToasts = createSystemSelector((s) => s.showSendToToasts);
111+
export const selectShowSendingToAlerts = createSystemSelector((s) => s.showSendingToDifferentViewAlerts);

invokeai/frontend/web/src/features/system/store/types.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,5 @@ export interface SystemState {
3939
logIsEnabled: boolean;
4040
logLevel: LogLevel;
4141
logNamespaces: LogNamespace[];
42-
showSendToAlerts: boolean;
43-
showSendToToasts: boolean;
42+
showSendingToDifferentViewAlerts: boolean;
4443
}

0 commit comments

Comments
 (0)