diff --git a/package.json b/package.json
index b4fb6a5..208878f 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
- "dev": "next dev --turbopack -p 4000",
+ "dev": "next dev -p 4000",
"build": "next build",
"build:docker": "docker build -t toogether/webapp .",
"start": "next start -p 4000",
diff --git a/src/app/admin/classes/page.tsx b/src/app/admin/classes/page.tsx
index 938e852..fc96c89 100644
--- a/src/app/admin/classes/page.tsx
+++ b/src/app/admin/classes/page.tsx
@@ -1,3 +1,4 @@
+import { ClassList } from "@/app/components/Class";
import { Metadata } from "next";
export const metadata: Metadata = {
@@ -5,5 +6,5 @@ export const metadata: Metadata = {
};
export default async function Page() {
- return
Hello world!
;
+ return ;
}
diff --git a/src/app/components/Class/index.tsx b/src/app/components/Class/index.tsx
new file mode 100644
index 0000000..b3c6a67
--- /dev/null
+++ b/src/app/components/Class/index.tsx
@@ -0,0 +1,71 @@
+"use client";
+import { Class } from "@/app/interface/class";
+import { classesService } from "@/app/services/classes.service";
+import {
+ Card,
+ Skeleton,
+ Table,
+ TableBody,
+ TableCell,
+ TableColumn,
+ TableHeader,
+ TableRow,
+} from "@nextui-org/react";
+import { useEffect, useState } from "react";
+
+export const ClassList = () => {
+ const [classes, setClasses] = useState();
+
+ useEffect(() => {
+ classesService.getAll().then((response) => {
+ setClasses(response.data);
+ });
+ }, []);
+
+ if (!classes) {
+ return (
+
+
+
+
+
+
+
+ );
+ }
+
+ if (classes.length === 0) {
+ return (
+
+
+ No classes found
+
+
+ );
+ }
+
+ return (
+
+
+ NAME
+
+
+ {classes.map((Class) => (
+
+ {Class.name}
+
+ ))}
+
+
+ );
+};
diff --git a/src/app/components/Users/index.tsx b/src/app/components/Users/index.tsx
index 9afc5ca..ef6aeea 100644
--- a/src/app/components/Users/index.tsx
+++ b/src/app/components/Users/index.tsx
@@ -43,18 +43,38 @@ export const UserList = () => {
);
}
+ if (users.length === 0) {
+ return (
+
+
+ No users found
+
+
+ );
+ }
+
return (
USERNAME
+ CLASS
- {users &&
- users.map((user) => (
-
- {user.username}
-
- ))}
+ {users.map((user) => (
+
+ {user.username}
+
+ {user.Class.map((c) => (
+
+ {c.name}
+
+ ))}
+
+
+ ))}
);
diff --git a/src/app/interface/user.ts b/src/app/interface/user.ts
index a102982..c3c1631 100644
--- a/src/app/interface/user.ts
+++ b/src/app/interface/user.ts
@@ -1,4 +1,10 @@
export interface User {
id: string;
username: string;
+
+ Class: {
+ id: string;
+ name: string;
+ createdAt: string;
+ }[];
}