-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: communities view page and datatable
- Loading branch information
1 parent
e2f6f3f
commit fe44854
Showing
33 changed files
with
2,725 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
import { DataTable } from "@/components/organisms/users-datatable/data-table"; | ||
import { tasks } from "@/components/organisms/users-datatable/data/tasks"; | ||
import { columns } from "@/components/organisms/users-datatable/columns"; | ||
|
||
import { dehydrate, HydrationBoundary } from "@tanstack/react-query"; | ||
import Communities from "@/components/organisms/Communities"; | ||
import { getQueryClient } from "@/lib/get-query-client"; | ||
|
||
export default function CommunityPage() { | ||
const queryClient = getQueryClient() | ||
|
||
return ( | ||
<> | ||
<div className="-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0"> | ||
<DataTable data={tasks} columns={columns} /> | ||
</div> | ||
</> | ||
<HydrationBoundary state={dehydrate(queryClient)}> | ||
<Communities /> | ||
</HydrationBoundary> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,14 @@ | ||
import { Button } from "@/components/ui/button"; | ||
import { | ||
Table, | ||
TableBody, | ||
TableCell, | ||
TableHead, | ||
TableHeader, | ||
TableRow, | ||
} from "@/components/ui/table"; | ||
import { DataTable } from "@/components/organisms/nodes-datatable/data-table"; | ||
import { tasks } from "@/components/organisms/nodes-datatable/data/tasks"; | ||
import { columns } from "@/components/organisms/nodes-datatable/columns"; | ||
|
||
interface Node { | ||
id: string; | ||
name: string; | ||
status: "active" | "inactive"; | ||
} | ||
|
||
const mockNodes: Node[] = [ | ||
{ id: "1", name: "Node 1", status: "active" }, | ||
{ id: "2", name: "Node 2", status: "inactive" }, | ||
]; | ||
|
||
export default function NodesTable() { | ||
export default function NodesPage() { | ||
return ( | ||
<Table> | ||
<TableHeader> | ||
<TableRow> | ||
<TableHead>Name</TableHead> | ||
<TableHead>Status</TableHead> | ||
<TableHead>Actions</TableHead> | ||
</TableRow> | ||
</TableHeader> | ||
<TableBody> | ||
{mockNodes.map((node) => ( | ||
<TableRow key={node.id}> | ||
<TableCell>{node.name}</TableCell> | ||
<TableCell>{node.status}</TableCell> | ||
<TableCell> | ||
<div className="flex space-x-2"> | ||
<Button size="sm">View</Button> | ||
<Button size="sm">Edit</Button> | ||
<Button size="sm" variant="destructive"> | ||
Delete | ||
</Button> | ||
</div> | ||
</TableCell> | ||
</TableRow> | ||
))} | ||
</TableBody> | ||
</Table> | ||
<> | ||
<div className="-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0"> | ||
<DataTable data={tasks} columns={columns} /> | ||
</div> | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"use client"; | ||
|
||
import { listCommunitiesQuery } from "@/lib/api"; | ||
import { useSuspenseQuery } from "@tanstack/react-query"; | ||
import { LoaderCircleIcon } from "lucide-react"; | ||
import { DataTable } from "./community-datatable/data-table"; | ||
import { columns } from "./community-datatable/columns"; | ||
|
||
export default function Communities() { | ||
const { data , isLoading } = | ||
useSuspenseQuery(listCommunitiesQuery); | ||
|
||
return ( | ||
<> | ||
<div className="-mx-4 flex-1 overflow-auto px-4 py-1 lg:flex-row lg:space-x-12 lg:space-y-0"> | ||
{isLoading ? ( | ||
<div className=""> | ||
<LoaderCircleIcon className="w-18 h-18" /> | ||
</div> | ||
) : ( | ||
<DataTable data={data?.data ?? []} columns={columns} /> | ||
)} | ||
</div> | ||
</> | ||
); | ||
} |
Oops, something went wrong.