Skip to content

Commit

Permalink
chore: Import component types from planx-core
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Feb 5, 2024
1 parent 3a89fcd commit fd64c10
Show file tree
Hide file tree
Showing 71 changed files with 188 additions and 223 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TYPES } from "@planx/components/types";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import {
EditorProps,
ICONS,
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/@planx/components/Calculate/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { styled } from "@mui/material/styles";
import Typography from "@mui/material/Typography";
import { TYPES } from "@planx/components/types";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import {
EditorProps,
ICONS,
Expand Down
16 changes: 8 additions & 8 deletions editor.planx.uk/src/@planx/components/Calculate/logic.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { TYPES } from "@planx/components/types";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { Store, vanillaStore } from "pages/FlowEditor/lib/store";

const { getState, setState } = vanillaStore;
const { upcomingCardIds, resetPreview, record, currentCard } = getState();
const { upcomingCardIds, resetPreview, record } = getState();

// Helper method
const visitedNodes = () => Object.keys(getState().breadcrumbs);
Expand Down Expand Up @@ -74,23 +74,23 @@ const flowWithAutomation: Store.flow = {
val: "1",
text: "1",
},
type: TYPES.Response,
type: TYPES.Answer,
edges: ["Group1Notice"],
},
Question: {
data: {
fn: "testGroup",
text: "Which test group? ",
},
type: TYPES.Statement,
type: TYPES.Question,
edges: ["Group1Response", "Group2Response"],
},
Group2Response: {
data: {
val: "2",
text: "2",
},
type: TYPES.Response,
type: TYPES.Answer,
edges: ["Group2Notice"],
},
};
Expand Down Expand Up @@ -128,23 +128,23 @@ const flowWithoutAutomation: Store.flow = {
val: "1",
text: "1",
},
type: TYPES.Response,
type: TYPES.Answer,
edges: ["Group1Notice"],
},
Question: {
data: {
fn: "testGroup",
text: "Which test group? ",
},
type: TYPES.Statement,
type: TYPES.Question,
edges: ["Group1Response", "Group2Response"],
},
Group2Response: {
data: {
val: "2",
text: "2",
},
type: TYPES.Response,
type: TYPES.Answer,
edges: ["Group2Notice"],
},
};
6 changes: 3 additions & 3 deletions editor.planx.uk/src/@planx/components/Checklist/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Delete from "@mui/icons-material/Delete";
import Box from "@mui/material/Box";
import Button from "@mui/material/Button";
import IconButton from "@mui/material/IconButton";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { useFormik } from "formik";
import adjust from "ramda/src/adjust";
import compose from "ramda/src/compose";
Expand All @@ -22,7 +23,6 @@ import InputRowItem from "ui/shared/InputRowItem";

