From 609ddb47a9ab4fabf8861aba5098cd8fc07b5b28 Mon Sep 17 00:00:00 2001 From: devthejo Date: Sun, 8 Mar 2026 12:49:38 +0100 Subject: [PATCH] feat(dae): loading list --- src/scenes/DAEList/Carte.js | 44 +++++++++++++++++++++++++++++++++++- src/scenes/DAEList/Liste.js | 45 +++++++++++++++++++++++++++++++++++-- 2 files changed, 86 insertions(+), 3 deletions(-) diff --git a/src/scenes/DAEList/Carte.js b/src/scenes/DAEList/Carte.js index edfa78a..8ababdf 100644 --- a/src/scenes/DAEList/Carte.js +++ b/src/scenes/DAEList/Carte.js @@ -53,6 +53,23 @@ function defibsToGeoJSON(defibs) { }; } +function LoadingView({ message }) { + const { colors } = useTheme(); + return ( + + + + {message} + + + ); +} + function EmptyNoLocation() { const { colors } = useTheme(); return ( @@ -127,8 +144,18 @@ export default React.memo(function DAEListCarte() { return ; } + // Waiting for location + if (!hasLocation && defibs.length === 0 && !hasCoords) { + return ( + + ); + } + + // Loading defibs from database if (loading && defibs.length === 0 && !hasCoords) { - return ; + return ( + + ); } return ( @@ -203,6 +230,21 @@ export default React.memo(function DAEListCarte() { }); const styles = StyleSheet.create({ + loadingContainer: { + flex: 1, + alignItems: "center", + justifyContent: "center", + paddingHorizontal: 32, + }, + loaderInner: { + flex: 0, + }, + loadingText: { + fontSize: 14, + textAlign: "center", + marginTop: 12, + lineHeight: 20, + }, container: { flex: 1, }, diff --git a/src/scenes/DAEList/Liste.js b/src/scenes/DAEList/Liste.js index ba9c9b5..2a3f054 100644 --- a/src/scenes/DAEList/Liste.js +++ b/src/scenes/DAEList/Liste.js @@ -11,6 +11,23 @@ import { defibsActions } from "~/stores"; import useNearbyDefibs from "./useNearbyDefibs"; import DefibRow from "./DefibRow"; +function LoadingView({ message }) { + const { colors } = useTheme(); + return ( + + + + {message} + + + ); +} + function EmptyNoLocation() { const { colors } = useTheme(); return ( @@ -173,9 +190,18 @@ export default React.memo(function DAEListListe() { return ; } - // Loading initial data + // Waiting for location + if (!hasLocation && allDefibs.length === 0) { + return ( + + ); + } + + // Loading defibs from database if (loading && allDefibs.length === 0) { - return ; + return ( + + ); } // Error state (non-blocking if we have stale data) @@ -239,6 +265,21 @@ export default React.memo(function DAEListListe() { }); const styles = StyleSheet.create({ + loadingContainer: { + flex: 1, + alignItems: "center", + justifyContent: "center", + paddingHorizontal: 32, + }, + loaderInner: { + flex: 0, + }, + loadingText: { + fontSize: 14, + textAlign: "center", + marginTop: 12, + lineHeight: 20, + }, container: { flex: 1, },