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

HTML new functionallity #175

Merged
merged 29 commits into from
Sep 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
a4114da
html button
brauliodiez Aug 21, 2023
f125485
wip
brauliodiez Aug 21, 2023
4f4d606
wip
brauliodiez Aug 21, 2023
8f600ce
add profile section
manudous Aug 21, 2023
f1b8eb8
aside
brauliodiez Aug 21, 2023
254d358
wip
brauliodiez Aug 21, 2023
adcffe7
Merge branch 'feature/develop' into feature/#153-entry-point-html
juanpms2 Aug 22, 2023
53fd348
updated generate html template
juanpms2 Aug 22, 2023
81775bc
created html parts
juanpms2 Aug 22, 2023
f96e12e
added header section
juanpms2 Aug 22, 2023
9322747
added aside and relevant links section
juanpms2 Aug 22, 2023
6e98515
added main element and refactor
juanpms2 Aug 22, 2023
ff26930
refactor
juanpms2 Aug 22, 2023
c166e58
Merge pull request #162 from Lemoncode/feature/#153-entry-point-html
brauliodiez Aug 22, 2023
135649f
feature #164 add language section
MTeresaMB Aug 25, 2023
ad2bb0c
Merge pull request #168 from MTeresaMB/feature/#164-add-language-section
brauliodiez Aug 25, 2023
6b00663
add experience section
MTeresaMB Aug 29, 2023
d436796
Merge pull request #169 from MTeresaMB/feature/#166-add-experience-se…
brauliodiez Aug 31, 2023
8121197
update
AbelDeTena Sep 1, 2023
4d2ec33
Hide studies section when array is empty
AbelDeTena Sep 1, 2023
9e0b638
Build dynamically studies section
AbelDeTena Sep 1, 2023
9f6c5e9
manfred2html hard and soft skills sections
JuanBerrocal Sep 3, 2023
9e6a671
Merge branch 'epic/html-export' into feature/#165-add-manfred2HTML-ha…
juanpms2 Sep 5, 2023
a9ceb24
Merge pull request #170 from JuanBerrocal/feature/#165-add-manfred2HT…
juanpms2 Sep 5, 2023
a7bcf01
removed level in hard and soft skills sections
juanpms2 Sep 5, 2023
504f5e1
Fix: Only display the finish date if a valid date is available. Revie…
AbelDeTena Sep 11, 2023
74cee55
Merge pull request #173 from AbelDeTena/feature/#167-studies-section
juanpms2 Sep 11, 2023
123eb80
added new language
juanpms2 Sep 11, 2023
c661ce1
Merge pull request #174 from Lemoncode/epic/html-export
brauliodiez Sep 11, 2023
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 @@ -6,10 +6,11 @@ import * as classes from './template-export.styles';
interface Props {
onExportToWord: (text: string) => void;
onExportToMarkdown: (text: string) => void;
onExportToHTML: (text: string) => void;
}

