This commit is contained in:
parent
d7dcbb0ea8
commit
6ae1cf268d
71
src/CV.tsx
71
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<Me>(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);
|
||||
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);
|
||||
}
|
||||
// @ts-ignore
|
||||
link.href = profile.picture
|
||||
}, []);
|
||||
)
|
||||
}, [])
|
||||
|
||||
return (
|
||||
<div className="CV">
|
||||
<Header tags={tags} profile={profile}/>
|
||||
if (error) {
|
||||
return <div>Error: {error}</div>;
|
||||
} else if (!isLoaded) {
|
||||
return <div>Loading...</div>;
|
||||
} else {
|
||||
|
||||
return (<div className="CV">
|
||||
<Header tags={cv.tags.filter(t => t.workThing)} profile={cv.profile}/>
|
||||
<div className="card flex divide-x divide-gray-600">
|
||||
<div className="basis-3/4 pr-2 divide-y divide-gray-400 details">
|
||||
<Jobs jobs={jobs}/>
|
||||
<Education education={ed}/>
|
||||
<SideProjects projs={projs}/>
|
||||
<Jobs jobs={cv.jobs}/>
|
||||
<Education education={cv.educationYears}/>
|
||||
<SideProjects projs={cv.sideProjects}/>
|
||||
</div>
|
||||
<div className="basis-1/4 pl-2 divide-y divide-gray-400 details">
|
||||
<Skills tags={tags}/>
|
||||
<Languages langs={langs}/>
|
||||
<Interests interests={interests}/>
|
||||
<Skills tags={cv.tags}/>
|
||||
<Languages langs={cv.languages}/>
|
||||
<Interests interests={cv.interests}/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default CV;
|
||||
|
@ -8,7 +8,7 @@ function Job(props: ComponentProps<any>) {
|
||||
</div>
|
||||
<h5>{props.company}</h5>
|
||||
<ul>
|
||||
{props.tasks.map((task: string) => <li key={task}>{task}</li>)}
|
||||
{props.tasks.split("|").map((task: string) => <li key={task}>{task}</li>)}
|
||||
</ul>
|
||||
</div>);
|
||||
}
|
||||
|
@ -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<any>) {
|
||||
return (<div className="prose">
|
||||
<h3><BeakerIcon className="icon"/> Projets personnels</h3>
|
||||
{props.projs.map((proj: SideProjectCats) => {
|
||||
return (<div key={proj.category}>
|
||||
<h4>{proj.category}</h4>
|
||||
{Object.entries(props.projs).map(projectsOfCat => {
|
||||
const cat = projectsOfCat[0];
|
||||
const projs = projectsOfCat[1] as SideProject[];
|
||||
return (<div key={cat}>
|
||||
<h4>{cat}</h4>
|
||||
<ul>
|
||||
{proj.projects.map(p => {
|
||||
{projs.map((p: SideProject) => {
|
||||
return (<li key={p.description}>
|
||||
{p.title ? <div><a href={p.url}>{p.title}</a> {p.description}</div> : <div>{p.description}</div>}
|
||||
</li>)
|
||||
|
@ -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<any>) {
|
||||
@ -10,7 +10,7 @@ function Skills(props: ComponentProps<any>) {
|
||||
<div className="flex flex-wrap justify-between">
|
||||
{map(tagsByCat, (tags, cat) => {
|
||||
return (<div key={cat}>
|
||||
<h4 className="m-0 mb-1.5">{cat}</h4>
|
||||
<h4 className="m-0 mb-1.5">{getTagTitle(cat)}</h4>
|
||||
<div>
|
||||
{tags.map((t: Tag) => <button key={t.name} className={"tag " + getTagColor(t)}>{t.name}</button>)}
|
||||
</div>
|
||||
|
17
src/Model/me.ts
Normal file
17
src/Model/me.ts
Normal file
@ -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<string, SideProject[]>
|
||||
educationYears!: EducationYear[]
|
||||
languages!: Lang[]
|
||||
tags!: Tag[]
|
||||
}
|
@ -2,6 +2,7 @@ export class SideProject {
|
||||
title?: string
|
||||
url?: string
|
||||
description!: string
|
||||
category!: string
|
||||
}
|
||||
|
||||
export class SideProjectCats {
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user