Skip to content

Commit 747e863

Browse files
Mary Hipphipsterusername
authored andcommitted
open notification by default, get rid of indicator
1 parent 3b3d47b commit 747e863

File tree

3 files changed

+13
-23
lines changed

3 files changed

+13
-23
lines changed

invokeai/frontend/web/src/features/ui/components/Notifications.tsx

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import {
2-
Box,
32
Flex,
43
IconButton,
54
Image,
65
Popover,
76
PopoverArrow,
87
PopoverBody,
8+
PopoverCloseButton,
99
PopoverContent,
1010
PopoverHeader,
1111
PopoverTrigger,
1212
Text,
1313
} from '@invoke-ai/ui-library';
1414
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
15-
import { shouldShowNotificationIndicatorChanged } from 'features/ui/store/uiSlice';
15+
import { shouldShowNotificationChanged } from 'features/ui/store/uiSlice';
1616
import InvokeSymbol from 'public/assets/images/invoke-favicon.png';
1717
import { useCallback } from 'react';
1818
import { useTranslation } from 'react-i18next';
@@ -24,9 +24,9 @@ import { CanvasV2Announcement } from './CanvasV2Announcement';
2424
export const Notifications = () => {
2525
const { t } = useTranslation();
2626
const dispatch = useAppDispatch();
27-
const shouldShowNotificationIndicator = useAppSelector((s) => s.ui.shouldShowNotificationIndicator);
27+
const shouldShowNotification = useAppSelector((s) => s.ui.shouldShowNotification);
2828
const resetIndicator = useCallback(() => {
29-
dispatch(shouldShowNotificationIndicatorChanged(false));
29+
dispatch(shouldShowNotificationChanged(false));
3030
}, [dispatch]);
3131
const { data } = useGetAppVersionQuery();
3232

@@ -35,7 +35,7 @@ export const Notifications = () => {
3535
}
3636

3737
return (
38-
<Popover onOpen={resetIndicator} placement="top-start">
38+
<Popover onClose={resetIndicator} placement="top-start" autoFocus={false} defaultIsOpen={shouldShowNotification}>
3939
<PopoverTrigger>
4040
<Flex pos="relative">
4141
<IconButton
@@ -44,22 +44,12 @@ export const Notifications = () => {
4444
icon={<PiLightbulbFilamentBold fontSize={20} />}
4545
boxSize={8}
4646
/>
47-
{shouldShowNotificationIndicator && (
48-
<Box
49-
pos="absolute"
50-
top={0}
51-
right="2px"
52-
w={2}
53-
h={2}
54-
backgroundColor="invokeYellow.500"
55-
borderRadius="100%"
56-
/>
57-
)}
5847
</Flex>
5948
</PopoverTrigger>
6049
<PopoverContent p={2}>
6150
<PopoverArrow />
62-
<PopoverHeader fontSize="md" fontWeight="semibold">
51+
<PopoverCloseButton />
52+
<PopoverHeader fontSize="md" fontWeight="semibold" pt={5}>
6353
<Flex alignItems="center" gap={3}>
6454
<Image src={InvokeSymbol} boxSize={6} />
6555
{t('whatsNew.whatsNewInInvoke')}

invokeai/frontend/web/src/features/ui/store/uiSlice.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const initialUIState: UIState = {
1313
shouldShowProgressInViewer: true,
1414
accordions: {},
1515
expanders: {},
16-
shouldShowNotificationIndicator: true,
16+
shouldShowNotification: true,
1717
};
1818

1919
export const uiSlice = createSlice({
@@ -37,8 +37,8 @@ export const uiSlice = createSlice({
3737
const { id, isOpen } = action.payload;
3838
state.expanders[id] = isOpen;
3939
},
40-
shouldShowNotificationIndicatorChanged: (state, action: PayloadAction<boolean>) => {
41-
state.shouldShowNotificationIndicator = action.payload;
40+
shouldShowNotificationChanged: (state, action: PayloadAction<boolean>) => {
41+
state.shouldShowNotification = action.payload;
4242
},
4343
},
4444
extraReducers(builder) {
@@ -54,7 +54,7 @@ export const {
5454
setShouldShowProgressInViewer,
5555
accordionStateChanged,
5656
expanderStateChanged,
57-
shouldShowNotificationIndicatorChanged,
57+
shouldShowNotificationChanged,
5858
} = uiSlice.actions;
5959

6060
export const selectUiSlice = (state: RootState) => state.ui;

invokeai/frontend/web/src/features/ui/store/uiTypes.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export interface UIState {
2626
*/
2727
expanders: Record<string, boolean>;
2828
/**
29-
* Whether or not to show the user an indicator on notifications icon.
29+
* Whether or not to show the user the open notification.
3030
*/
31-
shouldShowNotificationIndicator: boolean;
31+
shouldShowNotification: boolean;
3232
}

0 commit comments

Comments
 (0)