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

Generate localized .tex files and cv pdfs using content data and i18n files #4

Merged
merged 17 commits into from
Aug 1, 2024
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
22 changes: 11 additions & 11 deletions .github/workflows/build-and-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,23 @@ jobs:
steps:
- name: Set up Git repository
uses: actions/checkout@v4
- name: Compile LaTeX document (de)
uses: xu-cheng/latex-action@v3
- name: Install dependencies
run: npm install
- name: Generate localized LaTeX templates
run: npm run generate-latex
- name: Upload generated LaTeX templates
uses: actions/upload-artifact@v4
with:
root_file: cv/cv_hendrik_schmitz_de.tex
continue_on_error: "true"
env:
TEXINPUTS: ".:./cv//:"
- name: Compile LaTeX document (en)
name: latex-templates
path: cv/cv_hendrik_schmitz_*.tex
- name: Compile LaTeX documents
uses: xu-cheng/latex-action@v3
with:
root_file: cv/cv_hendrik_schmitz_en.tex
root_file: cv/cv_hendrik_schmitz_*.tex
continue_on_error: "true"
env:
TEXINPUTS: ".:./cv//:"
- name: Upload PDF files
- name: Upload generated PDF files
uses: actions/upload-artifact@v4
with:
name: cvs
Expand All @@ -29,8 +31,6 @@ jobs:
run: |
mkdir -p public
cp -R *.pdf public/
- name: Install dependencies
run: npm install
- name: Build Next.js app
run: npm run build
- name: Deploy to Netlify
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ yarn-error.log*
*.tsbuildinfo
next-env.d.ts

# ignore generated pdf files
# ignore generated latex and pdf files
*.tex
*.pdf
7 changes: 0 additions & 7 deletions app/[locale]/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,8 @@
import type { Metadata } from "next";
import "bootstrap/dist/css/bootstrap.min.css";
import "font-awesome/css/font-awesome.min.css";
import { supportedLocales } from "@/util/i18n";
import "../globals.scss";

// export const metadata: Metadata = {
// title: "Hendrik Schmitz | Portfolio",
// description:
// "Experienced Fullstack Software Engineer with a strong focus on Frontend Development. Explore my portfolio showcasing innovative web solutions and cutting-edge technology expertise.",
// };

