How assem-gh/csv-viewer works
Project Type and Purpose
• This is a client-side, single-page React application named “CSV-Viewer.”
• Purpose: let users import, view, edit, export CSV data and render charts.
• No backend/microservice layer—everything runs in the browser, relying on local file input/output and in-memory state.
File Structure Analysis
• Top level
• index.html – HTML shell
• public/ – static assets, sample CSV data, images
• src/ – React/TypeScript source
• src/main.tsx + src/App.tsx – application entrypoint and root component
• src/store/ – Redux Toolkit slices (gridSlice, uiSlice), store setup, typed hooks
• src/helpers/ – CSV parsing (PapaParse wrapper), chart data computation, formatting utilities
• src/Components/ – reusable UI pieces (buttons, modals, drawers, DataGrid subcomponents)
• src/Pages/ – DataGridPage and StartPage (route targets)
• Configuration – vite.config.ts, tsconfig.json etc.
Key Technologies (from README)
• React + TypeScript
• Redux Toolkit (state management)
• PapaParse (CSV parsing)
• AG-Grid (data grid UI)
• AG-Chart (charting)
• Mantine (UI library)
Main Components & Relationships
• User Browser: hosts the React SPA
• File Input Module (FileUploadButton) → PapaParse helper → CSV data
• Redux Store:
• gridSlice holds tabular data and edits
• uiSlice manages modal/drawer state, pagination, loading flags
• DataGridPage:
• AG-Grid component reads from gridSlice selector
• DataGridToolbar, PaginationControl, RowControl, Actions all dispatch Redux actions
• AddRowDrawer & AppDrawer open on dispatch from toolbar/menu
• ChartForm & ChartModal:
• User selects columns → passes to calculateChartData → AG-Chart renders inside ChartModal
• Export Module: transforms Redux state back to CSV string → triggers browser download
Architectural Patterns & Design Principles
• Unidirectional data flow (React → Redux → React)
• Component hierarchy:
• Pages at top, composite Components next, leaf Components for buttons, modals, etc.
• Separation of concerns: parsing & data formatting live in helpers, UI in Components, state in store
• Single-responsibility: each slice, helper, and component focuses on one aspect
• Clear component/module names matching folder/package names
• Annotations for key Redux slices and helpers