diff --git a/apps/app/components/project/single-project-card.tsx b/apps/app/components/project/single-project-card.tsx index 175e7430c..549ae7267 100644 --- a/apps/app/components/project/single-project-card.tsx +++ b/apps/app/components/project/single-project-card.tsx @@ -8,10 +8,9 @@ import { mutate } from "swr"; // services import projectService from "services/project.service"; // hooks -import useProjectMembers from "hooks/use-project-members"; import useToast from "hooks/use-toast"; // ui -import { CustomMenu, Loader, Tooltip } from "components/ui"; +import { CustomMenu, Tooltip } from "components/ui"; // icons import { CalendarDaysIcon, @@ -46,11 +45,8 @@ export const SingleProjectCard: React.FC = ({ const { setToastAlert } = useToast(); - // fetching project members information - const { members, hasJoined, isOwner, isMember } = useProjectMembers( - workspaceSlug as string, - project.id - ); + const isOwner = project.member_role === 20; + const isMember = project.member_role === 15; const handleAddToFavorites = () => { if (!workspaceSlug) return; @@ -125,125 +121,119 @@ export const SingleProjectCard: React.FC = ({ return ( <> - {members ? ( -
+
+ + +
+ {project.name} +
+ {!project.is_member ? ( + + ) : ( + + Member + + )} + {project.is_favorite && ( + + + + )} +
+
+
+ +
-
- {project.name} -
- {!hasJoined ? ( - - ) : ( - - Member - - )} - {project.is_favorite && ( - - - - )} -
+
+

{project.name}

+ {project.emoji ? ( + + {renderEmoji(project.emoji)} + + ) : project.icon_prop ? ( + renderEmoji(project.icon_prop) + ) : null}
+

+ {truncateText(project.description ?? "", 100)} +

-
- - -
-

{project.name}

- {project.emoji ? ( - - {renderEmoji(project.emoji)} - - ) : project.icon_prop ? ( - renderEmoji(project.icon_prop) - ) : null} -
-

- {truncateText(project.description ?? "", 100)} -

-
- -
- -
- - {renderShortDateWithYearFormat(project.created_at)} -
-
- {hasJoined ? ( -
- {(isOwner || isMember) && ( - - - - - - )} - - {isOwner && ( - setDeleteProject(project.id)}> - - - Delete project - - - )} - {project.is_favorite ? ( - - - - Remove from favorites - - - ) : ( - - - - Add to favorites - - - )} - +
+ +
+ + {renderShortDateWithYearFormat(project.created_at)} +
+
+ {project.is_member ? ( +
+ {(isOwner || isMember) && ( + + + + + + )} + + {isOwner && ( + setDeleteProject(project.id)}> - - Copy project link + + Delete project - -
- ) : null} -
+ )} + {project.is_favorite ? ( + + + + Remove from favorites + + + ) : ( + + + + Add to favorites + + + )} + + + + Copy project link + + +
+
+ ) : null}
- ) : ( - - - - )} +
); }; diff --git a/apps/app/types/projects.d.ts b/apps/app/types/projects.d.ts index df71adb31..d620a24b7 100644 --- a/apps/app/types/projects.d.ts +++ b/apps/app/types/projects.d.ts @@ -40,6 +40,8 @@ export interface IProject { id: string; identifier: string; is_favorite: boolean; + is_member: boolean; + member_role: 5 | 10 | 15 | 20 | null; issue_views_view: boolean; module_view: boolean; name: string;