diff --git a/apps/admin/data/fitai.db b/apps/admin/data/fitai.db
index 84fa70b..d779de0 100755
Binary files a/apps/admin/data/fitai.db and b/apps/admin/data/fitai.db differ
diff --git a/apps/admin/src/app/api/users/route.ts b/apps/admin/src/app/api/users/route.ts
index 54d0321..9cd102e 100644
--- a/apps/admin/src/app/api/users/route.ts
+++ b/apps/admin/src/app/api/users/route.ts
@@ -19,7 +19,25 @@ export async function GET(request: NextRequest) {
users.map(async (user) => {
const { password: _, ...userWithoutPassword } = user;
const client = await db.getClientByUserId(user.id);
- return { ...userWithoutPassword, client };
+
+ // Get active check-in status
+ let isCheckedIn = false;
+ let checkInTime = null;
+
+ if (client) {
+ const activeCheckIn = await db.getActiveCheckIn(client.id);
+ if (activeCheckIn) {
+ isCheckedIn = true;
+ checkInTime = activeCheckIn.checkInTime;
+ }
+ }
+
+ return {
+ ...userWithoutPassword,
+ client,
+ isCheckedIn,
+ checkInTime
+ };
}),
);
diff --git a/apps/admin/src/components/users/UserGrid.tsx b/apps/admin/src/components/users/UserGrid.tsx
index 6f0c3b9..9533350 100644
--- a/apps/admin/src/components/users/UserGrid.tsx
+++ b/apps/admin/src/components/users/UserGrid.tsx
@@ -9,6 +9,20 @@ import { formatDate } from "@/lib/utils";
ModuleRegistry.registerModules([AllCommunityModule]);
+function getTimeAgo(date: Date): string {
+ const now = new Date();
+ const diffMs = now.getTime() - date.getTime();
+ const diffMins = Math.floor(diffMs / 60000);
+ const diffHours = Math.floor(diffMins / 60);
+ const diffDays = Math.floor(diffHours / 24);
+
+ if (diffMins < 1) return 'just now';
+ if (diffMins < 60) return `${diffMins}m ago`;
+ if (diffHours < 24) return `${diffHours}h ago`;
+ return `${diffDays}d ago`;
+}
+
+
interface User {
id: string;
email: string;
@@ -17,6 +31,8 @@ interface User {
role: string;
phone?: string;
createdAt: Date;
+ isCheckedIn?: boolean;
+ checkInTime?: Date;
client?: {
id: string;
membershipType: string;
@@ -152,6 +168,27 @@ export function UserGrid({
},
minWidth: 120,
},
+ {
+ headerName: "Currently Checked In",
+ valueGetter: (params) => params.data?.isCheckedIn,
+ filter: "agTextColumnFilter",
+ sortable: true,
+ cellRenderer: (params: any) => {
+ if (!params.data?.isCheckedIn) {
+ return —;
+ }
+
+ const checkInTime = params.data.checkInTime ? new Date(params.data.checkInTime) : null;
+ const timeAgo = checkInTime ? getTimeAgo(checkInTime) : '';
+
+ return (
+
+ ✓ Checked In {timeAgo && `(${timeAgo})`}
+
+ );
+ },
+ minWidth: 180,
+ },
{
headerName: "Join Date",
valueGetter: (params) =>
diff --git a/apps/admin/src/components/users/UserManagement.tsx b/apps/admin/src/components/users/UserManagement.tsx
index f4ab707..cbd0203 100644
--- a/apps/admin/src/components/users/UserManagement.tsx
+++ b/apps/admin/src/components/users/UserManagement.tsx
@@ -13,6 +13,8 @@ interface User {
role: string;
phone?: string;
createdAt: Date;
+ isCheckedIn?: boolean;
+ checkInTime?: Date;
client?: {
id: string;
membershipType: string;