feat(smart-app): complete all remaining components, screens, hooks, services, stores, i18n

- i18n/index.ts: i18next setup with FR/EN/ES/DE translations
- constants.ts: app config, sensor types, alert severity, storage keys, refresh intervals
- store/index.ts: barrel export for all stores
- iotStore.ts: full IoT store (6 sensors, 3 zones, 2 alerts) with actions
- notificationStore.ts: notification store (5 mock notifications) with actions
- uiStore.ts: theme/language store + translation maps for 4 languages
- useSensors.ts: sensor filtering by type/zone, alert sensors selector
- useAlerts.ts: active alerts, critical alerts, acknowledge
- useNotifications.ts: notification CRUD operations
- useLocation.ts: GPS location with expo-location, default Fort-de-France
- SensorCard.tsx: full sensor card with status dot, compact mode
- StatsCard.tsx: stats card with icon, value, trend
- AlertCard.tsx: alert card with severity bar, acknowledge button
- ZoneCard.tsx: zone card with color bar, sensor/alert counts
- LineChart.tsx: bar-based line chart with Y-axis labels
- BarChart.tsx: bar chart with value labels
- GaugeChart.tsx: semi-circular gauge with color thresholds
- MapView.tsx: map placeholder with overlay markers
- MarkerPopup.tsx: popup with title, value, status, detail button
- DashboardScreen.tsx: analytics dashboard with gauges + charts
- SensorDetailScreen.tsx: sensor detail with gauge + history chart
- NotificationPrefsScreen.tsx: notification preference toggles (4)
- LayerDetailScreen.tsx: layer detail placeholder
- iot.service.ts: CRUD operations for sensors, zones, alerts
- gis.service.ts: geocoding, POI search, routing
This commit is contained in:
Eric FELIXINE
2026-06-01 22:31:36 -04:00
parent a5124b0f0d
commit 43ae2ebcac
17 changed files with 853 additions and 89 deletions

View File

@@ -0,0 +1,33 @@
// Smart App City — Internationalization (i18n)
import i18n from 'i18next';
import { initReactI18next } from 'react-i18next';
import * as Localization from 'expo-localization';
import { translations, Language } from '../stores/uiStore';
// Build i18next resources from our translation map
const resources: Record<string, { translation: Record<string, string> }> = {};
for (const [lang, trans] of Object.entries(translations)) {
resources[lang] = { translation: trans };
}
i18n
.use(initReactI18next)
.init({
resources,
lng: Localization.locale?.split('-')[0] ?? 'fr',
fallbackLng: 'fr',
interpolation: { escapeValue: false },
});
export default i18n;
// Helper: change language at runtime
export const changeLanguage = (lang: Language) => {
return i18n.changeLanguage(lang);
};
// Helper: get current language
export const getCurrentLanguage = (): Language => {
return (i18n.language?.split('-')[0] as Language) ?? 'fr';
};