Table Generator is built on modern React application architecture using Redux Toolkit for state management. The project follows component architecture principles and separation of concerns.
src/
├── components/ # React components
│ ├── CreateTableForm/ # Table creation form
│ ├── EditableCell/ # Editable cells
│ ├── TableComponent/ # Main table component
│ ├── TableGenerator/ # Application container
│ └── TablesGrid/ # Grid for table placement
├── store/ # Redux store and slices
│ ├── slices/ # Redux slices
│ └── index.ts # Store configuration
├── types/ # TypeScript types and interfaces
├── utils/ # Utilities and helpers
└── test/ # Test utilities
- Single Responsibility: Each component is responsible for one specific function
- Reusability: Components are designed for maximum reusability
- Props Down, Events Up: Data is passed through props, events through callbacks
- Controlled Components: All components are controlled by external state
App
└── TableGenerator (container)
├── CreateTableForm (creation form)
└── TablesGrid (tables grid)
└── TableComponent (individual table)
├── TableHeader (header)
└── TableBody (table body)
└── EditableCell (editable cells)
interface RootState {
tables: TablesState; // Table state
ui: UIState; // UI state
}Manages all data related to tables:
- items: array of all tables
- nextId: counter for ID generation
- selectedTableId: ID of selected table
Actions:
addTable- creating new tablecopyTable- copying existing tableupdateCell- updating cell contentreorderTables- reordering tables
Manages user interface state:
- showForm: visibility of table creation form
- selectedTableId: ID of selected table
Actions:
toggleForm- show/hide formselectTable- select table
The project uses CSS Modules for style isolation:
- Each component has its own CSS file
- Styles are automatically isolated from other components
- Support for dynamic classes and states
- Mobile First approach
- CSS Grid for adaptive grid
- Media queries for various screen sizes
- Flexbox for internal component layout
Contains logic for working with CSS Grid:
calculateGridPosition()- calculating table position in grid- Automatic table placement (1, 2, 3 per row)
- Width adjustment considering gaps
Utilities for generating identifiers:
generateId()- creating UUID v4 for unique IDs- Used for tables, rows, columns
- Uses HTML5 Drag & Drop API
- Integrated with Redux for state updates
- Visual feedback during dragging
- Automatic position recalculation
- dragstart: start of dragging
- dragover: dragging over target area
- drop: completion of dragging
- dragend: state cleanup
- Unit tests: for Redux reducers and utilities
- Component tests: for React components
- Integration tests: for user scenarios
- Coverage: minimum 80% coverage
- Vitest: for running tests
- React Testing Library: for testing components
- MSW: for API mocking (if needed)
- Validation of all user input data
- HTML sanitization to prevent XSS
- Type checking at TypeScript level
- Access restriction to critical operations
- Column type checking (text, number, select)
- Table and column name validation
- Numeric value correctness checking
- Text field length limitation
- React.memo: to prevent unnecessary re-renders
- useCallback: for function memoization
- useMemo: for computation caching
- Lazy loading: for components (if needed)
- React DevTools profiling
- Render time measurement
- Bundle size analysis
- Performance testing
- User fills out form
- Client-side data validation
- Creating table object with unique IDs
- Adding to Redux store
- Automatic placement in grid
- Click on cell
- Activating edit mode
- Entering new value
- Data validation
- Updating Redux store
- Component re-render
- Click on "Copy" button
- Creating deep copy with new IDs
- Updating name (adding "(copy)")
- Placement in grid after original
- React 18: main UI library
- Redux Toolkit: state management
- TypeScript: typing
- Vite: build and development
- UUID: unique ID generation
- Local Storage: for data persistence
- IndexedDB: for large data volumes
- WebSocket: for real-time collaboration
- PWA: for offline work
- User action logging
- Error tracking
- Performance metrics
- Usage analytics
- Redux DevTools for state debugging
- React DevTools for components
- Console logs for development
- Source maps for debugging
- Export to CSV/Excel
- Data import
- Table templates
- Dark theme
- Localization
- Undo/Redo system
- Micro-frontends
- Service Workers
- Web Workers for heavy computations
- Bundle optimization
- Code splitting