feat: App mobile Expo + API mobile dédiée
Some checks failed
CI / Lint, Unit Tests & Build (push) Failing after 1m21s
CI / Deploy production (on server) (push) Has been skipped

memento-mobile/ (Expo + React Native + expo-router):
- Auth: login email/password → Bearer token (expo-secure-store)
- Layout: guard auth → redirect /(auth)/login ou /(tabs)/home
- Tabs: Accueil, Carnets, Recherche, Profil
- Screens: login, home (recent notes + quick actions), notebooks list,
  note viewer (WebView HTML), search (texte), notebook detail, profile
- Design: tokens brand-accent (#A47148), ink, concrete, paper, border
- lib/config.ts: API_URL dev/prod configurable
- lib/api.ts: apiFetch avec Bearer token automatique
- lib/store.ts: Zustand auth store (login/logout/restore)

memento-note/ (API mobile dédiée):
- lib/mobile-auth.ts: createMobileToken / verifyMobileToken (HMAC-SHA256, 90j)
- POST /api/mobile/auth/login: email+password → token + user
- GET /api/mobile/auth/me: valider token, retourner profil
- GET /api/mobile/notebooks: liste carnets avec nb notes
- GET /api/mobile/notes: notes récentes (filtre par carnet optionnel)
- GET /api/mobile/notes/[id]: contenu complet d'une note
- GET /api/mobile/search: recherche fulltext titre+contenu

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Antigravity
2026-05-29 15:53:13 +00:00
parent c7d2e35ea6
commit aeedb2846f
27 changed files with 1228 additions and 10 deletions

View File

@@ -0,0 +1,5 @@
import { Stack } from 'expo-router'
export default function AuthLayout() {
return <Stack screenOptions={{ headerShown: false }} />
}

View File

@@ -0,0 +1,98 @@
import { useState } from 'react'
import {
View,
Text,
TextInput,
TouchableOpacity,
KeyboardAvoidingView,
Platform,
ActivityIndicator,
Alert,
} from 'react-native'
import { useAuthStore } from '@/lib/store'
export default function LoginScreen() {
const [email, setEmail] = useState('')
const [password, setPassword] = useState('')
const [loading, setLoading] = useState(false)
const login = useAuthStore((s) => s.login)
const handleLogin = async () => {
if (!email.trim() || !password.trim()) return
setLoading(true)
try {
await login(email.trim().toLowerCase(), password)
} catch (e: any) {
Alert.alert('Connexion échouée', e.message)
} finally {
setLoading(false)
}
}
return (
<KeyboardAvoidingView
behavior={Platform.OS === 'ios' ? 'padding' : 'height'}
className="flex-1 bg-paper"
>
<View className="flex-1 justify-center px-8">
{/* Logo */}
<View className="mb-12 items-center">
<Text className="text-4xl font-serif text-ink italic tracking-tight">Momento</Text>
<Text className="text-sm text-concrete mt-1">Votre espace de connaissance</Text>
</View>
{/* Form */}
<View className="space-y-3">
<View>
<Text className="text-[11px] font-semibold uppercase tracking-widest text-concrete mb-1.5">
Email
</Text>
<TextInput
value={email}
onChangeText={setEmail}
placeholder="vous@exemple.com"
autoCapitalize="none"
keyboardType="email-address"
autoComplete="email"
className="w-full border border-border rounded-xl px-4 py-3 text-ink text-[15px] bg-white"
placeholderTextColor="#8A8A82"
/>
</View>
<View>
<Text className="text-[11px] font-semibold uppercase tracking-widest text-concrete mb-1.5">
Mot de passe
</Text>
<TextInput
value={password}
onChangeText={setPassword}
placeholder="••••••••"
secureTextEntry
autoComplete="password"
className="w-full border border-border rounded-xl px-4 py-3 text-ink text-[15px] bg-white"
placeholderTextColor="#8A8A82"
onSubmitEditing={handleLogin}
/>
</View>
<TouchableOpacity
onPress={handleLogin}
disabled={loading || !email || !password}
className="mt-4 bg-ink rounded-xl py-3.5 items-center active:opacity-80"
style={{ opacity: loading || !email || !password ? 0.5 : 1 }}
>
{loading ? (
<ActivityIndicator color="white" size="small" />
) : (
<Text className="text-paper font-semibold text-[15px]">Se connecter</Text>
)}
</TouchableOpacity>
</View>
<Text className="text-center text-[12px] text-concrete mt-8">
memento-note.com
</Text>
</View>
</KeyboardAvoidingView>
)
}