diff --git a/client/src/pages/Talent/Talent.tsx b/client/src/pages/Talent/Talent.tsx index 6bcaad8..3e18b07 100644 --- a/client/src/pages/Talent/Talent.tsx +++ b/client/src/pages/Talent/Talent.tsx @@ -1,182 +1,217 @@ -import { createContext, useEffect, useState } from "react"; -import TalentNav from "../../components/Navbar/TalentNav"; -import "./Talent.css"; -import { FaFile } from "react-icons/fa"; -import TButton from "../../components/Button/TButton"; -import AddNewComp from "../../components/talentProfile/AddNewComp.tsx"; -import AddExperienceModal from "../../components/Modal/AddExperienceModal.tsx"; -import AddProjectModal from "../../components/Modal/AddProjectModal.tsx"; -import AddEducationModal from "../../components/Modal/AddEducationModal.tsx"; -import Showwcase from "../../components/talentProfile/Showwcase.tsx"; +/* eslint-disable @typescript-eslint/no-explicit-any */ +/* eslint-disable @typescript-eslint/ban-ts-comment */ +import { createContext, useEffect, useState } from 'react'; +import TalentNav from '../../components/Navbar/TalentNav'; +import './Talent.css'; +import { FaFile } from 'react-icons/fa'; +import TButton from '../../components/Button/TButton'; +import AddNewComp from '../../components/talentProfile/AddNewComp.tsx'; +import AddExperienceModal from '../../components/Modal/AddExperienceModal.tsx'; +import AddProjectModal from '../../components/Modal/AddProjectModal.tsx'; +import AddEducationModal from '../../components/Modal/AddEducationModal.tsx'; +import Showwcase from '../../components/talentProfile/Showwcase.tsx'; import { - CertificationShowwcaseCard, - EducationShowwcaseCard, - ExperienceShowwcaseCard, - ProjectShowwcaseCard, - SkillShowwcaseCard, -} from "../../components/talentProfile/ShowwcaseCard.tsx"; -import AddCertificateModal from "../../components/Modal/AddCertificateModal.tsx"; -import AddSkillModal from "../../components/Modal/AddSkillModal.tsx"; -import { getTalentExperiences } from "../../api/experience.ts"; -import { getTalentProjects } from "../../api/project.ts"; -import { getTalentEducations } from "../../api/education.ts"; -import { getTalentCertifications } from "../../api/certifications.ts"; -import { getTalentSkills } from "../../api/skills.ts"; + CertificationShowwcaseCard, + EducationShowwcaseCard, + ExperienceShowwcaseCard, + ProjectShowwcaseCard, + SkillShowwcaseCard, +} from '../../components/talentProfile/ShowwcaseCard.tsx'; +import AddCertificateModal from '../../components/Modal/AddCertificateModal.tsx'; +import AddSkillModal from '../../components/Modal/AddSkillModal.tsx'; +import { getTalentExperiences } from '../../api/experience.ts'; +import { getTalentProjects } from '../../api/project.ts'; +import { getTalentEducations } from '../../api/education.ts'; +import { getTalentCertifications } from '../../api/certifications.ts'; +import { getTalentSkills } from '../../api/skills.ts'; // @ts-ignore export const TalentContext: React.Context<{ - refresh: boolean; - setRefresh: React.Dispatch>; + refresh: boolean; + setRefresh: React.Dispatch>; }> = createContext({}); const Talent = (): JSX.Element => { - const [refresh, setRefresh] = useState(false); - const { talentProfile } = localStorage; - const temp = talentProfile ? JSON.parse(talentProfile as string).talent : {}; - // eslint-disable-next-line @typescript-eslint/no-unused-vars - const [user, _setUser] = useState(temp); - const [showexp, setShowexp] = useState(false); - const [showproj, setShowproj] = useState(false); - const [showedu, setShowedu] = useState(false); - const [showskill, setShowskill] = useState(false); - const [showcert, setShowcert] = useState(false); - const [talentExperiences, setTalentExperiences] = useState([]); - const [talentProjects, setTalentProjects] = useState([]); - const [talentEducations, setTalentEducations] = useState([]); - const [talentSkills, setTalentSkills] = useState([]); - const [talentCertifications, setTalentCertifications] = useState([]); + const [refresh, setRefresh] = useState(false); + const { talentProfile } = localStorage; + const temp = talentProfile + ? JSON.parse(talentProfile as string).talent + : {}; + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const [user, _setUser] = useState(temp); + const [showexp, setShowexp] = useState(false); + const [showproj, setShowproj] = useState(false); + const [showedu, setShowedu] = useState(false); + const [showskill, setShowskill] = useState(false); + const [showcert, setShowcert] = useState(false); + const [talentExperiences, setTalentExperiences] = useState([]); + const [talentProjects, setTalentProjects] = useState([]); + const [talentEducations, setTalentEducations] = useState([]); + const [talentSkills, setTalentSkills] = useState([]); + const [talentCertifications, setTalentCertifications] = useState([]); - useEffect(() => { - // @ts-ignore - getTalentExperiences(user._id).then((value) => { - setTalentExperiences(value.data); - }); - getTalentSkills(user._id).then((value) => setTalentSkills(value.data)); - getTalentProjects(user._id).then((value) => setTalentProjects(value.data)); - getTalentEducations(user._id).then((value) => - setTalentEducations(value.data), - ); - getTalentCertifications(user._id).then((value) => - setTalentCertifications(value.data), - ); - }, [refresh]); - return ( - <> - - -
-
-
- -
-
-
-

{user.name}

- -
+ useEffect(() => { + // @ts-ignore + getTalentExperiences(user._id).then((value) => { + setTalentExperiences(value.data); + }); + getTalentSkills(user._id).then((value) => setTalentSkills(value.data)); + getTalentProjects(user._id).then((value) => + setTalentProjects(value.data) + ); + getTalentEducations(user._id).then((value) => + setTalentEducations(value.data) + ); + getTalentCertifications(user._id).then((value) => + setTalentCertifications(value.data) + ); + }, [refresh, user._id]); + return ( + <> + + +
+
+
+ +
+
+
+

+ {user.name} +

+ +
-
- -
-
-
+
+ +
+
+
-
-
-
- - } - onClick={() => { - setShowexp(true); - }} - /> -
- - {talentExperiences.map((exp) => ( - - ))} - -
-
- { - setShowproj(true); - }} - > - - -
- - {talentProjects.map((project) => ( - - ))} - -
-
- {" "} - { - setShowedu(true); - }} - > - - -
- - {talentEducations.map((education) => ( - - ))} - -
{" "} -
- {" "} - { - setShowskill(true); - }} - > - - -
- - {talentSkills.map((skill) => ( - - ))} - -
{" "} -
- {" "} - { - setShowcert(true); - }} - > - - -
- - {talentCertifications.map((certs) => ( - - ))} - -
-
-
-
-
- - - ); +
+
+
+ + } + onClick={() => { + setShowexp(true); + }} + /> +
+ + {talentExperiences.map((exp) => ( + + ))} + +
+
+ { + setShowproj(true); + }} + > + + +
+ + {talentProjects.map((project) => ( + + ))} + +
+
+ {' '} + { + setShowedu(true); + }} + > + + +
+ + {talentEducations.map((education) => ( + + ))} + +
{' '} +
+ {' '} + { + setShowskill(true); + }} + > + + +
+ + {talentSkills.map((skill) => ( + + ))} + +
{' '} +
+ {' '} + { + setShowcert(true); + }} + > + + +
+ + {talentCertifications.map((certs) => ( + + ))} + +
+
+
+
+
+
+ + ); }; export default Talent;