From dcf4f01e688d62ac3bfb264cec3ea1e091479ec2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn=20Otgaar?= Date: Wed, 28 Jan 2026 12:26:57 +0100 Subject: [PATCH] chore: replace plan editor functionality into own folder with own files. --- .../components/PlanEditor.tsx | 279 ------------------ .../components/PlanEditor/ActionAdder.tsx | 72 +++++ .../GestureValueEditor.module.css | 4 +- .../{ => PlanEditor}/GestureValueEditor.tsx | 0 .../{ => PlanEditor}/Plan.default.ts | 0 .../components/{ => PlanEditor}/Plan.tsx | 6 +- .../{ => PlanEditor}/PlanEditingFunctions.tsx | 5 +- .../{ => PlanEditor}/PlanEditor.module.css | 4 +- .../components/PlanEditor/PlanEditor.tsx | 214 ++++++++++++++ .../components/PlanEditor/StepList.tsx | 54 ++++ .../visualProgrammingUI/nodes/GoalNode.tsx | 8 +- .../visualProgrammingUI/nodes/TriggerNode.tsx | 8 +- .../components/GestureValueEditor.test.tsx | 2 +- .../components/PlanEditor.test.tsx | 6 +- .../nodes/GoalNode.test.tsx | 2 +- .../nodes/TriggerNode.test.tsx | 2 +- 16 files changed, 365 insertions(+), 301 deletions(-) delete mode 100644 src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor.tsx create mode 100644 src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/ActionAdder.tsx rename src/pages/VisProgPage/visualProgrammingUI/components/{ => PlanEditor}/GestureValueEditor.module.css (99%) rename src/pages/VisProgPage/visualProgrammingUI/components/{ => PlanEditor}/GestureValueEditor.tsx (100%) rename src/pages/VisProgPage/visualProgrammingUI/components/{ => PlanEditor}/Plan.default.ts (100%) rename src/pages/VisProgPage/visualProgrammingUI/components/{ => PlanEditor}/Plan.tsx (98%) rename src/pages/VisProgPage/visualProgrammingUI/components/{ => PlanEditor}/PlanEditingFunctions.tsx (95%) rename src/pages/VisProgPage/visualProgrammingUI/components/{ => PlanEditor}/PlanEditor.module.css (99%) create mode 100644 src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/PlanEditor.tsx create mode 100644 src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/StepList.tsx diff --git a/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor.tsx b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor.tsx deleted file mode 100644 index d0ee109..0000000 --- a/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor.tsx +++ /dev/null @@ -1,279 +0,0 @@ -// This program has been developed by students from the bachelor Computer Science at Utrecht -// University within the Software Project course. -// © Copyright Utrecht University (Department of Information and Computing Sciences) -import {useRef, useState} from "react"; -import useFlowStore from "../VisProgStores.tsx"; -import styles from './PlanEditor.module.css'; -import { GetActionValue, type Action, type ActionTypes, type Plan } from "../components/Plan"; -import { defaultPlan } from "../components/Plan.default"; -import { TextField } from "../../../../components/TextField"; -import GestureValueEditor from "./GestureValueEditor"; - -type PlanEditorDialogProps = { - plan?: Plan; - onSave: (plan: Plan | undefined) => void; - description? : string; -}; - - -/** - * Creates an action, as a step for a plan. - * @param type the type of action to build - * @param value the value of this action to build - * @param isGestureTag whether or not this action, restricted to gestures, is a tag. - * @returns An action - */ -function createAction( - type: ActionTypes, - value: string, - isGestureTag: boolean -): Action { - const id = crypto.randomUUID(); - - switch (type) { - case "speech": - return { id, text: value, type: "speech" }; - case "gesture": - return { id, gesture: value, isTag: isGestureTag, type: "gesture" }; - case "llm": - return { id, goal: value, type: "llm" }; - } -} - - -export default function PlanEditorDialog({ - plan, - onSave, - description, -}: PlanEditorDialogProps) { - // UseStates and references - const dialogRef = useRef(null); - const [draftPlan, setDraftPlan] = useState(null); - const [newActionType, setNewActionType] = useState("speech"); - const [newActionGestureType, setNewActionGestureType] = useState(true); - const [newActionValue, setNewActionValue] = useState(""); - const [hasInteractedWithPlan, setHasInteractedWithPlan] = useState(false) - const { setScrollable } = useFlowStore(); - const nodes = useFlowStore().nodes; - - //Button Actions - const openCreate = () => { - setScrollable(false); - setDraftPlan({...structuredClone(defaultPlan), id: crypto.randomUUID()}); - dialogRef.current?.showModal(); - }; - - const openCreateWithDescription = () => { - setScrollable(false); - setDraftPlan({...structuredClone(defaultPlan), id: crypto.randomUUID(), name: description!}); - setNewActionType("llm") - setNewActionValue(description!) - dialogRef.current?.showModal(); - } - - const openEdit = () => { - setScrollable(false); - if (!plan) return; - setDraftPlan(structuredClone(plan)); - dialogRef.current?.showModal(); - }; - - const close = () => { - setScrollable(true); - dialogRef.current?.close(); - setDraftPlan(null); - }; - - const buildAction = (): Action => { - const id = crypto.randomUUID(); - setHasInteractedWithPlan(true) - switch (newActionType) { - case "speech": - return { id, text: newActionValue, type: "speech" }; - case "gesture": - return { id, gesture: newActionValue, isTag: newActionGestureType, type: "gesture" }; - case "llm": - return { id, goal: newActionValue, type: "llm" }; - } - }; - - return (<> - {/* Create and edit buttons */} - {!plan && ( - - )} - {plan && ( - - )} - - {/* Start of dialog (plan editor) */} - e.stopPropagation()} - data-testid={"PlanEditorDialogTestID"} - > -
-

