@@ -131,27 +131,59 @@ export function EditorDrawerTaskContent({
131131 </ div >
132132 < div className = "form-group" >
133133 < label > { t . resources } </ label >
134- { ( localNode . data . resources || [ ] ) . map ( ( resource : { label : string ; url : string } , idx : number ) => (
135- < div key = { idx } style = { { display : "flex" , gap : "8px" , marginBottom : "8px" } } >
136- < input
137- type = "text"
138- value = { resource . label || "" }
139- onChange = { ( e ) => handleResourceChange ( idx , "label" , e . target . value ) }
140- placeholder = { t . placeholderLabel }
141- style = { { flex : 1 } }
142- />
143- < input
144- type = "text"
145- value = { resource . url || "" }
146- onChange = { ( e ) => handleResourceChange ( idx , "url" , e . target . value ) }
147- placeholder = { t . placeholderURL }
148- style = { { flex : 2 } }
149- />
150- < button onClick = { ( ) => removeResource ( idx ) } className = "icon-button" >
151- < Trash2 size = { 16 } />
152- </ button >
153- </ div >
154- ) ) }
134+ { ( localNode . data . resources || [ ] ) . map ( ( resource : any , idx : number ) => {
135+ const isBook = resource . type === "book" ;
136+ return (
137+ < div key = { idx } style = { { marginBottom : "16px" , padding : "12px" , border : "1px solid #e5e7eb" , borderRadius : "6px" } } >
138+ < div style = { { display : "flex" , gap : "8px" , marginBottom : "8px" } } >
139+ < select
140+ value = { resource . type || "url" }
141+ onChange = { ( e ) => handleResourceChange ( idx , "type" , e . target . value ) }
142+ style = { { flex : 0.5 } }
143+ >
144+ < option value = "url" > URL</ option >
145+ < option value = "book" > Book</ option >
146+ </ select >
147+ < input
148+ type = "text"
149+ value = { resource . label || "" }
150+ onChange = { ( e ) => handleResourceChange ( idx , "label" , e . target . value ) }
151+ placeholder = { t . placeholderLabel }
152+ style = { { flex : 1 } }
153+ />
154+ < button onClick = { ( ) => removeResource ( idx ) } className = "icon-button" >
155+ < Trash2 size = { 16 } />
156+ </ button >
157+ </ div >
158+ { isBook ? (
159+ < >
160+ < input
161+ type = "text"
162+ value = { resource . bookName || "" }
163+ onChange = { ( e ) => handleResourceChange ( idx , "bookName" , e . target . value ) }
164+ placeholder = "Book name (e.g., Lambacher Schweitzer GK)"
165+ style = { { width : "100%" , marginBottom : "8px" } }
166+ />
167+ < input
168+ type = "text"
169+ value = { resource . bookLocation || "" }
170+ onChange = { ( e ) => handleResourceChange ( idx , "bookLocation" , e . target . value ) }
171+ placeholder = "Location (e.g., S. 223 Nr. 5)"
172+ style = { { width : "100%" } }
173+ />
174+ </ >
175+ ) : (
176+ < input
177+ type = "text"
178+ value = { resource . url || "" }
179+ onChange = { ( e ) => handleResourceChange ( idx , "url" , e . target . value ) }
180+ placeholder = { t . placeholderURL }
181+ style = { { width : "100%" } }
182+ />
183+ ) }
184+ </ div >
185+ ) ;
186+ } ) }
155187 < button onClick = { addResource } className = "secondary-button" >
156188 < Plus size = { 16 } /> { t . addResource }
157189 </ button >
0 commit comments