Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/components/ManagerCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ function ManagerCard() {
grade,
teamname: team.name,
coordinator: team?.cohort?.coordinator?.profile
? team.cohort.coordinator.profile.name
: team?.cohort.coordinator?.email,
? team.cohort?.coordinator.profile.name
: team?.cohort?.coordinator?.email,
ttl: team?.ttl?.profile ? team.ttl.profile.name : team?.ttl?.email,
phase: team.cohort.phase.name,
phase: team?.cohort?.phase?.name,
week:
calculateWeeks(team.startingPhase) > 0
? calculateWeeks(team.startingPhase)
Expand All @@ -161,9 +161,7 @@ function ManagerCard() {
});

return (
<div
className="font-serif px-4 md:px-0 pb-20 w-full dark:bg-dark-frame-bg dark:text-black h-full flex overflow-x-auto "
>
<div className="font-serif px-4 md:px-0 pb-20 w-full dark:bg-dark-frame-bg dark:text-black h-full flex overflow-x-auto ">
{loading ? (
<div className="flex items-center justify-center w-full h-full">
<div className="spinner" />
Expand All @@ -172,7 +170,7 @@ function ManagerCard() {
<div className="pl-10 flex">
{teamData &&
teamData.map((teamProps: any, index: number) => (
<Link key={index} to={`/team/${(teamProps.teamname)}`}>
<Link key={index} to={`/team/${teamProps.teamname}`}>
<Card {...teamProps} />
</Link>
))}
Expand Down
24 changes: 12 additions & 12 deletions src/components/teamDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ function TeamDetails() {
cohort: team?.cohort?.name,
teamname: team.name,
coordinator: team?.cohort?.coordinator?.profile
? team.cohort.coordinator.profile.name
: team?.cohort.coordinator?.email,
? team.cohort?.coordinator.profile.name
: team?.cohort?.coordinator?.email,
ttl: team?.ttl?.profile ? team.ttl.profile.name : team?.ttl?.email,
Qty,
Qnty,
Expand All @@ -90,8 +90,8 @@ function TeamDetails() {

const selectedTeam = teamData
? teamData.find(
(team: { teamname: string | null }) => team.teamname === teamname,
)
(team: { teamname: string | null }) => team.teamname === teamname,
)
: null;
function getColor(rating: number) {
if (rating >= 1.5 && rating <= 2) {
Expand Down Expand Up @@ -232,7 +232,7 @@ function TeamDetails() {
</h1>
</div>
<div className="relative dark:text-black">
<p>Coordinator: {selectedTeam.coordinator}</p>
<p>Coordinator: {selectedTeam?.coordinator}</p>
<p>TTL: {selectedTeam.ttl}</p>
</div>
</div>
Expand Down Expand Up @@ -314,8 +314,8 @@ function TeamDetails() {
{selectedTeam.Qty >= 1.5 && selectedTeam.Qty <= 2
? 'Good'
: selectedTeam.Qty >= 1 && selectedTeam.Qty < 1.5
? 'Improve'
: 'Poor'}
? 'Improve'
: 'Poor'}
</span>
</div>
</div>
Expand Down Expand Up @@ -351,8 +351,8 @@ function TeamDetails() {
? 'Good'
: selectedTeam.Qnty >= 1 &&
selectedTeam.Qnty < 1.5
? 'Improve'
: 'Poor'}
? 'Improve'
: 'Poor'}
</span>
</div>
</div>
Expand Down Expand Up @@ -386,12 +386,12 @@ function TeamDetails() {
</ul>
<span style={{ color: getColor(selectedTeam.skills) }}>
{selectedTeam.skills >= 1.5 &&
selectedTeam.skills <= 2
selectedTeam.skills <= 2
? 'Good'
: selectedTeam.skills >= 1 &&
selectedTeam.skills < 1.5
? 'Improve'
: 'Poor'}
? 'Improve'
: 'Poor'}
</span>
</div>
</div>
Expand Down
42 changes: 31 additions & 11 deletions src/containers/admin-dashBoard/Teams.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ export interface Team {
name: string;
cohort: Cohort;
ttl: any;
manager: any;
phase: any;
program: any;
}

export const getAllTeam = gql`
Expand Down Expand Up @@ -72,6 +75,15 @@ export const getAllTeam = gql`
quality
professional_Skills
}
phase {
name
}
program {
name
}
manager {
email
}
}

getAllCohorts(orgToken: $orgToken) {
Expand All @@ -96,6 +108,15 @@ export const getAllTeam = gql`
role
organizations
}
getAllPrograms(orgToken: $orgToken) {
id
name
}
getAllPhases(orgToken: $orgToken) {
id
name
description
}
}
`;

Expand Down Expand Up @@ -224,17 +245,16 @@ function AdminTeams() {
}),
},
];

const teamData = getData?.getAllTeams.map(({ name, cohort, ttl }) => ({
name,
cohortName: cohort?.name,
coordinator: cohort?.coordinator?.email
? cohort?.coordinator?.email
: 'Not Assigned',
phase: cohort?.phase.name,
programName: cohort?.program?.name,
ttlEmail: ttl?.profile && ttl.profile.name ? ttl?.email : 'Not Assigned',
}));
const teamData = getData?.getAllTeams.map(
({ name, cohort, ttl, phase, program, manager }) => ({
name,
cohortName: cohort?.name,
coordinator: manager?.email ? manager?.email : cohort?.coordinator?.email,
phase: phase?.name ? phase?.name : cohort?.phase?.name,
programName: program?.name ? program?.name : cohort?.program?.name,
ttlEmail: ttl?.profile && ttl.profile.name ? ttl?.email : 'Not Assigned',
}),
);

return (
<>
Expand Down
Loading
Loading