I created SPA and data simulation in front-end part. I used:
- React & TypeScript
- Single Page Application
- Drag & Drop functionality
- Local Storage to save cards
- Random Data Simulation
In such project should implement following tests:
- Input Field Tests: a. Invalid domain input b. Valid domain input
- Card Management Tests: a. Card creation b. Notification tests c. Card state updates
- Local Storage Tests:
a. Load saved cards from localStorage
b. Save cards to localStorage - Drag-and-Drop Tests: a. Reorder cards
- Button and Scan Submission Tests: a. Scan launch b. Click event
If I had more time I would implement all of listed tests.
To measure performance I am using Chrome DevTools, React Profiler. To optimize my code we can use:
- Memoization and Preventing Unnecessary Re-renders
- Optimize Drag-and-Drop
- Code splitting into chunks & Lazy Loading(in case we have too much domain cards)
My project may have the following bottlenecks:
- Frequent Re-renders
- Large Data Handling in State
- Inefficient Drag-and-Drop with Large Lists
- High Memory Usage with LocalStorage
My project improvements:
- Implement backend
- Add tooltips in modal window
- Add cards to the start of list, not end of list
- Optimize Drag-and-Drop
- Error handling
- Refactor to use useState
- Accessibility and disability