@@ -32,82 +32,90 @@ const SaveButton = ({
3232 } = useDisclosure ( ) ;
3333
3434 return (
35- < MyPopover
36- placement = { 'bottom-end' }
37- hasArrow = { false }
38- offset = { [ 2 , 4 ] }
39- w = { '116px' }
40- onOpenFunc = { ( ) => setIsSave ( true ) }
41- onCloseFunc = { ( ) => setIsSave ( false ) }
42- trigger = { 'hover' }
43- Trigger = {
44- < Button
45- size = { 'sm' }
46- flexShrink = { 0 }
47- rightIcon = {
48- < MyIcon
49- name = { isSave ? 'core/chat/chevronUp' : 'core/chat/chevronDown' }
50- w = { [ '14px' , '16px' ] }
51- />
52- }
53- >
54- < Box > { t ( 'common:Save' ) } </ Box >
55- </ Button >
56- }
35+ < Box
36+ flexShrink = { 0 }
37+ sx = { {
38+ section : {
39+ width : 'auto'
40+ }
41+ } }
5742 >
58- { ( { onClose } ) => (
59- < Box p = { 1.5 } >
60- < MyBox
61- display = { 'flex' }
62- alignItems = { 'center' }
63- gap = { 2 }
64- p = { 1.5 }
65- rounded = { '4px' }
66- _hover = { { color : 'primary.600' , bg : 'rgba(17, 24, 36, 0.05)' } }
67- cursor = { 'pointer' }
68- isLoading = { isLoading }
69- onClick = { async ( ) => {
70- await onClickSave ( { } ) ;
71- toast ( {
72- status : 'success' ,
73- title : t ( 'app:saved_success' ) ,
74- position : 'top-right' ,
75- isClosable : true
76- } ) ;
77- onClose ( ) ;
78- setIsSave ( false ) ;
79- } }
80- >
81- < MyIcon name = { 'core/workflow/upload' } w = { '1rem' } />
82- < Box fontSize = { 'sm' } > { t ( 'common:core.workflow.Save to cloud' ) } </ Box >
83- </ MyBox >
84- < HStack
85- p = { 1.5 }
86- rounded = { '4px' }
87- _hover = { { color : 'primary.600' , bg : 'rgba(17, 24, 36, 0.05)' } }
88- cursor = { 'pointer' }
89- onClick = { ( ) => {
90- const canOpen = ! checkData || checkData ( ) ;
91- if ( canOpen ) {
92- onSaveAndPublishModalOpen ( ) ;
93- }
94- onClose ( ) ;
95- setIsSave ( false ) ;
96- } }
97- >
98- < MyIcon name = { 'core/workflow/publish' } w = { '1rem' } />
99- < Box fontSize = { 'sm' } > { t ( 'common:core.workflow.Save and publish' ) } </ Box >
100- { isSaveAndPublishModalOpen && (
101- < SaveAndPublishModal
102- isLoading = { isLoading }
103- onClose = { onSaveAndPublishModalClose }
104- onClickSave = { onClickSave }
43+ < MyPopover
44+ placement = { 'bottom-end' }
45+ hasArrow = { false }
46+ offset = { [ 2 , 4 ] }
47+ w = { '116px' }
48+ onOpenFunc = { ( ) => setIsSave ( true ) }
49+ onCloseFunc = { ( ) => setIsSave ( false ) }
50+ trigger = { 'hover' }
51+ Trigger = {
52+ < Button
53+ size = { 'sm' }
54+ rightIcon = {
55+ < MyIcon
56+ name = { isSave ? 'core/chat/chevronUp' : 'core/chat/chevronDown' }
57+ w = { [ '14px' , '16px' ] }
10558 />
106- ) }
107- </ HStack >
108- </ Box >
59+ }
60+ >
61+ < Box > { t ( 'common:Save' ) } </ Box >
62+ </ Button >
63+ }
64+ >
65+ { ( { onClose } ) => (
66+ < Box p = { 1.5 } >
67+ < MyBox
68+ display = { 'flex' }
69+ alignItems = { 'center' }
70+ gap = { 2 }
71+ p = { 1.5 }
72+ rounded = { '4px' }
73+ _hover = { { color : 'primary.600' , bg : 'rgba(17, 24, 36, 0.05)' } }
74+ cursor = { 'pointer' }
75+ isLoading = { isLoading }
76+ onClick = { async ( ) => {
77+ await onClickSave ( { } ) ;
78+ toast ( {
79+ status : 'success' ,
80+ title : t ( 'app:saved_success' ) ,
81+ position : 'top-right' ,
82+ isClosable : true
83+ } ) ;
84+ onClose ( ) ;
85+ setIsSave ( false ) ;
86+ } }
87+ >
88+ < MyIcon name = { 'core/workflow/upload' } w = { '1rem' } />
89+ < Box fontSize = { 'sm' } > { t ( 'common:core.workflow.Save to cloud' ) } </ Box >
90+ </ MyBox >
91+ < HStack
92+ p = { 1.5 }
93+ rounded = { '4px' }
94+ _hover = { { color : 'primary.600' , bg : 'rgba(17, 24, 36, 0.05)' } }
95+ cursor = { 'pointer' }
96+ onClick = { ( ) => {
97+ const canOpen = ! checkData || checkData ( ) ;
98+ if ( canOpen ) {
99+ onSaveAndPublishModalOpen ( ) ;
100+ }
101+ onClose ( ) ;
102+ setIsSave ( false ) ;
103+ } }
104+ >
105+ < MyIcon name = { 'core/workflow/publish' } w = { '1rem' } />
106+ < Box fontSize = { 'sm' } > { t ( 'common:core.workflow.Save and publish' ) } </ Box >
107+ </ HStack >
108+ </ Box >
109+ ) }
110+ </ MyPopover >
111+ { isSaveAndPublishModalOpen && (
112+ < SaveAndPublishModal
113+ isLoading = { isLoading }
114+ onClose = { onSaveAndPublishModalClose }
115+ onClickSave = { onClickSave }
116+ />
109117 ) }
110- </ MyPopover >
118+ </ Box >
111119 ) ;
112120} ;
113121
0 commit comments