From ff459f7d9185b4194ba1d061c4f5d88204820497 Mon Sep 17 00:00:00 2001 From: Sunil Shetye Date: Mon, 14 Jul 2025 19:05:30 +0530 Subject: code cleanup --- .../components/SchematicEditor/ToolbarExtension.js | 103 ++++++++++----------- 1 file changed, 49 insertions(+), 54 deletions(-) diff --git a/blocks/eda-frontend/src/components/SchematicEditor/ToolbarExtension.js b/blocks/eda-frontend/src/components/SchematicEditor/ToolbarExtension.js index 0c6cc51c..58d758b8 100644 --- a/blocks/eda-frontend/src/components/SchematicEditor/ToolbarExtension.js +++ b/blocks/eda-frontend/src/components/SchematicEditor/ToolbarExtension.js @@ -693,6 +693,37 @@ ImageExportDialog.propTypes = { open: PropTypes.bool.isRequired } +function SchematicRow ({ sch, onClick, details, showDates = false }) { + return ( + + {sch.name} + + + + {sch.description !== null ? sch.description.slice(0, 30) + (sch.description.length < 30 ? '' : '...') : '-'} + + + + {showDates && ( + <> + {getDate(sch.create_time)} + {getDate(sch.save_time)} + + )} + + + + + ) +} + // Dialog box to open saved Schematics export function OpenSchDialog (props) { const { open, close, openLocal } = props @@ -753,32 +784,15 @@ export function OpenSchDialog (props) { <> - {GallerySchSample.map( - (sch) => { - return ( - - {sch.name} - - - - {sch.description !== null ? sch.description.slice(0, 30) + (sch.description.length < 30 ? '' : '...') : '-'} - - - - - - - - ) - } - )} + {GallerySchSample.map((sch) => ( + dispatch(fetchDiagram(id))} + details={details} + showDates={false} + /> + ))} @@ -803,34 +817,15 @@ export function OpenSchDialog (props) { <> - {schematics.map( - (sch) => { - return ( - - {sch.name} - - - - {sch.description !== null ? sch.description.slice(0, 30) + (sch.description.length < 30 ? '' : '...') : '-'} - - - - {getDate(sch.create_time)} - {getDate(sch.save_time)} - - - - - ) - } - )} + {schematics.map((sch) => ( + dispatch(fetchSchematic(id))} + details={details} + showDates={true} + /> + ))} -- cgit