import { Option, parseMoreInformation } from "../shared";
import PermissionSelect from "../shared/PermissionSelect";
import { TYPES } from "../types";
import { ICONS, InternalNotes, MoreInformation } from "../ui";
import type { Checklist, Group } from "./model";
import { toggleExpandableChecklist } from "./model";
Expand Down Expand Up @@ -319,7 +319,7 @@ export const ChecklistComponent: React.FC<ChecklistProps> = (props) => {
.map((o) => ({
...o,
id: o.id || undefined,
type: TYPES.Response,
type: TYPES.Answer,
}))
: groupedOptions
? groupedOptions
Expand All @@ -328,7 +328,7 @@ export const ChecklistComponent: React.FC<ChecklistProps> = (props) => {
.map((o) => ({
...o,
id: o.id || undefined,
type: TYPES.Response,
type: TYPES.Answer,
}))
: [],
);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Box from "@mui/material/Box";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { EditorProps, ICONS } from "@planx/components/ui";
import { useFormik } from "formik";
import React, { ChangeEvent } from "react";
Expand All @@ -11,7 +12,6 @@ import RichTextInput from "ui/editor/RichTextInput";
import Input from "ui/shared/Input";
import InputRow from "ui/shared/InputRow";

import { TYPES } from "../types";
import { Confirmation, parseNextSteps, Step } from "./model";

export type Props = EditorProps<TYPES.Confirmation, Confirmation>;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TYPES } from "@planx/components/types";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import {
EditorProps,
ICONS,
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/@planx/components/Content/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import type { Content } from "@planx/components/Content/model";
import { parseContent } from "@planx/components/Content/model";
import { TYPES } from "@planx/components/types";
import {
EditorProps,
ICONS,
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/@planx/components/DateInput/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Box from "@mui/material/Box";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import {
DateInput,
editorValidationSchema,
paddedDate,
} from "@planx/components/DateInput/model";
import { parseDateInput } from "@planx/components/DateInput/model";
import { TYPES } from "@planx/components/types";
import {
EditorProps,
ICONS,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TYPES } from "@planx/components/types";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import {
EditorProps,
ICONS,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { fireEvent, screen, waitFor } from "@testing-library/react";
import React from "react";
import { setup } from "testUtils";

import { TYPES } from "../types";
import ExternalPortalForm from "./Editor";

test("adding an external portal", async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TYPES } from "@planx/components/types";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { useFormik } from "formik";
import React from "react";
import ModalSection from "ui/editor/ModalSection";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TYPES } from "@planx/components/types";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { ICONS, InternalNotes, MoreInformation } from "@planx/components/ui";
import { useFormik } from "formik";
import React from "react";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Divider from "@mui/material/Divider";
import MenuItem from "@mui/material/MenuItem";
import { styled } from "@mui/material/styles";
import Typography from "@mui/material/Typography";
import { TYPES } from "@planx/components/types";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import {
EditorProps,
ICONS,
Expand Down
4 changes: 2 additions & 2 deletions editor.planx.uk/src/@planx/components/Filter/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
DEFAULT_FLAG_CATEGORY,
flatFlags,
} from "@opensystemslab/planx-core/types";
import { TYPES } from "@planx/components/types";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { useFormik } from "formik";
import React from "react";

Expand All @@ -29,7 +29,7 @@ const Filter: React.FC<Props> = (props) => {
]
.filter((f) => f.category === DEFAULT_FLAG_CATEGORY)
.map((f) => ({
type: TYPES.Response,
type: TYPES.Answer,
data: {
text: f.text,
val: f.value,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TYPES } from "@planx/components/types";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import {
EditorProps,
ICONS,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { fireEvent, screen, waitFor } from "@testing-library/react";
import React from "react";
import { axe, setup } from "testUtils";

import { TYPES } from "../types";
import InternalPortalForm from "./Editor";

describe("adding an internal portal", () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { useFormik } from "formik";
import React from "react";
import InputField from "ui/editor/InputField";

import { TYPES } from "../types";
import { FormError } from "../ui";

interface Flow {
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/@planx/components/NextSteps/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Box from "@mui/material/Box";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import type { NextSteps, Step } from "@planx/components/NextSteps/model";
import { parseNextSteps } from "@planx/components/NextSteps/model";
import { TYPES } from "@planx/components/types";
import {
EditorProps,
ICONS,
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/@planx/components/Notice/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import type { Notice } from "@planx/components/Notice/model";
import { parseNotice } from "@planx/components/Notice/model";
import { TYPES } from "@planx/components/types";
import { ICONS, InternalNotes, MoreInformation } from "@planx/components/ui";
import { useFormik } from "formik";
import React from "react";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import type { NumberInput } from "@planx/components/NumberInput/model";
import { parseNumberInput } from "@planx/components/NumberInput/model";
import { TYPES } from "@planx/components/types";
import {
EditorProps,
ICONS,
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/@planx/components/Pay/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Box from "@mui/material/Box";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { Pay, validationSchema } from "@planx/components/Pay/model";
import { parseMoreInformation } from "@planx/components/shared";
import { TYPES } from "@planx/components/types";
import { ICONS, InternalNotes, MoreInformation } from "@planx/components/ui";
import { useFormik } from "formik";
import React from "react";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { PaymentStatus } from "@opensystemslab/planx-core/types";
import { TYPES } from "@planx/components/types";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { screen } from "@testing-library/react";
import { FullStore, Store, vanillaStore } from "pages/FlowEditor/lib/store";
import React from "react";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TYPES } from "@planx/components/types";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { EditorProps, ICONS, InternalNotes } from "@planx/components/ui";
import { useFormik } from "formik";
import React from "react";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TYPES } from "@planx/components/types";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import {
EditorProps,
ICONS,
Expand Down
6 changes: 3 additions & 3 deletions editor.planx.uk/src/@planx/components/Question/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { useFormik } from "formik";
import React, { useEffect, useRef } from "react";
import ImgInput from "ui/editor/ImgInput";
Expand All @@ -12,7 +13,6 @@ import InputRowItem from "ui/shared/InputRowItem";

import { Option, parseMoreInformation } from "../shared";
import PermissionSelect from "../shared/PermissionSelect";
import { TYPES } from "../types";
import { ICONS, InternalNotes, MoreInformation } from "../ui";

interface Props {
Expand Down Expand Up @@ -126,7 +126,7 @@ const OptionEditor: React.FC<{
);

export const Question: React.FC<Props> = (props) => {
const type = TYPES.Statement;
const type = TYPES.Question;

const formik = useFormik({
initialValues: {
Expand All @@ -142,7 +142,7 @@ export const Question: React.FC<Props> = (props) => {
.filter((o) => o.data.text)
.map((o) => ({
id: o.id || undefined,
type: TYPES.Response,
type: TYPES.Answer,
data: o.data,
}));

Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/@planx/components/Result/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Box from "@mui/material/Box";
import Collapse from "@mui/material/Collapse";
import Typography from "@mui/material/Typography";
import { Flag, FlagSet, flatFlags } from "@opensystemslab/planx-core/types";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { useFormik } from "formik";
import groupBy from "lodash/groupBy";
import React, { useState } from "react";
Expand All @@ -10,7 +11,6 @@ import ModalSectionContent from "ui/editor/ModalSectionContent";
import Input from "ui/shared/Input";
import InputRow from "ui/shared/InputRow";

import { TYPES } from "../types";
import { ICONS } from "../ui";
import type { Result } from "./model";

Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/@planx/components/Review/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { useFormik } from "formik";
import React from "react";
import ModalSection from "ui/editor/ModalSection";
Expand All @@ -6,7 +7,6 @@ import RichTextInput from "ui/editor/RichTextInput";
import Input from "ui/shared/Input";
import InputRow from "ui/shared/InputRow";

import { TYPES } from "../types";
import { EditorProps, ICONS, InternalNotes } from "../ui";
import { parseContent, Review } from "./model";

Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/@planx/components/Section/Editor.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TYPES } from "@planx/components/types";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { EditorProps, ICONS, InternalNotes } from "@planx/components/ui";
import { useFormik } from "formik";
import React from "react";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { Meta, StoryObj } from "@storybook/react";
import { ComponentProps } from "react";
import { SectionNode } from "types";

import { TYPES } from "../types";
import { Root as Public } from "./Public";

const meta = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { TYPES } from "@planx/components/types";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { SectionNode, SectionStatus } from "types";

import { computeSectionStatuses } from "./model";
Expand Down
2 changes: 1 addition & 1 deletion editor.planx.uk/src/@planx/components/Send/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Warning from "@mui/icons-material/Warning";
import Box from "@mui/material/Box";
import Grid from "@mui/material/Grid";
import Typography from "@mui/material/Typography";
import { ComponentType as TYPES } from "@opensystemslab/planx-core/types";
import { getIn, useFormik } from "formik";
import React from "react";
import ModalSection from "ui/editor/ModalSection";
Expand All @@ -12,7 +13,6 @@ import Input from "ui/shared/Input";
import InputRow from "ui/shared/InputRow";
import { array, object } from "yup";

import { TYPES } from "../types";
import { EditorProps, ICONS } from "../ui";
import { Destination, Send } from "./model";
import { parseContent } from "./model";
Expand Down
Loading

0 comments on commit fd64c10

Please sign in to comment.