Skip to content

Commit

Permalink
Merge pull request #298 from MTeresaMB/feature/#264-CV-X-Wing-Squadro…
Browse files Browse the repository at this point in the history
…n-Create-Experience-section

Closed #264
  • Loading branch information
juanpms2 authored Dec 15, 2023
2 parents 25bdf42 + cabb943 commit 3be916c
Show file tree
Hide file tree
Showing 12 changed files with 114 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ describe('mapFromMacCvToExperienceSectionVm', () => {
],
},
],
URL: '',
},
],
},
Expand Down Expand Up @@ -112,6 +113,7 @@ describe('mapFromMacCvToExperienceSectionVm', () => {
],
},
],
URL: '',
},
];
expect(result).toEqual(expectResult);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const mapJobToExperience = (job: JobManfredAwesomicCV): ExperienceVm => (
description: job.organization?.description ?? '',
type: mapOrganizationType(job.type, types),
roles: job.roles?.map(role => role),
URL: job.organization?.URL ?? '',
});

export const mapOrganizationType = (type: string = '', types: Type[]): string => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export interface ExperienceVm {
description?: string;
type?: string;
roles: Role[];
URL: string;
}

export interface Type {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<%_ if(experienceCollection && experienceCollection.length !== 0) { -%>
<section class="main__section">
<div class="main__section__header">
<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><%- labels.EXPERIENCE_CAREER_HEADING %></h2>
</div>
<%_ for(const experience of experienceCollection) { -%>
<section class="main__section__item">
<h3><%= experience.name %></h3>
<h4><%= experience.roles[0].name %></h4>
<div class="section__content__date">
<svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none">
<path
opacity="0.75"
d="M4.33333 1V3M13.6667 1V3M1 15V5C1 4.46957 1.21071 3.96086 1.58579 3.58579C1.96086 3.21071 2.46957 3 3 3H15C15.5304 3 16.0391 3.21071 16.4142 3.58579C16.7893 3.96086 17 4.46957 17 5V15M1 15C1 15.5304 1.21071 16.0391 1.58579 16.4142C1.96086 16.7893 2.46957 17 3 17H15C15.5304 17 16.0391 16.7893 16.4142 16.4142C16.7893 16.0391 17 15.5304 17 15M1 15V8.33333C1 7.8029 1.21071 7.29419 1.58579 6.91912C1.96086 6.54405 2.46957 6.33333 3 6.33333H15C15.5304 6.33333 16.0391 6.54405 16.4142 6.91912C16.7893 7.29419 17 7.8029 17 8.33333V15M9 9.66667H9.00711V9.67378H9V9.66667ZM9 11.6667H9.00711V11.6738H9V11.6667ZM9 13.6667H9.00711V13.6738H9V13.6667ZM7 11.6667H7.00711V11.6738H7V11.6667ZM7 13.6667H7.00711V13.6738H7V13.6667ZM5 11.6667H5.00711V11.6738H5V11.6667ZM5 13.6667H5.00711V13.6738H5V13.6667ZM11 9.66667H11.0071V9.67378H11V9.66667ZM11 11.6667H11.0071V11.6738H11V11.6667ZM11 13.6667H11.0071V13.6738H11V13.6667ZM13 9.66667H13.0071V9.67378H13V9.66667ZM13 11.6667H13.0071V11.6738H13V11.6667Z"
stroke="#353241"
stroke-width="0.75"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
<p><%- new Date(experience.roles[0].startDate).toLocaleDateString(undefined, { year:"numeric", month:"short"})%> <%_ if(experience.roles[0].finishDate && experience.roles[0].finishDate.toLowerCase() !=='actualidad') { -%>
<%- "- "+new Date(experience.roles[0].finishDate).toLocaleDateString(undefined, { year:"numeric", month:"short"}) -%>
<%_ } else { -%>
- Actualidad
<%_}-%>
</p>
</div>
<div class="main__section__data">
<%_ if(experience.type) { -%>
<p><%= experience.description %></p>
<%_ } -%>
<%_ if(experience.roles[0].challenges && experience.roles[0].challenges.length !== 0){ -%>
<ul>
<%_ for(const challenge of experience.roles[0].challenges){ -%>
<li><%= challenge.description %></li>
<%_ } -%>
</ul>
<%_ } -%>
</div>
<a href="<%= experience.URL %>" target="_blank"><%= experience.name %></a>
<%_ if (experience.roles[0].competences && experience.roles[0].competence !== 0) { -%>
<h3 class="tech__tools__heading">Tecnologías y Herramientas</h3>
<ul class="ul__technologies">
<%_ for(const competence of experience.roles[0].competences) { -%>
<li class="li__technologies"><%= competence.name %></li>
<%_ } -%>
</ul>
<%_ } -%>
</section>
<%_}-%>
</section>
<%_}-%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { ExperienceVm, mapFromMacCvToExperienceSectionVm } from '@lemoncode/manfred-common/experience-section';
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, settings: Settings): string => {
const experienceSectionVm = mapFromMacCvToExperienceSectionVm(cv);
return generateExperienceSectionInner(experienceSectionVm, settings.language);
};

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 @@
export * from './experience-section.part';
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 @@ -9,3 +9,4 @@ export * from './about-me-section';
export * from './language-section';
export * from './hard-skills-section';
export * from './soft-skills-section';
export * from './experience-section';
3 changes: 3 additions & 0 deletions packages/manfred2html/src/engine/cv-x-wing-squadron/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
generateLanguageSection,
generateHardSkillsSection,
generateSoftSkillsSection,
generateExperienceSection,
} from './html-parts';

export const exportManfredJsonToCVXWingHTML = (manfredJsonContent: ManfredAwesomicCV, settings: Settings): string => {
Expand All @@ -22,6 +23,7 @@ export const exportManfredJsonToCVXWingHTML = (manfredJsonContent: ManfredAwesom
const mainElementStart = generateMainElementStart();
const aboutMeSection = generateAboutMeSection(manfredJsonContent, settings);
const mainElementEnd = generateMainElementEnd();
const experienceSection = generateExperienceSection(manfredJsonContent, settings);
const softSkillsSection = generateSoftSkillsSection(manfredJsonContent, settings);
const hardSkillsSection = generateHardSkillsSection(manfredJsonContent, settings);
const languageSection = generateLanguageSection(manfredJsonContent, settings);
Expand All @@ -35,6 +37,7 @@ export const exportManfredJsonToCVXWingHTML = (manfredJsonContent: ManfredAwesom
${languageSection}
${hardSkillsSection}
${softSkillsSection}
${experienceSection}
${mainElementEnd}
${htmlDocumentEnd}
`;
Expand Down

0 comments on commit 3be916c

Please sign in to comment.