+ {/* Tabs */}
+
+
+
+
+ Vous
+
+ {/*
Favoris
*/}
-
-
- Classe
-
-
-
+
+
+ Classe
+
+
+
- {/* Week Navigation */}
-
-
-
-
-
+ {/* Week Navigation */}
+
+
+ {/* Filter component */}
+
+
+
+
+
+
-
- {/* Filter component */}
-
-
+ {/* Your Colles Tab */}
+ {activeTab === "you" && (
+
+ )}
-
-
-
-
-
- {/* Your Colles Tab */}
- {activeTab === "you" && (
-
- )}
-
- {/* Favorites Tab
+ {/* Favorites Tab
{activeTab === "favorites" && (
)} */}
- {/* Class Colles Tab */}
- {activeTab === "class" && (
-
- )}
+ {/* Class Colles Tab */}
+ {activeTab === "class" && (
+
+ )}
- {/* Bottom Navigation for Mobile */}
-
-
+ {/* Bottom Navigation for Mobile */}
+
+
+
);
}
diff --git a/app/components/sync-status.tsx b/app/components/sync-status.tsx
index ccb15c3..12b20e9 100644
--- a/app/components/sync-status.tsx
+++ b/app/components/sync-status.tsx
@@ -8,10 +8,18 @@ import {
import { Cloud, CloudOff, Wifi, WifiOff } from "lucide-react";
import { cn } from "~/lib/utils";
-export function SyncButton() {
- const [isSync, setIsSync] = useState(true);
+export function SyncButton({
+ healthyUntil,
+ lastSync,
+}: {
+ healthyUntil: Date;
+ lastSync: Date;
+}) {
+ const healthyUntilDate = new Date(healthyUntil) || new Date(0);
+ const lastSyncDate = new Date(lastSync) || new Date(0);
+ // Determine if the sync is healthy based on the healthyUntil date
+ const isSync = healthyUntilDate > new Date();
const [isOpen, setIsOpen] = useState(false);
- const lastSync = new Date(); // TODO: Replace with actual last sync date
const getIcon = () => {
if (isSync) return
;
@@ -28,11 +36,12 @@ export function SyncButton() {
const now = new Date();
const diff = now.getTime() - date.getTime();
+ const seconds = Math.floor(diff / 1000);
const minutes = Math.floor(diff / 60000);
const hours = Math.floor(minutes / 60);
const days = Math.floor(hours / 24);
- if (minutes < 1) return "A l'instant";
+ if (minutes < 1) return `il y a ${seconds}s`;
if (minutes < 60) return `il y a ${minutes}m`;
if (hours < 24) return `il y a ${hours}h`;
return `il y a ${days}j`;
@@ -61,26 +70,26 @@ export function SyncButton() {
) : (
)}
-
- Status
-
+
Status
- {isSync ? "Connecté" : "Erreur"}
+ {isSync ? "Connecté" : "Hors ligne"}