From 83519cb8ad2c33f1fa1e8a706c811685329533e8 Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Wed, 18 Mar 2026 20:12:56 +0000 Subject: [PATCH] [jules] enhance: Add skeleton loading for HomeScreen groups Co-authored-by: Devasy23 <110348311+Devasy23@users.noreply.github.com> --- .Jules/changelog.md | 8 +++ .Jules/todo.md | 3 +- .../components/skeletons/GroupListSkeleton.js | 63 +++++++++++++++++++ mobile/components/ui/Skeleton.js | 52 +++++++++++++++ mobile/screens/HomeScreen.js | 6 +- 5 files changed, 127 insertions(+), 5 deletions(-) create mode 100644 mobile/components/skeletons/GroupListSkeleton.js create mode 100644 mobile/components/ui/Skeleton.js diff --git a/.Jules/changelog.md b/.Jules/changelog.md index 11fc864..ba1cdc8 100644 --- a/.Jules/changelog.md +++ b/.Jules/changelog.md @@ -7,6 +7,14 @@ ## [Unreleased] ### Added +- **Mobile Skeleton Loading:** Replaced basic ActivityIndicator with a sophisticated `GroupListSkeleton` in `HomeScreen`. + - **Features:** + - Created reusable animated `Skeleton` primitive. + - Created `GroupListSkeleton` mimicking actual `HapticCard` layout. + - Implemented subtle pulse animation matching theme variants. + - Fully accessible with appropriate `progressbar` roles and labels. + - **Technical:** Created `mobile/components/ui/Skeleton.js` and `mobile/components/skeletons/GroupListSkeleton.js`. Integrated into `mobile/screens/HomeScreen.js`. + - **Password Strength Meter:** Added a visual password strength indicator to the signup form. - **Features:** - Real-time strength calculation (Length, Uppercase, Lowercase, Number, Symbol). diff --git a/.Jules/todo.md b/.Jules/todo.md index ebb0c7a..efa819d 100644 --- a/.Jules/todo.md +++ b/.Jules/todo.md @@ -57,12 +57,13 @@ - Impact: Native feel, users can easily refresh data - Size: ~150 lines -- [ ] **[ux]** Complete skeleton loading for HomeScreen groups +- [x] **[ux]** Complete skeleton loading for HomeScreen groups - File: `mobile/screens/HomeScreen.js` - Context: Replace ActivityIndicator with skeleton group cards - Impact: Better loading experience, less jarring - Size: ~40 lines - Added: 2026-01-01 + - Completed: 2026-03-18 - [x] **[a11y]** Complete accessibility labels for all screens - Completed: 2026-01-29 diff --git a/mobile/components/skeletons/GroupListSkeleton.js b/mobile/components/skeletons/GroupListSkeleton.js new file mode 100644 index 0000000..dc79b33 --- /dev/null +++ b/mobile/components/skeletons/GroupListSkeleton.js @@ -0,0 +1,63 @@ +import React from 'react'; +import { View, StyleSheet, FlatList } from 'react-native'; +import { Card } from 'react-native-paper'; +import Skeleton from '../ui/Skeleton'; + +const GroupListSkeleton = () => { + const renderSkeletonItem = ({ item }) => ( + + } + left={(props) => ( + + + + )} + /> + + + + + ); + + // Render 5 placeholder items + const skeletonData = Array.from({ length: 5 }).map((_, i) => ({ id: `skeleton-${i}` })); + + return ( + + item.id} + contentContainerStyle={styles.list} + scrollEnabled={false} // Disable scrolling for skeleton list + /> + + ); +}; + +const styles = StyleSheet.create({ + container: { + flex: 1, + }, + list: { + padding: 16, + }, + card: { + marginBottom: 16, + }, + avatarPlaceholder: { + justifyContent: 'center', + alignItems: 'center', + }, + contentSkeleton: { + marginTop: 4, + }, +}); + +export default GroupListSkeleton; diff --git a/mobile/components/ui/Skeleton.js b/mobile/components/ui/Skeleton.js new file mode 100644 index 0000000..c722d7c --- /dev/null +++ b/mobile/components/ui/Skeleton.js @@ -0,0 +1,52 @@ +import React, { useEffect, useRef } from 'react'; +import { Animated, View, StyleSheet } from 'react-native'; +import { useTheme } from 'react-native-paper'; + +const Skeleton = ({ width, height, borderRadius = 4, style }) => { + const theme = useTheme(); + const animatedValue = useRef(new Animated.Value(0.3)).current; + + useEffect(() => { + const animation = Animated.loop( + Animated.sequence([ + Animated.timing(animatedValue, { + toValue: 0.7, + duration: 800, + useNativeDriver: true, + }), + Animated.timing(animatedValue, { + toValue: 0.3, + duration: 800, + useNativeDriver: true, + }), + ]) + ); + animation.start(); + + return () => animation.stop(); + }, [animatedValue]); + + return ( + + ); +}; + +const styles = StyleSheet.create({ + skeleton: { + overflow: 'hidden', + }, +}); + +export default Skeleton; diff --git a/mobile/screens/HomeScreen.js b/mobile/screens/HomeScreen.js index d2f3c38..46255ac 100644 --- a/mobile/screens/HomeScreen.js +++ b/mobile/screens/HomeScreen.js @@ -1,7 +1,6 @@ import { useContext, useEffect, useState } from "react"; import { Alert, FlatList, RefreshControl, StyleSheet, View } from "react-native"; import { - ActivityIndicator, Appbar, Avatar, Modal, @@ -13,6 +12,7 @@ import { import HapticButton from '../components/ui/HapticButton'; import HapticCard from '../components/ui/HapticCard'; import { HapticAppbarAction } from '../components/ui/HapticAppbar'; +import GroupListSkeleton from '../components/skeletons/GroupListSkeleton'; import * as Haptics from "expo-haptics"; import { createGroup, getGroups, getOptimizedSettlements } from "../api/groups"; import { AuthContext } from "../context/AuthContext"; @@ -257,9 +257,7 @@ const HomeScreen = ({ navigation }) => { {isLoading ? ( - - - + ) : (