diff --git a/ReaAaS-N-frontend/README.md b/ReaAaS-N-frontend/README.md
new file mode 100644
index 0000000..511f209
--- /dev/null
+++ b/ReaAaS-N-frontend/README.md
@@ -0,0 +1,98 @@
+# ReaAaS-N Frontend
+
+## Overview
+
+This project contains the frontend user interfaces for the ReaAaS-N (Reactive Algorithm and Automata Simulation - Next-gen) platform. It includes tools for visual algorithm building and classical digital circuit design and simulation. The frontend is built using React, TypeScript, Vite, and Material-UI.
+
+## Features
+
+### Algorithm Builder
+
+* **Description:** A tool for visually creating, managing, and simulating linear algorithms. Users can define steps, reorder them via drag-and-drop, and observe a step-by-step visualization of the algorithm's execution. It also supports generating algorithm steps from natural language input by parsing multiline text.
+* **User Guide:** For detailed usage instructions, see the [Algorithm Builder User Guide](./docs/AlgorithmBuilderGuide.md).
+
+### Classical Circuit Designer
+
+* **Description:** A drag-and-drop interface for designing and simulating classical digital logic circuits. It supports basic logic gates (AND, OR, NOT), input sources (toggleable boolean values), and output sinks to observe results. The circuit state is simulated in real-time. Users can save their circuit designs to and load them from the browser's local storage.
+* **User Guide:** For detailed usage instructions, see the [Classical Circuit Designer User Guide](./docs/CircuitDesignerGuide.md).
+
+## Getting Started
+
+### Prerequisites
+
+* Node.js (version 18.x or higher recommended, as per project dependencies like Vite and React Router DOM v7)
+* npm (version 9.x or higher, typically comes with Node.js) or Yarn.
+
+### Installation
+
+1. Clone the repository (if you haven't already).
+2. Navigate to the `ReaAaS-N-frontend` directory:
+ ```bash
+ cd ReaAaS-N-frontend
+ ```
+3. Install the dependencies:
+ ```bash
+ npm install
+ ```
+ (or `yarn install` if you prefer Yarn)
+
+### Running the Development Server
+
+1. Ensure you are in the `ReaAaS-N-frontend` directory.
+2. Start the Vite development server:
+ ```bash
+ npm run dev
+ ```
+ (or `yarn dev`)
+3. Open your browser and navigate to the local URL provided (usually `http://localhost:5173` or a similar port).
+
+### Note on Backend
+
+This frontend is designed to be served by the `ReaAaS-N-backend` server, which also provides API functionalities (though current features are client-side focused). For full application behavior as intended in a complete deployment, ensure the `ReaAaS-N-backend` server is also set up and running. The backend typically serves the built frontend application from its `dist` folder and can be started on a different port (e.g., 3001).
+
+## Testing
+
+Unit and component tests are implemented using [Vitest](https://vitest.dev/) and [React Testing Library](https://testing-library.com/docs/react-testing-library/intro/).
+
+* **Running Tests:**
+ To run all tests in watch mode:
+ ```bash
+ npm test
+ ```
+ or
+ ```bash
+ npx vitest
+ ```
+ To run tests with a UI:
+ ```bash
+ npm run test:ui
+ ```
+ To generate a coverage report:
+ ```bash
+ npm run coverage
+ ```
+
+* **End-to-End (E2E) Testing:**
+ For guidelines on E2E testing scenarios and features to cover, please refer to the [E2E Test Scenarios document](./docs/E2E_Test_Scenarios.md).
+
+## Project Structure
+
+A brief overview of key directories within `ReaAaS-N-frontend`:
+
+* **`public/`**: Contains static assets that are directly copied to the build output (e.g., `index.html` template, favicons).
+* **`src/`**: Contains all the source code for the React application.
+ * **`components/`**: Reusable UI components.
+ * `CircuitDesigner/nodes/`: Custom node components for the Circuit Designer.
+ * `CircuitDesigner/PropertiesPanel.tsx`: The properties panel for the Circuit Designer.
+ * **`docs/`**: Contains user guides and design documents in Markdown format. (This is a project-specific documentation folder within `src` if it contains docs directly related to source, or at the root if more general. As created, it's in `ReaAaS-N-frontend/docs/` relative to the project root).
+ * **`pages/`**: Components representing full pages/views of the application (e.g., `AlgorithmBuilderPage.tsx`, `CircuitDesignerPage.tsx`).
+ * **`test/`**: Test setup files (e.g., `setup.ts` for Vitest).
+ * **`App.tsx`**: Main application component, handles routing and global layout.
+ * **`main.tsx`**: Entry point of the React application.
+ * **`theme.ts`**: MUI theme configuration.
+* **`vite.config.ts`**: Vite configuration file, including Vitest setup.
+* **`package.json`**: Project dependencies and scripts.
+* **`README.md`**: This file.
+
+(Note: The actual `docs` folder was created at `ReaAaS-N-frontend/docs/`, so links like `./docs/AlgorithmBuilderGuide.md` are correct relative to this README in the same directory.)
+```
diff --git a/ReaAaS-N-frontend/docs/AlgorithmBuilderGuide.md b/ReaAaS-N-frontend/docs/AlgorithmBuilderGuide.md
new file mode 100644
index 0000000..9056806
--- /dev/null
+++ b/ReaAaS-N-frontend/docs/AlgorithmBuilderGuide.md
@@ -0,0 +1,95 @@
+# Algorithm Builder User Guide
+
+## Overview
+
+Welcome to the Algorithm Builder! This tool is designed to help you create, visualize, and simulate linear algorithms step-by-step. You can define the logic of your algorithm, reorder steps, and watch a visual representation of its execution.
+
+## Accessing the Algorithm Builder
+
+To access the Algorithm Builder:
+1. Open the ReaAaS-N application in your web browser.
+2. Click on the **"Algorithm Builder"** link, typically found in the main navigation bar at the top of the page. This is usually the default page when the application loads.
+
+## Interface Overview
+
+The Algorithm Builder interface is composed of several key areas:
+
+* **New Step Input Field:**
+ * Located at the top of the main content area, labeled **"New Step Description"**.
+ * This is where you type the textual description for a new algorithm step.
+* **"Add Step" Button:**
+ * Positioned next to the "New Step Description" input field.
+ * Clicking this button adds the text from the input field as a new step to your algorithm.
+* **Algorithm Steps List:**
+ * This central area displays all the steps you've added to your algorithm.
+ * Each step is shown as a card with its sequential number and description.
+ * You can **drag-and-drop** these cards to reorder the steps.
+ * Each step card has a **"Delete"** button to remove it from the algorithm.
+* **Natural Language Input Area (AI Tools):**
+ * Labeled **"Generate Algorithm with AI"**. This is a text area where you can input multiple steps at once, typically by writing each step on a new line.
+ * The **"Generate with AI"** button below this text area processes the input. (Currently, this replaces all existing steps with the new ones from the text area).
+* **"Run Algorithm" Button:**
+ * A prominent button, usually below the steps list.
+ * Clicking this button starts the simulation of your algorithm.
+* **Algorithm Visualization Area:**
+ * Appears when you run an algorithm.
+ * This section displays the steps of your algorithm, highlighting the currently executing step.
+
+## Working with Algorithm Steps
+
+### Adding Steps Manually
+
+1. Locate the input field labeled **"New Step Description"**.
+2. Type the description of your algorithm step into this field (e.g., "Initialize variable X to 0").
+3. Click the **"Add Step"** button.
+4. The new step will appear in the Algorithm Steps List below, automatically numbered. The input field will be cleared, ready for your next step.
+
+### Reordering Steps
+
+1. In the Algorithm Steps List, identify the step you wish to move.
+2. Click and hold the mouse button down on the step card.
+3. Drag the card up or down to the desired new position in the list.
+4. Release the mouse button.
+5. The steps will re-number themselves automatically to reflect the new order.
+
+### Deleting Steps
+
+1. In the Algorithm Steps List, find the step you want to remove.
+2. On the right side of the step card, click the **"Delete"** button.
+3. The step will be removed from the list, and the remaining steps will be re-numbered.
+
+## Using Natural Language Input
+
+The Algorithm Builder provides a way to quickly create multiple steps using the "Generate Algorithm with AI" feature.
+
+1. Locate the text area labeled **"Generate Algorithm with AI"** (usually found under the "AI Tools" section).
+2. Type or paste your algorithm steps into this area. Each line of text you enter will become a distinct step.
+ *Example Input:*
+ ```
+ Start
+ Read input A
+ Read input B
+ If A > B, then print A
+ Else, print B
+ End
+ ```
+3. Click the **"Generate with AI"** button.
+4. **Important:** Currently, this action will **replace all existing steps** in your algorithm with the ones generated from the text area. Empty lines in your input will be ignored.
+5. The text area will be cleared after the steps are generated.
+
+## Running and Visualizing Your Algorithm
+
+Once you have defined the steps of your algorithm, you can simulate its execution:
+
+1. Ensure your algorithm steps are in the desired order.
+2. Click the **"Run Algorithm"** button.
+3. The button's text will change to **"Running Algorithm..."** (or similar) and it may become disabled during execution.
+4. The **Algorithm Visualization** area will become active.
+ * Each step of your algorithm will be highlighted sequentially as it "executes".
+ * There is a short delay between steps to allow you to observe the flow.
+5. Once the simulation completes (all steps have been highlighted):
+ * The **"Run Algorithm"** button will return to its original state and become enabled again.
+ * The highlighting in the visualization area will reset.
+
+This allows you to visually trace the flow of your algorithm and verify its logic. Happy building!
+```
diff --git a/ReaAaS-N-frontend/docs/CircuitDesignerGuide.md b/ReaAaS-N-frontend/docs/CircuitDesignerGuide.md
new file mode 100644
index 0000000..0d55ab7
--- /dev/null
+++ b/ReaAaS-N-frontend/docs/CircuitDesignerGuide.md
@@ -0,0 +1,120 @@
+# Classical Circuit Designer User Guide
+
+## Overview
+
+Welcome to the Classical Circuit Designer! This tool allows you to visually create, simulate, and manage digital logic circuits. You can build circuits using standard logic gates, input sources, and output sinks, then observe their behavior in real-time. You can also save your designs to your browser's local storage and load them back later.
+
+## Accessing the Circuit Designer
+
+To access the Classical Circuit Designer:
+1. Open the ReaAaS-N application in your web browser.
+2. Click on the **"Circuit Designer"** link, typically found in the main navigation bar at the top of the page.
+
+## Interface Overview
+
+The Circuit Designer interface is primarily composed of three main areas, along with save/load controls:
+
+* **Component Palette:**
+ * Located on the **left sidebar**.
+ * This palette lists the available classical logic components you can use to build your circuit:
+ * **Input Source:** Provides a boolean input (0 or 1, LOW or HIGH) that you can toggle.
+ * **Output Sink:** Displays a boolean output value from the circuit.
+ * **AND Gate:** Performs a logical AND operation.
+ * **OR Gate:** Performs a logical OR operation.
+ * **NOT Gate:** Performs a logical NOT (inversion) operation.
+* **Canvas:**
+ * The large central area of the page.
+ * This is your main workspace where you drag components and draw wires to build your circuit.
+ * You can pan (move around) and zoom within the canvas.
+* **Properties Panel:**
+ * Located on the **right sidebar**.
+ * When you select a component (node) on the canvas, this panel displays its properties, such as its ID, type, and an editable **Label**.
+* **Save/Load Buttons:**
+ * Located at the top-left of the canvas area.
+ * **"Save Circuit" Button:** Saves your current circuit design.
+ * **"Load Circuit" Button:** Loads a previously saved circuit design.
+
+## Building Your Circuit
+
+### Adding Components
+
+1. Locate the desired component in the **Component Palette** on the left.
+2. Click and hold the mouse button down on the component in the palette.
+3. Drag the component from the palette onto the **Canvas**.
+4. Release the mouse button to place the component on the canvas.
+5. You can add multiple instances of any component.
+
+### Wiring Components (Creating Edges)
+
+Components are connected using wires (also called edges) between their connection points (handles).
+
+1. Identify the components you want to connect on the canvas.
+2. Hover your mouse over a component; small circular **handles** will appear on its sides.
+ * Output handles (typically on the right side of a node) are where a signal originates.
+ * Input handles (typically on the left side of a node) are where a signal is received.
+3. Click and hold the mouse button on an output handle of one component.
+4. Drag the mouse to an input handle of another component.
+5. Release the mouse button when the target handle is highlighted (or when your cursor is over it).
+6. A wire will be drawn connecting the two handles. Wires are animated and typically colored (e.g., teal).
+
+### Interacting with Components
+
+* **Selecting Nodes/Wires:**
+ * Click on any component (node) or wire (edge) on the canvas to select it.
+ * Selected elements are usually highlighted. When a node is selected, its details appear in the **Properties Panel**.
+* **Moving Nodes:**
+ * Click and drag any component (node) on the canvas to move it to a new position.
+* **Deleting Nodes/Wires:**
+ 1. Select the node or wire you wish to delete by clicking on it.
+ 2. Press the **Delete** key or the **Backspace** key on your keyboard.
+ 3. The selected element will be removed. If you delete a node, any wires connected to it will also be automatically removed.
+
+### Editing Component Labels
+
+Each component on the canvas can have a custom label.
+
+1. Click on a component (node) on the canvas to select it.
+2. The **Properties Panel** on the right will update to show the properties of the selected node.
+3. Locate the **"Label"** field in the Properties Panel.
+4. Click into the "Label" text field and type your desired label (e.g., "Main Input A", "Final Output").
+5. The label change is saved automatically as you type. This label is part of the data saved with your circuit. (Note: The visual display of this label on the node itself depends on the specific custom node's design; currently, most nodes display their type or value rather than this editable data label).
+
+## Simulating Your Circuit
+
+The circuit simulation runs in real-time as you build and interact with it.
+
+* **Using `InputSourceNode`:**
+ * The `InputSourceNode` is your primary way to provide input to the circuit.
+ * It displays its current boolean value (0 for LOW/false, 1 for HIGH/true).
+ * Click the **Switch** control on the `InputSourceNode` to toggle its value between 0 and 1.
+* **Automatic Propagation:**
+ * When you change the value of an `InputSourceNode`, the change automatically propagates through the connected wires and logic gates.
+* **Observing the Simulation:**
+ * **`OutputSinkNode`:** Displays the final boolean value (0 or 1) it receives from its connected input. Its background color also changes (e.g., to a light green for '1' and light red for '0') to indicate its state.
+ * **Logic Gates (`AND`, `OR`, `NOT`):** These gates also visually indicate their current output value. They will display text like "Out: 1" or "Out: 0" and their background color will change similarly to the `OutputSinkNode` to reflect their output state.
+ * **Wires (Edges):** Wires are animated to suggest signal flow but do not change color based on the boolean value they carry.
+
+By toggling input sources and observing the outputs and intermediate gate states, you can test and verify the logic of your circuit design.
+
+## Saving and Loading Your Work
+
+You can save your circuit designs to your browser's local storage and load them back later.
+
+### Saving a Circuit
+
+1. Once you are happy with your circuit design, click the **"Save Circuit"** button located at the top-left of the canvas area.
+2. An alert message (e.g., "Circuit saved!") will appear to confirm that your circuit has been saved.
+3. Your circuit design, including the positions of all nodes, their connections (wires), their current data (like labels and input source values), and the current viewport (zoom and pan settings), is saved in your browser's local storage.
+
+### Loading a Circuit
+
+1. To load a previously saved circuit, click the **"Load Circuit"** button, also located at the top-left of the canvas area.
+2. If a saved circuit is found in your browser's local storage, it will be loaded onto the canvas.
+ * The nodes, wires, and their states will be restored.
+ * The viewport (pan and zoom) will also be restored to how it was when saved.
+ * An alert message (e.g., "Circuit loaded!") will confirm the load.
+3. If no saved circuit data is found, an alert message (e.g., "No saved circuit found.") will be displayed.
+4. After loading, the circuit is fully interactive, and the simulation will be active.
+
+This allows you to persist your work between sessions on the same browser.
+```
diff --git a/ReaAaS-N-frontend/docs/CircuitDesignerIntegrationIdeas.md b/ReaAaS-N-frontend/docs/CircuitDesignerIntegrationIdeas.md
new file mode 100644
index 0000000..a80219f
--- /dev/null
+++ b/ReaAaS-N-frontend/docs/CircuitDesignerIntegrationIdeas.md
@@ -0,0 +1,84 @@
+# Integration Ideas: Circuit Designer & Algorithm Builder
+
+This document outlines potential concepts for integrating the Classical Circuit Designer with the linear Algorithm Builder within the ReaAaS-N application.
+
+## 1. Circuit as a Custom Algorithm Step (Function Call)
+
+* **Description:**
+ A user could define a specific step type in the linear Algorithm Builder that represents an "execution" of a saved circuit from the Circuit Designer.
+ - When defining this step, the user would select a saved circuit.
+ - The UI would then allow mapping variables from the linear algorithm's current scope to the `InputSourceNode`s of the selected circuit.
+ - Upon execution of this step, the circuit simulation would run with the provided input values.
+ - The values from the circuit's `OutputSinkNode`s would then be mapped back to specified variables in the linear algorithm's scope.
+ - This effectively allows a circuit to act like a reusable function or a complex custom operation within the linear flow.
+
+* **Key Considerations/Challenges:**
+ * **Data Mapping UI:** Designing an intuitive UI to map algorithm variables to circuit inputs and circuit outputs back to algorithm variables. This could involve dropdowns, drag-and-drop, or a naming convention.
+ * **Circuit Identification:** How to reference/load saved circuits (e.g., by name, ID). Requires a save/load mechanism for circuits that is accessible to the Algorithm Builder.
+ * **Synchronous/Asynchronous Execution:** Decide if the circuit execution blocks the linear algorithm or if it can run asynchronously (more complex, but potentially useful for long-running simulations). For classical logic, synchronous is likely sufficient.
+ * **Parameter Passing:** Handling data types and ensuring compatibility between algorithm variables and circuit inputs/outputs (e.g., boolean for classical logic).
+ * **Error Handling:** What happens if a circuit fails to load or produces unexpected output?
+ * **Circuit Versioning:** If a saved circuit is updated, how does it affect algorithm steps that use it?
+
+## 2. Circuit for Conditional Logic ("If" Step Condition)
+
+* **Description:**
+ An "If" or "Conditional" step in the linear Algorithm Builder could use a classical circuit to determine its true/false condition.
+ - The user would select a saved circuit to act as the condition.
+ - One or more `OutputSinkNode`s in the circuit would be designated as the "result" or "condition met" output (e.g., a specific named sink, or the first sink).
+ - Inputs to this conditional circuit could be derived from algorithm variables or be constants defined within the circuit itself for the condition.
+ - When the "If" step is encountered, the circuit is simulated. If the designated output sink(s) evaluate to `true`, the "true" branch of the algorithm is taken; otherwise, the "false" branch (if it exists) is taken.
+
+* **Key Considerations/Challenges:**
+ * **Defining "Main" Output:** A clear way to specify which `OutputSinkNode`(s) in the circuit determine the conditional result (e.g., a single, specially named output like "conditional_out").
+ * **Real-time Evaluation:** The circuit would need to be evaluated efficiently each time the conditional step is reached.
+ * **Complexity of Condition:** This allows for very complex, multi-input boolean conditions to be visually designed and managed.
+ * **UI for Conditional Step:** The "If" step UI in the Algorithm Builder would need to accommodate circuit selection and potentially input mapping for the conditional circuit.
+ * **Debugging:** Visualizing the state of the conditional circuit during algorithm debugging would be beneficial.
+
+## 3. Global Signal Bus / Shared State
+
+* **Description:**
+ Introduce a "Global Signal Bus" or a shared state manager that both the Algorithm Builder and the Circuit Designer can interact with.
+ - **Algorithm Builder:** Steps in the linear algorithm could read the current state of named signals or write new values to them.
+ - **Circuit Designer:**
+ - `InputSourceNode`s could be configured to "subscribe" to a named signal on the bus, automatically updating their value when the signal changes.
+ - `OutputSinkNode`s could be configured to "publish" their value to a named signal on the bus whenever their simulated state changes.
+ - This allows for a looser coupling, where the Algorithm Builder might set up conditions or inputs, and the Circuit Designer reacts to them (or vice-versa) without a direct "call."
+
+* **Key Considerations/Challenges:**
+ * **State Management Complexity:** Managing a global state accessible by two distinct tools can become complex. Need a robust state management solution (e.g., Zustand, Redux, or a custom context).
+ * **Naming Conventions & Collisions:** Requires strict naming conventions for signals to avoid collisions.
+ * **Debugging & Traceability:** Understanding data flow and debugging issues can be harder with this indirect interaction compared to direct calls. Visual tools to inspect signal states would be essential.
+ * **Race Conditions/Update Loops:** Potential for creating unintended update loops if, for example, a circuit output updates a signal that then feeds back into its own input via the algorithm. Careful design of update propagation is needed.
+ * **User Interface:** UI elements would be needed to configure signal subscriptions/publications for nodes and algorithm steps.
+
+## 4. Event-Driven Execution via Circuit Triggers
+
+* **Description:**
+ Specific `OutputSinkNode`s in a circuit could be designated as "trigger" outputs. When such an output changes its state (e.g., goes from `false` to `true`), it emits an event.
+ - The Algorithm Builder could have "Event Listener" steps that wait for specific events (emitted by circuit triggers) to proceed.
+ - This allows a circuit to signal the linear algorithm to perform actions or continue its flow based on internal circuit logic reaching a certain state.
+ - For example, a circuit might monitor several inputs, and only when a complex condition is met (triggering a specific output sink), does the linear algorithm advance.
+
+* **Key Considerations/Challenges:**
+ * **Event Naming and Management:** A system for defining and managing event names.
+ * **Listener Configuration:** UI for Algorithm Builder steps to subscribe to specific circuit events.
+ * **Circuit State Persistence:** The circuit might need to maintain its state independently for triggers to be meaningful over time.
+ * **Multiple Triggers:** Handling scenarios where multiple triggers might fire, or the order of events matters.
+ * **Debugging:** Tracing event flows and understanding why an algorithm did or did not proceed.
+
+## 5. Direct Visual Embedding of Circuit Logic
+
+* **Description:**
+ A step in the linear Algorithm Builder could allow for the direct embedding of a small, self-contained classical circuit.
+ - Instead of "calling" a saved circuit, the user would design or paste a small circuit directly into a modal or expanded view associated with that algorithm step.
+ - This circuit would have clearly defined input and output connection points that map to the algorithm step's local variables or flow.
+ - This is suitable for small, step-specific logic that benefits from visual representation but doesn't warrant a full, separate, saved circuit.
+
+* **Key Considerations/Challenges:**
+ * **UI Complexity:** Embedding a fully interactive React Flow canvas within another UI (the Algorithm Builder step) can be complex to implement and manage.
+ * **Performance:** Multiple embedded React Flow instances could impact performance if not carefully managed.
+ * **Scope and Reusability:** These embedded circuits would likely be less reusable than globally saved circuits.
+ * **Data Serialization:** The definition of this embedded circuit would need to be saved as part of the algorithm step's data.
+ * **Interaction Model:** Defining how the user interacts with the embedded mini-designer versus the main algorithm builder.
diff --git a/ReaAaS-N-frontend/docs/E2E_Test_Scenarios.md b/ReaAaS-N-frontend/docs/E2E_Test_Scenarios.md
new file mode 100644
index 0000000..d13fd9b
--- /dev/null
+++ b/ReaAaS-N-frontend/docs/E2E_Test_Scenarios.md
@@ -0,0 +1,173 @@
+# End-to-End Test Scenarios
+
+This document outlines End-to-End (E2E) test scenarios for the ReaAaS-N frontend application, covering the Algorithm Builder and the Circuit Designer.
+
+## Algorithm Builder
+
+### Scenario: Manual Step Management
+
+* **Title:** User can add, reorder, and delete algorithm steps manually.
+* **Steps to Perform:**
+ 1. Navigate to the Algorithm Builder.
+ 2. In the "New Step Description" input, type "Step 1" and click "Add Step".
+ 3. Type "Step 2" and click "Add Step".
+ 4. Type "Step 3" and click "Add Step".
+ 5. Verify "Step 1", "Step 2", "Step 3" appear in order.
+ 6. Drag "Step 3" and drop it before "Step 2".
+ 7. Verify the order is now "Step 1", "Step 3", "Step 2".
+ 8. Click the "Delete" button for "Step 3" (which is now in the middle).
+ 9. Verify the order is now "Step 1", "Step 2" and "Step 3" is gone.
+ 10. Click the "Delete" button for "Step 2" (which is now the last step).
+ 11. Verify only "Step 1" remains.
+ 12. Add "Step 4". Click the "Delete" button for "Step 1".
+ 13. Verify only "Step 4" (now numbered as "1. Step 4") remains.
+* **Expected Outcomes:**
+ * Steps are added to the list with correct numbering and content.
+ * Input field clears after adding a step.
+ * Steps can be reordered via drag-and-drop, and the numbering updates.
+ * Specific steps are removed when their delete button is clicked, and the list re-numbers correctly.
+
+### Scenario: Natural Language Step Generation (Multiline)
+
+* **Title:** User can generate multiple algorithm steps from multiline text input.
+* **Steps to Perform:**
+ 1. Navigate to the Algorithm Builder.
+ 2. Add a few initial steps manually (e.g., "Old Step 1", "Old Step 2").
+ 3. In the "Generate Algorithm with AI" text area, enter the following text (including newlines and empty lines):
+ ```
+ First generated step
+ Second generated step
+
+ Third generated step
+ ```
+ 4. Click the "Generate with AI" button.
+* **Expected Outcomes:**
+ * The existing "Old Step 1" and "Old Step 2" are removed from the list.
+ * The new steps are populated as:
+ 1. "First generated step"
+ 2. "Second generated step"
+ 3. "Third generated step"
+ * Empty lines from the input are ignored.
+ * The "Generate Algorithm with AI" text area is cleared after generation.
+
+### Scenario: Algorithm Execution and Visualization
+
+* **Title:** User can run an algorithm and see the execution visualized.
+* **Steps to Perform:**
+ 1. Navigate to the Algorithm Builder.
+ 2. Add three steps: "Step A", "Step B", "Step C".
+ 3. Click the "Run Algorithm" button.
+* **Expected Outcomes:**
+ * The "Run Algorithm" button text changes to "Running Algorithm..." and becomes disabled.
+ * The "Algorithm Visualization" area shows "Step A" highlighted (e.g., different background color).
+ * After a short delay (e.g., 1 second), "Step B" is highlighted, and "Step A" returns to normal.
+ * After another delay, "Step C" is highlighted, and "Step B" returns to normal.
+ * After the final step, all steps return to normal highlighting.
+ * The "Run Algorithm" button text reverts to "Run Algorithm" and becomes enabled.
+ * The `currentStep` state (if observable through dev tools or specific UI indicators not yet present) should cycle through 0, 1, 2, then -1.
+
+## Circuit Designer
+
+### Scenario: Full Circuit Creation and Simulation (AND Gate)
+
+* **Title:** User can create, wire, and simulate a simple AND gate circuit.
+* **Steps to Perform:**
+ 1. Navigate to the Circuit Designer page.
+ 2. Drag an "Input Source" component from the palette onto the canvas.
+ 3. Drag another "Input Source" component onto the canvas.
+ 4. Drag an "AND Gate" component onto the canvas.
+ 5. Drag an "Output Sink" component onto the canvas.
+ 6. Connect the first Input Source's output handle to the 'a' input handle of the AND gate.
+ 7. Connect the second Input Source's output handle to the 'b' input handle of the AND gate.
+ 8. Connect the AND gate's output handle to the Output Sink's input handle.
+ 9. Verify initial state: Input Sources show "0", AND gate output shows "0", Output Sink shows "0".
+ 10. Toggle the first Input Source to "1". Verify Output Sink still shows "0".
+ 11. Toggle the first Input Source back to "0". Toggle the second Input Source to "1". Verify Output Sink still shows "0".
+ 12. Toggle the first Input Source to "1" (so both inputs are "1"). Verify Output Sink now shows "1".
+ 13. Toggle the second Input Source to "0". Verify Output Sink returns to "0".
+ 14. Select the first Input Source node. In the Properties Panel, change its label to "Input A". Verify the label updates (if custom nodes display labels, otherwise this verifies data update).
+* **Expected Outcomes:**
+ * Nodes are correctly placed on the canvas.
+ * Edges (wires) can be drawn and connect to the correct handles.
+ * The Input Source nodes correctly display their value (0/1) and can be toggled.
+ * The AND gate node displays its calculated output value.
+ * The Output Sink node displays the final value from the AND gate.
+ * The circuit correctly implements AND logic for all four input combinations (00->0, 01->0, 10->0, 11->1).
+ * Node labels can be edited in the Properties Panel, and the changes are reflected in the node's data.
+
+### Scenario: Deleting Elements
+
+* **Title:** User can delete nodes and edges from the circuit.
+* **Steps to Perform:**
+ 1. Navigate to the Circuit Designer.
+ 2. Create a simple circuit (e.g., Input -> NOT -> Output).
+ 3. Select the edge between the Input Source and the NOT gate. Press the "Delete" or "Backspace" key.
+ 4. Verify the edge is removed.
+ 5. Select the NOT gate node. Press the "Delete" or "Backspace" key.
+ 6. Verify the NOT gate node is removed.
+ 7. Verify any edges connected to the deleted NOT gate are also removed.
+* **Expected Outcomes:**
+ * Selected edges are removed using keyboard delete.
+ * Selected nodes are removed using keyboard delete.
+ * When a node is deleted, all edges connected to it are automatically removed.
+
+### Scenario: Save and Load Circuit
+
+* **Title:** User can save a circuit to local storage and load it back.
+* **Steps to Perform:**
+ 1. Navigate to the Circuit Designer.
+ 2. Create a circuit (e.g., two Input Sources, one OR gate, one Output Sink, wired appropriately). Label one input "MyInput1". Toggle its value to "1".
+ 3. Adjust the zoom and pan (viewport).
+ 4. Click the "Save Circuit" button.
+ 5. (Conceptually, refresh the page or clear current state by deleting all nodes/edges if no hard refresh E2E command is available). For a test, this might involve re-navigating or triggering a component reset.
+ 6. Click the "Load Circuit" button.
+ 7. Verify the circuit (nodes with their labels and values, edges, viewport position/zoom) is restored to the saved state.
+ 8. Toggle the "MyInput1" (which should be "1"). Verify it changes to "0" and the OR gate simulation updates correctly.
+* **Expected Outcomes:**
+ * An alert "Circuit saved!" appears after saving.
+ * An alert "Circuit loaded!" appears after loading.
+ * The exact same nodes, their positions, their data (including labels and current values for Input Sources), and edges are restored.
+ * The viewport (pan and zoom) is restored.
+ * The loaded circuit is fully interactive, and the simulation works correctly (e.g., toggling an input propagates changes).
+
+### Scenario: Complex Propagation
+
+* **Title:** Simulation correctly propagates signals through a chain of multiple logic gates.
+* **Steps to Perform:**
+ 1. Navigate to the Circuit Designer.
+ 2. Create the following circuit:
+ * Input Source A (INA)
+ * Input Source B (INB)
+ * Input Source C (INC)
+ * NOT Gate (NOT1) connected to INA.
+ * AND Gate (AND1) with inputs from NOT1 (output) and INB.
+ * OR Gate (OR1) with inputs from AND1 (output) and INC.
+ * Output Sink (OUT1) connected to OR1 (output).
+ 3. Test various input combinations for INA, INB, INC and verify OUT1:
+ * INA=0, INB=0, INC=0: (NOT1=1, AND1(1,0)=0, OR1(0,0)=0) -> OUT1=0
+ * INA=1, INB=1, INC=0: (NOT1=0, AND1(0,1)=0, OR1(0,0)=0) -> OUT1=0
+ * INA=0, INB=1, INC=0: (NOT1=1, AND1(1,1)=1, OR1(1,0)=1) -> OUT1=1
+ * INA=0, INB=1, INC=1: (NOT1=1, AND1(1,1)=1, OR1(1,1)=1) -> OUT1=1
+ * INA=1, INB=0, INC=1: (NOT1=0, AND1(0,0)=0, OR1(0,1)=1) -> OUT1=1
+* **Expected Outcomes:**
+ * The OUT1 Output Sink displays the correct final boolean value for each combination of inputs, demonstrating correct signal propagation through the chain of NOT, AND, and OR gates.
+ * Intermediate gate outputs (if made visible or inferable) should also be correct.
+
+## General Navigation
+
+### Scenario: Navigation Between Tools
+
+* **Title:** User can navigate between the Algorithm Builder and Circuit Designer pages.
+* **Steps to Perform:**
+ 1. Start on the Algorithm Builder page (e.g., root URL).
+ 2. Verify unique content of Algorithm Builder is visible.
+ 3. Click the "Circuit Designer" navigation link/button in the AppBar.
+ 4. Verify the Circuit Designer page is displayed (e.g., palette, React Flow canvas).
+ 5. Click the "Algorithm Builder" navigation link/button in the AppBar.
+ 6. Verify the Algorithm Builder page is displayed again.
+* **Expected Outcomes:**
+ * The application correctly navigates to the selected page.
+ * The content specific to each page (Algorithm Builder UI or Circuit Designer UI) is rendered.
+ * **Advanced/Optional:** The state of each tool (e.g., steps in Algorithm Builder, nodes/edges in Circuit Designer) is preserved when navigating away and then back to it during the same session. (This might depend on implementation details like Redux, Zustand, or component state persistence strategies).
+
+```
diff --git a/ReaAaS-N-frontend/package-lock.json b/ReaAaS-N-frontend/package-lock.json
index c63f00a..314c07c 100644
--- a/ReaAaS-N-frontend/package-lock.json
+++ b/ReaAaS-N-frontend/package-lock.json
@@ -12,25 +12,40 @@
"@emotion/styled": "^11.14.0",
"@mui/material": "^7.1.0",
"@types/uuid": "^10.0.0",
+ "@xyflow/react": "^12.6.4",
"dotenv": "^16.5.0",
"react": "^18.2.0",
"react-beautiful-dnd": "^13.1.1",
"react-dom": "^18.2.0",
+ "react-router-dom": "^7.6.1",
"uuid": "^11.1.0"
},
"devDependencies": {
+ "@testing-library/jest-dom": "^6.6.3",
+ "@testing-library/react": "^16.3.0",
+ "@testing-library/user-event": "^14.6.1",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vitejs/plugin-react": "^4.0.3",
+ "@vitest/ui": "^3.1.4",
"eslint": "^8.45.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
+ "jsdom": "^26.1.0",
"typescript": "^5.0.2",
- "vite": "^6.3.5"
+ "vite": "^4.4.5",
+ "vitest": "^3.1.4"
}
},
+ "node_modules/@adobe/css-tools": {
+ "version": "4.4.3",
+ "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.4.3.tgz",
+ "integrity": "sha512-VQKMkwriZbaOgVCby1UDY/LDk5fIjhQicCvVPFqfe+69fWaPWydbWJ3wRt59/YzIwda1I81loas3oCoHxnqvdA==",
+ "dev": true
+ }
+ },
"node_modules/@ampproject/remapping": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.3.0.tgz",
@@ -44,6 +59,26 @@
"node": ">=6.0.0"
}
},
+
+ "node_modules/@asamuzakjp/css-color": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/@asamuzakjp/css-color/-/css-color-3.2.0.tgz",
+ "integrity": "sha512-K1A6z8tS3XsmCMM86xoWdn7Fkdn9m6RSVtocUrJYIwZnFVkng/PvkEoWtOWmP+Scc6saYWHWZYbndEEXxl24jw==",
+ "dev": true,
+ "dependencies": {
+ "@csstools/css-calc": "^2.1.3",
+ "@csstools/css-color-parser": "^3.0.9",
+ "@csstools/css-parser-algorithms": "^3.0.4",
+ "@csstools/css-tokenizer": "^3.0.3",
+ "lru-cache": "^10.4.3"
+ }
+ },
+ "node_modules/@asamuzakjp/css-color/node_modules/lru-cache": {
+ "version": "10.4.3",
+ "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.4.3.tgz",
+ "integrity": "sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==",
+ "dev": true
+ },
"node_modules/@babel/code-frame": {
"version": "7.27.1",
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.27.1.tgz",
@@ -315,6 +350,116 @@
"node": ">=6.9.0"
}
},
+ "node_modules/@csstools/color-helpers": {
+ "version": "5.0.2",
+ "resolved": "https://registry.npmjs.org/@csstools/color-helpers/-/color-helpers-5.0.2.tgz",
+ "integrity": "sha512-JqWH1vsgdGcw2RR6VliXXdA0/59LttzlU8UlRT/iUUsEeWfYq8I+K0yhihEUTTHLRm1EXvpsCx3083EU15ecsA==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/csstools"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/csstools"
+ }
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@csstools/css-calc": {
+ "version": "2.1.4",
+ "resolved": "https://registry.npmjs.org/@csstools/css-calc/-/css-calc-2.1.4.tgz",
+ "integrity": "sha512-3N8oaj+0juUw/1H3YwmDDJXCgTB1gKU6Hc/bB502u9zR0q2vd786XJH9QfrKIEgFlZmhZiq6epXl4rHqhzsIgQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/csstools"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/csstools"
+ }
+ ],
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@csstools/css-parser-algorithms": "^3.0.5",
+ "@csstools/css-tokenizer": "^3.0.4"
+ }
+ },
+ "node_modules/@csstools/css-color-parser": {
+ "version": "3.0.10",
+ "resolved": "https://registry.npmjs.org/@csstools/css-color-parser/-/css-color-parser-3.0.10.tgz",
+ "integrity": "sha512-TiJ5Ajr6WRd1r8HSiwJvZBiJOqtH86aHpUjq5aEKWHiII2Qfjqd/HCWKPOW8EP4vcspXbHnXrwIDlu5savQipg==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/csstools"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/csstools"
+ }
+ ],
+ "dependencies": {
+ "@csstools/color-helpers": "^5.0.2",
+ "@csstools/css-calc": "^2.1.4"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@csstools/css-parser-algorithms": "^3.0.5",
+ "@csstools/css-tokenizer": "^3.0.4"
+ }
+ },
+ "node_modules/@csstools/css-parser-algorithms": {
+ "version": "3.0.5",
+ "resolved": "https://registry.npmjs.org/@csstools/css-parser-algorithms/-/css-parser-algorithms-3.0.5.tgz",
+ "integrity": "sha512-DaDeUkXZKjdGhgYaHNJTV9pV7Y9B3b644jCLs9Upc3VeNGg6LWARAT6O+Q+/COo+2gg/bM5rhpMAtf70WqfBdQ==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/csstools"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/csstools"
+ }
+ ],
+ "engines": {
+ "node": ">=18"
+ },
+ "peerDependencies": {
+ "@csstools/css-tokenizer": "^3.0.4"
+ }
+ },
+ "node_modules/@csstools/css-tokenizer": {
+ "version": "3.0.4",
+ "resolved": "https://registry.npmjs.org/@csstools/css-tokenizer/-/css-tokenizer-3.0.4.tgz",
+ "integrity": "sha512-Vd/9EVDiu6PPJt9yAh6roZP6El1xHrdvIVGjyBsHR0RYwNHgL7FJPyIIW4fANJNG6FtyZfvlRPpFI4ZM/lubvw==",
+ "dev": true,
+ "funding": [
+ {
+ "type": "github",
+ "url": "https://github.com/sponsors/csstools"
+ },
+ {
+ "type": "opencollective",
+ "url": "https://opencollective.com/csstools"
+ }
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/@emotion/babel-plugin": {
"version": "11.13.5",
"resolved": "https://registry.npmjs.org/@emotion/babel-plugin/-/babel-plugin-11.13.5.tgz",
@@ -471,6 +616,7 @@
}
},
"node_modules/@esbuild/android-arm": {
+
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.5.tgz",
"integrity": "sha512-AdJKSPeEHgi7/ZhuIPtcQKr5RQdo6OO2IL87JkianiMYMPbCtot9fxPbrMiBADOWWm3T2si9stAiVsGbTQFkbA==",
@@ -530,6 +676,7 @@
],
"dev": true,
"license": "MIT",
+
"optional": true,
"os": [
"darwin"
@@ -558,7 +705,7 @@
"node_modules/@esbuild/freebsd-arm64": {
"version": "0.25.5",
"resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.5.tgz",
- "integrity": "sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw==",
+ "integrity": "sha512-nk4tGP3JThz4La38Uy/gzyXtpkPW8zSAmoUhK9xKKXdBCzKODMc2adkB2+8om9BDYugz+uGV7sLmpTYzvmz6Sw==",>>>>>>> PaQBoT
"cpu": [
"arm64"
],
@@ -750,7 +897,6 @@
"arm64"
],
"dev": true,
- "license": "MIT",
"optional": true,
"os": [
"netbsd"
@@ -784,7 +930,6 @@
"arm64"
],
"dev": true,
- "license": "MIT",
"optional": true,
"os": [
"openbsd"
@@ -875,6 +1020,7 @@
"win32"
],
"engines": {
+
"node": ">=18"
}
},
@@ -3922,6 +4068,225 @@
}
},
"node_modules/vite": {
+ "os": [
+ "netbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/openbsd-x64": {
+ "version": "0.25.5",
+ "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.5.tgz",
+ "integrity": "sha512-G4hE405ErTWraiZ8UiSoesH8DaCsMm0Cay4fsFWOOUcz8b8rC6uCvnagr+gnioEjWn0wC+o1/TAHt+It+MpIMg==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "openbsd"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/sunos-x64": {
+ "version": "0.25.5",
+ "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.5.tgz",
+ "integrity": "sha512-l+azKShMy7FxzY0Rj4RCt5VD/q8mG/e+mDivgspo+yL8zW7qEwctQ6YqKX34DTEleFAvCIUviCFX1SDZRSyMQA==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "sunos"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/win32-arm64": {
+ "version": "0.25.5",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.5.tgz",
+ "integrity": "sha512-O2S7SNZzdcFG7eFKgvwUEZ2VG9D/sn/eIiz8XRZ1Q/DO5a3s76Xv0mdBzVM5j5R639lXQmPmSo0iRpHqUUrsxw==",
+ "cpu": [
+ "arm64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/win32-ia32": {
+ "version": "0.25.5",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.5.tgz",
+ "integrity": "sha512-onOJ02pqs9h1iMJ1PQphR+VZv8qBMQ77Klcsqv9CNW2w6yLqoURLcgERAIurY6QE63bbLuqgP9ATqajFLK5AMQ==",
+ "cpu": [
+ "ia32"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@esbuild/win32-x64": {
+ "version": "0.25.5",
+ "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.5.tgz",
+ "integrity": "sha512-TXv6YnJ8ZMVdX+SXWVBo/0p8LTcrUYngpWjvm91TMjjBQii7Oz11Lw5lbDV5Y0TzuhSJHwiH4hEtC1I42mMS0g==",
+ "cpu": [
+ "x64"
+ ],
+ "dev": true,
+ "optional": true,
+ "os": [
+ "win32"
+ ],
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/vitest/node_modules/@vitest/mocker": {
+ "version": "3.1.4",
+ "resolved": "https://registry.npmjs.org/@vitest/mocker/-/mocker-3.1.4.tgz",
+ "integrity": "sha512-8IJ3CvwtSw/EFXqWFL8aCMu+YyYXG2WUSrQbViOZkWTKTVicVwZ/YiEZDSqD00kX+v/+W+OnxhNWoeVKorHygA==",
+ "dev": true,
+ "dependencies": {
+ "@vitest/spy": "3.1.4",
+ "estree-walker": "^3.0.3",
+ "magic-string": "^0.30.17"
+ },
+ "funding": {
+ "url": "https://opencollective.com/vitest"
+ },
+ "peerDependencies": {
+ "msw": "^2.4.9",
+ "vite": "^5.0.0 || ^6.0.0"
+ },
+ "peerDependenciesMeta": {
+ "msw": {
+ "optional": true
+ },
+ "vite": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/vitest/node_modules/esbuild": {
+ "version": "0.25.5",
+ "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.5.tgz",
+ "integrity": "sha512-P8OtKZRv/5J5hhz0cUAdu/cLuPIKXpQl1R9pZtvmHWQvrAUVd0UNIPT4IB4W3rNOqVO0rlqHmCIbSwxh/c9yUQ==",
+ "dev": true,
+ "hasInstallScript": true,
+ "bin": {
+ "esbuild": "bin/esbuild"
+ },
+ "engines": {
+ "node": ">=18"
+ },
+ "optionalDependencies": {
+ "@esbuild/aix-ppc64": "0.25.5",
+ "@esbuild/android-arm": "0.25.5",
+ "@esbuild/android-arm64": "0.25.5",
+ "@esbuild/android-x64": "0.25.5",
+ "@esbuild/darwin-arm64": "0.25.5",
+ "@esbuild/darwin-x64": "0.25.5",
+ "@esbuild/freebsd-arm64": "0.25.5",
+ "@esbuild/freebsd-x64": "0.25.5",
+ "@esbuild/linux-arm": "0.25.5",
+ "@esbuild/linux-arm64": "0.25.5",
+ "@esbuild/linux-ia32": "0.25.5",
+ "@esbuild/linux-loong64": "0.25.5",
+ "@esbuild/linux-mips64el": "0.25.5",
+ "@esbuild/linux-ppc64": "0.25.5",
+ "@esbuild/linux-riscv64": "0.25.5",
+ "@esbuild/linux-s390x": "0.25.5",
+ "@esbuild/linux-x64": "0.25.5",
+ "@esbuild/netbsd-arm64": "0.25.5",
+ "@esbuild/netbsd-x64": "0.25.5",
+ "@esbuild/openbsd-arm64": "0.25.5",
+ "@esbuild/openbsd-x64": "0.25.5",
+ "@esbuild/sunos-x64": "0.25.5",
+ "@esbuild/win32-arm64": "0.25.5",
+ "@esbuild/win32-ia32": "0.25.5",
+ "@esbuild/win32-x64": "0.25.5"
+ }
+ },
+ "node_modules/vitest/node_modules/fdir": {
+ "version": "6.4.5",
+ "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.5.tgz",
+ "integrity": "sha512-4BG7puHpVsIYxZUbiUE3RqGloLaSSwzYie5jvasC4LWuBWzZawynvYouhjbQKw2JuIGYdm0DzIxl8iVidKlUEw==",
+ "dev": true,
+ "peerDependencies": {
+ "picomatch": "^3 || ^4"
+ },
+ "peerDependenciesMeta": {
+ "picomatch": {
+ "optional": true
+ }
+ }
+ },
+ "node_modules/vitest/node_modules/picomatch": {
+ "version": "4.0.2",
+ "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.2.tgz",
+ "integrity": "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg==",
+ "dev": true,
+ "engines": {
+ "node": ">=12"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/jonschlinkert"
+ }
+ },
+ "node_modules/vitest/node_modules/rollup": {
+ "version": "4.41.1",
+ "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.41.1.tgz",
+ "integrity": "sha512-cPmwD3FnFv8rKMBc1MxWCwVQFxwf1JEmSX3iQXrRVVG15zerAIXRjMFVWnd5Q5QvgKF7Aj+5ykXFhUl+QGnyOw==",
+ "dev": true,
+ "dependencies": {
+ "@types/estree": "1.0.7"
+ },
+ "bin": {
+ "rollup": "dist/bin/rollup"
+ },
+ "engines": {
+ "node": ">=18.0.0",
+ "npm": ">=8.0.0"
+ },
+ "optionalDependencies": {
+ "@rollup/rollup-android-arm-eabi": "4.41.1",
+ "@rollup/rollup-android-arm64": "4.41.1",
+ "@rollup/rollup-darwin-arm64": "4.41.1",
+ "@rollup/rollup-darwin-x64": "4.41.1",
+ "@rollup/rollup-freebsd-arm64": "4.41.1",
+ "@rollup/rollup-freebsd-x64": "4.41.1",
+ "@rollup/rollup-linux-arm-gnueabihf": "4.41.1",
+ "@rollup/rollup-linux-arm-musleabihf": "4.41.1",
+ "@rollup/rollup-linux-arm64-gnu": "4.41.1",
+ "@rollup/rollup-linux-arm64-musl": "4.41.1",
+ "@rollup/rollup-linux-loongarch64-gnu": "4.41.1",
+ "@rollup/rollup-linux-powerpc64le-gnu": "4.41.1",
+ "@rollup/rollup-linux-riscv64-gnu": "4.41.1",
+ "@rollup/rollup-linux-riscv64-musl": "4.41.1",
+ "@rollup/rollup-linux-s390x-gnu": "4.41.1",
+ "@rollup/rollup-linux-x64-gnu": "4.41.1",
+ "@rollup/rollup-linux-x64-musl": "4.41.1",
+ "@rollup/rollup-win32-arm64-msvc": "4.41.1",
+ "@rollup/rollup-win32-ia32-msvc": "4.41.1",
+ "@rollup/rollup-win32-x64-msvc": "4.41.1",
+ "fsevents": "~2.3.2"
+ }
+ },
+ "node_modules/vitest/node_modules/vite": {
"version": "6.3.5",
"resolved": "https://registry.npmjs.org/vite/-/vite-6.3.5.tgz",
"integrity": "sha512-cZn6NDFE7wdTpINgs++ZJ4N49W2vRp8LCKrn3Ob1kYNtOo21vfDoaV5GzBfLU4MovSAB8uNRm4jgzVQZ+mBzPQ==",
@@ -3996,6 +4361,7 @@
}
}
},
+
"node_modules/vite/node_modules/fdir": {
"version": "6.4.5",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.4.5.tgz",
@@ -4039,21 +4405,43 @@
"node": ">= 8"
}
},
- "node_modules/word-wrap": {
- "version": "1.2.5",
- "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.5.tgz",
- "integrity": "sha512-BN22B5eaMMI9UMtjrGd5g5eCYPpCPDUy0FJXbYsaT5zYxjFOckS53SQDE3pWkVoWpHXVb3BrYcEN4Twa55B5cA==",
+ "node_modules/ws": {
+ "version": "8.18.2",
+ "resolved": "https://registry.npmjs.org/ws/-/ws-8.18.2.tgz",
+ "integrity": "sha512-DMricUmwGZUVr++AEAe2uiVM7UoO9MAVZMDu05UQOaUII0lp+zOzLLU4Xqh/JvTqklB1T4uELaaPBKyjE1r4fQ==",
"dev": true,
"engines": {
- "node": ">=0.10.0"
+ "node": ">=10.0.0"
+ },
+ "peerDependencies": {
+ "bufferutil": "^4.0.1",
+ "utf-8-validate": ">=5.0.2"
+ },
+ "peerDependenciesMeta": {
+ "bufferutil": {
+ "optional": true
+ },
+ "utf-8-validate": {
+ "optional": true
+ }
}
},
- "node_modules/wrappy": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
- "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==",
+ "node_modules/xml-name-validator": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/xml-name-validator/-/xml-name-validator-5.0.0.tgz",
+ "integrity": "sha512-EvGK8EJ3DhaHfbRlETOWAS5pO9MZITeauHKJyb8wyajUfQUenkIg2MvLDTZ4T/TgIcm3HU0TFBgWWboAZ30UHg==",
+ "dev": true,
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/xmlchars": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/xmlchars/-/xmlchars-2.2.0.tgz",
+ "integrity": "sha512-JZnDKK8B0RCDw84FNdDAIpZK+JuJw+s7Lz8nksI7SIuU3UXJJslUthsi+uWBUYOwPFwW7W7PRLRfUKpxjtjFCw==",
"dev": true
},
+
"node_modules/yallist": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz",
@@ -4086,6 +4474,34 @@
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
}
+ },
+ "node_modules/zustand": {
+ "version": "4.5.7",
+ "resolved": "https://registry.npmjs.org/zustand/-/zustand-4.5.7.tgz",
+ "integrity": "sha512-CHOUy7mu3lbD6o6LJLfllpjkzhHXSBlX8B9+qPddUsIfeF5S/UZ5q0kmCsnRqT1UHFQZchNFDDzMbQsuesHWlw==",
+ "dependencies": {
+ "use-sync-external-store": "^1.2.2"
+ },
+ "engines": {
+ "node": ">=12.7.0"
+ },
+ "peerDependencies": {
+ "@types/react": ">=16.8",
+ "immer": ">=9.0.6",
+ "react": ">=16.8"
+ },
+ "peerDependenciesMeta": {
+ "@types/react": {
+ "optional": true
+ },
+ "immer": {
+ "optional": true
+ },
+ "react": {
+ "optional": true
+ }
+ }
+
}
}
}
diff --git a/ReaAaS-N-frontend/package.json b/ReaAaS-N-frontend/package.json
index 55b59c0..5ed2c3c 100644
--- a/ReaAaS-N-frontend/package.json
+++ b/ReaAaS-N-frontend/package.json
@@ -7,20 +7,17 @@
"dev": "vite",
"build": "vite build",
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
- "preview": "vite preview"
- },
- "dependencies": {
- "@emotion/react": "^11.14.0",
- "@emotion/styled": "^11.14.0",
- "@mui/material": "^7.1.0",
- "@types/uuid": "^10.0.0",
"dotenv": "^16.5.0",
"react": "^18.2.0",
"react-beautiful-dnd": "^13.1.1",
"react-dom": "^18.2.0",
+ "react-router-dom": "^7.6.1",
"uuid": "^11.1.0"
},
"devDependencies": {
+ "@testing-library/jest-dom": "^6.6.3",
+ "@testing-library/react": "^16.3.0",
+ "@testing-library/user-event": "^14.6.1",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@typescript-eslint/eslint-plugin": "^6.0.0",
diff --git a/ReaAaS-N-frontend/src/App.test.tsx b/ReaAaS-N-frontend/src/App.test.tsx
new file mode 100644
index 0000000..90e1663
--- /dev/null
+++ b/ReaAaS-N-frontend/src/App.test.tsx
@@ -0,0 +1,20 @@
+import { render, screen } from '@testing-library/react';
+import App from './App';
+import { BrowserRouter } from 'react-router-dom';
+import { ThemeProvider } from '@mui/material/styles'; // Import ThemeProvider
+import theme from './theme'; // Import your theme
+
+describe('App', () => {
+ it('renders the AppBar with the application title "ReaAaS-N"', () => {
+ render(
+
+ {/* Wrap with ThemeProvider */}
+
+
+
+ );
+ // Check for the AppBar title "ReaAaS-N"
+ // This text is within a Typography component in the AppBar
+ expect(screen.getByText(/ReaAaS-N/i)).toBeInTheDocument();
+ });
+});
diff --git a/ReaAaS-N-frontend/src/components/CircuitDesigner/PropertiesPanel.tsx b/ReaAaS-N-frontend/src/components/CircuitDesigner/PropertiesPanel.tsx
new file mode 100644
index 0000000..899ee61
--- /dev/null
+++ b/ReaAaS-N-frontend/src/components/CircuitDesigner/PropertiesPanel.tsx
@@ -0,0 +1,86 @@
+import React from 'react';
+import { Box, Paper, Typography, TextField, Divider } from '@mui/material';
+import { Node } from '@xyflow/react';
+
+// Define the expected structure of node data that includes a label
+interface NodeWithLabelData {
+ label: string;
+ [key: string]: any; // Allow other data properties
+}
+
+interface PropertiesPanelProps {
+ selectedNode: Node | null;
+ onUpdateNodeLabel: (nodeId: string, newLabel: string) => void;
+}
+
+// Helper function to format node type for display
+const formatNodeType = (type?: string): string => {
+ if (!type) return 'N/A';
+ switch (type) {
+ case 'inputSource': return 'Input Source';
+ case 'outputSink': return 'Output Sink';
+ case 'andGate': return 'AND Gate';
+ case 'orGate': return 'OR Gate';
+ case 'notGate': return 'NOT Gate';
+ default: return type.charAt(0).toUpperCase() + type.slice(1);
+ }
+};
+
+const PropertiesPanel: React.FC = ({ selectedNode, onUpdateNodeLabel }) => {
+ const handleLabelChange = (event: React.ChangeEvent) => {
+ if (selectedNode) {
+ onUpdateNodeLabel(selectedNode.id, event.target.value);
+ }
+ };
+
+ return (
+
+
+ Properties
+
+
+ {selectedNode ? (
+
+ ID:
+ {selectedNode.id}
+
+ Type:
+ {formatNodeType(selectedNode.type)}
+
+ {typeof selectedNode.data?.label !== 'undefined' && (
+ <>
+ Label:
+
+ >
+ )}
+ {/* Add more editable properties here if needed, e.g., specific to node type */}
+
+ ) : (
+
+ Select a node to see its properties.
+
+ )}
+
+ );
+};
+
+export default PropertiesPanel;
diff --git a/ReaAaS-N-frontend/src/components/CircuitDesigner/nodes/AndGateNode.tsx b/ReaAaS-N-frontend/src/components/CircuitDesigner/nodes/AndGateNode.tsx
new file mode 100644
index 0000000..5e32afd
--- /dev/null
+++ b/ReaAaS-N-frontend/src/components/CircuitDesigner/nodes/AndGateNode.tsx
@@ -0,0 +1,60 @@
+import React from 'react';
+import { Handle, Position, NodeProps } from '@xyflow/react';
+import { Paper, Typography, Box } from '@mui/material'; // Added Box for value display
+
+// data prop for this node type
+export interface AndGateData {
+ label: string;
+ outputValue: boolean; // Added for simulation output
+}
+
+const AndGateNode: React.FC> = ({ data, isConnectable }) => {
+ return (
+
+
+ {data.label || 'AND'}
+
+
+ Out: {data.outputValue ? '1' : '0'}
+
+
+
+
+
+ );
+};
+
+export default AndGateNode;
diff --git a/ReaAaS-N-frontend/src/components/CircuitDesigner/nodes/InputSourceNode.tsx b/ReaAaS-N-frontend/src/components/CircuitDesigner/nodes/InputSourceNode.tsx
new file mode 100644
index 0000000..9170034
--- /dev/null
+++ b/ReaAaS-N-frontend/src/components/CircuitDesigner/nodes/InputSourceNode.tsx
@@ -0,0 +1,56 @@
+import React from 'react';
+import { Handle, Position, NodeProps } from '@xyflow/react'; // Removed useReactFlow, Node as it's not needed here
+import { Paper, Typography, Box, Switch } from '@mui/material';
+
+// data prop for this node type
+export interface InputSourceData {
+ label: string;
+ value: boolean;
+ onValueChange: (id: string, value: boolean) => void; // Added for simulation trigger
+}
+
+const InputSourceNode: React.FC> = ({ id, data, isConnectable }) => {
+ // No need for setNodes here, use the passed callback
+ // const { setNodes } = useReactFlow();
+
+ const onToggleChange = (event: React.ChangeEvent) => {
+ const newValue = event.target.checked;
+ // Call the callback passed in data to update the node and trigger simulation
+ if (data.onValueChange) {
+ data.onValueChange(id, newValue);
+ }
+ };
+
+ return (
+
+
+ {data.label || 'Input Source'}
+
+
+
+ {data.value ? '1' : '0'}
+
+
+
+
+
+ );
+};
+
+export default InputSourceNode;
diff --git a/ReaAaS-N-frontend/src/components/CircuitDesigner/nodes/NotGateNode.tsx b/ReaAaS-N-frontend/src/components/CircuitDesigner/nodes/NotGateNode.tsx
new file mode 100644
index 0000000..2e47dc4
--- /dev/null
+++ b/ReaAaS-N-frontend/src/components/CircuitDesigner/nodes/NotGateNode.tsx
@@ -0,0 +1,53 @@
+import React from 'react';
+import { Handle, Position, NodeProps } from '@xyflow/react';
+import { Paper, Typography, Box } from '@mui/material'; // Added Box
+
+// data prop for this node type
+export interface NotGateData {
+ label: string;
+ outputValue: boolean; // Added for simulation output
+}
+
+const NotGateNode: React.FC> = ({ data, isConnectable }) => {
+ return (
+
+
+ {data.label || 'NOT'}
+
+
+ Out: {data.outputValue ? '1' : '0'}
+
+
+
+
+ );
+};
+
+export default NotGateNode;
diff --git a/ReaAaS-N-frontend/src/components/CircuitDesigner/nodes/OrGateNode.tsx b/ReaAaS-N-frontend/src/components/CircuitDesigner/nodes/OrGateNode.tsx
new file mode 100644
index 0000000..3322425
--- /dev/null
+++ b/ReaAaS-N-frontend/src/components/CircuitDesigner/nodes/OrGateNode.tsx
@@ -0,0 +1,60 @@
+import React from 'react';
+import { Handle, Position, NodeProps } from '@xyflow/react';
+import { Paper, Typography, Box } from '@mui/material'; // Added Box
+
+// data prop for this node type
+export interface OrGateData {
+ label: string;
+ outputValue: boolean; // Added for simulation output
+}
+
+const OrGateNode: React.FC> = ({ data, isConnectable }) => {
+ return (
+
+
+ {data.label || 'OR'}
+
+
+ Out: {data.outputValue ? '1' : '0'}
+
+
+
+
+
+ );
+};
+
+export default OrGateNode;
diff --git a/ReaAaS-N-frontend/src/components/CircuitDesigner/nodes/OutputSinkNode.tsx b/ReaAaS-N-frontend/src/components/CircuitDesigner/nodes/OutputSinkNode.tsx
new file mode 100644
index 0000000..bd6950b
--- /dev/null
+++ b/ReaAaS-N-frontend/src/components/CircuitDesigner/nodes/OutputSinkNode.tsx
@@ -0,0 +1,44 @@
+import React from 'react';
+import { Handle, Position, NodeProps } from '@xyflow/react';
+import { Paper, Typography, Box } from '@mui/material';
+
+// data prop for this node type
+export interface OutputSinkData {
+ label: string;
+ value: boolean; // This will be updated by the simulation based on connected input
+}
+
+const OutputSinkNode: React.FC> = ({ data, isConnectable }) => {
+ return (
+
+
+ {data.label || 'Output Sink'}
+
+
+
+ {/* Value will be determined by connected input during simulation */}
+ {data.value ? '1' : '0'}
+
+
+
+
+ );
+};
+
+export default OutputSinkNode;
diff --git a/ReaAaS-N-frontend/src/main.tsx b/ReaAaS-N-frontend/src/main.tsx
index fcdb991..0df1ee8 100644
--- a/ReaAaS-N-frontend/src/main.tsx
+++ b/ReaAaS-N-frontend/src/main.tsx
@@ -4,10 +4,17 @@ import App from './App'; // Assuming App.jsx or App.tsx
import theme from './theme';
import { ThemeProvider } from '@mui/material/styles';
import CssBaseline from '@mui/material/CssBaseline';
+import { BrowserRouter } from 'react-router-dom'; // Import BrowserRouter
import './index.css'; // Ensure this is present
ReactDOM.createRoot(document.getElementById('root')!).render(
+ {/* Wrap App with BrowserRouter */}
+
+
+
+
+
diff --git a/ReaAaS-N-frontend/src/pages/AlgorithmBuilderPage.test.tsx b/ReaAaS-N-frontend/src/pages/AlgorithmBuilderPage.test.tsx
new file mode 100644
index 0000000..f728a0d
--- /dev/null
+++ b/ReaAaS-N-frontend/src/pages/AlgorithmBuilderPage.test.tsx
@@ -0,0 +1,120 @@
+import { render, screen, within } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import AlgorithmBuilderPage from './AlgorithmBuilderPage';
+import { vi } from 'vitest';
+
+// Mock react-beautiful-dnd
+vi.mock('react-beautiful-dnd', async (importOriginal) => {
+ const actual = await importOriginal();
+ return {
+ ...actual,
+ DragDropContext: ({ children }: { children: React.ReactNode }) =>