@@ -8,7 +8,7 @@ import { ConfigService } from "../../../assets/lib/kookit-extra-browser.min";
88class AddDialog extends Component < AddDialogProps , AddDialogState > {
99 constructor ( props : AddDialogProps ) {
1010 super ( props ) ;
11- this . state = { isNew : true , shelfTitle : "" } ;
11+ this . state = { isNew : true , shelfTitle : "" , actionType : "copy" } ;
1212 }
1313
1414 handleCancel = ( ) => {
@@ -43,13 +43,29 @@ class AddDialog extends Component<AddDialogProps, AddDialogState> {
4343 }
4444 if ( this . props . isSelectBook ) {
4545 this . props . selectedBooks . forEach ( ( item ) => {
46+ if ( this . state . actionType === "move" ) {
47+ ConfigService . deleteFromMapConfig (
48+ this . props . shelfTitle ,
49+ item ,
50+ "shelfList"
51+ ) ;
52+ }
4653 ConfigService . setMapConfig ( shelfTitle , item , "shelfList" ) ;
4754 } ) ;
4855 this . props . handleSelectBook ( ! this . props . isSelectBook ) ;
4956 if ( this . props . isSelectBook ) {
5057 this . props . handleSelectedBooks ( [ ] ) ;
5158 }
5259 } else {
60+ console . log ( this . state . actionType , "actionType" ) ;
61+ if ( this . state . actionType === "move" ) {
62+ ConfigService . deleteFromMapConfig (
63+ this . props . shelfTitle ,
64+ this . props . currentBook . key ,
65+ "shelfList"
66+ ) ;
67+ }
68+
5369 ConfigService . setMapConfig (
5470 shelfTitle ,
5571 this . props . currentBook . key ,
@@ -90,10 +106,33 @@ class AddDialog extends Component<AddDialogProps, AddDialogState> {
90106 } ) ;
91107 } ;
92108 return (
93- < div className = "add-dialog-container" >
109+ < div
110+ className = "add-dialog-container"
111+ style = { { height : this . props . mode === "shelf" ? "240px" : "189px" } }
112+ >
94113 < div className = "add-dialog-title" >
95114 < Trans > Add to shelf</ Trans >
96115 </ div >
116+ { this . props . mode === "shelf" && (
117+ < div className = "add-dialog-shelf-list-container" >
118+ < div className = "add-dialog-shelf-list-text" >
119+ < Trans > Action</ Trans >
120+ </ div >
121+ < select
122+ className = "add-dialog-shelf-list-box"
123+ onChange = { ( event : React . ChangeEvent < HTMLSelectElement > ) => {
124+ this . setState ( { actionType : event . target . value } ) ;
125+ } }
126+ >
127+ < option value = "copy" className = "add-dialog-shelf-list-option" >
128+ { this . props . t ( "Copy to" ) }
129+ </ option >
130+ < option value = "move" className = "add-dialog-shelf-list-option" >
131+ { this . props . t ( "Move to" ) }
132+ </ option >
133+ </ select >
134+ </ div >
135+ ) }
97136 < div className = "add-dialog-shelf-list-container" >
98137 < div className = "add-dialog-shelf-list-text" >
99138 < Trans > Select</ Trans >
@@ -107,7 +146,7 @@ class AddDialog extends Component<AddDialogProps, AddDialogState> {
107146 { renderShelfList ( ) }
108147 </ select >
109148 </ div >
110- < div className = "add-dialog-new- shelf-container" >
149+ < div className = "add-dialog-shelf-list -container" >
111150 < div className = "add-dialog-new-shelf-text" >
112151 < Trans > New</ Trans >
113152 </ div >
0 commit comments