diff --git a/src/CV.tsx b/src/CV.tsx index 07d20bd..0c6a8f5 100644 --- a/src/CV.tsx +++ b/src/CV.tsx @@ -1,4 +1,4 @@ -import React, {useEffect} from 'react'; +import React, {useEffect, useState} from 'react'; import Header from './Components/Header'; import './Assets/scss/CV.scss' import Jobs from './Components/Jobs'; @@ -14,58 +14,53 @@ import {SideProjectCats} from './Model/side-project'; import {JobAtCompany} from './Model/job-at-company'; import {Interest} from './Model/interests'; import {Profile} from './Model/profile'; +import { Me } from './Model/me'; function CV() { - const tags: Tag[] = [] - const langs: Lang[] = [] - - const ed: EducationYear[] = [] - - const projs: SideProjectCats[] = [] - - const jobs: JobAtCompany[] = [] - - const interests: Interest[] = [] - - const profile: Profile = { - "name": "", - "title": "", - "quote": "", - "picture": "" - } - - document.title = profile.name; + const [error, setError] = useState(null); + const [isLoaded, setIsLoaded] = useState(false); + const [cv, setCV] = useState(new Me()); useEffect(() => { - let link = document.querySelector("link[rel~='icon']"); - if (!link) { - link = document.createElement('link'); - // @ts-ignore - link.rel = 'icon'; - document.getElementsByTagName('head')[0].appendChild(link); - } - // @ts-ignore - link.href = profile.picture - }, []); + fetch("http://localhost:7070/api/me") + .then(res => res.json()) + .then( + (result: Me) => { + setIsLoaded(true); + setCV(result); + document.title = result.profile.name; + }, + (error) => { + setIsLoaded(true); + setError(error); + } + ) + }, []) - return ( -
-
-
-
- - - -
-
- - - + if (error) { + return
Error: {error}
; + } else if (!isLoaded) { + return
Loading...
; + } else { + + return (
+
t.workThing)} profile={cv.profile}/> +
+
+ + + +
+
+ + + +
-
- ); + ); + } } export default CV; diff --git a/src/Components/Job.tsx b/src/Components/Job.tsx index 00ad678..55ed760 100644 --- a/src/Components/Job.tsx +++ b/src/Components/Job.tsx @@ -8,7 +8,7 @@ function Job(props: ComponentProps) {
{props.company}
    - {props.tasks.map((task: string) =>
  • {task}
  • )} + {props.tasks.split("|").map((task: string) =>
  • {task}
  • )}
); } diff --git a/src/Components/SideProjects.tsx b/src/Components/SideProjects.tsx index cad0d56..cf814a8 100644 --- a/src/Components/SideProjects.tsx +++ b/src/Components/SideProjects.tsx @@ -1,15 +1,18 @@ import React, {ComponentProps} from 'react'; import {BeakerIcon} from '@heroicons/react/24/outline'; -import {SideProjectCats} from '../Model/side-project'; +import {SideProject} from '../Model/side-project'; +import {each, keys, map} from 'lodash'; function SideProjects(props: ComponentProps) { return (

Projets personnels

- {props.projs.map((proj: SideProjectCats) => { - return (
-

{proj.category}

+ {Object.entries(props.projs).map(projectsOfCat => { + const cat = projectsOfCat[0]; + const projs = projectsOfCat[1] as SideProject[]; + return (
+

{cat}

    - {proj.projects.map(p => { + {projs.map((p: SideProject) => { return (
  • {p.title ?
    {p.title} {p.description}
    :
    {p.description}
    }
  • ) diff --git a/src/Components/Skills.tsx b/src/Components/Skills.tsx index 516c0d6..e7c85ab 100644 --- a/src/Components/Skills.tsx +++ b/src/Components/Skills.tsx @@ -1,6 +1,6 @@ import React, {ComponentProps} from 'react'; import {CalendarDaysIcon, CheckBadgeIcon, LanguageIcon} from '@heroicons/react/24/outline'; -import {getTagColor, Tag, TagCategory} from '../Model/tag'; +import {getTagColor, getTagTitle, Tag, TagCategory} from '../Model/tag'; import {forIn, groupBy, map} from 'lodash'; function Skills(props: ComponentProps) { @@ -10,7 +10,7 @@ function Skills(props: ComponentProps) {
    {map(tagsByCat, (tags, cat) => { return (
    -

    {cat}

    +

    {getTagTitle(cat)}

    {tags.map((t: Tag) => )}
    diff --git a/src/Model/me.ts b/src/Model/me.ts new file mode 100644 index 0000000..6340653 --- /dev/null +++ b/src/Model/me.ts @@ -0,0 +1,17 @@ +import {EducationYear} from './education'; +import {SideProject} from './side-project'; +import {Interest} from './interests'; +import {Profile} from './profile'; +import {Tag} from './tag'; +import {Lang} from './lang'; +import {JobAtCompany} from './job-at-company'; + +export class Me { + profile!: Profile + interests!: Interest[] + jobs!: JobAtCompany[] + sideProjects!: Map + educationYears!: EducationYear[] + languages!: Lang[] + tags!: Tag[] +} diff --git a/src/Model/side-project.ts b/src/Model/side-project.ts index 78edd95..26275f1 100644 --- a/src/Model/side-project.ts +++ b/src/Model/side-project.ts @@ -2,6 +2,7 @@ export class SideProject { title?: string url?: string description!: string + category!: string } export class SideProjectCats { diff --git a/src/Model/tag.ts b/src/Model/tag.ts index 3e9abd6..ab14868 100644 --- a/src/Model/tag.ts +++ b/src/Model/tag.ts @@ -13,12 +13,27 @@ export function getTagColor(t: Tag) { } }; +export function getTagTitle(cat: string) { + switch (cat) { + case TagCategory.FRONT: + return 'Developpement Front' + case TagCategory.BACK: + return 'Developpement Back' + case TagCategory.MOBILE: + return 'Developpement Mobile' + case TagCategory.DB: + return 'Bases de données' + case TagCategory.OTHER: + return 'Autre' + } +}; + export enum TagCategory { - FRONT = 'Developpement Front', - BACK = 'Developpement Back', - MOBILE = 'Developpement Mobile', - DB = 'Bases de données', - OTHER = 'Autre' + FRONT = 'FRONT', + BACK = 'BACK', + MOBILE = 'MOBILE', + DB = 'DB', + OTHER = 'OTHER' } export class Tag {