Okay, let's break down your prompt and refine it. The goal is to get a detailed action plan for building a specific UI with React and FastAPI, focusing on visual fidelity, specific interactions, and future backend control.
Reasoning for Changes:
- Figma Interaction: The phrase "contact the figma MCP server" is problematic. LLMs cannot directly interact with external servers or proprietary design files like Figma. The intent is to get detailed information from the Figma design. The prompt needs to be rephrased to assume this information is available or described, and instruct the LLM to act as if it has access to these details.
- Pixel Perfect vs. Planning: The original prompt has a slight contradiction: "Do not code anything before you are sure..." versus "...start working now, but think again before every step...". The primary request is for an action plan. The prompt should focus on generating a robust plan first, detailing how pixel-perfect replication and the specified behaviors will be achieved, rather than instructing the LLM to start coding prematurely or demanding impossible certainty before planning.
- Clarity of Instructions: Some instructions can be made clearer and more structured. Separating UI layout, component behaviors, state management, and backend interaction will make the prompt easier to follow.
- Button State Clarity: Specify the cycling mechanism more explicitly (e.g.,
0 -> 1 -> 2 -> 3 -> 0). Clarify the zoom behavior (is it a slider, dropdown, buttons?). Specify the type of animation for the zoom (e.g., CSS transitions).
- Initial State: Clarify that "buttons won't do anything" refers to API calls, but they should still update their visual state in response to clicks.
- Structure and Output: Explicitly ask for the action plan as the main output, detailing the steps involved in development. Mention the technologies and constraints within the plan's context.
- Assets: Explicitly state that the SVGs need to be integrated correctly.
Improved Prompt:
**Objective:** Create a comprehensive action plan to build a user interface using React.js for the frontend and FastAPI for the backend. The UI will eventually control camera variables via Python, but the immediate focus is on replicating a specific Figma design with high fidelity and implementing the specified interactive behaviors.
**Context:**
* **Frontend:** React.js
* **Backend:** FastAPI (Python)
* **Core Functionality:** UI elements should visually represent and allow interaction with camera control variables. Button clicks should trigger placeholder actions or UI state changes now, designed to easily integrate API calls to the FastAPI backend later.
* **Design Source:** A Figma design specification. Assume you have access to all necessary details regarding layout, spacing, colors, typography, component states, and assets (specifically SVG icons located in an `icons` folder).
**UI Specifications:**
1. **Layout:** A main sidebar area and a larger surrounding whitespace area.
* **Sidebar:**
* Width: 171px
* Height: 1600px
* Background Color: Pitch black (`#000000`)
* **Surrounding Area:**
* Dimensions: 2389px width x 1600px height (adjacent to the sidebar)
* Background Color: White (`#FFFFFF`)
* Content: Initially empty whitespace, intended for a future camera feed.
2. **Components & Assets:**
* Use the *exact* SVG icons provided in the `icons` folder for all graphical elements corresponding to the Figma design.
* Achieve a pixel-perfect (or near-pixel-perfect, high-fidelity) replication of the Figma design in terms of layout, spacing, colors, and element appearance.
* All interactive elements (buttons, switches, sliders) must match the Figma design precisely.
**Component Behaviors & States:**
* **General Interaction:** All UI elements should provide immediate visual feedback on user interaction (e.g., hover states, click feedback) before any state change occurs.
* **Button States:**
* `cooling_button`: Cycles through 4 states (0 -> 1 -> 2 -> 3 -> 0).
* `heating_button`: Cycles through 4 states (0 -> 1 -> 2 -> 3 -> 0).
* `gain_switch`: Toggles between 2 states (LCG <-> HCG).
* `denoising_button`: Cycles through 4 states (0 -> 25 -> 50 -> 75 -> 0).
* `high_ful_well_button`: Toggles between 2 states (0 <-> 1).
* `low_noise_mode_button`: Toggles between 2 states (0 <-> 1).
* **Zoom Control:**
* Control element (e.g., slider, segmented control, buttons - clarify based on Figma) allows switching zoom values.
* Default zoom: 1x.
* Available zoom values: 1x, 3x, 5x, 10x.
* Transition between zoom values must be smooth, employing modern, iOS-like animations (specify CSS transitions/animations).
* **Record Button:**
* `record_button`: Toggles between two states: not pressed (`State = 0`) and pressed (`State = 1`).
* On click, it should switch to `State = 1` and remain visually pressed until clicked again, at which point it returns to `State = 0`.
* **Shutter Button:**
* `shutter_button`: Starts in the not pressed position (`State = 0`).
* On click, it should animate to a pressed state (`State = 1`) with an effect similar to an iOS camera shutter sound/visual press, but *only* for a brief duration, after which it automatically returns to `State = 0`.
**Backend Integration Strategy (Conceptual):**
* The React components should be structured to easily dispatch actions or make calls to the FastAPI backend when variable states change.
* Assume potential API endpoints like `POST /api/camera/set_variable` where the request body might be JSON, e.g., `{"variable": "cooling", "value": 1}`.
**Task:**
Generate a detailed **action plan** outlining the steps required to build this UI. The plan should cover:
1. **Project Setup:** Environment setup (Node.js, React via Vite/CRA, Python/FastAPI).
2. **Component Architecture:** How to structure the React application (e.g., main App component, Sidebar component, individual Button/Switch components).
3. **Styling Strategy:** How to achieve the pixel-perfect design (e.g., CSS Modules, Styled Components, Tailwind CSS with custom configuration, direct CSS). How to handle the specific colors and dimensions.
4. **State Management:** How React state (e.g., `useState`, `useReducer`) will be used to manage the different states of the buttons, switches, and zoom level within the UI.
5. **UI Implementation Details:** Specific approaches for implementing:
* The layout structure (sidebar + whitespace).
* Styling the sidebar (black background, dimensions).
* Styling the whitespace area (white background).
* Integrating and displaying the specific SVG icons.
* Implementing the state-cycling and toggling logic for each button/switch.
* Implementing the smooth zoom transitions with animations.
* Implementing the visual feedback and state changes for the record and shutter buttons, including the shutter's timed return animation.
6. **Backend Interaction Plan:** How the React frontend will eventually call the FastAPI endpoints (e.g., using `fetch` or `axios`). Outline the necessary API endpoint structure conceptually within the plan.
7. **Verification:** How to verify that the UI matches the Figma design closely at each stage.
**Constraint:** Focus solely on creating the *action plan* based on the information provided. Do not generate code initially. Ensure the plan is thorough enough that execution could follow logically and achieve the specified design and interactivity.