Skip to content

Commit

Permalink
🚚 [open-formulieren/open-forms#2177] Moving map settings to separate tab
Browse files Browse the repository at this point in the history
  • Loading branch information
robinmolen committed Jan 9, 2025
1 parent 5f3ff11 commit 42ab5a7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/registry/map/edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
useDeriveComponentKey,
} from '@/components/builder';
import {LABELS} from '@/components/builder/messages';
import {Checkbox, Select, TabList, TabPanel, Tabs} from '@/components/formio';
import {Checkbox, Select, Tab, TabList, TabPanel, Tabs} from '@/components/formio';
import {BuilderContext} from '@/context';
import InteractionConfiguration from '@/registry/map/interaction-configuration';
import {useErrorChecker} from '@/utils/errors';
Expand Down Expand Up @@ -62,16 +62,25 @@ const EditForm: EditFormDefinition<MapComponentSchema> = () => {
'showInPDF',
'hidden',
'clearOnHide',
'isSensitiveData',
'isSensitiveData'
)}
/>
<BuilderTabs.Advanced hasErrors={hasAnyError('conditional')} />
<BuilderTabs.Validation hasErrors={hasAnyError('validate')} />
<Tab
hasErrors={hasAnyError(
'useConfigDefaultMapSettings',
'defaultZoom',
'initialCenter',
'tileLayerIdentifier',
'interactions'
)}
/>
<BuilderTabs.Advanced hasErrors={hasAnyError('conditional')} />
<BuilderTabs.Validation hasErrors={hasAnyError('validate')} />
>
<FormattedMessage
description="Component edit form tab title for 'Map settings' tab"
defaultMessage="Map settings"
/>
</Tab>
<BuilderTabs.Registration hasErrors={hasAnyError('registration')} />
<BuilderTabs.Translations hasErrors={hasAnyError('openForms.translations')} />
</TabList>
Expand All @@ -86,10 +95,6 @@ const EditForm: EditFormDefinition<MapComponentSchema> = () => {
<Hidden />
<ClearOnHide />
<IsSensitiveData />
<UseConfigDefaultMapSettings />
{!values.useConfigDefaultMapSettings && <MapConfiguration />}
<TileLayer />
<InteractionConfiguration />
</TabPanel>

{/* Advanced tab */}
Expand All @@ -104,6 +109,14 @@ const EditForm: EditFormDefinition<MapComponentSchema> = () => {
<Validate.ValidationErrorTranslations />
</TabPanel>

{/* Map settings tab */}
<TabPanel>
<TileLayer />
<InteractionConfiguration />
<UseConfigDefaultMapSettings />
{!values.useConfigDefaultMapSettings && <MapConfiguration />}
</TabPanel>

{/* Registration tab */}
<TabPanel>
<Registration.RegistrationAttributeSelect />
Expand Down
2 changes: 2 additions & 0 deletions src/registry/map/map-configuration.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export const NotUsingGlobalConfig: Story = {
const canvas = within(canvasElement);

await step('Initial state', async () => {
await userEvent.click(canvas.getByRole('link', {name: 'Map settings'}));
expect(
canvas.getByLabelText('Use globally configured map component settings')
).not.toBeChecked();
Expand Down Expand Up @@ -81,6 +82,7 @@ export const UsingGlobalConfig: Story = {
const canvas = within(canvasElement);

await step('Initial state', async () => {
await userEvent.click(canvas.getByRole('link', {name: 'Map settings'}));
expect(
canvas.getByLabelText('Use globally configured map component settings')
).not.toBeChecked();
Expand Down

0 comments on commit 42ab5a7

Please sign in to comment.