Skip to content

Commit 8218891

Browse files
Mary Hippmaryhipp
Mary Hipp
authored andcommitted
easier way to override Whats New
1 parent 4c248d8 commit 8218891

File tree

3 files changed

+25
-1
lines changed

3 files changed

+25
-1
lines changed

invokeai/frontend/web/src/app/components/InvokeAIUI.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { $openAPISchemaUrl } from 'app/store/nanostores/openAPISchemaUrl';
1818
import { $projectId, $projectName, $projectUrl } from 'app/store/nanostores/projectId';
1919
import { $queueId, DEFAULT_QUEUE_ID } from 'app/store/nanostores/queueId';
2020
import { $store } from 'app/store/nanostores/store';
21+
import { $whatsNew } from 'app/store/nanostores/whatsNew';
2122
import { createStore } from 'app/store/store';
2223
import type { PartialAppConfig } from 'app/types/invokeai';
2324
import Loading from 'common/components/Loading/Loading';
@@ -58,6 +59,7 @@ interface Props extends PropsWithChildren {
5859
socketOptions?: Partial<ManagerOptions & SocketOptions>;
5960
isDebugging?: boolean;
6061
logo?: ReactNode;
62+
whatsNew?: ReactNode[];
6163
workflowCategories?: WorkflowCategory[];
6264
workflowTagCategories?: WorkflowTagCategory[];
6365
workflowSortOptions?: WorkflowSortOption[];
@@ -90,6 +92,7 @@ const InvokeAIUI = ({
9092
workflowSortOptions,
9193
loggingOverrides,
9294
onClickGoToModelManager,
95+
whatsNew,
9396
}: Props) => {
9497
useLayoutEffect(() => {
9598
/*
@@ -224,6 +227,16 @@ const InvokeAIUI = ({
224227
};
225228
}, [logo]);
226229

230+
useEffect(() => {
231+
if (whatsNew) {
232+
$whatsNew.set(whatsNew);
233+
}
234+
235+
return () => {
236+
$whatsNew.set(undefined);
237+
};
238+
}, [whatsNew]);
239+
227240
useEffect(() => {
228241
if (onClickGoToModelManager) {
229242
$onClickGoToModelManager.set(onClickGoToModelManager);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { atom } from 'nanostores';
2+
import type { ReactNode } from 'react';
3+
4+
export const $whatsNew = atom<ReactNode[] | undefined>(undefined);

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

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import { ExternalLink, Flex, ListItem, Text, UnorderedList } from '@invoke-ai/ui-library';
2+
import { useStore } from '@nanostores/react';
23
import { createSelector } from '@reduxjs/toolkit';
4+
import { $whatsNew } from 'app/store/nanostores/whatsNew';
35
import { useAppSelector } from 'app/store/storeHooks';
46
import { selectConfigSlice } from 'features/system/store/configSlice';
57
import type { ReactNode } from 'react';
@@ -17,8 +19,13 @@ export const WhatsNew = () => {
1719
const { t } = useTranslation();
1820
const { data } = useGetAppVersionQuery();
1921
const isLocal = useAppSelector(selectIsLocal);
22+
const whatsNew = useStore($whatsNew);
2023

2124
const items = useMemo<ReactNode[]>(() => {
25+
if (whatsNew) {
26+
return whatsNew;
27+
}
28+
2229
if (data?.highlights?.length) {
2330
return data.highlights.map((highlight, index) => <ListItem key={`${highlight}-${index}`}>{highlight}</ListItem>);
2431
}
@@ -32,7 +39,7 @@ export const WhatsNew = () => {
3239
<Trans i18nKey={key} components={components} />
3340
</ListItem>
3441
));
35-
}, [data?.highlights, t]);
42+
}, [data?.highlights, t, whatsNew]);
3643

3744
return (
3845
<Flex gap={4} flexDir="column">

0 commit comments

Comments
 (0)