Conversion vers données JSON statiques pour compatibilité APK

- Création des fichiers JSON dans public/data/
- Modification de tous les composants pour fetch depuis /data/*.json
- PlaceList, FAQ, Lexique, Tides, SunTimes, Excursions, Notifications
- Données complètes pour Fakarava (plages, restaurants, épiceries)
- Fix docker-compose.build.yml (suppression volume node_modules)
This commit is contained in:
2025-11-23 10:23:13 +01:00
parent 115d8c05a7
commit d0694df12a
67 changed files with 377 additions and 1034 deletions

View File

@ -20,7 +20,7 @@ export default function PushNotificationManager() {
const fetchNotifications = async () => {
try {
const response = await fetch("/api/notifications");
const response = await fetch("/data/notifications.json");
const data = await response.json();
setNotifications(data);
} catch (error) {
@ -48,7 +48,7 @@ export default function PushNotificationManager() {
// Vérifier périodiquement les nouvelles notifications
setInterval(async () => {
try {
const response = await fetch("/api/notifications");
const response = await fetch("/data/notifications.json");
const newNotifications = await response.json();
const unread = newNotifications.filter((n: Notification) => !n.read);
@ -88,18 +88,11 @@ export default function PushNotificationManager() {
};
const markAsRead = async (id: string) => {
try {
await fetch("/api/notifications", {
method: "PATCH",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ id, read: true }),
});
setNotifications(
notifications.map((n) => (n.id === id ? { ...n, read: true } : n))
);
} catch (error) {
console.error("Erreur lors de la mise à jour:", error);
}
// Dans une version statique, on met à jour uniquement localement
// (sans API backend)
setNotifications(
notifications.map((n) => (n.id === id ? { ...n, read: true } : n))
);
};
const getNotificationIcon = (type: string) => {