Skip to content
Snippets Groups Projects
Commit f5232747 authored by Piotr Gawron's avatar Piotr Gawron
Browse files

by default use first option when exporting to image

parent 7778a33e
No related branches found
No related tags found
2 merge requests!264Resolve "add support for matomo",!250Resolve "Default value for radio button of image format and Submap"
......@@ -4,7 +4,8 @@ import {
loadingConfigurationMainSelector,
} from '@/redux/configuration/configuration.selectors';
import { useAppSelector } from '@/redux/hooks/useAppSelector';
import { useContext } from 'react';
import { useContext, useState } from 'react';
import { CheckboxItem } from '@/components/Map/Drawer/ExportDrawer/CheckboxFilter/CheckboxFilter.types';
import { CheckboxFilter } from '../../CheckboxFilter';
import { CollapsibleSection } from '../../CollapsibleSection';
import { ExportContext } from '../ExportCompound.context';
......@@ -23,6 +24,16 @@ export const ImageFormat = (): React.ReactNode => {
label: name,
}));
const options = useState<CheckboxItem[]>(mappedElementAnnotations);
if (
!isPending &&
currentImageFormats.length === ZERO &&
options.length > ZERO &&
options[ZERO].length > ZERO
) {
setImageFormats([options[ZERO][ZERO]]);
}
return (
<CollapsibleSection title="Image format">
{isPending && <p>Loading...</p>}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment