From 88d35b51639feae67a1245c2a3624bd43fe58cba Mon Sep 17 00:00:00 2001 From: Ian Jones Date: Wed, 15 Jan 2025 11:39:04 +0000 Subject: [PATCH 1/3] demo: Council resources in the editor prototype --- .../src/@planx/components/SetValue/Editor.tsx | 142 ++++++++++++------ .../src/components/EditorNavMenu.tsx | 7 + .../FlowEditor/components/Sidebar/index.tsx | 2 +- .../FlowEditor/components/forms/FormModal.tsx | 3 + editor.planx.uk/src/routes/authenticated.tsx | 13 ++ 5 files changed, 122 insertions(+), 45 deletions(-) diff --git a/editor.planx.uk/src/@planx/components/SetValue/Editor.tsx b/editor.planx.uk/src/@planx/components/SetValue/Editor.tsx index b1ebc9de72..bf3bc2bea4 100644 --- a/editor.planx.uk/src/@planx/components/SetValue/Editor.tsx +++ b/editor.planx.uk/src/@planx/components/SetValue/Editor.tsx @@ -1,11 +1,15 @@ +import Box from "@mui/material/Box"; import FormControl from "@mui/material/FormControl"; import RadioGroup from "@mui/material/RadioGroup"; +import Tabs from "@mui/material/Tabs"; import Typography from "@mui/material/Typography"; import { ComponentType as TYPES } from "@opensystemslab/planx-core/types"; import BasicRadio from "@planx/components/shared/Radio/BasicRadio"; import { EditorProps } from "@planx/components/shared/types"; import { useFormik } from "formik"; -import React from "react"; +import { TabList } from "pages/FlowEditor/components/Sidebar"; +import StyledTab from "pages/FlowEditor/components/Sidebar/StyledTab"; +import React, { useState } from "react"; import { ModalFooter } from "ui/editor/ModalFooter"; import ModalSection from "ui/editor/ModalSection"; import ModalSectionContent from "ui/editor/ModalSectionContent"; @@ -17,8 +21,6 @@ import { parseSetValue, SetValue } from "./model"; type Props = EditorProps; -export default SetValueComponent; - interface Option { value: SetValue["operation"]; label: string; @@ -77,7 +79,9 @@ const DescriptionText: React.FC = ({ fn, val, operation }) => { } }; -function SetValueComponent(props: Props) { +const SetValueComponent: React.FC = (props) => { + const [activeTab, setActiveTab] = useState(0); + const formik = useFormik({ initialValues: parseSetValue(props.node?.data), onSubmit: (newValues) => { @@ -93,49 +97,99 @@ function SetValueComponent(props: Props) { formik.setFieldValue("operation", target.value); }; + const handleTabChange = (event: React.SyntheticEvent, newValue: number) => { + setActiveTab(newValue); + }; + return (