diff --git a/src/components/ProfileCoverpage.tsx b/src/components/ProfileCoverpage.tsx
index 98379665c..961d602ed 100644
--- a/src/components/ProfileCoverpage.tsx
+++ b/src/components/ProfileCoverpage.tsx
@@ -62,7 +62,7 @@ export default function ProfileCoverpage({
formData.append('upload_preset', 'my_upload');
const avatar = await axios.post(
- 'https://api.cloudinary.com/v1_1/dj24yfas5/image/upload',
+ `${process.env.COVER_IMAGE_URL}`,
formData,
);
/* istanbul ignore next */
@@ -97,7 +97,7 @@ export default function ProfileCoverpage({
formData.append('upload_preset', 'my_upload');
const cover = await axios.post(
- 'https://api.cloudinary.com/v1_1/dta2axdpw/image/upload',
+ `${process.env.COVER_IMAGE_URL}`,
formData,
);
/* istanbul ignore next */
diff --git a/src/components/ProfileTabs.tsx b/src/components/ProfileTabs.tsx
index d33cfc2fb..9336c2528 100644
--- a/src/components/ProfileTabs.tsx
+++ b/src/components/ProfileTabs.tsx
@@ -23,8 +23,22 @@ import { UserContext } from '../hook/useAuth';
import { CountryComponent } from '../pages/Profile';
import { GET_ALL_TRAINEES } from '../Mutations/Ratings';
-import { FaEdit, FaEraser, FaGithub, FaGithubSquare, FaPlusSquare, FaRemoveFormat } from 'react-icons/fa';
-import { ADD_REPO, GET_GITHUB_STATISTICS, GET_ORGANISATION, REMOVE_REPO, UPDATE_ORGANISATION_NAME, GET_TRAINEE_PROFILE, } from '../Mutations/manageStudentMutations';
+import {
+ FaEdit,
+ FaEraser,
+ FaGithub,
+ FaGithubSquare,
+ FaPlusSquare,
+ FaRemoveFormat,
+} from 'react-icons/fa';
+import {
+ ADD_REPO,
+ GET_GITHUB_STATISTICS,
+ GET_ORGANISATION,
+ REMOVE_REPO,
+ UPDATE_ORGANISATION_NAME,
+ GET_TRAINEE_PROFILE,
+} from '../Mutations/manageStudentMutations';
import Spinner from './Spinner';
import GitHubActivityChart from './chartGitHub';
import BookOpenIcon from '@heroicons/react/outline/BookOpenIcon';
@@ -130,9 +144,9 @@ export default function ProfileTabs({ data: profileData }: any) {
cohort: null,
team: null,
phase: null,
- startDate: null
+ startDate: null,
});
- const role: String | undefined = profileData?.user?.role
+ const role: String | undefined = profileData?.user?.role;
/* istanbul ignore next */
const [fetchData2] = useLazyQuery(GET_ALL_TRAINEES, {
@@ -147,11 +161,11 @@ export default function ProfileTabs({ data: profileData }: any) {
},
});
- const [getGitHubStatistics]= useLazyQuery(GET_GITHUB_STATISTICS, {
+ const [getGitHubStatistics] = useLazyQuery(GET_GITHUB_STATISTICS, {
variables: {
organisation: localStorage.getItem('orgName')?.split('.')[0],
username: profileData?.githubUsername,
- }
+ },
});
const [fetchProfile] = useLazyQuery(GET_TRAINEE_PROFILE, {
@@ -160,40 +174,39 @@ export default function ProfileTabs({ data: profileData }: any) {
},
});
-
-
-/* istanbul ignore next */
+ /* istanbul ignore next */
useEffect(() => {
- switch(role) {
+ switch (role) {
case 'manager':
setManagementData((data: any) => ({
...data,
- program: profileData.user.program?.name
- }))
+ program: profileData.user.program?.name,
+ }));
break;
case 'coordinator':
setManagementData((data: any) => ({
...data,
cohort: profileData.user.cohort?.name,
- program: profileData.user.cohort?.program?.name
- }))
+ program: profileData.user.cohort?.program?.name,
+ }));
break;
case 'trainee':
// eslint-disable-next-line no-case-declarations
- const {team} = profileData.user
- team && setManagementData((data: any) => ({
- ...data,
- program: team.cohort?.program?.name,
- cohort: team.cohort?.name,
- team: team.name,
- phase: team.cohort?.phase?.name,
- startDate: team.cohort?.startDate
- }))
+ const { team } = profileData.user;
+ team &&
+ setManagementData((data: any) => ({
+ ...data,
+ program: team.cohort?.program?.name,
+ cohort: team.cohort?.name,
+ team: team.name,
+ phase: team.cohort?.phase?.name,
+ startDate: team.cohort?.startDate,
+ }));
break;
default:
}
- }, [profileData, role])
-/* istanbul ignore next */
+ }, [profileData, role]);
+ /* istanbul ignore next */
useEffect(() => {
fetchData2({
fetchPolicy: 'network-only',
@@ -207,44 +220,40 @@ export default function ProfileTabs({ data: profileData }: any) {
getGitHubStatistics({
fetchPolicy: 'network-only',
onCompleted: (data) => {
- setIsLoaded(false)
+ setIsLoaded(false);
setGitHubStatistics(data.gitHubActivity);
-
},
- onError:(error)=>{
- setIsLoaded(false)
- }
- });
+ onError: (error) => {
+ setIsLoaded(false);
+ },
+ });
fetchOrgData({
fetchPolicy: 'network-only',
onCompleted: (data) => {
setOrganisation(data.getOrganization);
- }
+ },
});
-
fetchProfile({
fetchPolicy: 'network-only',
onCompleted: (data) => {
setTraineeProfile(data.getProfile);
-
},
});
-
}, []);
const [addActiveRepostoOrganization] = useMutation(ADD_REPO, {
variables: {
name: orgName,
- repoUrl: repo
+ repoUrl: repo,
},
/* istanbul ignore next */
onCompleted: (data) => {
setTimeout(() => {
setButtonLoading(false);
toast.success(' added successfully');
- setRepoModel(false);
+ setRepoModel(false);
}, 500);
},
/* istanbul ignore next */
@@ -252,17 +261,15 @@ export default function ProfileTabs({ data: profileData }: any) {
setTimeout(() => {
setButtonLoading(false);
toast.error(err.message);
- setRepoModel(false);
-
+ setRepoModel(false);
}, 1000);
},
});
-
const [removeActiveRepostoOrganization] = useMutation(REMOVE_REPO, {
variables: {
name: orgName,
- repoUrl: repo
+ repoUrl: repo,
},
/* istanbul ignore next */
onCompleted: (data) => {
@@ -275,22 +282,19 @@ export default function ProfileTabs({ data: profileData }: any) {
toast.success('deleted successfully');
setRemoveRepoModel(false);
}, 500);
- }
+ },
});
-
},
/* istanbul ignore next */
onError: (err) => {
setTimeout(() => {
setButtonLoading(false);
toast.error(err.message);
- setRepoModel(false);
-
+ setRepoModel(false);
}, 1000);
},
});
-
const [updateGithubOrganisation] = useMutation(UPDATE_ORGANISATION_NAME, {
/* istanbul ignore next */
onCompleted: (data) => {
@@ -303,9 +307,8 @@ export default function ProfileTabs({ data: profileData }: any) {
toast.success('organisation name updated');
setOrgModel(false);
}, 500);
- }
+ },
});
-
},
/* istanbul ignore next */
onError: (err) => {
@@ -313,7 +316,6 @@ export default function ProfileTabs({ data: profileData }: any) {
setButtonLoading(false);
toast.error(err.message);
setOrgModel(false);
-
}, 1000);
},
});
@@ -326,9 +328,7 @@ export default function ProfileTabs({ data: profileData }: any) {
setSingleUser(singleTrainne[0]); // returns an object with single trainnee data that can be accessed singleUser.email
}, [traineeData]);
-
-
-
+ console.log('ProfileData', traineeProfile);
return (
@@ -391,15 +393,15 @@ export default function ProfileTabs({ data: profileData }: any) {
- {profileData?.name || "Name not available"}{' '}
+ {profileData?.name || 'Name not available'}{' '}
- {user?.email || "unavailable"}
+ {user?.email || 'unavailable'}
- {profileData?.phoneNumber || "unavailable"}
+ {profileData?.phoneNumber || 'unavailable'}
@@ -407,8 +409,8 @@ export default function ProfileTabs({ data: profileData }: any) {
{/* istanbul ignore next */}
{profileData?.city &&
/* istanbul ignore next */
- profileData?.country && ','
- }
+ profileData?.country &&
+ ','}
{profileData?.country && (
/* istanbul ignore next */
@@ -417,204 +419,249 @@ export default function ProfileTabs({ data: profileData }: any) {
{profileData?.githubUsername}
-
-
-
-
-
- View Resume
-
+
+ {traineeProfile.resume ? (
+ <>
+
+
+ View Resume
+
+ >
+ ) : (
+
No Resume uploaded yet
+ )}
-
+ {/* Or you can disable the link like below */}
+ {/*
*/}
-
- {t('Biography')}
-
-
{profileData?.biography || 'No biography'}
+
{t('Biography')}
+
+ {profileData?.biography || 'No biography'}
+
{/* istanbul ignore next */}
- {role && [].includes(role as never) &&
- /* istanbul ignore next */
-
-
-
-
-
- {orgName}
-
-
- https://andela.pulse.com/
-
-
-
-
-
- {/* You in the organization */}
- {t('You in the organization')}
-
-
-
{t('Role')}:
- {user?.role}
-
-
-
{t('Team')}:
- {singleUser && singleUser.team
- ? singleUser.team.name
- : 'Unavailabe'}
-
-
-
-
- {t('Management')}
-
-
-
- {t('program')}:
-
- {singleUser && singleUser.team
- ? singleUser.team.cohort.program.name
- : 'Unavailabe'}
+ {role && [].includes(role as never) && (
+ /* istanbul ignore next */
+
+
+
+
+
+ {orgName}
+
+
+ https://andela.pulse.com/
+
+
-
-
- {t('Stage(current)')}:
+
+
+ {/* You in the organization */}
+ {t('You in the organization')}
+
+
+
+ {t('Role')}:
+
+ {user?.role}
+
+
+
+ {t('Team')}:
+
{singleUser && singleUser.team
- ? singleUser.team.cohort.phase.name
+ ? singleUser.team.name
: 'Unavailabe'}
-
+
-
-
- {t('Manager')}:
-
+
+
+ {t('Management')}
+
+
+
+ {t('program')}:
+
+ {singleUser && singleUser.team
+ ? singleUser.team.cohort.program.name
+ : 'Unavailabe'}
+
+
+
+ {t('Stage(current)')}:
+ {singleUser && singleUser.team
+ ? singleUser.team.cohort.phase.name
+ : 'Unavailabe'}
+
+
+
+
+ {t('Manager')}:
+
- {singleUser && singleUser.team
- ? singleUser.team.cohort.program.manager.profile.name
- : 'Unavailabe'}
+ {singleUser && singleUser.team
+ ? singleUser.team.cohort.program.manager.profile.name
+ : 'Unavailabe'}
+
-
}
+ )}
-
-
- {isLoaded?(
-
-
-
-
- Loading gitHub statistics...
-
-
-
-
-
- ):(
-
-
-
-
-
- {gitHubStatistics?.totalCommits} total commits
-
-
-
-
-
-
-
- {gitHubStatistics?(
-
- ):(
- <>
-
- >
+ {isLoaded ? (
+
+
+
Loading gitHub statistics...
+
+
+
+
+ ) : (
+
+
+
+ {gitHubStatistics?.totalCommits} total commits
+
+
+
+
+ {gitHubStatistics ? (
+
+ ) : (
+ <>>
+ )}
+
+
+
)}
-
-
-
- )}
-
-
+
- Github Organisation
-
+ Github Organisation
-
-
-
- {organisation?.gitHubOrganisation}
-
-
-
{
- setOrg(organisation?.gitHubOrganisation);
- setOrgModel(true);
- }} />
+
+
+
+ {organisation?.gitHubOrganisation}
+
+
{
+ setOrg(organisation?.gitHubOrganisation);
+ setOrgModel(true);
+ }}
+ />
-
-
-
-
- Repository
-
-
-
@@ -639,56 +686,60 @@ export default function ProfileTabs({ data: profileData }: any) {
-
+
{t('You in the organization')}
-
{t('Role')}:
+
+ {t('Role')}:
+
{user?.role}
-
- {role && ['manager', 'coordinator', 'trainee'].includes(role as never) && (
-
-
- {t('Management')}
-
- {managementData.program && (
-
-
- {t('Program')}:
-
- {managementData.program}
-
- )}
- {managementData.cohort && (
-
-
- {t('Cohort')}:
-
- {managementData.cohort}
-
- )}
- {managementData.team && (
-
-
- {t('Team')}:
-
- {managementData.team}
-
- )}
- {managementData.phase && (
-
-
- {t('Phase')}:
-
- {managementData.phase}
-
- )}
-
- )}
+ {role &&
+ ['manager', 'coordinator', 'trainee'].includes(
+ role as never,
+ ) && (
+
+
+ {t('Management')}
+
+ {managementData.program && (
+
+
+ {t('Program')}:
+
+ {managementData.program}
+
+ )}
+ {managementData.cohort && (
+
+
+ {t('Cohort')}:
+
+ {managementData.cohort}
+
+ )}
+ {managementData.team && (
+
+
+ {t('Team')}:
+
+ {managementData.team}
+
+ )}
+ {managementData.phase && (
+
+
+ {t('Phase')}:
+
+ {managementData.phase}
+
+ )}
+
+ )}
@@ -703,68 +754,59 @@ export default function ProfileTabs({ data: profileData }: any) {
+ >{' '}
+ {/* =========================== Start:: RemoveTraineeModel =============================== */}
+
+
+
+
+ {t('Remove Repo')}
+
+
+
+
-{/* =========================== End:: RemoveTraineeModel =============================== */}
-
-
-
-
-{/* =========================== Start:: InviteTraineeModel =============================== */}
-
-
+ {/* =========================== End:: RemoveTraineeModel =============================== */}
+ {/* =========================== Start:: InviteTraineeModel =============================== */}
+
- Fill in the repository name
+ Fill in the repository name
@@ -805,13 +847,10 @@ export default function ProfileTabs({ data: profileData }: any) {
variant="info"
size="sm"
style="w-[30%] md:w-1/4 text-sm font-sans"
- onClick={
- () => setRepoModel(false)
- }
+ onClick={() => setRepoModel(false)}
children={t('Cancel')}
/>
-
{/* =========================== End:: InviteTraineeModel =============================== */}
-
-
-
-{/* =========================== Start:: InviteTraineeModel =============================== */}
-
-
- Fill in the organisation name
+ Fill in the organisation name
@@ -876,13 +911,10 @@ export default function ProfileTabs({ data: profileData }: any) {
variant="info"
size="sm"
style="w-[30%] md:w-1/4 text-sm font-sans"
- onClick={
- () => setOrgModel(false)
- }
+ onClick={() => setOrgModel(false)}
children={t('Cancel')}
/>
-
);
-}
\ No newline at end of file
+}
diff --git a/src/components/Resume.tsx b/src/components/Resume.tsx
index 89b582559..636e4e90f 100644
--- a/src/components/Resume.tsx
+++ b/src/components/Resume.tsx
@@ -1,4 +1,5 @@
/* istanbul ignore file */
+/* eslint-disable */
import React, { useState, useContext, useEffect } from 'react';
import { useTranslation } from 'react-i18next';
import { gql, useMutation } from '@apollo/client';
@@ -13,7 +14,6 @@ import Spinner from './Spinner';
const UPLOAD_RESUME = gql`
mutation UploadResume($userId: ID!, $resume: String!) {
uploadResume(userId: $userId, resume: $resume) {
- kindly
resume
}
}
@@ -123,13 +123,12 @@ function Resume() {
formData.append('file', file);
formData.append('upload_preset', 'mydocs');
formData.append('resource_type', 'raw');
-
try {
if (file && file.type === 'application/pdf') {
setButtonLoading(true);
- const resume = await axios.post(
- `https://api.cloudinary.com/v1_1/dta2axdpw/raw/upload`,
+ const resume = await axios.post(
+ `${process.env.RESUME_URL}`,
formData,
);
diff --git a/src/pages/AdminTraineeDashboard.tsx b/src/pages/AdminTraineeDashboard.tsx
index 7dd66c39b..a1613ea7a 100644
--- a/src/pages/AdminTraineeDashboard.tsx
+++ b/src/pages/AdminTraineeDashboard.tsx
@@ -114,7 +114,7 @@ function AdminTraineeDashboard() {
},
});
};
-
+ console.log('Trainees', traineeData);
const handleClose = () => {
setOpen(false);
};
@@ -1096,7 +1096,7 @@ function AdminTraineeDashboard() {
data={traineeData?.length > 0 ? datum : [{}]}
columns={columns}
loading={loading}
- title={t('Trainees list')}
+ title={t('Trainee list')}
/>
diff --git a/src/pages/tests/__snapshots__/userRegister.test.tsx.snap b/src/pages/tests/__snapshots__/userRegister.test.tsx.snap
index 862e468dd..d361fadac 100644
--- a/src/pages/tests/__snapshots__/userRegister.test.tsx.snap
+++ b/src/pages/tests/__snapshots__/userRegister.test.tsx.snap
@@ -72,7 +72,7 @@ exports[`TraineeRatingDashboard Tests Renders TraineeRatingDashboard 1`] = `
className="text-gray-400 border border-primary py-2 dark:bg-dark-bg rounded outline-none px-5 font-sans text-xs w-full h-[38px] "
data-placeholder="Date of birth"
id="date-placeholder"
- max="2023-10-02"
+ max="2023-09-19"
name="dateOfBirth"
onBlur={[Function]}
onChange={[Function]}