feat: add mobile application structure with emotion picker and API integration

- Added favicon and icon assets for the mobile app.
- Implemented EmotionPicker component for selecting emotions with child options.
- Created hooks for fetching emotions, feeds, and rapport data.
- Established API service for handling requests and authentication.
- Integrated Zustand for state management of user authentication.
- Defined color palette for the application.
- Set up TypeScript types for various entities including User, Emotion, and Feed.
- Configured Babel and TypeScript for the mobile project.
- Added package.json with necessary dependencies for Expo and React Native.
This commit is contained in:
Azmog
2026-04-15 16:09:20 +02:00
parent 88f5863cb5
commit bfd35905c9
60 changed files with 2437 additions and 42 deletions
+56
View File
@@ -0,0 +1,56 @@
import { useEffect } from 'react';
import { Stack, useRouter, useSegments } from 'expo-router';
import { StatusBar } from 'expo-status-bar';
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { useAuthStore } from '@/lib/auth-store';
import { View, ActivityIndicator } from 'react-native';
const queryClient = new QueryClient();
function AuthGuard({ children }: { children: React.ReactNode }) {
const { isAuthenticated, isLoading, loadToken } = useAuthStore();
const segments = useSegments();
const router = useRouter();
useEffect(() => {
loadToken();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
useEffect(() => {
if (isLoading) return;
const inAuthGroup = segments[0] === 'auth';
if (!isAuthenticated && !inAuthGroup) {
router.replace('/auth/login');
} else if (isAuthenticated && inAuthGroup) {
router.replace('/(tabs)');
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [isAuthenticated, isLoading, segments]);
if (isLoading) {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#fff' }}>
<ActivityIndicator size="large" color="#fce117" />
</View>
);
}
return <>{children}</>;
}
export default function RootLayout() {
return (
<QueryClientProvider client={queryClient}>
<AuthGuard>
<Stack screenOptions={{ headerShown: false }}>
<Stack.Screen name="auth" />
<Stack.Screen name="(tabs)" />
</Stack>
</AuthGuard>
<StatusBar style="auto" />
</QueryClientProvider>
);
}