{draftPlan?.id === plan?.id ? "Edit Plan" : "Create Plan"}

- {/* Plan name text field */} - {draftPlan && ( - - setDraftPlan({ ...draftPlan, name })} - placeholder="Plan name" - data-testid="name_text_field"/> - )} - - {/* Entire "bottom" part (adder and steps) without cancel, confirm and reset */} - {draftPlan && (
-
- {/* Left Side (Action Adder) */} -

Add Action

- {(!plan && description && draftPlan.steps.length === 0 && !hasInteractedWithPlan) && (
- - -
)} - - - {/* Action value editor*/} - {newActionType === "gesture" ? ( - // Gesture get their own editor component - - ) : ( - - )} - - {/* Adding steps */} - -
- - {/* Right Side (Steps shown) */} -
-

Steps

- - {/* Show if there are no steps yet */} - {draftPlan.steps.length === 0 && ( -
- No steps yet -
- )} - - - {/* Map over all steps */} - {draftPlan.steps.map((step, index) => ( -
{ - if (e.key === "Enter" || e.key === " ") { - setDraftPlan({ - ...draftPlan, - steps: draftPlan.steps.filter((s) => s.id !== step.id),}); - }}} - onClick={() => { - setDraftPlan({ - ...draftPlan, - steps: draftPlan.steps.filter((s) => s.id !== step.id),}); - }}> - - {index + 1}. - {step.type}: - - { - // This just tries to find the goals name, i know it looks ugly:( - step.type === "goal" - ? ((nodes.find(x => x.id === step.id)?.data.name as string) == "" ? - "unnamed goal": (nodes.find(x => x.id === step.id)?.data.name as string)) - : (GetActionValue(step) ?? "")} - -
- ))} -
-
- )} - - {/* Buttons */} -
- {/* Close button */} - - - {/* Confirm/ Create button */} - - - {/* Reset button */} - -
- -
- -); -} \ No newline at end of file diff --git a/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/ActionAdder.tsx b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/ActionAdder.tsx new file mode 100644 index 0000000..fa91a87 --- /dev/null +++ b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/ActionAdder.tsx @@ -0,0 +1,72 @@ +import { TextField } from "../../../../../components/TextField"; +import GestureValueEditor from "./GestureValueEditor"; +import type { ActionTypes } from "./Plan"; +import styles from './PlanEditor.module.css'; + +type ActionAdderProps = { + newActionType: ActionTypes; + setNewActionType: (t: ActionTypes) => void; + newActionValue: string; + setNewActionValue: (v: string) => void; + setNewActionGestureType: (b: boolean) => void; + onAdd: () => void; + showSuggestion: boolean; +}; + + +export function ActionAdder({ + newActionType, + setNewActionType, + newActionValue, + setNewActionValue, + setNewActionGestureType, + onAdd, + showSuggestion, +}: ActionAdderProps) { + return ( +
+

Add Action

+ + {showSuggestion && ( +
+ + +
+ )} + + + + {newActionType === "gesture" ? ( + + ) : ( + + )} + + +
+ ); +} diff --git a/src/pages/VisProgPage/visualProgrammingUI/components/GestureValueEditor.module.css b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/GestureValueEditor.module.css similarity index 99% rename from src/pages/VisProgPage/visualProgrammingUI/components/GestureValueEditor.module.css rename to src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/GestureValueEditor.module.css index 442c862..fbc39dd 100644 --- a/src/pages/VisProgPage/visualProgrammingUI/components/GestureValueEditor.module.css +++ b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/GestureValueEditor.module.css @@ -1,8 +1,8 @@ -{/* +/* This program has been developed by students from the bachelor Computer Science at Utrecht University within the Software Project course. © Copyright Utrecht University (Department of Information and Computing Sciences) -*/} +*/ .gestureEditor { display: flex; flex-direction: column; diff --git a/src/pages/VisProgPage/visualProgrammingUI/components/GestureValueEditor.tsx b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/GestureValueEditor.tsx similarity index 100% rename from src/pages/VisProgPage/visualProgrammingUI/components/GestureValueEditor.tsx rename to src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/GestureValueEditor.tsx diff --git a/src/pages/VisProgPage/visualProgrammingUI/components/Plan.default.ts b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/Plan.default.ts similarity index 100% rename from src/pages/VisProgPage/visualProgrammingUI/components/Plan.default.ts rename to src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/Plan.default.ts diff --git a/src/pages/VisProgPage/visualProgrammingUI/components/Plan.tsx b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/Plan.tsx similarity index 98% rename from src/pages/VisProgPage/visualProgrammingUI/components/Plan.tsx rename to src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/Plan.tsx index 255354c..04f6fb3 100644 --- a/src/pages/VisProgPage/visualProgrammingUI/components/Plan.tsx +++ b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/Plan.tsx @@ -2,7 +2,7 @@ // University within the Software Project course. // © Copyright Utrecht University (Department of Information and Computing Sciences) import { type Node } from "@xyflow/react" -import { GoalReduce } from "../nodes/GoalNode" +import { GoalReduce } from "../../nodes/GoalNode" export type Plan = { @@ -124,4 +124,6 @@ export function GetActionValue(action: Action) { return returnAction.goal; default: } -} \ No newline at end of file +} + + diff --git a/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditingFunctions.tsx b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/PlanEditingFunctions.tsx similarity index 95% rename from src/pages/VisProgPage/visualProgrammingUI/components/PlanEditingFunctions.tsx rename to src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/PlanEditingFunctions.tsx index c683881..ddb26e7 100644 --- a/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditingFunctions.tsx +++ b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/PlanEditingFunctions.tsx @@ -2,7 +2,7 @@ // University within the Software Project course. // © Copyright Utrecht University (Department of Information and Computing Sciences) // This file is to avoid sharing both functions and components which eslint dislikes. :) -import type { GoalNode } from "../nodes/GoalNode" +import type { GoalNode } from "../../nodes/GoalNode" import type { Goal, Plan } from "./Plan" /** @@ -35,4 +35,5 @@ export function deleteGoalInPlanByID(plan: Plan, goalID: string) { steps: plan.steps.filter((x) => x.id !== goalID) } return updatedPlan.steps.length == 0 ? undefined : updatedPlan -} \ No newline at end of file +} + diff --git a/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor.module.css b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/PlanEditor.module.css similarity index 99% rename from src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor.module.css rename to src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/PlanEditor.module.css index 91e3f98..2c7a026 100644 --- a/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor.module.css +++ b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/PlanEditor.module.css @@ -1,8 +1,8 @@ -{/* +/* This program has been developed by students from the bachelor Computer Science at Utrecht University within the Software Project course. © Copyright Utrecht University (Department of Information and Computing Sciences) -*/} +*/ .planDialog { overflow:visible; width: 80vw; diff --git a/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/PlanEditor.tsx b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/PlanEditor.tsx new file mode 100644 index 0000000..4d85411 --- /dev/null +++ b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/PlanEditor.tsx @@ -0,0 +1,214 @@ +// This program has been developed by students from the bachelor Computer Science at Utrecht +// University within the Software Project course. +// © Copyright Utrecht University (Department of Information and Computing Sciences) +import {useRef, useState} from "react"; +import useFlowStore from "../../VisProgStores.tsx"; +import styles from './PlanEditor.module.css'; +import { type Action, type ActionTypes, type Plan } from "./Plan.tsx"; +import { defaultPlan } from "./Plan.default.ts"; +import { TextField } from "../../../../../components/TextField.tsx"; +import { StepsList } from "./StepList.tsx"; +import { ActionAdder } from "./ActionAdder.tsx"; + + + +type PlanEditorDialogProps = { + plan?: Plan; + onSave: (plan: Plan | undefined) => void; + description? : string; +}; + + +/** + * Creates an action, as a step for a plan. + * @param type the type of action to build + * @param value the value of this action to build + * @param isGestureTag whether or not this action, restricted to gestures, is a tag. + * @returns An action + */ +function buildAction( + type: ActionTypes, + value: string, + isGestureTag: boolean +): Action { + const id = crypto.randomUUID(); + + switch (type) { + case "speech": + return { id, text: value, type: "speech" }; + case "gesture": + return { id, gesture: value, isTag: isGestureTag, type: "gesture" }; + case "llm": + return { id, goal: value, type: "llm" }; + } +} + + + + + +export default function PlanEditorDialog({ + plan, + onSave, + description, +}: PlanEditorDialogProps) { + // UseStates and references + const dialogRef = useRef(null); + const [draftPlan, setDraftPlan] = useState(null); + const [newActionType, setNewActionType] = useState("speech"); + const [newActionGestureType, setNewActionGestureType] = useState(true); + const [newActionValue, setNewActionValue] = useState(""); + const [hasInteractedWithPlan, setHasInteractedWithPlan] = useState(false) + const { setScrollable } = useFlowStore(); + const nodes = useFlowStore().nodes; + + //Button Actions + const openCreate = () => { + setScrollable(false); + setDraftPlan({...structuredClone(defaultPlan), id: crypto.randomUUID()}); + dialogRef.current?.showModal(); + }; + + const openCreateWithDescription = () => { + setScrollable(false); + setDraftPlan({...structuredClone(defaultPlan), id: crypto.randomUUID(), name: description!}); + setNewActionType("llm") + setNewActionValue(description!) + dialogRef.current?.showModal(); + } + + const openEdit = () => { + setScrollable(false); + if (!plan) return; + setDraftPlan(structuredClone(plan)); + dialogRef.current?.showModal(); + }; + + const close = () => { + setScrollable(true); + dialogRef.current?.close(); + setDraftPlan(null); + }; + + const addAction = () => { + if (!draftPlan) return; + // Add action to steps + const action = buildAction(newActionType, newActionValue, newActionGestureType); + setDraftPlan({ + ...draftPlan, + steps: [...draftPlan.steps, action],}); + + // Reset current action building + setNewActionValue(""); + setNewActionType("speech"); + setHasInteractedWithPlan(true); + } + + + const showSuggestion : boolean = ( + !plan && + !!description && + draftPlan !== null && + draftPlan.steps.length === 0 && + !hasInteractedWithPlan) + + return (<> + {/* Create and edit buttons */} + {!plan && ( + + )} + {plan && ( + + )} + + {/* Start of dialog (plan editor) */} + e.stopPropagation()} + data-testid={"PlanEditorDialogTestID"} + > +
+

{draftPlan?.id === plan?.id ? "Edit Plan" : "Create Plan"}

+ {/* Plan name text field */} + {draftPlan && ( + + setDraftPlan({ ...draftPlan, name })} + placeholder="Plan name" + data-testid="name_text_field"/> + )} + + {/* Entire "bottom" part (adder and steps) without cancel, confirm and reset */} + {draftPlan && (
+
+ {/* Left Side (Action Adder) */} + +
+ + {/* Right Side (Steps shown) */} +
+

Steps

+ {/* Map over all steps */} + + setDraftPlan({ + ...draftPlan, + steps: draftPlan.steps.filter(s => s.id !== id), + }) + } + /> +
+
+ )} + + {/* Buttons */} +
+ {/* Close button */} + + + {/* Confirm/ Create button */} + + + {/* Reset button */} + +
+ +
+ +); +} \ No newline at end of file diff --git a/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/StepList.tsx b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/StepList.tsx new file mode 100644 index 0000000..70c4cfa --- /dev/null +++ b/src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/StepList.tsx @@ -0,0 +1,54 @@ +import { GetActionValue, type PlanElement } from "./Plan"; +import styles from './PlanEditor.module.css'; +import { type Node} from "@xyflow/react" + +type StepsListProps = { + steps: PlanElement[]; + onRemove: (id: string) => void; + nodes: Node[]; +}; + +function getStepLabel( + step: PlanElement, + nodes: Node[], +): string { + if (step.type === "goal") { + // For goals, we lookup the value through the nodes in the diagram + const node = nodes.find(n => n.id === step.id); + return (node?.data?.name as string)?.trim() || "unnamed goal"; + } + + // Not a goal, we lookup the correct action value of the action + return GetActionValue(step) ?? ""; +} + +export function StepsList({ steps, onRemove, nodes }: StepsListProps) { + if (steps.length === 0) { + return
No steps yet
; + } + + return ( + <> + {steps.map((step, index) => ( +
onRemove(step.id)} + onKeyDown={(e) => { + if (e.key === "Enter" || e.key === " ") { + onRemove(step.id); + } + }} + > + {index + 1}. + {step.type}: + + {getStepLabel(step, nodes)} + +
+ ))} + + ); +} diff --git a/src/pages/VisProgPage/visualProgrammingUI/nodes/GoalNode.tsx b/src/pages/VisProgPage/visualProgrammingUI/nodes/GoalNode.tsx index a225299..1ea2cf6 100644 --- a/src/pages/VisProgPage/visualProgrammingUI/nodes/GoalNode.tsx +++ b/src/pages/VisProgPage/visualProgrammingUI/nodes/GoalNode.tsx @@ -14,11 +14,11 @@ import { TextField } from '../../../../components/TextField'; import {MultiConnectionHandle} from "../components/RuleBasedHandle.tsx"; import {allowOnlyConnectionsFromHandle, allowOnlyConnectionsFromType} from "../HandleRules.ts"; import useFlowStore from '../VisProgStores'; -import {DoesPlanIterate, HasCheckingSubGoal, PlanReduce, type Plan } from '../components/Plan'; -import PlanEditorDialog from '../components/PlanEditor'; +import {DoesPlanIterate, HasCheckingSubGoal, PlanReduce, type Plan } from '../components/PlanEditor/Plan.tsx'; +import PlanEditorDialog from '../components/PlanEditor/PlanEditor.tsx'; import { MultilineTextField } from '../../../../components/MultilineTextField'; -import { defaultPlan } from '../components/Plan.default.ts'; -import { deleteGoalInPlanByID, insertGoalInPlan } from '../components/PlanEditingFunctions.tsx'; +import { defaultPlan } from '../components/PlanEditor/Plan.default.ts'; +import { deleteGoalInPlanByID, insertGoalInPlan } from '../components/PlanEditor/PlanEditingFunctions.tsx'; /** * The default data dot a phase node diff --git a/src/pages/VisProgPage/visualProgrammingUI/nodes/TriggerNode.tsx b/src/pages/VisProgPage/visualProgrammingUI/nodes/TriggerNode.tsx index 2bd3ebd..98a9abf 100644 --- a/src/pages/VisProgPage/visualProgrammingUI/nodes/TriggerNode.tsx +++ b/src/pages/VisProgPage/visualProgrammingUI/nodes/TriggerNode.tsx @@ -13,12 +13,12 @@ import styles from '../../VisProg.module.css'; import {MultiConnectionHandle, SingleConnectionHandle} from "../components/RuleBasedHandle.tsx"; import {allowOnlyConnectionsFromHandle, allowOnlyConnectionsFromType} from "../HandleRules.ts"; import useFlowStore from '../VisProgStores'; -import {PlanReduce, type Plan } from '../components/Plan'; -import PlanEditorDialog from '../components/PlanEditor'; +import {PlanReduce, type Plan } from '../components/PlanEditor/Plan.tsx'; +import PlanEditorDialog from '../components/PlanEditor/PlanEditor.tsx'; import {BeliefGlobalReduce} from "./BeliefGlobals.ts"; import type { GoalNode } from './GoalNode.tsx'; -import { defaultPlan } from '../components/Plan.default.ts'; -import { deleteGoalInPlanByID, insertGoalInPlan } from '../components/PlanEditingFunctions.tsx'; +import { defaultPlan } from '../components/PlanEditor/Plan.default.ts'; +import { deleteGoalInPlanByID, insertGoalInPlan } from '../components/PlanEditor/PlanEditingFunctions.tsx'; import { TextField } from '../../../../components/TextField.tsx'; /** diff --git a/test/pages/visProgPage/visualProgrammingUI/components/GestureValueEditor.test.tsx b/test/pages/visProgPage/visualProgrammingUI/components/GestureValueEditor.test.tsx index a171bdd..5db4807 100644 --- a/test/pages/visProgPage/visualProgrammingUI/components/GestureValueEditor.test.tsx +++ b/test/pages/visProgPage/visualProgrammingUI/components/GestureValueEditor.test.tsx @@ -4,7 +4,7 @@ import { useState } from 'react'; import userEvent from '@testing-library/user-event'; import { renderWithProviders, screen } from '../../../../test-utils/test-utils.tsx'; -import GestureValueEditor from '../../../../../src/pages/VisProgPage/visualProgrammingUI/components/GestureValueEditor'; +import GestureValueEditor from '../../../../../src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/GestureValueEditor.tsx'; function TestHarness({ initialValue = '', initialType=true, placeholder = 'Gesture name' } : { initialValue?: string, initialType?: boolean, placeholder?: string }) { const [value, setValue] = useState(initialValue); diff --git a/test/pages/visProgPage/visualProgrammingUI/components/PlanEditor.test.tsx b/test/pages/visProgPage/visualProgrammingUI/components/PlanEditor.test.tsx index 0dac0e2..9b427f1 100644 --- a/test/pages/visProgPage/visualProgrammingUI/components/PlanEditor.test.tsx +++ b/test/pages/visProgPage/visualProgrammingUI/components/PlanEditor.test.tsx @@ -6,12 +6,12 @@ import { screen, within } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import type { Node } from '@xyflow/react'; import { renderWithProviders } from '../../../../test-utils/test-utils.tsx'; -import PlanEditorDialog from '../../../../../src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor'; -import { PlanReduce, type Plan } from '../../../../../src/pages/VisProgPage/visualProgrammingUI/components/Plan'; +import PlanEditorDialog from '../../../../../src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/PlanEditor.tsx'; +import { PlanReduce, type Plan } from '../../../../../src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/Plan.tsx'; import '@testing-library/jest-dom'; import { GoalReduce, type GoalNodeData } from '../../../../../src/pages/VisProgPage/visualProgrammingUI/nodes/GoalNode.tsx'; import { GoalNodeDefaults } from '../../../../../src/pages/VisProgPage/visualProgrammingUI/nodes/GoalNode.default.ts'; -import { insertGoalInPlan } from '../../../../../src/pages/VisProgPage/visualProgrammingUI/components/PlanEditingFunctions.tsx'; +import { insertGoalInPlan } from '../../../../../src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/PlanEditingFunctions.tsx'; // Mock structuredClone diff --git a/test/pages/visProgPage/visualProgrammingUI/nodes/GoalNode.test.tsx b/test/pages/visProgPage/visualProgrammingUI/nodes/GoalNode.test.tsx index ad75aff..500ba1e 100644 --- a/test/pages/visProgPage/visualProgrammingUI/nodes/GoalNode.test.tsx +++ b/test/pages/visProgPage/visualProgrammingUI/nodes/GoalNode.test.tsx @@ -10,7 +10,7 @@ import useFlowStore from '../../../../../src/pages/VisProgPage/visualProgramming import type { Node } from '@xyflow/react'; import '@testing-library/jest-dom'; import { GoalNodeDefaults } from '../../../../../src/pages/VisProgPage/visualProgrammingUI/nodes/GoalNode.default.ts'; -import { defaultPlan } from '../../../../../src/pages/VisProgPage/visualProgrammingUI/components/Plan.default.ts'; +import { defaultPlan } from '../../../../../src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/Plan.default.ts'; describe('GoalNode', () => { let user: ReturnType; diff --git a/test/pages/visProgPage/visualProgrammingUI/nodes/TriggerNode.test.tsx b/test/pages/visProgPage/visualProgrammingUI/nodes/TriggerNode.test.tsx index a152f93..1fc2604 100644 --- a/test/pages/visProgPage/visualProgrammingUI/nodes/TriggerNode.test.tsx +++ b/test/pages/visProgPage/visualProgrammingUI/nodes/TriggerNode.test.tsx @@ -14,7 +14,7 @@ import type { Node } from '@xyflow/react'; import '@testing-library/jest-dom'; import { TriggerNodeDefaults } from '../../../../../src/pages/VisProgPage/visualProgrammingUI/nodes/TriggerNode.default.ts'; import { BasicBeliefNodeDefaults } from '../../../../../src/pages/VisProgPage/visualProgrammingUI/nodes/BasicBeliefNode.default.ts'; -import { defaultPlan } from '../../../../../src/pages/VisProgPage/visualProgrammingUI/components/Plan.default.ts'; +import { defaultPlan } from '../../../../../src/pages/VisProgPage/visualProgrammingUI/components/PlanEditor/Plan.default.ts'; import { NormNodeDefaults } from '../../../../../src/pages/VisProgPage/visualProgrammingUI/nodes/NormNode.default.ts'; import { GoalNodeDefaults } from '../../../../../src/pages/VisProgPage/visualProgrammingUI/nodes/GoalNode.default.ts'; import { act } from '@testing-library/react';