Skip to content

Commit

Permalink
Merge branch 'epic/cv-x-wing-squadron' into feature/#269-CV-X-Wing-Sq…
Browse files Browse the repository at this point in the history
…uadron-Create-relevants-links-section
  • Loading branch information
MTeresaMB committed Dec 15, 2023
2 parents 45f95da + a5a9af7 commit aa085ed
Show file tree
Hide file tree
Showing 39 changed files with 277 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ export interface ProfileSectionVm {
fullname: string;
emails: string[];
relevantLinks: RelevantLinkVm[];
avatar: string;
regionLocation: string;
countryLocation: string;
avatar?: string;
regionLocation?: string;
countryLocation?: string;
}

export interface RelevantLinkVm {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ describe('studies-section.helpers specs', () => {
description: 'description2',
institution: {
name: 'name2',
description: 'description2',
location: {
country: 'Italia',
region: 'region2',
Expand All @@ -31,6 +32,7 @@ describe('studies-section.helpers specs', () => {
description: 'description2',
institution: {
name: 'name2',
description: 'description2',
location: {
country: 'Italia',
region: 'region2',
Expand All @@ -47,6 +49,7 @@ describe('studies-section.helpers specs', () => {
description: 'description',
institution: {
name: 'name',
description: 'description',
location: {
country: 'España',
region: 'region',
Expand All @@ -69,6 +72,7 @@ describe('studies-section.helpers specs', () => {
description: 'description',
institution: {
name: 'name',
description: 'description',
location: {
country: 'España',
region: 'region',
Expand All @@ -85,6 +89,7 @@ describe('studies-section.helpers specs', () => {
description: 'description2',
institution: {
name: 'name2',
description: 'description2',
location: {
country: 'Italia',
region: 'region2',
Expand All @@ -101,6 +106,7 @@ describe('studies-section.helpers specs', () => {
description: 'description2',
institution: {
name: 'name2',
description: 'description2',
location: {
country: 'Italia',
region: 'region2',
Expand All @@ -123,6 +129,7 @@ describe('studies-section.helpers specs', () => {
description: 'description',
institution: {
name: 'name',
description: 'description',
location: {
country: 'España',
region: 'region',
Expand All @@ -139,6 +146,7 @@ describe('studies-section.helpers specs', () => {
description: 'description2',
institution: {
name: 'name2',
description: 'description2',
location: {
country: 'Italia',
region: 'region2',
Expand All @@ -161,6 +169,7 @@ describe('studies-section.helpers specs', () => {
description: 'description',
institution: {
name: 'name',
description: 'description',
location: {
country: 'España',
region: 'region',
Expand All @@ -177,6 +186,7 @@ describe('studies-section.helpers specs', () => {
description: 'description2',
institution: {
name: 'name2',
description: 'description2',
location: {
country: 'Italia',
region: 'region2',
Expand All @@ -201,6 +211,7 @@ describe('studies-section.helpers specs', () => {
description: 'description2',
institution: {
name: 'name2',
description: 'description2',
location: {
country: 'Italia',
region: 'region2',
Expand All @@ -223,6 +234,7 @@ describe('studies-section.helpers specs', () => {
description: 'description2',
institution: {
name: 'name2',
description: 'description2',
location: {
country: 'Italia',
region: 'region2',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ describe('studies-section.mapper specs', () => {
address: 'address',
},
},
linkedCompetences: [{ name: 'Competence 1' }, { name: 'Competence 2' }],
},
],
},
Expand All @@ -91,12 +92,14 @@ describe('studies-section.mapper specs', () => {
description: 'description',
institution: {
name: 'name',
description: 'description',
location: {
country: 'España',
region: 'region',
address: 'address',
},
},
linkedCompetences: ['Competence 1', 'Competence 2'],
},
];

Expand Down Expand Up @@ -134,6 +137,7 @@ describe('studies-section.mapper specs', () => {
address: 'address',
},
},
linkedCompetences: [{ name: 'Competence 1' }, { name: 'Competence 2' }],
},
{
studyType: 'certification',
Expand All @@ -151,6 +155,7 @@ describe('studies-section.mapper specs', () => {
address: 'address2',
},
},
linkedCompetences: [{ name: 'Competence 3' }, { name: 'Competence 4' }],
},
],
},
Expand All @@ -170,12 +175,14 @@ describe('studies-section.mapper specs', () => {
description: 'description',
institution: {
name: 'name',
description: 'description',
location: {
country: 'España',
region: 'region',
address: 'address',
},
},
linkedCompetences: ['Competence 1', 'Competence 2'],
},
{
studyType: 'Certificación',
Expand All @@ -186,12 +193,14 @@ describe('studies-section.mapper specs', () => {
description: 'description2',
institution: {
name: 'name2',
description: 'description2',
location: {
country: 'Italia',
region: 'region2',
address: 'address2',
},
},
linkedCompetences: ['Competence 3', 'Competence 4'],
},
];

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ManfredAwesomicCV } from '@/model';
import { Competence, ManfredAwesomicCV } from '@/model';
import { CountryType, Institution, StudiesSectionVm, StudyTypeWithTranslation } from './studies-section.vm';
import { studiesTypes, countryList } from './studies-section.constants';
import { sortedStudiesByStartDate } from './studies-section.helpers';
Expand All @@ -16,17 +16,18 @@ export const mapFromMacCvToStudiesSectionVm = (cv: ManfredAwesomicCV): StudiesSe
const description = study?.description ?? '';
let institution: Institution = {
name: study?.institution?.name ?? '',
description: study?.institution?.description ?? '',
location: {
country: study?.institution?.location?.country ?? '',
region: study?.institution?.location?.region ?? '',
address: study?.institution?.location?.address ?? '',
},
};

const mapStudyType = mapStudiesTypes(studyType, studiesTypes);
const mapCountry = mapCountries(institution.location.country, countryList);
institution = { ...institution, location: { ...institution.location, country: mapCountry } };

const linkedCompetences: Competence[] = study?.linkedCompetences ?? [];
const mapLinkedCompetence = linkedCompetences.map(competence => competence.name);
return {
name,
studyType: mapStudyType,
Expand All @@ -35,6 +36,7 @@ export const mapFromMacCvToStudiesSectionVm = (cv: ManfredAwesomicCV): StudiesSe
finishDate,
description,
institution,
linkedCompetences: mapLinkedCompetence,
};
}) ?? [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,13 @@ export interface StudiesSectionVm {
finishDate: string;
description: string;
institution: Institution;
linkedCompetences: string[];
}

export interface Institution {
name: string;
location: Location;
description: string;
}

export interface Location {
Expand Down
2 changes: 1 addition & 1 deletion packages/manfred-common/src/model/manfred-schema.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,6 @@ export interface Role {
*/
export interface Competence {
name: string;
type: 'tool' | 'technology' | 'practice' | 'hardware' | 'domain';
type?: 'tool' | 'technology' | 'practice' | 'hardware' | 'domain';
description?: string;
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="6" viewBox="0 0 32 6" fill="none">
<path d="M5.51343e-07 3L32 3" stroke="#3BA0B7" stroke-width="6" />
</svg>
<h2>Experiencia</h2>
<h2><%- labels.EXPERIENCE_CAREER_HEADING %></h2>
</div>
<%_ for(const experience of experienceCollection) { -%>
<section class="main__section__item">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import { ExperienceVm, mapFromMacCvToExperienceSectionVm } from '@lemoncode/manfred-common/experience-section';
import { ManfredAwesomicCV } from '@/model';
import { ManfredAwesomicCV, Settings, Language } from '@/model';
import { ISO_SPANISH_LANGUAGE } from '@/engine/engine.const';
import { getLabels } from './labels';
import ejs from 'ejs';
import experienceTemplate from './experience-section.ejs?raw';

export const generateExperienceSection = (cv: ManfredAwesomicCV): string => {
export const generateExperienceSection = (cv: ManfredAwesomicCV, settings: Settings): string => {
const experienceSectionVm = mapFromMacCvToExperienceSectionVm(cv);
return generateExperienceSectionInner(experienceSectionVm);
return generateExperienceSectionInner(experienceSectionVm, settings.language);
};

const generateExperienceSectionInner = (experienceSectionVm: ExperienceVm[]): string => {
const generateExperienceSectionInner = (
experienceSectionVm: ExperienceVm[],
language: Language = ISO_SPANISH_LANGUAGE
): string => {
const rootObject = {
experienceCollection: experienceSectionVm,
labels: getLabels(language),
};
return ejs.render(experienceTemplate, rootObject);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { ExperienceLabels } from './experience-label.model';

export const englishExperienceLabels: ExperienceLabels = {
EXPERIENCE_CAREER_HEADING: 'Experience / Career',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface ExperienceLabels {
EXPERIENCE_CAREER_HEADING: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { ExperienceLabels } from './experience-label.model';

export const spanishExperienceLabels: ExperienceLabels = {
EXPERIENCE_CAREER_HEADING: 'Experiencia / Carrera',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Language } from '@/model';
import { ExperienceLabels } from './experience-label.model';
import { spanishExperienceLabels } from './experience-spanish-labels.const';
import { englishExperienceLabels } from './experience-english-labels.const';

export const getLabels = (language: Language): ExperienceLabels => {
switch (language) {
case 'es':
return spanishExperienceLabels;
case 'en':
return englishExperienceLabels;
default:
throw new Error(`Language not supported: ${language}`);
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="6" viewBox="0 0 32 6" fill="none">
<path d="M5.51343e-07 3L32 3" stroke="#3BA0B7" stroke-width="6" />
</svg>
<h2>Competencias</h2>
<h2><%- labels.HARD_SKILLS_HEADING %></h2>
</div>
<ul class="ul__technologies">
<%_ for (const item of hardSkillsCollection) { -%>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,22 @@
import { ManfredAwesomicCV } from '@/model';
import { ManfredAwesomicCV, Settings, Language } from '@/model';
import { HardSkillVM, mapFromCvToHardSkillVm } from '@lemoncode/manfred-common/hard-skill-section';
import { ISO_SPANISH_LANGUAGE } from '@/engine/engine.const';
import { getLabels } from './labels';
import ejs from 'ejs';
import hardSkillsTemplate from './hard-skills-section.ejs?raw';

export const generateHardSkillsSection = (cv: ManfredAwesomicCV): string => {
export const generateHardSkillsSection = (cv: ManfredAwesomicCV, settings: Settings): string => {
const hardSkillsSectionVm = mapFromCvToHardSkillVm(cv);
return generateHardSkillSectionInner(hardSkillsSectionVm);
return generateHardSkillSectionInner(hardSkillsSectionVm, settings.language);
};

const generateHardSkillSectionInner = (hardSkillsSectionVm: HardSkillVM[]): string => {
const generateHardSkillSectionInner = (
hardSkillsSectionVm: HardSkillVM[],
language: Language = ISO_SPANISH_LANGUAGE
): string => {
const rootObject = {
hardSkillsCollection: hardSkillsSectionVm,
labels: getLabels(language),
};
return ejs.render(hardSkillsTemplate, rootObject);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { HardSkillsLabels } from './hard-skills-label.model';

export const englishHardSkillsLabels: HardSkillsLabels = {
HARD_SKILLS_HEADING: 'Hard Skills',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface HardSkillsLabels {
HARD_SKILLS_HEADING: string;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { HardSkillsLabels } from './hard-skills-label.model';

export const spanishHardSkillsLabels: HardSkillsLabels = {
HARD_SKILLS_HEADING: 'Competencias',
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Language } from '@/model';
import { HardSkillsLabels } from './hard-skills-label.model';
import { spanishHardSkillsLabels } from './hard-skills-spanish-labels.const';
import { englishHardSkillsLabels } from './hard-skills-english-labels.const';

export const getLabels = (language: Language): HardSkillsLabels => {
switch (language) {
case 'es':
return spanishHardSkillsLabels;
case 'en':
return englishHardSkillsLabels;
default:
throw new Error(`Language not supported: ${language}`);
}
};
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export * from './langauge-section.part';
export * from './language-section.part';
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { Language } from '@/model';
import { LanguageLabels } from './language-label.model';
import { spanishLanguageLabels } from './language-spanish-labels.const';
import { englishLanguageLabels } from './language-english-labels.const';

export const getLabels = (language: Language): LanguageLabels => {
switch (language) {
case 'es':
return spanishLanguageLabels;
case 'en':
return englishLanguageLabels;
default:
throw new Error(`Language not supported: ${language}`);
}
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { LanguageLabels } from './language-label.model';

export const englishLanguageLabels: LanguageLabels = {
LANGUAGE_HEADING: 'Languages',
LEVEL_ONE: 'Native/Bilingual',
LEVEL_TWO: 'Fluent',
LEVEL_THREE: 'Intermediate',
LEVEL_FOUR: 'Basic',
};
Loading

0 comments on commit aa085ed

Please sign in to comment.