diff --git a/src/components/TeamDropdown/TeamDropdown.tsx b/src/components/TeamDropdown/TeamDropdown.tsx
index dce18d218..52708935a 100644
--- a/src/components/TeamDropdown/TeamDropdown.tsx
+++ b/src/components/TeamDropdown/TeamDropdown.tsx
@@ -76,13 +76,13 @@ export function TeamDropdown() {
.filter((team) => team.status === 'invited')
.map((team) => team._id);
- if (
- !user?.email.endsWith('@insightpartners.com') &&
- !user?.email.endsWith('@roadmap.sh') &&
- !['arikchangma@gmail.com', 'kamranahmed.se@gmail.com', 'stephen.chetcuti@gmail.com'].includes(user?.email!)
- ) {
- return null;
- }
+ // if (
+ // !user?.email.endsWith('@insightpartners.com') &&
+ // !user?.email.endsWith('@roadmap.sh') &&
+ // !['arikchangma@gmail.com', 'kamranahmed.se@gmail.com', 'stephen.chetcuti@gmail.com'].includes(user?.email!)
+ // ) {
+ // return null;
+ // }
return (
diff --git a/src/components/TeamMembers/TeamMemberItem.tsx b/src/components/TeamMembers/TeamMemberItem.tsx
new file mode 100644
index 000000000..e3b7a3541
--- /dev/null
+++ b/src/components/TeamMembers/TeamMemberItem.tsx
@@ -0,0 +1,82 @@
+import { MemberActionDropdown } from "./MemberActionDropdown";
+import { MemberRoleBadge } from "./RoleBadge";
+import type { TeamMemberItem } from "./TeamMembersPage";
+
+type TeamMemberProps = {
+ member: TeamMemberItem;
+ userId: string;
+ index: number;
+ teamId: string;
+ canManageCurrentTeam: boolean;
+ handleDeleteMember: () => void;
+ onUpdateMember: () => void;
+};
+
+export function TeamMemberItem(props: TeamMemberProps) {
+ const { member, index, teamId, onUpdateMember, canManageCurrentTeam, userId, handleDeleteMember } = props;
+ const hasProgress = member.progress.length > 0;
+
+ return (
+
+
+
+
+
+
+
+
+
+ {member.name}
+ {member.userId === userId && (
+
+ You
+
+ )}
+
+
+ {member.status === 'invited' && (
+
+ Invited
+
+ )}
+ {member.status === 'rejected' && (
+
+ Rejected
+
+ )}
+
+
+
+ {member.invitedEmail}
+
+
+
+
+
+
+
+
+ {canManageCurrentTeam && (
+
+ )}
+
+
+ )
+}
diff --git a/src/components/TeamMembers/TeamMembersPage.tsx b/src/components/TeamMembers/TeamMembersPage.tsx
index 9133de018..673de2ed7 100644
--- a/src/components/TeamMembers/TeamMembersPage.tsx
+++ b/src/components/TeamMembers/TeamMembersPage.tsx
@@ -14,6 +14,7 @@ import { useStore } from '@nanostores/preact';
import { $canManageCurrentTeam } from '../../stores/team';
import { useToast } from '../../hooks/use-toast';
import { MemberRoleBadge } from './RoleBadge';
+import { TeamMemberItem } from './TeamMemberItem';
export interface TeamMemberDocument {
_id?: string;
@@ -26,9 +27,23 @@ export interface TeamMemberDocument {
updatedAt: Date;
}
-interface TeamMemberItem extends TeamMemberDocument {
+export interface UserResourceProgressDocument {
+ _id?: string;
+ userId: string;
+ resourceId: string;
+ resourceType: 'roadmap' | 'best-practice';
+ isFavorite?: boolean;
+ done: string[];
+ learning: string[];
+ skipped: string[];
+ createdAt: Date;
+ updatedAt: Date;
+}
+
+export interface TeamMemberItem extends TeamMemberDocument {
name: string;
avatar: string;
+ progress: UserResourceProgressDocument[];
}
export function TeamMembersPage() {
@@ -83,8 +98,7 @@ export function TeamMembersPage() {
async function deleteMember(teamId: string, memberId: string) {
pageProgressMessage.set('Deleting member');
const { response, error } = await httpDelete(
- `${
- import.meta.env.PUBLIC_API_URL
+ `${import.meta.env.PUBLIC_API_URL
}/v1-delete-member/${teamId}/${memberId}`,
{}
);
@@ -98,6 +112,16 @@ export function TeamMembersPage() {
await getTeamMemberList();
}
+ const joinedMembers = teamMembers.filter(
+ (member) => member.status === 'joined'
+ );
+ const invitedMembers = teamMembers.filter(
+ (member) => member.status === 'invited'
+ );
+ const rejectedMembers = teamMembers.filter(
+ (member) => member.status === 'rejected'
+ );
+
return (
{memberToUpdate && (
@@ -139,80 +163,83 @@ export function TeamMembersPage() {
- {teamMembers.map((member, index) => {
+ {joinedMembers.map((member, index) => {
return (
-
-
-
-
-
-
-
-
-
- {member.name}
- {member.userId === user?.id && (
-
- You
-
- )}
-
-
- {member.status === 'invited' && (
-
- Invited
-
- )}
- {member.status === 'rejected' && (
-
- Rejected
-
- )}
-
-
-
- {member.invitedEmail}
-
-
-
-
-
-
-
-
- {canManageCurrentTeam && (
- {
+ {
+ deleteMember(teamId, member._id!).finally(() => {
+ pageProgressMessage.set('');
+ });
+ }}
+ onUpdateMember={() => {
+ setMemberToUpdate(member);
+ }}
+ />
+ );
+ })}
+
+
+ {invitedMembers.length > 0 && (
+
Invited Members
+
+ {invitedMembers.map((member, index) => {
+ return (
+ {
+ deleteMember(teamId, member._id!).finally(() => {
+ pageProgressMessage.set('');
+ });
+ }}
+ onUpdateMember={() => {
+ setMemberToUpdate(member);
+ }}
+ />
+ );
+ })}
+
+
)}
+
+ {
+ rejectedMembers.length > 0 && (
+
+
Rejected Members
+
+ {rejectedMembers.map((member, index) => {
+ return (
+ {
deleteMember(teamId, member._id!).finally(() => {
pageProgressMessage.set('');
});
}}
- isDisabled={member.userId === user?.id}
onUpdateMember={() => {
setMemberToUpdate(member);
}}
- member={member}
/>
- )}
-
+ );
+ })}
- );
- })}
-
+
+ )
+ }
{canManageCurrentTeam && (