11import React from "react" ;
22import imagePlaceholder from "../assets/image_placeholder.svg" ;
3- import { GenerationProgressState , ImageRecord } from "../types" ;
3+ import { GenerationProgressState , ImageRecord , ImageSlotActionKey } from "../types" ;
44import { MagnifiableImage } from "./MagnifiableImage" ;
5+ import { Icon , Icons } from "./Icons" ;
56import { kPrimary , theme } from "../themes" ;
67import { ImageSlotHeader } from "./ImageSlotHeader" ;
78import { ImageSlotActions , ImageSlotActionsHandle } from "./ImageSlotActions" ;
@@ -70,6 +71,8 @@ export interface ImageSlotProps {
7071 disabled ?: boolean ;
7172 isDropZone ?: boolean ;
7273 onClick ?: ( ) => void ;
74+ previewModifierActive ?: boolean ;
75+ previewSelected ?: boolean ;
7376 isSelected ?: boolean ;
7477 onDrop ?: ( imageId : string ) => void ;
7578 onUpload ?: ( file : File ) => void ;
@@ -87,6 +90,7 @@ export interface ImageSlotProps {
8790 dropLabel ?: string ;
8891 dataTestId ?: string ;
8992 actionLabels ?: Partial < Record < keyof ImageSlotControls , string > > ;
93+ actionDisabledReasons ?: Partial < Record < ImageSlotActionKey , string > > ;
9094 removeIcon ?: string ;
9195 starState ?: { isStarred : boolean ; onToggle : ( ) => void } ;
9296 isAnyDndDragging ?: boolean ;
@@ -240,6 +244,8 @@ export const ImageSlot: React.FC<ImageSlotProps> = ({
240244 disabled = false ,
241245 isDropZone = false ,
242246 onClick,
247+ previewModifierActive = false ,
248+ previewSelected = false ,
243249 isSelected = false ,
244250 onDrop,
245251 onUpload,
@@ -257,6 +263,7 @@ export const ImageSlot: React.FC<ImageSlotProps> = ({
257263 dropLabel = "Drop image" ,
258264 dataTestId,
259265 actionLabels,
266+ actionDisabledReasons,
260267 removeIcon,
261268 starState,
262269 isAnyDndDragging : isAnyDndDraggingProp = false ,
@@ -643,6 +650,7 @@ export const ImageSlot: React.FC<ImageSlotProps> = ({
643650 supportsUpload = { ! ! onUpload }
644651 supportsRemove = { ! ! onRemove }
645652 actionLabels = { actionLabels }
653+ actionDisabledReasons = { actionDisabledReasons }
646654 removeIcon = { removeIcon }
647655 iconSize = { ACTION_ICON_SIZE }
648656 buttonPadding = { ACTION_BUTTON_PADDING }
@@ -710,7 +718,12 @@ export const ImageSlot: React.FC<ImageSlotProps> = ({
710718 ? 1
711719 : 0.8
712720 : 1 ,
713- cursor : ! disabled && ( onClick || variant === "thumb" ) ? "pointer" : "default" ,
721+ cursor :
722+ ! disabled && variant === "thumb" && ! ! image && previewModifierActive
723+ ? "zoom-in"
724+ : ! disabled && ( onClick || variant === "thumb" )
725+ ? "pointer"
726+ : "default" ,
714727 pointerEvents : disabled ? "none" : "auto" ,
715728 filter : disabled ? "grayscale(1)" : "none" ,
716729 borderColor : isDragOver
@@ -795,6 +808,37 @@ export const ImageSlot: React.FC<ImageSlotProps> = ({
795808 emptyStateContent
796809 ) }
797810
811+ { variant === "thumb" && image && previewSelected ? (
812+ < div
813+ data-testid = "preview-selection-indicator"
814+ style = { {
815+ position : "absolute" ,
816+ inset : 0 ,
817+ display : "flex" ,
818+ alignItems : "center" ,
819+ justifyContent : "center" ,
820+ backgroundColor : "rgba(7, 12, 20, 0.34)" ,
821+ pointerEvents : "none" ,
822+ } }
823+ >
824+ < div
825+ style = { {
826+ width : 52 ,
827+ height : 52 ,
828+ borderRadius : "50%" ,
829+ display : "flex" ,
830+ alignItems : "center" ,
831+ justifyContent : "center" ,
832+ backgroundColor : "rgba(255, 255, 255, 0.92)" ,
833+ boxShadow : "0 12px 28px rgba(15, 23, 42, 0.32)" ,
834+ color : theme . colors . textPrimary ,
835+ } }
836+ >
837+ < Icon path = { Icons . Magnifier } width = { 28 } height = { 28 } />
838+ </ div >
839+ </ div >
840+ ) : null }
841+
798842 < ImageSlotActions
799843 ref = { thumbActionsRef }
800844 placement = "overlay"
@@ -806,6 +850,7 @@ export const ImageSlot: React.FC<ImageSlotProps> = ({
806850 supportsUpload = { ! ! onUpload }
807851 supportsRemove = { ! ! onRemove }
808852 actionLabels = { actionLabels }
853+ actionDisabledReasons = { actionDisabledReasons }
809854 removeIcon = { removeIcon }
810855 iconSize = { ACTION_ICON_SIZE }
811856 buttonPadding = { ACTION_BUTTON_PADDING }
0 commit comments