export const TemplateExport: React.FC<Props> = props => {
const { onExportToWord, onExportToMarkdown } = props;
const { onExportToWord, onExportToMarkdown, onExportToHTML } = props;
const { userChoice, setUserChoice } = useUserChoiceContext();
const [text, setText] = React.useState<string>('');

Expand All @@ -27,6 +28,11 @@ export const TemplateExport: React.FC<Props> = props => {
onExportToMarkdown(text);
};

const handleExportToHTML = () => {
setUserChoice({ ...userChoice, manfredJsonContent: text });
onExportToHTML(text);
};

return (
<div className={classes.root}>
<Navbar />
Expand Down Expand Up @@ -55,6 +61,14 @@ export const TemplateExport: React.FC<Props> = props => {
>
Export To Markdown
</Button>
<Button
disabled={text ? false : true}
onClick={handleExportToHTML}
className={classes.buttonClass}
showIcon={false}
>
Export To HTML
</Button>
</div>
</div>
<Footer />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import { exportManfredJSonToWordAndDownload, parseStringToManfredJSon } from '@lemoncode/manfred2word';
import { exportManfredJSonToMarkdown } from '@lemoncode/manfred2md';
import { exportManfredJSonToHTML } from '@lemoncode/manfred2html';
import { DEFAULT_EXPORT_FILENAME } from '@/core';
import { download } from '@/common';
import { TemplateExport } from './template-export.component';
Expand Down Expand Up @@ -34,5 +35,24 @@ export const TemplateExportContainer: React.FC = () => {
}
};

return <TemplateExport onExportToWord={onExportJsonToWord} onExportToMarkdown={onExportJsonToMarkdown} />;
const onExportJsonToHTML = async (text: string) => {
try {
const manfredJsonContent = parseManfredJson(text);
const content = exportManfredJSonToHTML(manfredJsonContent);
const blob = new Blob([content], { type: 'text/html' });

await download(blob, 'manfred.html');
} catch (error) {
console.error(error);
alert('Hay un error, no está utilizando el formato correcto');
}
};

return (
<TemplateExport
onExportToWord={onExportJsonToWord}
onExportToMarkdown={onExportJsonToMarkdown}
onExportToHTML={onExportJsonToHTML}
/>
);
};
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { LanguageType, LevelLanguageType } from './language-section.vm';

export const languageList: LanguageType[] = [
{ iso: 'de', name: 'Alemán' },
{ iso: 'es', name: 'Español' },
{ iso: 'it', name: 'Italiano' },
{ iso: 'en', name: 'Inglés' },
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@

<%_ if (profile && profile !== 'undefined' ) { -%>
<h1><%= profile?.name %> <br /><span><%= profile?.surnames %></span></h1>
<hr />
<p class="job-title"><%= profile?.title %></p>
<p><%= profile?.description %></p>
<%_ } -%>


Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { ManfredAwesomicCV } from '@/model';
import { ProfileSectionVm, mapFromMacCvToProfileSectionVm } from '@lemoncode/manfred-common/profile-section';
import aboutMe from './about-me-section.ejs?raw';
import ejs from 'ejs';

export const generateAboutMeSection = (cv: ManfredAwesomicCV): string => {
const profileSectionVm = mapFromMacCvToProfileSectionVm(cv);

return generateAboutMeSectionInner(profileSectionVm);
};

const generateAboutMeSectionInner = (profileSectionVm: ProfileSectionVm): string => {
const rootObject = {
profile: profileSectionVm,
};

return ejs.render(aboutMe, rootObject);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './about-me-section.part';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
</aside>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import ejs from 'ejs';
import asideElementEndTemplate from './aside-element-end.ejs?raw';

export const generateAsideElementEnd = (): string => ejs.render(asideElementEndTemplate);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './aside-element-end.part';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<aside>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import ejs from 'ejs';
import asideElementStartTemplate from './aside-element-start.ejs?raw';

export const generateAsideElementStart = (): string => ejs.render(asideElementStartTemplate);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './aside-element-start.part';
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<%_ if(experienceCollection && experienceCollection.length !== 0){ -%>
<section class="main__section">
<div class="main__section__header">
<h2>Experiencia / carrera</h2>
<hr class="secondary-divider" />
</div>
<%_ for(const experience of experienceCollection){ -%>
<div class="main__section__item">
<div class="date date-desktop">
<p>Inicio: <b><%- experience.roles[0].startDate %></b></p>
<%_ if(experience.roles[0].finishDate || experience.roles[0].finishDate === 'Actualidad') { -%>
<p>Fin: <b><%- experience.roles[0].finishDate %></b></p>
<%_ } -%>
</div>
<div class="line-icon">
<div class="circle"></div>
<hr class="line" />
</div>
<div class="section__content">
<div class="section__content__header">
<h3><%- experience.name %></h3>
<%_ if(experience.type) { -%>
<h4><%- experience.description %></h4>
<%_ } -%>
</div>
<div class="date date-mobile">
<p>Inicio: <b><%- experience.roles[0].startDate %></b></p>
<%_ if(experience.roles[0].finishDate || experience.roles[0].finishDate === 'Actualidad') { -%>
<p>Fin: <b><%- experience.roles[0].finishDate %></b></p>
<%_ } -%>
</div>
<div class="data">
<%_ if(experience.type) { -%>
<p>Tipo de organización: <b><%- experience.type %></b></p>
<%_ } -%>
<p>Roles dentro de la empresa: <b><%- experience.roles[0].name %></b></p>
<%_ if(experience.roles[0].challenges && experience.roles[0].challenges.length !== 0) { -%>
<p>Retos:</p>
<ul>
<%_ for(const challenge of experience.roles[0].challenges){ -%>
<li><%- challenge.description %></li>
<%_ }-%>
</ul>
<%_ }-%>
</div>
</div>
</div>
<%_ }-%>
</section>
<%_ }-%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import ejs from 'ejs';
import { ExperienceVm, mapFromMacCvToExperienceSectionVm } from '@lemoncode/manfred-common/experience-section';
import { ManfredAwesomicCV } from '@/model';
import experienceTemplate from './experience-section.ejs?raw';

export const generateExperiencesSection = (cv: ManfredAwesomicCV): string => {
const experienceSectionVm = mapFromMacCvToExperienceSectionVm(cv);

return generateExperienceSectionInner(experienceSectionVm);
};

const generateExperienceSectionInner = (experienceSectionVm: ExperienceVm[]): string => {
const rootObject = {
experienceCollection: experienceSectionVm,
};

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,30 @@
<%_ if (hardSkillsCollection && hardSkillsCollection.length !== 0) { -%>
<div class="aside__section">
<div class="aside__section__header">
<svg
xmlns="http://www.w3.org/2000/svg"
width="21"
height="33"
viewBox="0 0 21 33"
fill="none"
class="svg-stroke"
>
<path
d="M19.6061 22.939C18.4811 24.2172 17.0964 25.2407 15.5444 25.9412C13.9924 26.6417 12.3088 27.003 10.6061 27.001M10.6061 27.001C8.90332 27.003 7.21973 26.6417 5.66772 25.9412C4.11571 25.2407 2.73101 24.2172 1.60608 22.939M10.6061 27.001V31.501M7.60608 31.501H13.6061M10.6061 1.50098C13.9198 1.50098 16.6061 4.18727 16.6061 7.50098V15.001C16.6061 18.3147 13.9198 21.001 10.6061 21.001C7.29237 21.001 4.60608 18.3147 4.60608 15.001V7.50098C4.60608 4.18727 7.29237 1.50098 10.6061 1.50098Z"
stroke-width="2.5"
stroke-linecap="round"
stroke-linejoin="round"
/>
</svg>
<div>
<h3>HARD SKILLS</h3>
<hr class="secondary-divider" />
</div>
</div>
<ul class="aside__section__list-items">
<%_ for (const item of hardSkillsCollection) { -%>
<li><%- item.skill.name %></li>
<%_ } -%>
</ul>
</div>
<%_ } -%>
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import ejs from 'ejs';
import { ManfredAwesomicCV } from '@/model';
import { HardSkillVM, mapFromCvToHardSkillVm } from '@lemoncode/manfred-common/hard-skill-section';
import hardSkillsSection from './hard-skills-section.ejs?raw';

export const generateHardSkillsSection = (cv: ManfredAwesomicCV): string => {
const hardSkillsSectionVm = mapFromCvToHardSkillVm(cv);
return generateHardSkillsSectionInner(hardSkillsSectionVm);
};

const generateHardSkillsSectionInner = (hardSkillsSectionVm: HardSkillVM[]): string => {
const rootObject = {
hardSkillsCollection: hardSkillsSectionVm,
};
return ejs.render(hardSkillsSection, rootObject);
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './hard-skills-section.part';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
</header>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import ejs from 'ejs';
import headerElementEndTemplate from './header-element-end.ejs?raw';

export const generateHeaderElementEnd = (): string => ejs.render(headerElementEndTemplate);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './header-element-end.part';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<header>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import ejs from 'ejs';
import headerElementStartTemplate from './header-element-start.ejs?raw';

export const generateHeaderElementStart = (): string => ejs.render(headerElementStartTemplate);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './header-element-start.part';
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
</div>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import ejs from 'ejs';
import htmlDocumentEndTemplate from './html-document-end.ejs?raw';

export const generateHtmlDocumentEnd = (): string => ejs.render(htmlDocumentEndTemplate);
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './html-document-end.part';
Loading
Loading