|
|
@ -11,6 +11,10 @@ import { ActivityStream } from '../Activity/ActivityStream'; |
|
|
|
import { MemberRoleBadge } from '../TeamMembers/RoleBadge'; |
|
|
|
import { MemberRoleBadge } from '../TeamMembers/RoleBadge'; |
|
|
|
import { TeamMemberEmptyPage } from './TeamMemberEmptyPage'; |
|
|
|
import { TeamMemberEmptyPage } from './TeamMemberEmptyPage'; |
|
|
|
import { Pagination } from '../Pagination/Pagination'; |
|
|
|
import { Pagination } from '../Pagination/Pagination'; |
|
|
|
|
|
|
|
import type { ResourceType } from '../../lib/resource-progress'; |
|
|
|
|
|
|
|
import { MemberProgressModal } from '../TeamProgress/MemberProgressModal'; |
|
|
|
|
|
|
|
import { useStore } from '@nanostores/react'; |
|
|
|
|
|
|
|
import { $currentTeam } from '../../stores/team'; |
|
|
|
|
|
|
|
|
|
|
|
type GetTeamMemberProgressesResponse = TeamMemberDocument & { |
|
|
|
type GetTeamMemberProgressesResponse = TeamMemberDocument & { |
|
|
|
name: string; |
|
|
|
name: string; |
|
|
@ -31,6 +35,7 @@ export function TeamMemberDetailsPage() { |
|
|
|
const { t: teamId, m: memberId } = getUrlParams() as { t: string; m: string }; |
|
|
|
const { t: teamId, m: memberId } = getUrlParams() as { t: string; m: string }; |
|
|
|
|
|
|
|
|
|
|
|
const toast = useToast(); |
|
|
|
const toast = useToast(); |
|
|
|
|
|
|
|
const currentTeam = useStore($currentTeam); |
|
|
|
|
|
|
|
|
|
|
|
const [memberProgress, setMemberProgress] = |
|
|
|
const [memberProgress, setMemberProgress] = |
|
|
|
useState<GetTeamMemberProgressesResponse | null>(null); |
|
|
|
useState<GetTeamMemberProgressesResponse | null>(null); |
|
|
@ -38,6 +43,12 @@ export function TeamMemberDetailsPage() { |
|
|
|
useState<GetTeamMemberActivityResponse | null>(null); |
|
|
|
useState<GetTeamMemberActivityResponse | null>(null); |
|
|
|
const [currPage, setCurrPage] = useState(1); |
|
|
|
const [currPage, setCurrPage] = useState(1); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const [selectedResource, setSelectedResource] = useState<{ |
|
|
|
|
|
|
|
resourceId: string; |
|
|
|
|
|
|
|
resourceType: ResourceType; |
|
|
|
|
|
|
|
isCustomResource?: boolean; |
|
|
|
|
|
|
|
} | null>(null); |
|
|
|
|
|
|
|
|
|
|
|
const loadMemberProgress = async () => { |
|
|
|
const loadMemberProgress = async () => { |
|
|
|
const { response, error } = await httpGet<GetTeamMemberProgressesResponse>( |
|
|
|
const { response, error } = await httpGet<GetTeamMemberProgressesResponse>( |
|
|
|
`${import.meta.env.PUBLIC_API_URL}/v1-get-team-member-progresses/${teamId}/${memberId}`, |
|
|
|
`${import.meta.env.PUBLIC_API_URL}/v1-get-team-member-progresses/${teamId}/${memberId}`, |
|
|
@ -90,7 +101,25 @@ export function TeamMemberDetailsPage() { |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
<div className="flex items-center gap-3 mb-8"> |
|
|
|
{selectedResource && ( |
|
|
|
|
|
|
|
<MemberProgressModal |
|
|
|
|
|
|
|
teamId={teamId} |
|
|
|
|
|
|
|
member={{ |
|
|
|
|
|
|
|
...memberProgress, |
|
|
|
|
|
|
|
_id: memberId, |
|
|
|
|
|
|
|
updatedAt: new Date(memberProgress.updatedAt).toISOString(), |
|
|
|
|
|
|
|
progress: memberProgress.progresses, |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
resourceId={selectedResource.resourceId} |
|
|
|
|
|
|
|
resourceType={selectedResource.resourceType} |
|
|
|
|
|
|
|
isCustomResource={selectedResource.isCustomResource} |
|
|
|
|
|
|
|
onClose={() => setSelectedResource(null)} |
|
|
|
|
|
|
|
onShowMyProgress={() => { |
|
|
|
|
|
|
|
window.location.href = `/team/member?t=${teamId}&m=${currentTeam?.memberId}`; |
|
|
|
|
|
|
|
}} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
)} |
|
|
|
|
|
|
|
<div className="mb-8 flex items-center gap-3"> |
|
|
|
<img |
|
|
|
<img |
|
|
|
src={avatarUrl} |
|
|
|
src={avatarUrl} |
|
|
|
alt={memberProgress?.name} |
|
|
|
alt={memberProgress?.name} |
|
|
@ -130,6 +159,13 @@ export function TeamMemberDetailsPage() { |
|
|
|
title={progress.resourceTitle} |
|
|
|
title={progress.resourceTitle} |
|
|
|
roadmapSlug={progress.roadmapSlug} |
|
|
|
roadmapSlug={progress.roadmapSlug} |
|
|
|
showActions={false} |
|
|
|
showActions={false} |
|
|
|
|
|
|
|
onResourceClick={() => { |
|
|
|
|
|
|
|
setSelectedResource({ |
|
|
|
|
|
|
|
resourceId: progress.resourceId, |
|
|
|
|
|
|
|
resourceType: progress.resourceType, |
|
|
|
|
|
|
|
isCustomResource: progress.isCustomResource, |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
); |
|
|
|
); |
|
|
|
})} |
|
|
|
})} |
|
|
@ -146,6 +182,9 @@ export function TeamMemberDetailsPage() { |
|
|
|
activities={ |
|
|
|
activities={ |
|
|
|
memberActivity?.data?.flatMap((act) => act.activity) || [] |
|
|
|
memberActivity?.data?.flatMap((act) => act.activity) || [] |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
onResourceClick={(resourceId, resourceType, isCustomResource) => { |
|
|
|
|
|
|
|
setSelectedResource({ resourceId, resourceType, isCustomResource }); |
|
|
|
|
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<Pagination |
|
|
|
<Pagination |
|
|
|
currPage={currPage} |
|
|
|
currPage={currPage} |
|
|
|