import { Ionicons } from "@expo/vector-icons"; import { useEffect, useState } from "react"; import { ActivityIndicator, Text, View } from "react-native"; import { Alert, getAlerts } from "../../api"; import { t } from "../../lib/locales"; import { colors } from "../../lib/theme"; import { Card, Divider, H2, Muted, Pill, Row, Screen } from "../../lib/ui"; export default function AlertsScreen() { const [alerts, setAlerts] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { console.log("AlertsScreen: Fetching alerts..."); setLoading(true); getAlerts() .then((data) => { console.log("AlertsScreen: Received alerts:", data); setAlerts(data); }) .catch((error) => { console.error("AlertsScreen: Error fetching alerts:", error); }) .finally(() => { setLoading(false); }); }, []); return ( {loading ? ( {t("loadingAlerts")} ) : alerts.length === 0 ? (

{t("allClearTitle")}

{t("noAlertsToReview")}
) : ( alerts.map((alert) => (

{alert.title}

{alert.timeLabel}
} right={ } />

{t("whatHappened")}

{alert.whatHappened}

{t("whyItMatters")}

{alert.whyItMatters}

{t("suggestedNextStep")}

{alert.suggestedAction}
)) )}
); }