How reacto11mecha/unj-timetable works
Main Components
• Frontend UI Layer:
• Astro pages (files in src/pages like index.astro and 404.astro)
• Layouts (src/layouts/Layout.astro)
• Component Modules:
• React components for the interactive parts (e.g., components in src/components/IndexPage and src/components/ui)
• UI elements like alert dialogs, buttons, cards, forms, etc., housed under src/components/ui
• Business Logic and Data Processing:
• The file processor and data extractor: submit-handler.ts in src/lib; this is the core module that reads, validates, and processes the uploaded KRS file.
• Additional utility modules (src/lib/utils.ts and atom.ts)
• Styles and Configurations:
• Tailwind CSS with its configuration (tailwind.config.js and src/styles/global.css)
• Astro configuration (astro.config.mjs)
• TypeScript configurations (tsconfig.json) and package management files (package.json, pnpm-lock.yaml)
Relationships and Interactions
• Data Flow:
• The user interacts with the frontend UI (built with Astro pages and React components). When the “Tambah File” button is clicked, the process starts via event handlers wired to the file input.
• The UI components (e.g., NoData.tsx) rely on the submit-handler.ts to:
• Read and validate the raw KRS file.
• Extract and parse student identity data and schedule table from the HTML/MHTML content.
• Restructure and sort the data.
• Once processing is complete, the cleaned data is stored using local storage on the client (via functions such as setKrsData).
• Component Integration:
• Astro acts as the shell and routing framework that then calls or embeds React components.
• React UI components make use of Tailwind for styling.
• Utility libraries (src/lib) support components with shared functions or state management (using atoms, for example).
Architectural Patterns and Principles
• Client-Side Data Processing:
• Emphasis on local processing of data – meaning the heavy lifting is performed in the browser.
• Modular Design:
• Clear separation between UI (components directory), logic (lib directory), and layout/pages (layouts and pages directories).
• Reusability:
• The design pattern is based on reusable UI components (notice a dedicated ui folder for elements such as buttons, dialogs, inputs, etc.).
• Integration of multiple frameworks:
• Astro for page composition and routing.
• React for interactive front-end behavior.
• Tailwind CSS for styling.