How prjwl458/cignotee works
This is a single-device, offline-first React Native (Expo) app for managing a product list (name/price/quantity) with derived totals, and quick export/share (copy/WhatsApp). There is no backend, no accounts, and no cloud; the “system” is primarily the mobile client plus local persistence.
• UI screens (route-based)
• Presentational components
• Centralized business logic (hooks/utils)
• Local storage (AsyncStorage)
• Cross-cutting concerns (theme, error boundaries/recovery)
App entry / navigation shell
• App.tsx
• index.js
• app/_layout.tsx (Expo Router layout)
• app/index.tsx, app/about.tsx (screens/routes)
These form the Composition Root (where providers, router, and global boundaries typically live).
UI (dumb/presentational)
• src/components/*
• ProductForm.tsx, ProductItem.tsx, ProductList (implicit via composition), TotalDisplay.tsx
• ActionButtons.tsx, FooterActions.tsx (export/share triggers likely here)
• SplashLoader.tsx
• ErrorBoundary.tsx, GracefulRecovery.tsx
In the README’s “Dumb UI, Smart Logic” philosophy, these should appear as leaf nodes that receive props and emit events.
State + business logic (smart layer)
• src/hooks/useProducts.ts (core domain workflow: CRUD, persistence, derived totals integration)
• src/utils/calculator.ts (pure functions; totals/price math)
• src/constants/types.ts, validation.ts (domain types & constraints)
• src/hooks/useTheme.ts + src/context/ThemeContext.tsx (theme logic)
This layer is what you want to emphasize as the “brain”: centralized logic, minimal duplicated state.
Platform persistence (offline)
• (Not explicitly shown as a wrapper file, but README states) AsyncStorage
• In practice, it will be imported/used from useProducts.ts (or a helper inside it).
Build/deploy/config (supporting, not runtime architecture)
• app.json, eas.json, tsconfig.json, .eslintrc.json, .prettierrc
Routes / Screens (app/)
• index.tsx (main list screen)
• about.tsx
• _layout.tsx (navigation + providers)
UI Components (src/components)
• Product entry/edit: ProductForm, ProductItem
• Totals: TotalDisplay
• Actions: ActionButtons, FooterActions
• UX resilience: SplashLoader, ErrorBoundary, GracefulRecovery
State/Logic Layer
• useProducts (single source of truth for product list operations)
• calculator.ts (pure derived computations)
• validation.ts (input constraints)
• types.ts (domain model)
Cross-cutting
• ThemeContext + useTheme
• theme.ts + scale.ts
Infrastructure dependency
• AsyncStorage (local persistence)
• Screens → Components (composition)
• Components → Hooks (event handlers call commands; hooks provide state)
• useProducts → AsyncStorage (persist/load)
• useProducts → calculator (compute totals; emphasize “derived state only”)
• Theme provider (ThemeContext) → Components/Screens (styles/theme props)
Product lifecycle (offline-first core)
• On app start: useProducts loads from AsyncStorage → provides products to UI
• On add/edit/remove: UI event → useProducts updates in-memory state → writes to AsyncStorage
• Totals: UI displays totals from calculator(products) (computed, not stored)
Export/share
• UI action (Footer/Action button) → format list (likely inside useProducts or utility) → OS share/copy → WhatsApp
Theme
• ThemeContext provides current theme + toggle
• Components consume theme tokens (theme.ts, scale.ts)
Error handling / recovery
• ErrorBoundary catches render errors (wrap near root)
Explicit annotations (small text callouts attached to components):
• “Smart logic in hooks”: useProducts is the central orchestrator
• “Derived state”: totals computed in calculator.ts, not stored
• “Offline-first”: AsyncStorage is the source of persistence; app works without network
• “Presentational components”: src/components/* are “dumb” (props in, events out)
• “Composition root”: _layout.tsx / App.tsx configure providers/boundaries
Technologies to include as labels (don’t hide the stack)
• App container: React Native (Expo) + TypeScript
• Routing layer: Expo Router (implied by app/ + _layout.tsx)
• Persistence: AsyncStorage
• Sharing: OS Share Sheet / Clipboard / WhatsApp
Diagramming conventions (so it’s readable and “principal-grade”)
Labels like: “read”, “write”, “compute totals”, “share intent”.
Granularity guidance (don’t overthink—split into many components)
For *this* repo, “as many components as possible” means:
That combination will be the most accurate representation of Cignotee’s architecture: a clean offline-first client with centralized logic and dumb UI.