diff --git a/.Jules/changelog.md b/.Jules/changelog.md index 11fc864..29d0dbd 100644 --- a/.Jules/changelog.md +++ b/.Jules/changelog.md @@ -7,6 +7,13 @@ ## [Unreleased] ### Added +- **Mobile Skeleton Loading:** Implemented a reusable skeleton loading system for the mobile app. + - **Features:** + - Created `Skeleton` component with pulsing animation using `Animated` and `useTheme`. + - Created `GroupListSkeleton` component mimicking the layout of group cards. + - Integrated skeleton loading into `HomeScreen`, replacing the generic spinner. + - **Technical:** Created `mobile/components/ui/Skeleton.js` and `mobile/components/skeletons/GroupListSkeleton.js`. Updated `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..0df865a 100644 --- a/.Jules/todo.md +++ b/.Jules/todo.md @@ -57,12 +57,12 @@ - Impact: Native feel, users can easily refresh data - Size: ~150 lines -- [ ] **[ux]** Complete skeleton loading for HomeScreen groups - - File: `mobile/screens/HomeScreen.js` +- [x] **[ux]** Complete skeleton loading for HomeScreen groups + - Completed: 2026-02-09 + - Files: `mobile/screens/HomeScreen.js`, `mobile/components/skeletons/GroupListSkeleton.js`, `mobile/components/ui/Skeleton.js` - Context: Replace ActivityIndicator with skeleton group cards - - Impact: Better loading experience, less jarring - - Size: ~40 lines - - Added: 2026-01-01 + - Impact: Professional loading experience that mimics actual content layout + - Size: ~60 lines - [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..832466a --- /dev/null +++ b/mobile/components/skeletons/GroupListSkeleton.js @@ -0,0 +1,59 @@ +import React from 'react'; +import { View, StyleSheet } from 'react-native'; +import { Card } from 'react-native-paper'; +import Skeleton from '../ui/Skeleton'; + +const GroupListSkeleton = () => { + // Render 6 skeleton items to fill the screen + return ( + + {[...Array(6)].map((_, index) => ( + + + {/* Avatar Skeleton */} + + + {/* Title Skeleton */} + + + + + + + {/* Status Skeleton */} + + + + ))} + + ); +}; + +const styles = StyleSheet.create({ + container: { + padding: 16, + }, + card: { + marginBottom: 16, + }, + header: { + flexDirection: 'row', + alignItems: 'center', + padding: 16, // Mimics Card.Title padding + }, + titleContainer: { + marginLeft: 16, + flex: 1, + justifyContent: 'center', + }, + status: { + 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..388f996 --- /dev/null +++ b/mobile/components/ui/Skeleton.js @@ -0,0 +1,46 @@ +import React, { useEffect, useRef } from 'react'; +import { Animated } from 'react-native'; +import { useTheme } from 'react-native-paper'; + +const Skeleton = ({ width, height, borderRadius = 4, style }) => { + const theme = useTheme(); + const opacity = useRef(new Animated.Value(0.5)).current; + + useEffect(() => { + const animation = Animated.loop( + Animated.sequence([ + Animated.timing(opacity, { + toValue: 1, + duration: 800, + useNativeDriver: true, + }), + Animated.timing(opacity, { + toValue: 0.5, + duration: 800, + useNativeDriver: true, + }), + ]) + ); + + animation.start(); + + return () => animation.stop(); + }, [opacity]); + + return ( + + ); +}; + +export default Skeleton; diff --git a/mobile/screens/HomeScreen.js b/mobile/screens/HomeScreen.js index d2f3c38..3cbc2b9 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 ? ( - - - + ) : (