How leon0113/kajan_frontend works
1. This repository is a client-side React single-page application built with Vite and TypeScript. There is no visible backend, database, or API layer in the tree, so the architecture is focused on local UI composition and in-browser computation.
2. The top-level app entry is src/main.tsx, which bootstraps App.tsx into index.html. App.tsx is the central composition point where page selection and application-wide structure are likely wired together.
3. The app is organized around page-level screens in src/pages: Dashboard, Calculator, Leads, Index, and NotFound. This suggests a route-driven architecture, with each page owning a distinct user task or workflow.
4. A shared layout subsystem lives in src/components/layout. MainLayout and AppSidebar indicate a persistent shell around the pages, with navigation likely anchored in the sidebar and content swapped into the main region.
5. The calculator domain is isolated under src/components/calculator. MortgageCalculator, MortgageCostCalculator, DownPaymentPlanner, and CalculatedScenario point to a workflow where users enter mortgage-related inputs and receive computed scenario outputs and cost breakdowns. This is the main data-processing area of the app.
6. The dashboard domain is smaller and centered on presentation. src/components/dashboard/StatsCard.tsx suggests summary metrics or KPIs are surfaced on the dashboard page, probably fed from calculator results or static sample data.
7. Shared UI primitives are vendored under src/components/ui. This is a shadcn-style component library layer containing buttons, cards, dialogs, forms, tables, sidebars, toasts, charts, and other building blocks. These components provide the design system and interaction primitives used across pages and feature components.
8. Reusable utility hooks live in src/hooks. use-mobile.tsx likely drives responsive behavior, while use-toast.ts integrates the toast/notification system. These are cross-cutting concerns rather than feature-specific logic.
9. Styling is handled by Tailwind CSS plus local CSS entry points (src/index.css and src/App.css). Supporting config files such as tailwind.config.ts, postcss.config.js, and components.json reinforce that the UI layer is assembled from utility classes and generated/managed component patterns.
10. The architecture boundary is primarily “UI composition + client-side calculations.” Inputs originate in calculator components, derived values are passed into scenario/result components, and summary views like the dashboard render those outcomes. There is no evidence of server synchronization, auth, persistence, or third-party data integration in this repo snapshot.
11. Static/public assets are minimal, with public/robots.txt and src/assets for bundled images or icons. The app appears self-contained and deployable as static frontend assets via the Vite build.
12. For an architecture diagram, the key boxes are: app bootstrap, layout shell, page routes, calculator feature cluster, dashboard feature cluster, shared UI library, and utility hooks/styles. The main flow is user interaction in pages → local state/calculation in feature components → rendered summaries and notifications in shared UI.
Main entry points: App.tsx App · ui UI Kit · MortgageCalculator.tsx Mortgage Calc · Dashboard.tsx Dashboard
Components 18
App Shell
Bootstraps the SPA and wires the top-level composition.
Pages
Route-level screens and user-facing entry points.
- Index · Primary landing or redirect screen.
src/pages/Index.tsx - Dashboard · Dashboard screen for summary metrics.
src/pages/Dashboard.tsx - Calculator · Page hosting mortgage calculation workflows.
src/pages/Calculator.tsx - Leads · Leads-related screen or workflow.
src/pages/Leads.tsx - Not Found · Fallback route for unknown paths.
src/pages/NotFound.tsx
Calculator Domain
Mortgage calculation workflow and scenario outputs.
- Mortgage Calc · Core mortgage input and computation component.
src/components/calculator/MortgageCalculator.tsx - Cost Calc · Derives mortgage cost and payment details.
src/components/calculator/MortgageCostCalculator.tsx - Down Payment · Helps plan or tune down payment scenarios.
src/components/calculator/DownPaymentPlanner.tsx - Scenario · Renders calculated scenario output.
src/components/calculator/CalculatedScenario.tsx
Dashboard Domain
Summary presentation for key metrics.
- Stats Card · Dashboard metric card component.
src/components/dashboard/StatsCard.tsx
Layout
Persistent navigation shell around page content.
- MainLayout · Persistent application shell for page content.
src/components/layout/MainLayout.tsx - Sidebar · Primary navigation and section switching.
src/components/layout/AppSidebar.tsx
Shared UI
Reusable UI primitives and cross-cutting hooks/styles.
- UI Kit · Reusable shadcn-style primitives for forms, cards, charts, dialogs, and navigation.
src/components/ui - Hooks · Cross-cutting hooks for responsive behavior and toasts.
src/hooks - Toaster · Toast rendering and notification plumbing.
src/components/ui/toaster.tsx - Styles · Tailwind and global CSS entry points.
src/index.css
Connections 21
- main.tsx → App: mounts · Bootstraps the application root.
- App → MainLayout: wraps · Provides the persistent shell around routed content.
- MainLayout → Sidebar: contains · Navigation lives in the layout shell.
- App → Index: routes to · Selects the landing screen.
- App → Dashboard: routes to · Selects the dashboard screen.
- App → Calculator: routes to · Selects the calculator screen.
- App → Leads: routes to · Selects the leads screen.
- App → Not Found: fallback · Handles unmatched routes.
- Calculator → Mortgage Calc: uses · Page hosts the core calculation UI.
- Mortgage Calc → Cost Calc: derives · Computes mortgage cost breakdowns.
- Mortgage Calc → Down Payment: plans · Supports down payment scenario exploration.
- Mortgage Calc → Scenario: outputs · Surfaces computed scenario results.
- Dashboard → Stats Card: renders · Dashboard summarizes metrics via cards.
- MainLayout → UI Kit: builds with · Layout composes shared primitives.
- Calculator → UI Kit: builds with · Feature UI is assembled from shared components.
- Dashboard → UI Kit: builds with · Dashboard presentation uses the design system.
- Leads → UI Kit: builds with · Leads screen uses shared UI primitives.
- App → Hooks: depends on · App-level behavior relies on shared hooks.
- UI Kit → Toaster: includes · Notification primitives are part of the shared layer.
- UI Kit → Styles: styled by · UI primitives are themed with global styles.
- Hooks → Toaster: feeds · Toast hook drives notification rendering.