-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
- Loading branch information
1 parent
5effa8f
commit 283a966
Showing
6 changed files
with
31 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 24 additions & 6 deletions
30
...web/src/features/controlLayers/components/CanvasAlerts/CanvasAlertsInvocationProgress.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,45 @@ | ||
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; | ||
} | ||
|
||
return ( | ||
<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'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters