import { View } from "react-native"; import { Text } from "@/components/ui/Text"; import type { RxStatus } from "@/lib/stores/prescriptionStore"; import { colors, radii } from "@/lib/theme"; const STEPS: { key: RxStatus; label: string }[] = [ { key: "submitted", label: "Submitted" }, { key: "under_review", label: "Under review" }, { key: "approved", label: "Approved" }, { key: "filled", label: "Filled" }, ]; const BRANCH: Partial> = { queried: { label: "Queried", tone: "info" }, rejected: { label: "Rejected", tone: "danger" }, }; function stepIndex(status: RxStatus) { if (status === "queried") return 1; if (status === "rejected") return 1; const i = STEPS.findIndex((s) => s.key === status); return i < 0 ? 0 : i; } export function RxStatusStepper({ status }: { status: RxStatus }) { const active = stepIndex(status); const branch = BRANCH[status]; return ( {STEPS.map((step, i) => { const done = i <= active && !branch; const current = i === active; const muted = i > active; return ( {(done && !current) || status === "filled" && i <= active ? ( ) : null} {step.label} {i < STEPS.length - 1 ? ( ) : null} ); })} {branch ? ( Pharmacist: {branch.label} ) : null} ); }