# Yaltopia Tickets App — Agent Guide ## First Read Read these before writing any code: - `app/_layout.tsx` — root stack, guards, heartbeat, fonts, theme - `lib/api.ts` — API services & endpoint definitions - `lib/api-middlewares.ts` — auth injection + token refresh logic - `lib/routes.ts` — all route definitions with guard metadata - `lib/auth-store.ts` — zustand persisted auth state ## Commands ``` npm run start # expo start npm run android # expo run:android npm run ios # expo run:ios npm run web # expo start --web ``` No lint, typecheck, or test scripts exist. No `postinstall` hook beyond `patch-package`. ## Project Structure - **`app/`** — expo-router file-based screens; entry point is `expo-router/entry` (set in `package.json` `main`) - **`app/(tabs)/`** — 5 bottom tabs: index (Home), payments, scan, proforma, news - **`lib/`** — API client (`api.ts`), middleware (`api-middlewares.ts`), stores, guards, routes, permissions, theme, utils - **`components/`** — shared UI; `components/ui/` has shadcn-style primitives (button, text, card) - **Path alias**: `@/` → project root (tsconfig paths) ## Key Conventions - **Navigating**: `useSirouRouter().go("routeName", { params })` — NOT expo-router's `router.push`. Import `AppRoutes` from `@/lib/routes`. - **API calls**: Use the `@simple-api` client (`api.{service}.{endpoint}({ body, params, query, headers })`). For file uploads (scan), use raw `fetch` with FormData. - **Auth tokens**: Never manually inject Bearer. `authMiddleware` does it automatically + proactively refreshes near-expiry tokens via `refreshTokens()` singleton promise. - **Phone numbers**: Ethiopian `+251` is auto-prepended. Input fields accept the 9-digit number without prefix. - **Toast**: `import { toast } from "@/lib/toast-store"` then `toast.success("Title", "Message")`, `.error()`, `.warning()`, `.info()`. - **Form screens** use inline `StyleSheet.create` for input styles and `useInputColors()` custom hook for theming. No form validation library. ## UI Patterns (look at existing screens) - **Tab bar**: Floating pill, `absolute`, `bottom: 25`, `marginHorizontal: 20`, `borderRadius: 32` (see `app/(tabs)/_layout.tsx`) - **Primary color**: `#ea580c` (orange) — used as `text-primary`, `bg-primary`, `color="#ea580c"` - **Cards**: `` + `` from `@/components/ui/card`, often wrapped in `` - **Text**: `` from `@/components/ui/text` - **Buttons**: `