From a009d67c83026cbee449c877828a90c1508ffd59 Mon Sep 17 00:00:00 2001 From: Rory Doak Date: Thu, 12 Sep 2024 13:36:02 +0100 Subject: [PATCH] fix: tidy index.tsx and response type --- editor.planx.uk/package.json | 2 +- editor.planx.uk/pnpm-lock.yaml | 10 +++++----- .../Settings/GeneralSettings/index.tsx | 19 ++++--------------- .../src/pages/FlowEditor/lib/store/team.ts | 2 +- 4 files changed, 11 insertions(+), 22 deletions(-) diff --git a/editor.planx.uk/package.json b/editor.planx.uk/package.json index 939e8db76f..3298764afa 100644 --- a/editor.planx.uk/package.json +++ b/editor.planx.uk/package.json @@ -15,7 +15,7 @@ "@mui/material": "^5.15.10", "@mui/utils": "^5.15.11", "@opensystemslab/map": "1.0.0-alpha.3", - "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#306a172", + "@opensystemslab/planx-core": "git+https://github.com/theopensystemslab/planx-core#3891420", "@tiptap/core": "^2.4.0", "@tiptap/extension-bold": "^2.0.3", "@tiptap/extension-bubble-menu": "^2.1.13", diff --git a/editor.planx.uk/pnpm-lock.yaml b/editor.planx.uk/pnpm-lock.yaml index e1522508a4..579f0e87d6 100644 --- a/editor.planx.uk/pnpm-lock.yaml +++ b/editor.planx.uk/pnpm-lock.yaml @@ -47,8 +47,8 @@ dependencies: specifier: 1.0.0-alpha.3 version: 1.0.0-alpha.3 '@opensystemslab/planx-core': - specifier: git+https://github.com/theopensystemslab/planx-core#306a172 - version: github.com/theopensystemslab/planx-core/306a172(@types/react@18.2.45) + specifier: git+https://github.com/theopensystemslab/planx-core#3891420 + version: github.com/theopensystemslab/planx-core/3891420(@types/react@18.2.45) '@tiptap/core': specifier: ^2.4.0 version: 2.4.0(@tiptap/pm@2.0.3) @@ -21379,9 +21379,9 @@ packages: use-sync-external-store: 1.2.0(react@18.2.0) dev: false - github.com/theopensystemslab/planx-core/306a172(@types/react@18.2.45): - resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/306a172} - id: github.com/theopensystemslab/planx-core/306a172 + github.com/theopensystemslab/planx-core/3891420(@types/react@18.2.45): + resolution: {tarball: https://codeload.github.com/theopensystemslab/planx-core/tar.gz/3891420} + id: github.com/theopensystemslab/planx-core/3891420 name: '@opensystemslab/planx-core' version: 1.0.0 prepare: true diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Settings/GeneralSettings/index.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Settings/GeneralSettings/index.tsx index 65d4eb8a4b..0750ea8f4f 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Settings/GeneralSettings/index.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Settings/GeneralSettings/index.tsx @@ -1,13 +1,8 @@ import Container from "@mui/material/Container"; import Typography from "@mui/material/Typography"; -import { - TeamContactSettings, - TeamSettings, -} from "@opensystemslab/planx-core/types"; +import { TeamSettings } from "@opensystemslab/planx-core/types"; import { FormikConfig } from "formik"; -import gql from "graphql-tag"; import { useToast } from "hooks/useToast"; -import { client } from "lib/graphql"; import { useStore } from "pages/FlowEditor/lib/store"; import React, { useEffect, useState } from "react"; import SettingsSection from "ui/editor/SettingsSection"; @@ -22,12 +17,6 @@ export interface FormProps { onSuccess: () => void; } -interface GetTeamEmailSettings { - teams: { - teamSettings: TeamContactSettings; - }[]; -} - const GeneralSettings: React.FC = () => { const [formikConfig, setFormikConfig] = useState< FormikConfig | undefined @@ -40,11 +29,11 @@ const GeneralSettings: React.FC = () => { const fetchedTeamSettings = await useStore .getState() .fetchCurrentTeamSettings(); - console.log(fetchedTeamSettings); - if (!fetchedTeamSettings.settings) throw Error("Unable to find team"); + + if (!fetchedTeamSettings) throw Error("Unable to find team"); setFormikConfig({ - initialValues: fetchedTeamSettings.settings, + initialValues: fetchedTeamSettings, onSubmit: () => {}, validateOnBlur: false, validateOnChange: false, diff --git a/editor.planx.uk/src/pages/FlowEditor/lib/store/team.ts b/editor.planx.uk/src/pages/FlowEditor/lib/store/team.ts index 9e18f5af44..afc0768b98 100644 --- a/editor.planx.uk/src/pages/FlowEditor/lib/store/team.ts +++ b/editor.planx.uk/src/pages/FlowEditor/lib/store/team.ts @@ -26,7 +26,7 @@ export interface TeamStore { initTeamStore: (slug: string) => Promise; clearTeamStore: () => void; fetchCurrentTeam: () => Promise; - fetchCurrentTeamSettings: () => Partial; + fetchCurrentTeamSettings: () => Promise; updateTeamTheme: (theme: Partial) => Promise; updateTeamSettings: (teamSettings: Partial) => Promise; createTeam: (newTeam: { name: string; slug: string }) => Promise;