mirror of
https://github.com/invoke-ai/InvokeAI.git
synced 2026-04-23 03:00:31 -04:00
feat(ui): progress alert config setting
- Add `invocationProgressAlert` as a disable-able feature. Hide the alert and the setting in system settings when disabled. - Fix merge conflict
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
import { Alert, AlertDescription, AlertIcon, AlertTitle } from '@invoke-ai/ui-library';
|
||||
import { useStore } from '@nanostores/react';
|
||||
import { useAppSelector } from 'app/store/storeHooks';
|
||||
import { useFeatureStatus } from 'features/system/hooks/useFeatureStatus';
|
||||
import { selectSystemShouldShowInvocationProgressDetail } from 'features/system/store/systemSlice';
|
||||
import { memo } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { $canvasProgressMessage } from 'services/events/stores';
|
||||
import { $invocationProgressMessage } from 'services/events/stores';
|
||||
|
||||
export const CanvasAlertsInvocationProgress = memo(() => {
|
||||
const CanvasAlertsInvocationProgressContent = memo(() => {
|
||||
const { t } = useTranslation();
|
||||
const progressEventMessage = useStore($canvasProgressMessage);
|
||||
const shouldShowInvocationProgressDetail = useAppSelector(selectSystemShouldShowInvocationProgressDetail);
|
||||
const invocationProgressMessage = useStore($invocationProgressMessage);
|
||||
|
||||
if (!shouldShowInvocationProgressDetail || !progressEventMessage) {
|
||||
if (!invocationProgressMessage) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -19,9 +19,27 @@ export const CanvasAlertsInvocationProgress = memo(() => {
|
||||
<Alert status="loading" borderRadius="base" fontSize="sm" shadow="md" w="fit-content">
|
||||
<AlertIcon />
|
||||
<AlertTitle>{t('common.generating')}</AlertTitle>
|
||||
<AlertDescription>{progressEventMessage}</AlertDescription>
|
||||
<AlertDescription>{invocationProgressMessage}</AlertDescription>
|
||||
</Alert>
|
||||
);
|
||||
});
|
||||
CanvasAlertsInvocationProgressContent.displayName = 'CanvasAlertsInvocationProgressContent';
|
||||
|
||||
export const CanvasAlertsInvocationProgress = memo(() => {
|
||||
const isProgressMessageAlertEnabled = useFeatureStatus('invocationProgressAlert');
|
||||
const shouldShowInvocationProgressDetail = useAppSelector(selectSystemShouldShowInvocationProgressDetail);
|
||||
|
||||
// The alert is disabled at the system level
|
||||
if (!isProgressMessageAlertEnabled) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// The alert is disabled at the user level
|
||||
if (!shouldShowInvocationProgressDetail) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return <CanvasAlertsInvocationProgressContent />;
|
||||
});
|
||||
|
||||
CanvasAlertsInvocationProgress.displayName = 'CanvasAlertsInvocationProgress';
|
||||
|
||||
Reference in New Issue
Block a user