diff --git a/src/app/virtual-lab/lab/[virtualLabId]/(lab)/team/page.tsx b/src/app/virtual-lab/lab/[virtualLabId]/(lab)/team/page.tsx
index c80d94b3e..a745b956b 100644
--- a/src/app/virtual-lab/lab/[virtualLabId]/(lab)/team/page.tsx
+++ b/src/app/virtual-lab/lab/[virtualLabId]/(lab)/team/page.tsx
@@ -1,5 +1,9 @@
import VirtualLabTeamTable from '@/components/VirtualLab/VirtualLabTeamTable';
+import { ServerSideComponentProp } from '@/types/common';
-export default function VirtualLabTeamPage() {
- return ;
+export default function VirtualLabTeamPage({
+ params,
+}: ServerSideComponentProp<{ virtualLabId: string }>) {
+ const { virtualLabId } = params;
+ return ;
}
diff --git a/src/app/virtual-lab/lab/[virtualLabId]/(project)/project/[projectId]/(pages)/home/page.tsx b/src/app/virtual-lab/lab/[virtualLabId]/(project)/project/[projectId]/(pages)/home/page.tsx
index 22a19805b..95438960d 100644
--- a/src/app/virtual-lab/lab/[virtualLabId]/(project)/project/[projectId]/(pages)/home/page.tsx
+++ b/src/app/virtual-lab/lab/[virtualLabId]/(project)/project/[projectId]/(pages)/home/page.tsx
@@ -77,9 +77,11 @@ export default function VirtualLabProjectPage() {
{mockMembers.map((member) => (
))}
diff --git a/src/components/VirtualLab/VirtualLabHomePage/Member.tsx b/src/components/VirtualLab/VirtualLabHomePage/Member.tsx
index 203ec58a6..25531c0d5 100644
--- a/src/components/VirtualLab/VirtualLabHomePage/Member.tsx
+++ b/src/components/VirtualLab/VirtualLabHomePage/Member.tsx
@@ -3,14 +3,16 @@ import { Role } from '@/types/virtual-lab/members';
type Props = {
name: string;
+ first_name: string;
+ last_name: string;
lastActive: string;
memberRole: Role;
};
-export default function Member({ name, lastActive, memberRole }: Props) {
+export default function Member({ name, first_name, last_name, lastActive, memberRole }: Props) {
return (
-
+
{name}
Active {lastActive}
diff --git a/src/components/VirtualLab/VirtualLabHomePage/index.tsx b/src/components/VirtualLab/VirtualLabHomePage/index.tsx
index 7e3d2b151..26da4be15 100644
--- a/src/components/VirtualLab/VirtualLabHomePage/index.tsx
+++ b/src/components/VirtualLab/VirtualLabHomePage/index.tsx
@@ -161,9 +161,11 @@ export default function VirtualLabHomePage({ id }: Props) {
{virtualLabDetail.data.users.map((user) => (
))}
diff --git a/src/components/VirtualLab/VirtualLabMemberIcon/index.tsx b/src/components/VirtualLab/VirtualLabMemberIcon/index.tsx
index 28990dd10..6a3956b47 100644
--- a/src/components/VirtualLab/VirtualLabMemberIcon/index.tsx
+++ b/src/components/VirtualLab/VirtualLabMemberIcon/index.tsx
@@ -1,15 +1,14 @@
-import { Role } from "@/types/virtual-lab/members";
-
+import { Role } from '@/types/virtual-lab/members';
type Props = {
role: Role;
- name: string;
+ first_name: string;
+ last_name: string;
};
-export default function VirtualLabMemberIcon({ role, name }: Props) {
- const getInitials = (_name: string) => {
- const splitted = _name.split(' ');
- return splitted.length > 1 ? `${splitted[0][0]}${splitted[1][0]}` : splitted[0][0];
+export default function VirtualLabMemberIcon({ role, first_name, last_name }: Props) {
+ const getInitials = () => {
+ return `${first_name[0]} ${last_name[0]}`;
};
const generateRandomHexColor = () => {
@@ -32,7 +31,7 @@ export default function VirtualLabMemberIcon({ role, name }: Props) {
style={{ backgroundColor: generateRandomHexColor() }}
className={`flex h-12 w-12 items-center justify-center ${role === 'member' ? 'rounded-full' : ''}`}
>
- {getInitials(name)}
+ {getInitials()}
);
}
diff --git a/src/components/VirtualLab/VirtualLabTeamTable/index.tsx b/src/components/VirtualLab/VirtualLabTeamTable/index.tsx
index 3f9104619..d19c603ee 100644
--- a/src/components/VirtualLab/VirtualLabTeamTable/index.tsx
+++ b/src/components/VirtualLab/VirtualLabTeamTable/index.tsx
@@ -1,14 +1,42 @@
'use client';
-import { DownOutlined, PlusOutlined } from '@ant-design/icons';
-import { ConfigProvider, Select, Table } from 'antd';
+import { DownOutlined, LoadingOutlined, PlusOutlined } from '@ant-design/icons';
+import { ConfigProvider, Select, Spin, Table } from 'antd';
+import { loadable } from 'jotai/utils';
+import { useAtomValue } from 'jotai';
import VirtualLabMemberIcon from '../VirtualLabMemberIcon';
-import { mockMembers } from '@/components/VirtualLab/mockData/members';
-import { MockMember, MockRole } from '@/types/virtual-lab/members';
+import { MockRole, Role, VirtualLabMember } from '@/types/virtual-lab/members';
+import { virtualLabDetailAtomFamily } from '@/state/virtual-lab/lab';
-export default function VirtualLabTeamTable() {
- const roleOptions: { value: MockRole; label: string }[] = [
- { value: 'administrator', label: 'Administrator' },
+type Props = {
+ virtualLabId: string;
+};
+
+export default function VirtualLabTeamTable({ virtualLabId }: Props) {
+ const virtualLabDetail = useAtomValue(loadable(virtualLabDetailAtomFamily(virtualLabId)));
+ if (virtualLabDetail.state === 'loading') {
+ return (
+
+ } />
+
+ );
+ }
+ if (virtualLabDetail.state === 'hasError') {
+ return (
+
+
+ {(virtualLabDetail.error as Error).message === 'Status: 404' ? (
+ <>Virtual Lab not found>
+ ) : (
+ <>Something went wrong when fetching virtual lab>
+ )}
+
+
+ );
+ }
+
+ const roleOptions: { value: Role; label: string }[] = [
+ { value: 'admin', label: 'Administrator' },
{ value: 'member', label: 'Member' },
];
@@ -17,8 +45,12 @@ export default function VirtualLabTeamTable() {
title: 'Icon',
key: 'icon',
dataIndex: 'name',
- render: (_: any, record: MockMember) => (
-
+ render: (_: any, record: VirtualLabMember) => (
+
),
},
{
@@ -29,9 +61,9 @@ export default function VirtualLabTeamTable() {
},
{
title: 'Last active',
- dataIndex: 'lastActive',
- key: 'lastActive',
- render: (lastActive: string) => Active {lastActive},
+ dataIndex: 'last_active',
+ key: 'last_active',
+ render: () => Active N/A,
},
{
title: 'Action',
@@ -68,7 +100,7 @@ export default function VirtualLabTeamTable() {
Total members
- 11
+ {virtualLabDetail.data.users.length}
Invite member
@@ -89,7 +121,7 @@ export default function VirtualLabTeamTable() {
>