How pku2213/sketch-coffee-pad-new works
Sketch Coffee is an in-store tablet system for café ordering and daily operations. The main workflow is browsing and configuring a drink, calculating its price, recording it locally, then completing it in the ledger and syncing it to Feishu; offline orders wait for retry. Separate workflows cover recipes, restocking, and shift checklists. The graph includes the documented local-first storage and Feishu menu/checklist integrations. Several page and library implementations were not sampled, so those connections reflect README documentation rather than inspected call sites.
Main entry points: db.ts Tablet IndexedDB · sync.ts Refresh and retry · MenuBrowser.tsx Menu browser · page.tsx Order page
Components 21
Tablet workflows
- Order page
app/order/page.tsx - Menu browser
components/MenuBrowser.tsx - Recipe page
app/process/page.tsx - Ledger page
app/ledger/page.tsx - Restock page
app/restock/page.tsx - Duty checklist
app/duty/page.tsx - Settings modal
components/SettingsModal.tsx
Domain services
- Price calculation
lib/pricing.ts - Order lifecycle
lib/orders.ts - Menu search
lib/search.ts - Supply tracking
lib/restock.ts - Shift settings
lib/settings.ts - Refresh and retry
lib/sync.ts - Local menu access
lib/useMenu.ts
Local data
- Tablet IndexedDB
lib/db.ts
Feishu integration
- Menu endpoint
app/api/menu/route.ts - Duty endpoint
app/api/duty/route.ts - Order sync endpoint
app/api/orders/sync/route.ts - Feishu client
lib/feishu.ts
Other components
- Café staff
- Feishu Bitable
Connections 30
- Café staff → Order page: places orders
- Café staff → Recipe page: views recipes
- Café staff → Ledger page: tracks orders
- Café staff → Restock page: tracks supplies
- Café staff → Duty checklist: checks tasks
- Café staff → Settings modal: sets preferences
- Order page → Menu browser: browses menu
- Recipe page → Menu browser: browses recipes
- Menu browser → Menu search: searches items
- Menu browser → Local menu access: loads menu
- Menu browser → Refresh and retry: refreshes menu
- Local menu access → Tablet IndexedDB: reads menu
- Order page → Price calculation: calculates price
- Order page → Tablet IndexedDB: records orders
- Ledger page → Order lifecycle: completes or reverses
- Order lifecycle → Tablet IndexedDB: updates orders
- Restock page → Supply tracking: records changes
- Restock page → Tablet IndexedDB: reads and writes
- Duty checklist → Refresh and retry: refreshes checklist
- Duty checklist → Tablet IndexedDB: stores check state
- Settings modal → Shift settings: updates settings
- Shift settings → Tablet IndexedDB: stores settings
- Refresh and retry → Menu endpoint: fetches menu
- Refresh and retry → Duty endpoint: fetches checklist
- Refresh and retry → Order sync endpoint: uploads queued orders
- Refresh and retry → Tablet IndexedDB: refreshes and retries
- Menu endpoint → Feishu client: requests menu
- Duty endpoint → Feishu client: requests tasks
- Order sync endpoint → Feishu client: checks and writes orders
- Feishu client → Feishu Bitable: reads and writes