chore: code cleanup

This commit is contained in:
2026-02-23 20:03:39 +00:00
parent 0087f6fb28
commit b9a92d41b4
4 changed files with 52 additions and 42 deletions

View File

Before

Width:  |  Height:  |  Size: 112 KiB

After

Width:  |  Height:  |  Size: 112 KiB

View File

@@ -116,6 +116,10 @@ const workExperienceData : WorkExperienceArgs[] = [
} }
]; ];
export const workExperienceIntro =
"Growing up in Warsaw, I moved to London at 18. Since then, my career and education has taken me through " +
"Edinburgh and Manchester, shaping my journey across the UK.";
export const workExperienceParagraph = export const workExperienceParagraph =
"Since the age of 16, I have actively engaged in various professional roles across multiple industries, " + "Since the age of 16, I have actively engaged in various professional roles across multiple industries, " +
"including Artificial Intelligence, Software, Education, and Hospitality. My journey began in the hospitality " + "including Artificial Intelligence, Software, Education, and Hospitality. My journey began in the hospitality " +

View File

@@ -1,6 +1,7 @@
import styles from "../styling/experience.module.scss"; import styles from "../styling/experience.module.scss";
import { getCityGroups } from "./Experience/helpers"; import { getCityGroups } from "./Experience/helpers";
import CityGroup from "./Experience/CityGroup"; import CityGroup from "./Experience/CityGroup";
import { workExperienceIntro } from "@/src/portfolio/data/workExperienceData";
const Experience = (): JSX.Element => { const Experience = (): JSX.Element => {
const cityGroups = getCityGroups(); const cityGroups = getCityGroups();
@@ -8,10 +9,7 @@ const Experience = (): JSX.Element => {
return ( return (
<div className={styles.section} id={"experience"}> <div className={styles.section} id={"experience"}>
<h2>Work Experience</h2> <h2>Work Experience</h2>
<p className={styles.intro}> <p className={styles.intro}>{workExperienceIntro}</p>
Growing up in Warsaw, I moved to London at 18. Since then, my career and education has taken me through
Edinburgh and Manchester, shaping my journey across the UK.
</p>
<div className={styles.cityGroupsContainer}> <div className={styles.cityGroupsContainer}>
{cityGroups.map((group, index) => ( {cityGroups.map((group, index) => (
<CityGroup key={index} group={group} /> <CityGroup key={index} group={group} />

View File

@@ -9,21 +9,24 @@ export interface ICityGroup {
hiddenCount: number; hiddenCount: number;
imageUrl: string; imageUrl: string;
offsetDirection: "left" | "right"; offsetDirection: "left" | "right";
description?: string;
} }
const CITY_IMAGES: Record<string, string> = { const CITY_IMAGES: Record<string, string> = {
"Manchester": "/portfolio/cities/Manchester.png", "Manchester": "/portfolio/cities/Manchester.png",
"Edinburgh": "/portfolio/cities/Edinburgh.png", "Edinburgh": "/portfolio/cities/Edinburgh.png",
"London": "/portfolio/cities/London.png", "Greater London": "/portfolio/cities/Greater London.png",
"Warsaw": "/portfolio/cities/Warsaw.png" "Warsaw": "/portfolio/cities/Warsaw.png"
}; };
const CITY_ALIASES: Record<string, string> = {
"London": "Greater London",
"Upminster": "Greater London"
};
const createCityGroup = ( const createCityGroup = (
city: string, city: string,
jobs: WorkExperienceArgs[], jobs: WorkExperienceArgs[],
offset: "left" | "right", offset: "left" | "right"
description?: string
): ICityGroup => { ): ICityGroup => {
const importantJobs = jobs.filter(job => job.isImportant); const importantJobs = jobs.filter(job => job.isImportant);
const nonImportantJobs = jobs.filter(job => !job.isImportant); const nonImportantJobs = jobs.filter(job => !job.isImportant);
@@ -39,41 +42,46 @@ const createCityGroup = (
hasMore: remainingNonImportant.length > 0, hasMore: remainingNonImportant.length > 0,
hiddenCount: remainingNonImportant.length, hiddenCount: remainingNonImportant.length,
imageUrl: CITY_IMAGES[city] || "", imageUrl: CITY_IMAGES[city] || "",
offsetDirection: offset, offsetDirection: offset
description
}; };
}; };
const normalizeCityName = (city: string): string => {
return CITY_ALIASES[city] || city;
};
const parseDate = (dateString: string): Date => {
return new Date(dateString);
};
const getEarliestJobDate = (jobs: WorkExperienceArgs[]): Date => {
return jobs.reduce((earliest, job) => {
const jobDate = parseDate(job.startDate);
return jobDate < earliest ? jobDate : earliest;
}, parseDate(jobs[0].startDate));
};
export const getCityGroups = (): ICityGroup[] => { export const getCityGroups = (): ICityGroup[] => {
const manchesterJobs = workExperienceData.filter(job => job.city === "Manchester"); const cityJobsMap = new Map<string, WorkExperienceArgs[]>();
const edinburghJobs = workExperienceData.filter(job => job.city === "Edinburgh");
const londonJobs = workExperienceData.filter(job => job.city === "London" || job.city === "Upminster");
const warsawJobs = workExperienceData.filter(job => job.city === "Warsaw");
return [ workExperienceData.forEach(job => {
createCityGroup( const normalizedCity = normalizeCityName(job.city);
"Manchester", if (!cityJobsMap.has(normalizedCity)) {
manchesterJobs, cityJobsMap.set(normalizedCity, []);
"right", }
"After finishing my master's degree, I moved to Manchester because I really liked the culture and the city." cityJobsMap.get(normalizedCity)!.push(job);
), });
createCityGroup(
"Edinburgh", const cityOrder = Array.from(cityJobsMap.entries())
edinburghJobs, .map(([city, jobs]) => ({ city, earliestDate: getEarliestJobDate(jobs) }))
"left", .sort((a, b) => b.earliestDate.getTime() - a.earliestDate.getTime())
"I moved to Edinburgh to pursue my Master's in Artificial Intelligence at the University of Edinburgh." .map(entry => entry.city);
),
createCityGroup( const offsetPattern: ("left" | "right")[] = ["right", "left", "right", "left"];
"London",
londonJobs, return cityOrder.map((city, index) => createCityGroup(
"right", city,
"After Warsaw, I moved to London for my bachelor's education at Queen Mary University." cityJobsMap.get(city)!,
), offsetPattern[index % offsetPattern.length]
createCityGroup( ));
"Warsaw",
warsawJobs,
"left",
"Where my journey began - my first job experience in the hospitality industry."
)
];
}; };