From d0fe7db4f22f93902dd46fe454763d03669c5bfe Mon Sep 17 00:00:00 2001
From: Piotr Gawron <p.gawron@atcomp.pl>
Date: Thu, 10 Oct 2024 08:10:41 +0200
Subject: [PATCH] expand accordions

---
 CHANGELOG                                                     | 2 ++
 .../CollapsibleSection/CollapsibleSection.component.tsx       | 4 +++-
 .../ExportCompound/ImageFormat/ImageFormat.component.test.tsx | 2 --
 .../ExportCompound/ImageFormat/ImageFormat.component.tsx      | 2 +-
 .../ExportCompound/ImageSize/ImageSize.component.tsx          | 2 +-
 .../ExportCompound/Submap/Submap.component.test.tsx           | 2 --
 .../ExportDrawer/ExportCompound/Submap/Submap.component.tsx   | 2 +-
 7 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/CHANGELOG b/CHANGELOG
index 6be2d083..e7e1ccbf 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,6 +1,8 @@
 minerva-front (18.0.0~beta.5) stable; urgency=medium
   * Small improvements: when exporting map as image provide default selections
     in for format and submap  (#295)
+  * Small improvements: dropdown sections in exporting map as image are
+    unfolded permanently (#296)
 
  -- Piotr Gawron <piotr.gawron@uni.lu>  Fri, 04 Oct 2024 13:00:00 +0200
 
diff --git a/src/components/Map/Drawer/ExportDrawer/CollapsibleSection/CollapsibleSection.component.tsx b/src/components/Map/Drawer/ExportDrawer/CollapsibleSection/CollapsibleSection.component.tsx
index 2dc750a9..0ac2e56d 100644
--- a/src/components/Map/Drawer/ExportDrawer/CollapsibleSection/CollapsibleSection.component.tsx
+++ b/src/components/Map/Drawer/ExportDrawer/CollapsibleSection/CollapsibleSection.component.tsx
@@ -12,12 +12,14 @@ type CollapsibleSectionProps = {
   title: string;
   children: React.ReactNode;
   onOpened?(): void;
+  dangerouslySetExpanded?: boolean;
 };
 
 export const CollapsibleSection = ({
   title,
   children,
   onOpened,
+  dangerouslySetExpanded,
 }: CollapsibleSectionProps): React.ReactNode => {
   const handleOnChange = (ids: ID[]): void => {
     const hasBeenOpened = ids.length > ZERO;
@@ -29,7 +31,7 @@ export const CollapsibleSection = ({
 
   return (
     <Accordion allowZeroExpanded onChange={handleOnChange}>
-      <AccordionItem>
+      <AccordionItem dangerouslySetExpanded={dangerouslySetExpanded}>
         <AccordionItemHeading>
           <AccordionItemButton>{title}</AccordionItemButton>
         </AccordionItemHeading>
diff --git a/src/components/Map/Drawer/ExportDrawer/ExportCompound/ImageFormat/ImageFormat.component.test.tsx b/src/components/Map/Drawer/ExportDrawer/ExportCompound/ImageFormat/ImageFormat.component.test.tsx
index e8c6df39..33a1897e 100644
--- a/src/components/Map/Drawer/ExportDrawer/ExportCompound/ImageFormat/ImageFormat.component.test.tsx
+++ b/src/components/Map/Drawer/ExportDrawer/ExportCompound/ImageFormat/ImageFormat.component.test.tsx
@@ -40,8 +40,6 @@ describe('ImageFormat - component', () => {
       },
     });
 
-    expect(screen.queryByTestId('checkbox-filter')).not.toBeVisible();
-
     const navigationButton = screen.getByTestId('accordion-item-button');
 
     act(() => {
diff --git a/src/components/Map/Drawer/ExportDrawer/ExportCompound/ImageFormat/ImageFormat.component.tsx b/src/components/Map/Drawer/ExportDrawer/ExportCompound/ImageFormat/ImageFormat.component.tsx
index 3b735d20..84e59e23 100644
--- a/src/components/Map/Drawer/ExportDrawer/ExportCompound/ImageFormat/ImageFormat.component.tsx
+++ b/src/components/Map/Drawer/ExportDrawer/ExportCompound/ImageFormat/ImageFormat.component.tsx
@@ -35,7 +35,7 @@ export const ImageFormat = (): React.ReactNode => {
   }
 
   return (
-    <CollapsibleSection title="Image format">
+    <CollapsibleSection title="Image format" dangerouslySetExpanded>
       {isPending && <p>Loading...</p>}
       {!isPending && mappedElementAnnotations.length > ZERO && (
         <CheckboxFilter
diff --git a/src/components/Map/Drawer/ExportDrawer/ExportCompound/ImageSize/ImageSize.component.tsx b/src/components/Map/Drawer/ExportDrawer/ExportCompound/ImageSize/ImageSize.component.tsx
index 1a66c44e..0847c460 100644
--- a/src/components/Map/Drawer/ExportDrawer/ExportCompound/ImageSize/ImageSize.component.tsx
+++ b/src/components/Map/Drawer/ExportDrawer/ExportCompound/ImageSize/ImageSize.component.tsx
@@ -5,7 +5,7 @@ export const ImageSize = (): React.ReactNode => {
   const { width, height, handleChangeHeight, handleChangeWidth } = useImageSize();
 
   return (
-    <CollapsibleSection title="Image size">
+    <CollapsibleSection title="Image size" dangerouslySetExpanded>
       <div className="flex flex-col gap-4">
         <label className="flex h-9 items-center gap-4">
           <span className="w-12">Width:&nbsp;</span>
diff --git a/src/components/Map/Drawer/ExportDrawer/ExportCompound/Submap/Submap.component.test.tsx b/src/components/Map/Drawer/ExportDrawer/ExportCompound/Submap/Submap.component.test.tsx
index 2374285d..6ee9cb42 100644
--- a/src/components/Map/Drawer/ExportDrawer/ExportCompound/Submap/Submap.component.test.tsx
+++ b/src/components/Map/Drawer/ExportDrawer/ExportCompound/Submap/Submap.component.test.tsx
@@ -39,8 +39,6 @@ describe('Submap - component', () => {
       },
     });
 
-    expect(screen.queryByTestId('checkbox-filter')).not.toBeVisible();
-
     const navigationButton = screen.getByTestId('accordion-item-button');
 
     act(() => {
diff --git a/src/components/Map/Drawer/ExportDrawer/ExportCompound/Submap/Submap.component.tsx b/src/components/Map/Drawer/ExportDrawer/ExportCompound/Submap/Submap.component.tsx
index 1da3b420..422c4b73 100644
--- a/src/components/Map/Drawer/ExportDrawer/ExportCompound/Submap/Submap.component.tsx
+++ b/src/components/Map/Drawer/ExportDrawer/ExportCompound/Submap/Submap.component.tsx
@@ -30,7 +30,7 @@ export const Submap = (): React.ReactNode => {
   }
 
   return (
-    <CollapsibleSection title="Submap">
+    <CollapsibleSection title="Submap" dangerouslySetExpanded>
       {isPending && <p>Loading...</p>}
       {!isPending && mappedElementAnnotations && mappedElementAnnotations.length > ZERO && (
         <CheckboxFilter
-- 
GitLab