+ spaceName&&
diff --git a/src/features/workspace-view/workspace-card/index.scss b/src/features/workspace-view/workspace-card/index.scss
index 2c14e66..25b0b6b 100644
--- a/src/features/workspace-view/workspace-card/index.scss
+++ b/src/features/workspace-view/workspace-card/index.scss
@@ -97,3 +97,7 @@
opacity: 1;
}
}
+
+.image-stack {
+ margin-left: 1rem;
+}
\ No newline at end of file
diff --git a/src/features/workspace-view/workspace-card/index.tsx b/src/features/workspace-view/workspace-card/index.tsx
index b1ee358..25b3bc0 100644
--- a/src/features/workspace-view/workspace-card/index.tsx
+++ b/src/features/workspace-view/workspace-card/index.tsx
@@ -13,7 +13,8 @@ import {
setOrgBookmarkStatus,
} from 'app/api/user';
import { useNavigate } from 'react-router-dom';
-
+import { AVATAR_API } from 'envConstants';
+import { AVATAR_URL } from 'app/constants/api';
type workspaceCardProps = {
workspaceName: string;
role: string;
@@ -33,6 +34,7 @@ const WorkspaceCard = (props: workspaceCardProps) => {
const [fileName, setFileName] = useState
(null);
const [imageSrc, setImageSrc] = useState(null);
const [members, setMembers] = useState(null);
+ const [membersArray, setMembersArray]= useState<{username:string}[]>([]);
const userContext = useContext(UserContext);
const navigate = useNavigate();
@@ -51,6 +53,10 @@ const WorkspaceCard = (props: workspaceCardProps) => {
try {
const members_data = await getOrgMembers(token, workspaceName);
setMembers(members_data.data.members);
+ const membersArray = Object.entries(members_data.data.members).map(([username]) => ({ username }));
+ setMembersArray(membersArray)
+
+
} catch (e) {}
}
};
@@ -166,12 +172,23 @@ const WorkspaceCard = (props: workspaceCardProps) => {
{archeive ? 'Unarchive' : 'archive'}
- {members&&userContext?.username&&(members[userContext?.username.toString()]==="admin")&&
- delete
-
}
- {members&&userContext?.username&&(members[userContext?.username.toString()]==="admin")&& navigate(`/editWorkspace/${workspaceName}`)}>
- edit
-
}
+ {members &&
+ userContext?.username &&
+ members[userContext?.username.toString()] === 'admin' && (
+
+ delete
+
+ )}
+ {members &&
+ userContext?.username &&
+ members[userContext?.username.toString()] === 'admin' && (
+ navigate(`/editWorkspace/${workspaceName}`)}
+ >
+ edit
+
+ )}
@@ -190,8 +207,33 @@ const WorkspaceCard = (props: workspaceCardProps) => {
? "USER's WORKSPACE"
: workspaceName}
-
-
img
+
navigate(`/workspaceMembers/${workspaceName}`)}>
+
+
+ { membersArray.length > 0 ? (
+ membersArray.slice(0, 4).map((obj) => {
+ const url =
+ AVATAR_URL +
+ '/' +
+ obj.username +
+ '.png?apikey=' +
+ AVATAR_API;
+ return (
+
+ );
+ })
+ ) : (
+ <>
+
+ >
+ )}
+
+
+
{members ? Object.keys(members).length : 0} members