import React from 'react'; import { RefreshControl, ScrollView, StyleSheet, Text, View } from 'react-native'; import type { NativeStackScreenProps } from '@react-navigation/native-stack'; import Ionicons from '@react-native-vector-icons/ionicons'; import type { LoanStackParamList } from '../../../navigation/types'; import { Button, Card, EmptyState, Loader, ScreenShell } from '../../../components'; import { useTheme } from '../../../theme'; import { formatCurrency, formatDate, formatCompactCurrency } from '../../../utils/formatters'; import { useLoanDashboard } from '../hooks/useLoanDashboard'; import { LoanSummaryHero } from '../components/LoanSummaryHero'; import { LoanAccountCard } from '../components/LoanAccountCard'; import { LoanFilterChip } from '../components/LoanFilterChip'; import { LoanNotificationItem } from '../components/LoanNotificationItem'; import { useGetLoanNotificationsQuery } from '../services/loanApi'; type Props = NativeStackScreenProps; export default function LoanDashboardScreen({ navigation }: Props) { const theme = useTheme(); const { activeLoans, applications, totalOutstanding, nextEmi, summary, unreadNotifications, isLoading, isError, refreshing, onRefresh, } = useLoanDashboard(); // Mock notifications for demonstration on dashboard const { data: notifications } = useGetLoanNotificationsQuery(); const recentNotifications = (notifications ?? []).slice(0, 2); return ( } > {/* Hero Summary */} {/* Notifications Section */} {recentNotifications.length > 0 && ( What's new {unreadNotifications > 0 && ( {unreadNotifications} )} {recentNotifications.map((notif, index) => ( {index < recentNotifications.length - 1 && ( )} ))} )} {/* Quick Actions */} Quick actions Apply for a new loan, calculate EMI, or manage payments