This web application allows restaurant managers to create custom seating arrangements with a drag-and-drop interface. Users can select, resize, rotate, duplicate, and delete tables (both circular and square) on a customizable restaurant floor plan. It’s designed for flexibility and precision in floor plan management.
- Drag-and-Drop: Easily place tables on a virtual floor.
- Rotation: Rotate tables to customize the layout.
- Resize: Adjust the size of tables as needed.
- Duplicate and Delete: Create duplicates or remove tables.
- Customizable Floor Plan: Design the floor layout for any restaurant space.
- React: Frontend framework for building user interfaces.
- Redux: Manages application state and facilitates table data management.
- React DnD: Handles drag-and-drop functionality within React components.
- React RND: Enables resizable and draggable functionality on tables.
- Tailwind CSS: Provides styling for a responsive and modern UI.
- Axios: Handles HTTP requests for backend communication.
- SVG Icons & React Icons: Used for icons throughout the application, such as action buttons.
To get the application running on your local machine, follow these steps.
-
Navigate to the project root directory.
-
Run the following commands to install dependencies and start the frontend:
npm install npm start
-
Navigate to the api directory:
cd api
-
Install dependencies and start the backend server:
npm install npm start
The backend server should now be running on http://localhost:8080.
The application utilizes React DnD and React RND for its drag-and-drop and resizing functionality. Here’s a breakdown of the drag-and-drop mechanism:
- Initial Placement: Users drag tables onto the floor plan using React DnD. Position Calculation: Table coordinates are calculated through monitor.getClientOffset() in React DnD, ensuring accurate placement within the floor bounds.
- Resizing: The React RND library is used to allow tables to be resized directly within the floor plan.
- Rotation: Custom code calculates table rotation by tracking the mouse position relative to the table center.
- State Management: All table data (position, size, rotation) is stored in a Redux store, allowing precise control over re-rendering and table selection.
Justification: This approach, combining React DnD and React RND, provides flexibility, ease of implementation, and reliability for handling complex drag, drop, and resize events. It allows users to create an accurate restaurant floor layout quickly.