//function to generate the routes for all the locales
export async function generateStaticParams() {
return supportedLocales.map((locale) => ({ locale }));
Expand Down
19 changes: 7 additions & 12 deletions app/[locale]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { notFound } from "next/navigation";
import { Metadata } from "next";
import { Locale, Messages } from "@/util/i18n";
import { Locale, getMessages } from "@/util/i18n";
import about from "@/content/about.json";

import About from "@/components/About";
import Banner from "@/components/Banner";
Expand All @@ -18,7 +18,10 @@ export async function generateMetadata({
params: { locale: Locale };
}): Promise<Metadata> {
const messages = await getMessages(params.locale);
return messages.metadata;
return {
...messages.metadata,
title: messages.metadata.title.replace("{name}", about.name)
}
}

export default async function Home({
Expand All @@ -38,17 +41,9 @@ export default async function Home({
<Experience messages={messages} locale={params.locale} />
<Education messages={messages} locale={params.locale} />
<Projects messages={messages} locale={params.locale} />
<Skills messages={messages} />
<Skills messages={messages} locale={params.locale} />
<Contact messages={messages} />
<Footer />
</>
);
}

async function getMessages(locale: string): Promise<Messages> {
try {
return (await import(`../../messages/${locale}.json`)).default;
} catch (error) {
notFound();
}
}
11 changes: 6 additions & 5 deletions components/About.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import Image from "next-export-optimize-images/image";
import experience from "@/content/experience.json";
import about from "@/content/about.json";
import profilePic from "@/cv/profile_picture.jpg";
import styles from "./About.module.scss";
import { formatDate } from "@/util/date-time";
import { Locale, Messages } from "@/util/i18n";
import { Locale, Messages, getMultilingualContent } from "@/util/i18n";

const birthDate = new Date("1998-06-30");
const birthDate = new Date(about.birthday);
const currentDate = new Date();
const difference = currentDate.getTime() - birthDate.getTime();
const ageDate = new Date(difference);
Expand All @@ -26,8 +27,8 @@ export default function About({
"{startDate}",
formatDate(new Date(currentJob.startDate), locale, messages)
)
.replace("{jobTitle}", String(currentJob.title))
.replace("{company}", currentJob.company);
.replace("{jobTitle}", getMultilingualContent(currentJob.title, locale))
.replace("{company}", getMultilingualContent(currentJob.company, locale));

return (
<div id="about" className={styles.about}>
Expand All @@ -38,7 +39,7 @@ export default function About({
<Image
className={styles.profilePicture}
src={profilePic}
alt="Hendrik Schmitz"
alt={about.name}
/>
</div>
<div className="col-md-8">
Expand Down
3 changes: 2 additions & 1 deletion components/Banner.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { Locale, Messages } from "@/util/i18n";
import about from "@/content/about.json";
import styles from "./Banner.module.scss";

export default function Banner({
Expand All @@ -11,7 +12,7 @@ export default function Banner({
return (
<div className={styles.banner}>
<div className={styles.bannerContent}>
<h1>Hendrik Schmitz</h1>
<h1>{about.name}</h1>
<h2>{messages.banner.jobTitle}</h2>
<a
href={`/cv_hendrik_schmitz_${locale}.pdf`}
Expand Down
65 changes: 37 additions & 28 deletions components/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import about from "@/content/about.json";
import styles from "./Footer.module.scss";

const currentYear = new Date().getFullYear();
Expand All @@ -8,7 +9,9 @@ export default function Footer() {
<div className="container">
<div className="row">
<div className={`col-sm-5 ${styles.copyright}`}>
<p>Copyright &copy; {currentYear} Hendrik Schmitz</p>
<p>
Copyright &copy; {currentYear} {about.name}
</p>
</div>
<div className={`col-sm-2 ${styles.top}`}>
<a id="to-top" href="#">
Expand All @@ -17,33 +20,39 @@ export default function Footer() {
</div>
<div className={`col-sm-5 ${styles.social}`}>
<ul>
<li>
<a
href="https://github.com/drik98"
target="_blank"
rel="noopener noreferrer"
>
<i className="fa fa-github" aria-hidden="true"></i>
</a>
</li>
<li>
<a
href="https://www.linkedin.com/in/hendriksmtz"
target="_blank"
rel="noopener noreferrer"
>
<i className="fa fa-linkedin" aria-hidden="true"></i>
</a>
</li>
<li>
<a
href="https://www.xing.com/profile/Hendrik_Schmitz29"
target="_blank"
rel="noopener noreferrer"
>
<i className="fa fa-xing" aria-hidden="true"></i>
</a>
</li>
{about.github ? (
<li>
<a
href={`https://github.com/${about.github}`}
target="_blank"
rel="noopener noreferrer"
>
<i className="fa fa-github" aria-hidden="true"></i>
</a>
</li>
) : null}
{about.linkedIn ? (
<li>
<a
href={`https://www.linkedin.com/in/${about.linkedIn}`}
target="_blank"
rel="noopener noreferrer"
>
<i className="fa fa-linkedin" aria-hidden="true"></i>
</a>
</li>
) : null}
{about.xing ? (
<li>
<a
href={`https://www.xing.com/profile/${about.xing}`}
target="_blank"
rel="noopener noreferrer"
>
<i className="fa fa-xing" aria-hidden="true"></i>
</a>
</li>
) : null}
</ul>
</div>
</div>
Expand Down
33 changes: 22 additions & 11 deletions components/Projects.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,17 @@
}

.project {
position: relative;
max-width: 900px;
margin: 0 auto 30px auto;
overflow: hidden;
background: #fff;
border-radius: 4px;
display: flex;
}

.projectImage {
float: left;
max-width: 300px;
height: 300px;
width: 30%;
min-width: 300px;
aspect-ratio: 1;
overflow: hidden;

img {
Expand All @@ -32,11 +31,11 @@
}

.projectInfo {
position: absolute;
top: 50%;
transform: translateY(-50%);
margin-left: 300px;
padding: 15px;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;

h3 {
font-size: 1.5em;
Expand All @@ -52,15 +51,17 @@
}

a {
padding: 0 0.5rem;
vertical-align: middle;
i {
margin-right: 0.5rem;
vertical-align: middle;
}
}
}

.projectLogos {
display: flex;
flex-wrap: wrap;
justify-content: center;
padding: 10px;
}
Expand All @@ -82,7 +83,17 @@

@media only screen and (max-width: 768px) {
.projectImage {
display: none;
width: 100%;
height: 20vh;
aspect-ratio: unset;

img {
height: unset;
width: 100%;
}
}
.project {
flex-direction: column;
}
.projectInfo {
position: relative;
Expand Down
26 changes: 14 additions & 12 deletions components/Projects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,20 @@ function ProjectItem({
<h3>{translatedTitle}</h3>
<p>{getMultilingualContent(description, locale)}</p>
<Technologies technologies={technologies} messages={messages} />
{projectUrl ? (
<a href={projectUrl} target="_blank" rel="noopener noreferrer">
<i className="fa fa-external-link"></i>
{messages.projects.viewProject}
</a>
) : null}
{sourceCodeUrl ? (
<a href={sourceCodeUrl} target="_blank" rel="noopener noreferrer">
<i className="fa fa-code"></i>
{messages.projects.viewCode}
</a>
) : null}
<span>
{projectUrl ? (
<a href={projectUrl} target="_blank" rel="noopener noreferrer">
<i className="fa fa-external-link"></i>
{messages.projects.viewProject}
</a>
) : null}
{sourceCodeUrl ? (
<a href={sourceCodeUrl} target="_blank" rel="noopener noreferrer">
<i className="fa fa-code"></i>
{messages.projects.viewCode}
</a>
) : null}
</span>
</div>
</div>
);
Expand Down
19 changes: 16 additions & 3 deletions components/Skills.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
import rawSkills from "@/content/skills.json";
import { Messages } from "@/util/i18n";
import categories from "@/content/skill-categories.json";
import { Locale, Messages, getMultilingualContent } from "@/util/i18n";
import styles from "./Skills.module.scss";

const skills = rawSkills.map((skill) => skill.name).sort();
export default function Skills({
messages,
locale,
}: {
messages: Messages;
locale: Locale;
}) {
const displayedSkillCategories = Object.entries(categories)
.filter(([id, category]) => category.displayOnWebpage)
.map(([id]) => id);
const skills = rawSkills
.filter((skill) => displayedSkillCategories.includes(skill.category))
.map((skill) => getMultilingualContent(skill.name, locale))
.sort();

export default function Skills({ messages }: { messages: Messages }) {
return (
<div id="skills" className={styles.skills}>
<h2 className="heading">{messages.header.sections.skills}</h2>
Expand Down
11 changes: 11 additions & 0 deletions content/about.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "Hendrik Schmitz",
"birthday": "1998-06-30",
"phoneNumber": "+49 151 70013949",
"address": "Pontstr. 137, 52062 Aachen",
"website": "smtz.dev",
"linkedIn": "hendriksmtz",
"xing": "Hendrik_Schmitz29",
"github": "drik98",
"mail": "[email protected]"
}
2 changes: 1 addition & 1 deletion content/education.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"image": "/images/experience/wzl.png",
"keyPoints": {
"de": [
"Entwicklung von Java-Webanwendungen für industrielle Anwendungen, mit Schwerpunkt auf Frontend-Entwicklung von Software- Demonstratoren in Industrie 4.0",
"Entwicklung von Java-Webanwendungen für industrielle Anwendungen, mit Schwerpunkt auf Frontend-Entwicklung von Software- Demonstratoren in Industrie 4.0",
"Nutzung von Technologien wie JavaScript, HTML, CSS, Java, PostgreSQL und Hibernate",
"Erfassung von Anforderungen und Konzeption von Anwendungen",
"Betreuung von Auszubildenden"
Expand Down
Loading