import { Linking, Text, TouchableOpacity, View } from "react-native"; import { tr } from "@/lib/i18n"; import type { LocationStatus } from "@/lib/use-user-location"; const COPY: Record = { denied: { titleKey: "components.locationNotice.denied.title", bodyKey: "components.locationNotice.denied.body", actionKey: "components.locationNotice.denied.action", }, "services-off": { titleKey: "components.locationNotice.servicesOff.title", bodyKey: "components.locationNotice.servicesOff.body", actionKey: "components.locationNotice.servicesOff.action", }, unavailable: { titleKey: "components.locationNotice.unavailable.title", bodyKey: "components.locationNotice.unavailable.body", actionKey: "components.locationNotice.unavailable.action", }, }; /** Fills the map slot when there's no position to draw. */ export const LocationNotice = ({ status, onRetry, }: { status: LocationStatus; onRetry: () => void; }) => { const copy = COPY[status]; if (!copy) return null; return ( {tr(copy.titleKey)} {tr(copy.bodyKey)} status === "denied" ? void Linking.openSettings() : onRetry() } activeOpacity={0.8} className="mt-5 rounded-full bg-primary-500 px-6 py-3" > {tr(copy.actionKey)} ); };