A React-based application for drawing, saving, and managing polygons on a canvas. Built with Vite for fast development and Ant Design for UI components.
- Canvas Drawing: Click on the canvas to create points and draw polygons.
- Polygon Management: Save polygons with a name, view a list of saved polygons, and delete them.
- Responsive Design: The app layout adjusts to different screen sizes.
- API Integration: Interacts with a backend API for saving and retrieving polygons.
- Frontend: React, React Konva, Ant Design
- State Management: React Hooks
- HTTP Client: Axios
- Build Tool: Vite
- Linting & Formatting: ESLint, Prettier
├── public/ # Static assets
├── src/ # Source code
│ ├── api/ # API interaction logic
│ ├── components/ # React components
│ ├── utils/ # Utility functions
│ ├── App.jsx # Main app component
│ ├── main.jsx # Entry point
│ └── index.css # Global styles
├── .gitignore # Git ignore rules
├── .prettierrc # Prettier configuration
├── eslint.config.js # ESLint configuration
├── vite.config.js # Vite configuration
├── package.json # Project dependencies and scripts
└── README.md # Project documentation
-
Clone the repository:
git clone https://github.com/harut0111/react-polygons.git cd react-polygons -
Install dependencies:
npm install
-
Start the development server:
npm run dev
-
Open the app:
Open your browser and navigate to http://localhost:5173.
-
npm run dev
Start the development server. -
npm run build
Build the app for production. -
npm run preview
Preview the production build. -
npm run lint
Run ESLint to check for code issues. -
npm run lint:fix
Automatically fix linting issues. -
npm run format
Format code using Prettier.
The app interacts with the following API endpoints:
-
GET
/api/polygons
Fetch all saved polygons. -
POST
/api/polygons
Save a new polygon. -
DELETE
/api/polygons/:id
Delete a polygon by ID.