From 95c12558119d2a2af31135afb7002049e8f9e068 Mon Sep 17 00:00:00 2001 From: Andymick Date: Sat, 18 Jul 2026 16:32:09 +0100 Subject: [PATCH] Make image dimensions and font properties collapsible sections - Add expandedSections state to track which sections are open - Image Dimensions section now collapses by default (click to expand) - Font Properties section now collapses by default (click to expand) - Shows count of items in each section - Dramatically reduces vertical scrolling on the right sidebar - More compact layout with accordion-style sections Co-Authored-By: Claude Haiku 4.5 --- src/components/DesignCanvas.tsx | 53 +++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 13 deletions(-) diff --git a/src/components/DesignCanvas.tsx b/src/components/DesignCanvas.tsx index 37c1ca2..0eac906 100644 --- a/src/components/DesignCanvas.tsx +++ b/src/components/DesignCanvas.tsx @@ -505,6 +505,11 @@ export default function DesignCanvas({ product }: { product: ProductDTO }) { const [designApprovalId, setDesignApprovalId] = useState(null); const [submissionMessage, setSubmissionMessage] = useState(null); const [imageDimensions, setImageDimensions] = useState>({}); + const [expandedSections, setExpandedSections] = useState>({}); + + const toggleSection = (section: string) => { + setExpandedSections((prev) => ({ ...prev, [section]: !prev[section] })); + }; const stageFrontRef = useRef(null); const stageBackRef = useRef(null); @@ -1177,11 +1182,20 @@ export default function DesignCanvas({ product }: { product: ProductDTO }) { {(() => { const images = view === 'front' ? elementsFront.filter(el => el.type === 'image') : elementsBack.filter(el => el.type === 'image'); return images.length > 0 ? ( -
- {images.map((img, idx) => ( -
-

Image {idx + 1}

-
+
+ + {expandedSections.imageDimensions && ( +
+ {images.map((img, idx) => ( +
+

Image {idx + 1}

+
-
+
+
+ ))}
- ))} + )}
) : null; })()} @@ -1229,11 +1245,20 @@ export default function DesignCanvas({ product }: { product: ProductDTO }) { {(() => { const texts = view === 'front' ? elementsFront.filter(el => el.type === 'text') : elementsBack.filter(el => el.type === 'text'); return texts.length > 0 ? ( -
- {texts.map((text, idx) => ( -
-

Font {idx + 1}

-
+
+ + {expandedSections.fontProperties && ( +
+ {texts.map((text, idx) => ( +
+

Font {idx + 1}

+
)} +
-
))} +
+ )}
) : null; })()}