8
8
} from 'features/controlLayers/store/ephemeral' ;
9
9
import { useImageViewer } from 'features/gallery/components/ImageViewer/useImageViewer' ;
10
10
import { useCurrentDestination } from 'features/queue/hooks/useCurrentDestination' ;
11
+ import { selectActiveTab } from 'features/ui/store/uiSelectors' ;
11
12
import { setActiveTab } from 'features/ui/store/uiSlice' ;
12
13
import { AnimatePresence , motion } from 'framer-motion' ;
13
14
import type { PropsWithChildren , ReactNode } from 'react' ;
@@ -30,13 +31,18 @@ const ActivateImageViewerButton = (props: PropsWithChildren) => {
30
31
export const CanvasAlertsSendingToGallery = ( ) => {
31
32
const { t } = useTranslation ( ) ;
32
33
const destination = useCurrentDestination ( ) ;
34
+ const tab = useAppSelector ( selectActiveTab ) ;
33
35
const isVisible = useMemo ( ( ) => {
36
+ // This alert should only be visible when the destination is gallery and the tab is canvas
37
+ if ( tab !== 'canvas' ) {
38
+ return false ;
39
+ }
34
40
if ( ! destination ) {
35
41
return false ;
36
42
}
37
43
38
44
return destination === 'gallery' ;
39
- } , [ destination ] ) ;
45
+ } , [ destination , tab ] ) ;
40
46
41
47
return (
42
48
< AlertWrapper
@@ -68,7 +74,13 @@ export const CanvasAlertsSendingToCanvas = () => {
68
74
const { t } = useTranslation ( ) ;
69
75
const destination = useCurrentDestination ( ) ;
70
76
const isStaging = useAppSelector ( selectIsStaging ) ;
77
+ const tab = useAppSelector ( selectActiveTab ) ;
71
78
const isVisible = useMemo ( ( ) => {
79
+ // When we are on a non-canvas tab, and the current generation's destination is not the canvas, we don't show the alert
80
+ // For example, on the workflows tab, when the destinatin is gallery, we don't show the alert
81
+ if ( tab !== 'canvas' && destination !== 'canvas' ) {
82
+ return false ;
83
+ }
72
84
if ( isStaging ) {
73
85
return true ;
74
86
}
@@ -78,7 +90,7 @@ export const CanvasAlertsSendingToCanvas = () => {
78
90
}
79
91
80
92
return destination === 'canvas' ;
81
- } , [ destination , isStaging ] ) ;
93
+ } , [ destination , isStaging , tab ] ) ;
82
94
83
95
return (
84
96
< AlertWrapper
0 commit comments