Struktur kode
src/ worker.ts Worker passthrough Workers Assets app/ Rute Expo Router _layout.tsx Root Stack + AuthProvider +html.tsx HTML shell: manifest, theme-color, registrasi service worker login.tsx (app)/ Area ter-autentikasi (Tabs) _layout.tsx Gate login + tab per peran + logout index.tsx Beranda input.tsx Hub Input + layar form + Checklist + dst. pricing.tsx Segmented: Paket / Acuan Harga / Pelanggan / Tanya AI pos.tsx Kasir + Riwayat pesanan.tsx Daftar pesanan pesanan/[orderId].tsx pengeluaran/[item].tsx Tren harga satu item insight/{catering,warung,pengeluaran}.tsx components/ Komponen UI per fitur (lihat tabel) lib/ api, auth, storage, tipe, format, form-config, paket, invoice| File | Fungsi |
|---|---|
api.ts |
apiFetch + api.get/post/put/del, ApiError, penanganan 401 |
auth.tsx |
AuthProvider, useAuth |
storage.ts |
Wrapper token (web localStorage, native SecureStore) |
types.ts |
Salinan subset tipe citarasa-erp: InsightPayload, KpiSummary, dll |
format.ts |
rp() (Rupiah id-ID), tanggal(), waktu() |
form-config.ts |
Satu sumber kebenaran 6 form input satu-item |
paket.ts |
Katalog 54 menu satuan, harga, hitungPaket() |
invoice.ts |
Render struk jadi PNG lewat Canvas 2D |
invoice-history.ts |
Tipe dan saveInvoice() |
supplier-prices.ts |
Parser teks produk supplier jajan menjadi harga beli dan jual |
components/
Section titled “components/”| Komponen | Dipakai oleh |
|---|---|
fields.tsx, DateField(.web).tsx, CustomerAutocomplete.tsx |
Form input |
RiwayatList.tsx |
Riwayat per form |
DailyChecklist.tsx, ChecklistRow.tsx, ChecklistHistory.tsx, ChecklistInsight.tsx |
Checklist harian |
ExpenseDay.tsx |
Pengeluaran warung |
InvoiceTool.tsx, InvoiceHistory.tsx |
Invoice |
SupplierList.tsx |
Data supplier |
PaketCalculator.tsx, PricingAssistant.tsx, RepeatCustomers.tsx, AiAsk.tsx |
Pricing |
CartBar.tsx |
POS |
KpiCard.tsx, TrendChart.tsx, ExpenseInsights.tsx, StatusBadge.tsx |
Beranda dan insight |
Konvensi
Section titled “Konvensi”- Alias impor
@/menunjuk kesrc/(tsconfig.json). - Styling hanya
StyleSheet; warna merek#007838, merah#b91c1chanya untuk error. - Platform: file
*.web.tsxdipakai di web (mis.DateField.web.tsxmemakai<input type="date">),*.tsxsebagai fallback native. react-native-webtidak mendukungAlert.alert: pakaiPlatform.OS === 'web'denganwindow.confirm, atau banner status di layar.