From 7fc9ef2c40f258ce17598d20b67bcfdd84895c03 Mon Sep 17 00:00:00 2001 From: Boaz Poolman Date: Sun, 2 Jul 2023 21:33:19 +0200 Subject: [PATCH] feat: Modal tabs --- .../components/ModalForm/Collection/index.jsx | 2 +- admin/src/components/ModalForm/index.jsx | 51 +++++++++++++++++-- admin/src/index.js | 5 ++ admin/src/translations/en.json | 2 + server/controllers/core.js | 2 + tsconfig.json | 1 - 6 files changed, 58 insertions(+), 5 deletions(-) diff --git a/admin/src/components/ModalForm/Collection/index.jsx b/admin/src/components/ModalForm/Collection/index.jsx index 5a5b1a4..a8a3711 100644 --- a/admin/src/components/ModalForm/Collection/index.jsx +++ b/admin/src/components/ModalForm/Collection/index.jsx @@ -69,7 +69,7 @@ const CollectionForm = (props) => { }); return ( -
+ diff --git a/admin/src/components/ModalForm/index.jsx b/admin/src/components/ModalForm/index.jsx index 135e52f..720e540 100644 --- a/admin/src/components/ModalForm/index.jsx +++ b/admin/src/components/ModalForm/index.jsx @@ -1,11 +1,30 @@ import React, { useState, useEffect } from 'react'; import { useIntl } from 'react-intl'; -import { request } from '@strapi/helper-plugin'; -import { ModalLayout, ModalFooter, ModalBody, ModalHeader, Button, Typography } from '@strapi/design-system'; +import { request, InjectionZone } from '@strapi/helper-plugin'; + +import { useSelector } from 'react-redux'; + +import { + ModalLayout, + ModalFooter, + ModalBody, + ModalHeader, + Button, + Typography, + TabGroup, + Tabs, + Tab, + TabPanels, + TabPanel, + Box, + Flex, + Divider, +} from '@strapi/design-system'; import CustomForm from './Custom'; import CollectionForm from './Collection'; +import pluginId from '../../helpers/pluginId'; const ModalForm = (props) => { const [uid, setUid] = useState(''); @@ -13,6 +32,8 @@ const ModalForm = (props) => { const [patternInvalid, setPatternInvalid] = useState({ invalid: false }); const { formatMessage } = useIntl(); + const hasPro = useSelector((state) => state.getIn(['sitemap', 'info', 'hasPro'], false)); + const { onSubmit, onCancel, @@ -82,7 +103,31 @@ const ModalForm = (props) => { - {form()} + + {hasPro && ( + + + + {formatMessage({ id: 'sitemap.Modal.Tabs.Basic.Title', defaultMessage: 'Basic settings' })} + {formatMessage({ id: 'sitemap.Modal.Tabs.Advanced.Title', defaultMessage: 'Advanced settings' })} + + + + + + )} + + + + {form()} + + + + + +