Build complete Expo/React Native mobile app with: - Auth flow: email/password login, registration, biometric auth - Dashboard: exposure summary, spam stats, voice protection status - DarkWatch: watch list management, exposure feed, alert toggles - SpamShield: call/text history, whitelist/blacklist management - VoicePrint: family member enrollment, voice analysis - Settings: tier management, notification preferences, security - Push notification integration via FCM/APNs - Offline-first state management with Zustand + AsyncStorage - Integration with @shieldai/mobile-api-client for API services - React Navigation with auth-aware routing (stack + bottom tabs) - Dark theme with consistent design system (colors, spacing, typography) - Network status monitoring and offline request queuing Co-Authored-By: Paperclip <noreply@paperclip.ing>
47 lines
1.3 KiB
TypeScript
47 lines
1.3 KiB
TypeScript
import { create } from 'zustand';
|
|
import { persist, createJSONStorage } from 'zustand/middleware';
|
|
import AsyncStorage from '@react-native-async-storage/async-storage';
|
|
import type { DashboardData } from '@/types';
|
|
|
|
interface DashboardState {
|
|
data: DashboardData | null;
|
|
isLoading: boolean;
|
|
lastUpdated: string | null;
|
|
refreshDashboard: () => Promise<void>;
|
|
setData: (data: DashboardData) => void;
|
|
}
|
|
|
|
export const useDashboardStore = create<DashboardState>()(
|
|
persist(
|
|
(set) => ({
|
|
data: null,
|
|
isLoading: false,
|
|
lastUpdated: null,
|
|
|
|
refreshDashboard: async () => {
|
|
set({ isLoading: true });
|
|
try {
|
|
const mockData: DashboardData = {
|
|
exposureSummary: { total: 0, unresolved: 0, critical: 0 },
|
|
spamStats: { blockedToday: 0, blockedTotal: 0, spamScore: 0 },
|
|
voiceProtectionStatus: { isMonitoring: false, profilesEnrolled: 0, lastAnalysis: '' },
|
|
};
|
|
set({
|
|
data: mockData,
|
|
isLoading: false,
|
|
lastUpdated: new Date().toISOString(),
|
|
});
|
|
} catch {
|
|
set({ isLoading: false });
|
|
}
|
|
},
|
|
|
|
setData: (data) => set({ data, lastUpdated: new Date().toISOString() }),
|
|
}),
|
|
{
|
|
name: '@shieldai_dashboard',
|
|
storage: createJSONStorage(() => AsyncStorage),
|
|
}
|
|
)
|
|
);
|