@@ -20,15 +20,15 @@ interface ExportOptionButton {
2020 type : "button"
2121 label : string
2222 icon ?: React . ReactElement
23- isVisible : boolean | ( ( images : string [ ] ) => boolean )
24- onClick : ( images : string [ ] ) => void
23+ isVisible : boolean | ( ( images : string [ ] , currentImage ?: string ) => boolean )
24+ onClick : ( images : string [ ] , currentImage ?: string ) => void
2525}
2626
2727interface ExportOptionMenu {
2828 type : "menu"
2929 label : string
3030 icon ?: React . ReactElement
31- isVisible : boolean | ( ( images : string [ ] ) => boolean )
31+ isVisible : boolean | ( ( images : string [ ] , currentImage ?: string ) => boolean )
3232 options : Array < Omit < ExportOptionButton , "type" > >
3333}
3434
@@ -38,16 +38,16 @@ export interface HeaderProps {
3838}
3939
4040export const Header = ( { onClose, exportOptions } : HeaderProps ) => {
41- const { imageList } = useEditorStore ( )
41+ const { imageList, currentImage } = useEditorStore ( )
4242
4343 const headerText = useMemo ( ( ) => {
4444 if ( imageList . length === 1 ) {
4545 return decodeURIComponent (
46- imageList [ 0 ] . split ( "/" ) . pop ( ) ?. split ( "?" ) ?. [ 0 ] || "" ,
46+ currentImage ? .split ( "/" ) . pop ( ) ?. split ( "?" ) ?. [ 0 ] || "" ,
4747 )
4848 }
4949 return `${ imageList . length } Images`
50- } , [ imageList ] )
50+ } , [ imageList , currentImage ] )
5151
5252 return (
5353 < Flex
@@ -72,7 +72,7 @@ export const Header = ({ onClose, exportOptions }: HeaderProps) => {
7272 ?. filter ( ( exportOption ) =>
7373 typeof exportOption . isVisible === "boolean"
7474 ? exportOption . isVisible
75- : exportOption . isVisible ( imageList ) ,
75+ : exportOption . isVisible ( imageList , currentImage ) ,
7676 )
7777 . map ( ( exportOption ) => (
7878 < React . Fragment key = { `export-option-${ exportOption . label } ` } >
@@ -88,7 +88,7 @@ export const Header = ({ onClose, exportOptions }: HeaderProps) => {
8888 variant = "ghost"
8989 fontWeight = "normal"
9090 size = "sm"
91- onClick = { ( ) => exportOption . onClick ( imageList ) }
91+ onClick = { ( ) => exportOption . onClick ( imageList , currentImage ) }
9292 >
9393 { exportOption . label }
9494 </ Button >
@@ -110,12 +110,12 @@ export const Header = ({ onClose, exportOptions }: HeaderProps) => {
110110 . filter ( ( option ) =>
111111 typeof option . isVisible === "boolean"
112112 ? option . isVisible
113- : option . isVisible ( imageList ) ,
113+ : option . isVisible ( imageList , currentImage ) ,
114114 )
115115 . map ( ( option ) => (
116116 < MenuItem
117117 key = { `export-menu-option-${ option . label } ` }
118- onClick = { ( ) => option . onClick ( imageList ) }
118+ onClick = { ( ) => option . onClick ( imageList , currentImage ) }
119119 >
120120 { option . label }
121121 </ MenuItem >
0 commit comments