Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/#274 cv monochrome force create experience section #303

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -252,19 +252,19 @@ describe('experience-section.helpers specs', () => {
competences: [
{
name: 'name',
type: 'type',
type: 'technology',
},
{
name: 'name',
type: 'type',
type: 'technology',
},
{
name: 'name',
type: 'type',
type: 'technology',
},
{
name: 'name',
type: 'name',
type: 'technology',
},
],
organization: {
Expand Down Expand Up @@ -365,19 +365,19 @@ describe('experience-section.helpers specs', () => {
competences: [
{
name: 'name',
type: 'type',
type: 'technology',
},
{
name: 'name',
type: 'type',
type: 'technology',
},
{
name: 'name',
type: 'type',
type: 'technology',
},
{
name: 'name',
type: 'name',
type: 'technology',
},
],
organization: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ describe('mapFromMacCvToExperienceSectionVm', () => {
organization: {
name: 'name',
description: 'description',
URL: 'https://lemoncode.net',
},
type: 'freelance',
roles: [
Expand Down Expand Up @@ -89,6 +90,7 @@ describe('mapFromMacCvToExperienceSectionVm', () => {
{
name: 'name',
description: 'description',
url: 'https://lemoncode.net',
type: 'Autónomo',
roles: [
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ export const mapFromMacCvToExperienceSectionVm = (cv: ManfredAwesomicCV): Experi
export const mapJobToExperience = (job: JobManfredAwesomicCV): ExperienceVm => ({
name: job.organization?.name ?? '',
description: job.organization?.description ?? '',
url: job.organization?.URL ?? '',
type: mapOrganizationType(job.type, types),
roles: job.roles?.map(role => role),
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { OrganizationType, PublicEntityDetails, Role } from '@/model';
import { Competence, OrganizationType, PublicEntityDetails, Role } from '@/model';

export interface ExperienceVm {
name: string;
description?: string;
url?: string;
type?: string;
roles: Role[];
}
Expand All @@ -18,4 +19,5 @@ export interface JobManfredAwesomicCV {
organization: PublicEntityDetails;
type?: OrganizationType | undefined;
roles: [Role, ...Role[]];
competences?: Competence[];
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<%_ if(experienceCollection && experienceCollection.length !== 0){ -%>
<section class="section experiencies">
<h2 class="title"><%- labels.EXPERIENCE_CAREER_HEADING %></h2>
<div class="experiencies__container">
<%_ for(const experience of experienceCollection){ -%>
<div class="experience">
<p class="experience__date"><%- 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>
<h3 class="experience__position"><%- experience.roles[0].name %></h3>
<h4 class="experience__company"><%- experience.name %></h4>
<%_ if(experience.roles[0].challenges && experience.roles[0].challenges.length !== 0) { -%>
<div class="experience__text">
<%_ for(const challenge of experience.roles[0].challenges){ -%>
<p><%- challenge.description %></p>
<%_}-%>
</div>
<%_}-%>
<%_ if(experience.url && experience.url !== "undefined") { -%>
<a href="https://www.getmanfred.com" class="experience__url"><%- experience.url %></a>
<%_}-%>
<%_ if(experience.roles[0].competences && experience.roles[0].competences.length !== 0) { -%>
<div>
<h5 class="experience__tools"><%- labels.EXPERIENCE_CAREER_TOOLS %></h5>
<ul class="experience__tools-list">
<%_ for(const competences of experience.roles[0].competences ){ -%>
<li class="chip"><%- competences.name %></li>
<%_ } -%>
</ul>
</div>
<%_ } -%>
</div>
<%_ } -%>
</div>
</section>
<%_ }-%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import ejs from 'ejs';
import { ExperienceVm, mapFromMacCvToExperienceSectionVm } from '@lemoncode/manfred-common/experience-section';
import { Settings, Language, ManfredAwesomicCV } from '@/model';
import { ISO_SPANISH_LANGUAGE } from '@/engine/engine.const';
import experienceTemplate from './experience-section.ejs?raw';
import { getLabels } from './labels';

export const generateExperiencesSection = (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,6 @@
import { ExperienceLabels } from './experience-label.model';

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

export const spanishExperienceLabels: ExperienceLabels = {
EXPERIENCE_CAREER_HEADING: 'Experiencia / Carrera',
EXPERIENCE_CAREER_TOOLS: 'Tecnologías y Herramientas',
};
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 @@ -7,6 +7,7 @@ export * from './footer-section';
export * from './main-element-start';
export * from './main-element-end';
export * from './about-me-section';
export * from './experience-section';
export * from './soft-skills-section';
export * from './relevants-links-section';
export * from './hard-skills-section';
export * from './hard-skills-section';
3 changes: 3 additions & 0 deletions packages/manfred2html/src/engine/cv-monochrome-force/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
generateMainElementStart,
generateMainElementEnd,
generateAboutMeSection,
generateExperiencesSection,
generateSoftSkillsSection,
generateRelevantsLinksSection,
generateHardSkillsSection,
Expand All @@ -28,6 +29,7 @@ export const exportManfredJSonToCVMonochromeForceHTML = (
const mainElementEnd = generateMainElementEnd();
const relevantsLinksSection = generateRelevantsLinksSection(manfredJsonContent, settings);
const aboutMeSection = generateAboutMeSection(manfredJsonContent, settings);
const experienceSection = generateExperiencesSection(manfredJsonContent, settings);
const softSkillsSection = generateSoftSkillsSection(manfredJsonContent, settings);
const hardSkillsSection = generateHardSkillsSection(manfredJsonContent, settings);

Expand All @@ -38,6 +40,7 @@ export const exportManfredJSonToCVMonochromeForceHTML = (
${headerElementEnd}
${mainElementStart}
${aboutMeSection}
${experienceSection}
${softSkillsSection}
${relevantsLinksSection}
${aboutMeSection}
Expand Down
Loading