Skip to content

Commit

Permalink
fix: Always extend BaseNodeData, remove duplicate MoreInfo properties
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed Oct 3, 2024
1 parent 323bc62 commit 2159a1e
Show file tree
Hide file tree
Showing 8 changed files with 16 additions and 28 deletions.
9 changes: 2 additions & 7 deletions editor.planx.uk/src/@planx/components/Checklist/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Input from "ui/shared/Input";
import InputRow from "ui/shared/InputRow";
import InputRowItem from "ui/shared/InputRowItem";

import { Option, parseBaseNodeData } from "../shared";
import { BaseNodeData, Option, parseBaseNodeData } from "../shared";
import PermissionSelect from "../shared/PermissionSelect";
import { ICONS, InternalNotes, MoreInformation } from "../ui";
import type { Category, Checklist, Group } from "./model";
Expand All @@ -35,16 +35,11 @@ export interface ChecklistProps extends Checklist {
data?: {
allRequired?: boolean;
categories?: Array<Category>;
definitionImg?: string;
description?: string;
fn?: string;
howMeasured?: string;
img?: string;
info?: string;
notes?: string;
policyRef?: string;
text: string;
};
} & BaseNodeData;
};
}

Expand Down
4 changes: 3 additions & 1 deletion editor.planx.uk/src/@planx/components/Confirmation/model.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { BaseNodeData } from "../shared";

export interface Step {
title: string;
description: string;
}

export interface Confirmation {
export interface Confirmation extends BaseNodeData {
heading?: string;
description?: string;
color?: { text: string; background: string };
Expand Down
4 changes: 0 additions & 4 deletions editor.planx.uk/src/@planx/components/DrawBoundary/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ export interface DrawBoundary extends BaseNodeData {
hideFileUpload?: boolean;
dataFieldBoundary: string;
dataFieldArea: string;
info?: string;
policyRef?: string;
howMeasured?: string;
definitionImg?: string;
}

export const parseDrawBoundary = (
Expand Down
1 change: 0 additions & 1 deletion editor.planx.uk/src/@planx/components/Notice/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ export interface Notice extends BaseNodeData {
title: string;
description: string;
color: string;
notes?: string;
resetButton?: boolean;
}

Expand Down
9 changes: 2 additions & 7 deletions editor.planx.uk/src/@planx/components/Question/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,24 +11,19 @@ import Input from "ui/shared/Input";
import InputRow from "ui/shared/InputRow";
import InputRowItem from "ui/shared/InputRowItem";

import { Option, parseBaseNodeData } from "../shared";
import { BaseNodeData, Option, parseBaseNodeData } from "../shared";
import PermissionSelect from "../shared/PermissionSelect";
import { ICONS, InternalNotes, MoreInformation } from "../ui";

interface Props {
node: {
data?: {
definitionImg?: string;
description?: string;
fn?: string;
howMeasured?: string;
img?: string;
info?: string;
notes?: string;
policyRef?: string;
text: string;
type?: string;
};
} & BaseNodeData;
};
options?: Option[];
handleSubmit?: Function;
Expand Down
8 changes: 3 additions & 5 deletions editor.planx.uk/src/@planx/components/Question/model.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { Store } from "pages/FlowEditor/lib/store";
import { HandleSubmit } from "pages/Preview/Node";

export interface Question {
import { BaseNodeData } from "../shared";

export interface Question extends BaseNodeData {
id?: string;
text?: string;
description?: string;
info?: string;
policyRef?: string;
howMeasured?: string;
definitionImg?: string;
img?: string;
responses: {
id?: string;
Expand Down
4 changes: 3 additions & 1 deletion editor.planx.uk/src/@planx/components/Result/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import { Response } from "pages/FlowEditor/lib/store/preview";
import type { HandleSubmit } from "pages/Preview/Node";
import type { TextContent } from "types";

import { BaseNodeData } from "../shared";

export interface FlagDisplayText {
heading?: string;
description?: string;
}

export interface Result {
export interface Result extends BaseNodeData {
flagSet: FlagSet;
overrides?: { [flagId: string]: FlagDisplayText };
}
Expand Down
5 changes: 3 additions & 2 deletions editor.planx.uk/src/@planx/components/Review/model.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
export interface Review {
import { BaseNodeData } from "../shared";

export interface Review extends BaseNodeData {
title: string;
description: string;
notes: string;
}

export const parseContent = (
Expand Down

0 comments on commit 2159a1e

Please sign in to comment.