feat(smart-app): implement complete mobile app MVP

- App.tsx: full navigation (Auth stack + Main tabs with 5 screens)
- Auth: LoginScreen, RegisterScreen, ForgotPasswordScreen
- HomeScreen: dashboard with IoT metrics, weather widget, alerts, quick actions, sensors
- MapScreen: interactive map with layer toggles (6 layers)
- MarketplaceScreen: categories (6), products (5), search
- ChatScreen: AI chat with quick prompts (4), bot responses
- ProfileScreen: user info, stats, menu (9 items), logout
- AlertsScreen: alert list with severity, acknowledge
- SensorsScreen: sensor list with type filters (6 types), search
- ZonesScreen: zone cards with stats
- SettingsScreen: language picker (FR/EN/ES/DE), privacy, about
- Stores: iotStore (sensors, zones, alerts), notificationStore, uiStore + i18n
- Hooks: useSensors, useAlerts, useNotifications, useLocation
- Components: Card, Button, LoadingSpinner, ErrorBoundary, Header
- Services: iotService, notificationService (with axios API client)
- Utils: formatters (temp, AQI, noise, dates), validators (email, password, IBAN)
- Theme: colors.ts with full design system (Blue Ocean palette)
- Ditto: fixed MongoDB connection, new JWT secrets, official gateway image
This commit is contained in:
Eric FELIXINE
2026-06-01 18:00:35 -04:00
parent 08ca495bde
commit e30ae8ed09
35578 changed files with 3703534 additions and 43 deletions

View File

@@ -0,0 +1 @@
// TODO: Implement

View File

@@ -0,0 +1,48 @@
// Smart App City — Formatters utility
export const formatters = {
temperature: (value: number, unit: string = '°C') => `${value.toFixed(1)}${unit}`,
humidity: (value: number) => `${value}%`,
aqi: (value: number) => {
if (value <= 50) return { label: 'Bon', color: '#2E7D32' };
if (value <= 100) return { label: 'Modéré', color: '#F57C00' };
if (value <= 150) return { label: 'Mauvais', color: '#D32F2F' };
return { label: 'Dangereux', color: '#7B1FA2' };
},
noise: (value: number) => {
if (value <= 40) return { label: 'Silencieux', color: '#2E7D32' };
if (value <= 55) return { label: 'Normal', color: '#0288D1' };
if (value <= 70) return { label: 'Bruyant', color: '#F57C00' };
return { label: 'Très bruyant', color: '#D32F2F' };
},
date: (date: string | Date, locale: string = 'fr-FR') => {
const d = new Date(date);
return d.toLocaleDateString(locale, {
day: '2-digit',
month: '2-digit',
year: 'numeric',
hour: '2-digit',
minute: '2-digit',
});
},
time: (date: string | Date) => {
const d = new Date(date);
return d.toLocaleTimeString('fr-FR', { hour: '2-digit', minute: '2-digit' });
},
relativeTime: (date: string | Date) => {
const d = new Date(date);
const now = new Date();
const diffMs = now.getTime() - d.getTime();
const diffMins = Math.floor(diffMs / 60000);
const diffHours = Math.floor(diffMs / 3600000);
const diffDays = Math.floor(diffMs / 86400000);
if (diffMins < 1) return "À l'instant";
if (diffMins < 60) return `Il y a ${diffMins} min`;
if (diffHours < 24) return `Il y a ${diffHours}h`;
if (diffDays < 7) return `Il y a ${diffDays}j`;
return d.toLocaleDateString('fr-FR', { day: '2-digit', month: '2-digit' });
},
currency: (value: number, currency: string = 'EUR') =>
new Intl.NumberFormat('fr-FR', { style: 'currency', currency }).format(value),
};

View File

@@ -0,0 +1,35 @@
// Smart App City — Validators utility
export const validators = {
email: (email: string): boolean => {
const re = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
return re.test(email);
},
password: (password: string): { valid: boolean; errors: string[] } => {
const errors: string[] = [];
if (password.length < 8) errors.push('Au moins 8 caractères');
if (!/[A-Z]/.test(password)) errors.push('Au moins une majuscule');
if (!/[a-z]/.test(password)) errors.push('Au moins une minuscule');
if (!/[0-9]/.test(password)) errors.push('Au moins un chiffre');
return { valid: errors.length === 0, errors };
},
name: (name: string): boolean => {
return name.trim().length >= 2;
},
required: (value: string): boolean => {
return value.trim().length > 0;
},
iban: (iban: string): boolean => {
const cleaned = iban.replace(/\s/g, '').toUpperCase();
if (!/^[A-Z]{2}[0-9]{2}[A-Z0-9]{4}[0-9]{7}([A-Z0-9]?){0,16}$/.test(cleaned)) return false;
// IBAN checksum validation
const rearranged = cleaned.slice(4) + cleaned.slice(0, 4);
const numeric = rearranged.replace(/[A-Z]/g, (c) => (c.charCodeAt(0) - 55).toString());
let remainder = numeric;
while (remainder.length > 2) {
const block = remainder.slice(0, 9);
remainder = (parseInt(block, 10) % 97).toString() + remainder.slice(block.length);
}
return parseInt(remainder, 10) % 97 === 1;
},
};