@@ -30,6 +30,9 @@ import { BsFillHeartFill, BsHeart} from "react-icons/bs";
3030// Export Shape
3131import { ExportShape , CopyShapeSource , NoShapeFound } from '..' ;
3232
33+ // CreateShape to edit shape
34+ import { CreateShape } from ".." ;
35+
3336// misc unitless
3437import { getShapeFileName , getShapeId } from '../../utils/misc' ;
3538
@@ -222,6 +225,10 @@ const ShapeList = (
222225 const [ showCopySourceModal , setCopySourceModal ] = useState ( false ) ;
223226 const [ shapeToSourceCopy , setShapeToSourceCopy ] = useState ( ) ;
224227
228+ // All about editing private shapes
229+ const [ showEditModal , setShowEditModal ] = useState ( false ) ;
230+ const [ shapeToEdit , setShapeToEdit ] = useState ( ) ;
231+
225232 useEffect ( ( ) => {
226233 const copy = [ ...shapes ] ;
227234 if ( sort === 'recent' ) {
@@ -272,6 +279,20 @@ const ShapeList = (
272279 }
273280 }
274281
282+ /**
283+ * Method to execute when user clicks on the edit shape
284+ */
285+ const performEdit = shape => {
286+ // Set the shape details to edit
287+ setShapeToEdit ( shape ) ;
288+ // Show the export modal
289+ setShowEditModal ( true ) ;
290+ }
291+
292+ const closeEditModal = ( ) => {
293+ setShowEditModal ( false ) ;
294+ }
295+
275296 /**
276297 * Method to execute when user clicks on the likes
277298 */
@@ -364,6 +385,12 @@ const ShapeList = (
364385 shape = { shapeToSourceCopy } />
365386 }
366387
388+ { shapeToEdit && < CreateShape
389+ show = { showEditModal }
390+ handleClose = { closeEditModal }
391+ shapeInformation = { shapeToSourceCopy } />
392+ }
393+
367394 {
368395 filteredShape . length === 0 ? < NoShapeFound /> : filteredShape . map ( ( shape , index ) => (
369396 < React . Fragment key = { index } >
@@ -410,6 +437,11 @@ const ShapeList = (
410437 < CopyIcon
411438 size = { 24 } />
412439 </ Button >
440+ { shape . private ?
441+ < Button title = "Edit Shape" vairant = "outline-light" onClick = { ( ) => performEdit ( shape ) } className = "btn-icon" >
442+ Edit
443+ </ Button > : null
444+ }
413445 </ ShapeActionsContainer >
414446 </ ShapeActions >
415447 </ ShapeCardBody >
0 commit comments