From 82a77d90b0f2938dc79a3b2226e48a0c9a57d10f Mon Sep 17 00:00:00 2001 From: Owen Schwartz Date: Sat, 21 Dec 2024 16:37:07 -0500 Subject: [PATCH] Add online offline to table --- .../settings/sites/components/SitesTable.tsx | 39 ++++++++++++++++++- src/app/[orgId]/settings/sites/page.tsx | 1 + 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/src/app/[orgId]/settings/sites/components/SitesTable.tsx b/src/app/[orgId]/settings/sites/components/SitesTable.tsx index fd9dc41c..86d389ff 100644 --- a/src/app/[orgId]/settings/sites/components/SitesTable.tsx +++ b/src/app/[orgId]/settings/sites/components/SitesTable.tsx @@ -9,7 +9,7 @@ import { DropdownMenuTrigger, } from "@app/components/ui/dropdown-menu"; import { Button } from "@app/components/ui/button"; -import { ArrowRight, ArrowUpDown, MoreHorizontal } from "lucide-react"; +import { ArrowRight, ArrowUpDown, Check, MoreHorizontal, X } from "lucide-react"; import Link from "next/link"; import { useRouter } from "next/navigation"; import { AxiosResponse } from "axios"; @@ -29,6 +29,7 @@ export type SiteRow = { mbOut: string; orgId: string; type: "newt" | "wireguard"; + online: boolean; }; type SitesTableProps = { @@ -168,6 +169,42 @@ export default function SitesTable({ sites, orgId }: SitesTableProps) { } }, }, + { + accessorKey: "online", + header: ({ column }) => { + return ( + + ); + }, + cell: ({ row }) => { + const originalRow = row.original; + console.log(originalRow.online); + + if (originalRow.online) { + return ( + + + Online + + ); + } else { + return ( + + + Offline + + ); + } + }, + }, { id: "actions", cell: ({ row }) => { diff --git a/src/app/[orgId]/settings/sites/page.tsx b/src/app/[orgId]/settings/sites/page.tsx index 63c1d7b5..6e7b2d37 100644 --- a/src/app/[orgId]/settings/sites/page.tsx +++ b/src/app/[orgId]/settings/sites/page.tsx @@ -41,6 +41,7 @@ export default async function SitesPage(props: SitesPageProps) { mbOut: formatSize(site.megabytesOut || 0), orgId: params.orgId, type: site.type as any, + online: site.online, }; });