-
Comment:
-
- blocked because he was watching youtube
-
+ const isChecked = devices.some((d) => d.id === device.id);
+
+ return (
+
{ }}
+ onClick={() => {
+ if (parentalControl === true) return
+ setDeviceCart((prev) =>
+ devices.some((d) => d.id === device.id)
+ ? prev.filter((d) => d.id !== device.id)
+ : [...prev, device]
+ )
+ }
+ }
+ className="w-full">
+
+
+
+
+ {device.name}
+
+
+
+ {device.mac}
+
+
- )}
- {!parentalControl ? (
-
- ) : (
-
- )}
+
+ {device.isActive && (
+
+ Active until{" "}
+ {new Date().toLocaleDateString("en-US", {
+ month: "short",
+ day: "2-digit",
+ year: "numeric",
+ })}
+
+ )}
+
+ {device.blocked && (
+
+
Comment:
+
+ blocked because he was watching youtube
+
+
+ )}
+
+
+
+ {!parentalControl ? (
+
+ ) : (
+
+ )}
+
)
diff --git a/components/devices-table.tsx b/components/devices-table.tsx
index 65c2a73..c9258d7 100644
--- a/components/devices-table.tsx
+++ b/components/devices-table.tsx
@@ -11,9 +11,7 @@ import {
import { auth } from "@/lib/auth";
import prisma from "@/lib/db";
import { headers } from "next/headers";
-import Link from "next/link";
-import AddDevicesToCartButton from "./add-devices-to-cart-button";
-import BlockDeviceButton from "./block-device-dialog";
+import ClickableRow from "./clickable-row";
import DeviceCard from "./device-card";
import Pagination from "./pagination";
@@ -56,7 +54,7 @@ export async function DevicesTable({
paid: false
}
},
- isActive: parentalControl ? parentalControl : undefined,
+ isActive: parentalControl,
blocked: parentalControl !== undefined ? undefined : false,
},
});
@@ -89,7 +87,6 @@ export async function DevicesTable({
},
isActive: parentalControl,
blocked: parentalControl !== undefined ? undefined : false,
-
},
skip: offset,
@@ -114,48 +111,49 @@ export async function DevicesTable({
Device Name
MAC Address
- Actions
+ #
{devices.map((device) => (
-
-
-
-
- {device.name}
-
-
- Active until{" "}
- {new Date().toLocaleDateString("en-US", {
- month: "short",
- day: "2-digit",
- year: "numeric",
- })}
-
- {parentalControl && (
-
-
Comment:
-
- blocked because he was watching youtube
-
-
- )}
+ //
+ //
+ //
+ //
+ // {device.name}
+ //
+ //
+ // Active until{" "}
+ // {new Date().toLocaleDateString("en-US", {
+ // month: "short",
+ // day: "2-digit",
+ // year: "numeric",
+ // })}
+ //
+ // {parentalControl && (
+ //
+ //
Comment:
+ //
+ // blocked because he was watching youtube
+ //
+ //
+ // )}
-
-
- {device.mac}
-
- {!parentalControl ? (
-
- ) : (
-
- )}
-
-
+ //
+ //
+ // {device.mac}
+ //
+ // {!parentalControl ? (
+ //
+ // ) : (
+ //
+ // )}
+ //
+ //
+
))}