From 7eb8ccae48b0cc18a9dcaa9c3626a02df8e6d919 Mon Sep 17 00:00:00 2001 From: JustZvan Date: Fri, 6 Feb 2026 13:22:33 +0100 Subject: feat: initial commit! --- app/(tabs)/index.tsx | 135 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 135 insertions(+) create mode 100644 app/(tabs)/index.tsx (limited to 'app/(tabs)/index.tsx') diff --git a/app/(tabs)/index.tsx b/app/(tabs)/index.tsx new file mode 100644 index 0000000..a29ec87 --- /dev/null +++ b/app/(tabs)/index.tsx @@ -0,0 +1,135 @@ +import { Ionicons } from "@expo/vector-icons"; +import { useEffect, useState } from "react"; +import { getHomeData, HomeData } from "../../api"; +import { useDevice } from "../../lib/device"; +import { t } from "../../lib/locales"; +import { colors } from "../../lib/theme"; +import { + Card, + DeviceSelector, + Divider, + H2, + Muted, + Pill, + Row, + Screen, +} from "../../lib/ui"; + +export default function Index() { + const [data, setData] = useState(null); + const { + devices, + selectedDevice, + selectDevice, + isLoading: isDeviceLoading, + } = useDevice(); + + useEffect(() => { + if (selectedDevice) { + getHomeData(selectedDevice.id).then(setData); + } + }, [selectedDevice]); + + if (!selectedDevice && !isDeviceLoading) + return ( + + + {t("noDeviceSelectedPleaseLinkFirst")} + + ); + + if (!data) + return ( + + + + ); + + return ( + + + + + + {data.overallStatus === "all_clear" + ? t("allClear") + : t("attentionNeeded")} + + } + right={ + + } + /> + } + /> + + {data.overallStatus === "all_clear" + ? t("nothingNeedsAttention") + : t("fewItemsNeedReview")} + + + + + + } + right={ +

+ {data.deviceOnline + ? t("deviceIsOnline") + : t("deviceIsOffline")} +

+ } + /> + } + /> + } + /> + + {data.deviceOnline + ? t("protectionActive") + : t("reconnectingAutomatically")} + +
+
+ ); +} -- cgit v1.2.3