import { router } from 'expo-router'; import { useState, type ReactNode } from 'react'; import { Modal, Pressable, ScrollView, Text, View } from 'react-native'; import { WORK_ORDER_STATUS_LABELS, type WorkOrderStatus } from '@siop/shared'; import { useTokens, type Tokens } from '@/theme/tokens'; /** Briques d'écran de la maquette R4 — cartes, chips, boutons, sélecteur. */ export function Carte({ titre, children }: { titre?: string; children: ReactNode }) { const t = useTokens(); return ( {titre ? ( {titre} ) : null} {children} ); } export function LigneInfo({ nom, valeur }: { nom: string; valeur: ReactNode }) { const t = useTokens(); return ( {nom} {typeof valeur === 'string' ? ( {valeur} ) : ( valeur )} ); } const STYLE_STATUT: Record [string, string]> = { OPEN: (t) => [t.stOuvert, t.stOuvertFond], IN_PROGRESS: (t) => [t.stEncours, t.stEncoursFond], ON_HOLD: (t) => [t.stAttente, t.stAttenteFond], DONE: (t) => [t.stTermine, t.stTermineFond], CANCELLED: (t) => [t.stAnnule, t.stAnnuleFond], }; export function ChipStatut({ statut }: { statut: WorkOrderStatus }) { const t = useTokens(); const [encre, fond] = STYLE_STATUT[statut](t); return ( {WORK_ORDER_STATUS_LABELS[statut]} ); } export function BoutonTel({ libelle, variante = 'prim', desactive, surAppui, }: { libelle: string; variante?: 'prim' | 'vert' | 'contour' | 'gris'; desactive?: boolean; surAppui: () => void; }) { const t = useTokens(); const fonds = { prim: t.primaire, vert: t.succes, contour: t.surface, gris: t.bordureForte }; return ( {libelle} ); } export function EnteteFiche({ titre, apres }: { titre: string; apres?: ReactNode }) { const t = useTokens(); return ( (router.canGoBack() ? router.back() : router.replace('/(tabs)/journee'))} hitSlop={10} > {titre} {apres} ); } /** Sélecteur au pouce (RN n'a pas de