Skip to content

Commit 4e0e1a4

Browse files
committed
fix: Update website to read directly from yaml file
1 parent 4a0723c commit 4e0e1a4

File tree

8 files changed

+396
-325
lines changed

8 files changed

+396
-325
lines changed

src/lib/components/Experience.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts">
2-
import type { Experience } from '@prisma/client';
2+
import type { Experience } from '$lib/types';
33
import SimpleIcon from '$lib/components/SimpleIcon.svelte';
44
55
// Change visble section

src/lib/components/Projects.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script lang="ts">
2-
import type { Project } from '@prisma/client';
2+
import type { Project } from '$lib/types';
3+
34
// Import project images
45
import acbiggan from '$lib/images/projects/acbigan.png?enhanced';
56
import aisdc from '$lib/images/projects/aisdc.jpg?enhanced';

src/lib/components/Skills.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<script lang="ts">
22
import { onDestroy, onMount } from 'svelte';
3-
import type { Skill } from '@prisma/client';
43
import { browser } from '$app/environment';
54
import { theme } from '$lib/stores';
5+
import { type Skill } from '$lib/types';
66
77
// Import skill icons
88
import * as icons from 'simple-icons';

src/lib/profile.yaml

Lines changed: 296 additions & 296 deletions
Large diffs are not rendered by default.

src/lib/types.ts

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
export enum ProfileVisibility {
2+
PUBLIC = 'PUBLIC',
3+
PRIVATE = 'PRIVATE'
4+
}
5+
6+
export interface Profile {
7+
id: string;
8+
firstName: string;
9+
lastName: string;
10+
nickName?: string;
11+
ign?: string;
12+
descriptions: string[];
13+
email: string;
14+
mobile?: string;
15+
website?: string;
16+
github?: string;
17+
linkedin?: string;
18+
twitter?: string;
19+
myanimelist?: string;
20+
visibility: ProfileVisibility;
21+
}
22+
23+
export interface Skill {
24+
category: string;
25+
name: string;
26+
}
27+
28+
export interface Experience {
29+
title: string;
30+
org: string;
31+
isJob: boolean;
32+
startDate: Date;
33+
endDate?: Date;
34+
descriptions: string[];
35+
shortDescription?: string;
36+
githubLink?: string;
37+
externalLinks: string[];
38+
}
39+
40+
export interface Project {
41+
category: string;
42+
title: string;
43+
year: string;
44+
shortDescription: string;
45+
longDescriptions: string[];
46+
img: string;
47+
link?: string;
48+
tags: string[];
49+
}
50+
51+
export interface Education {
52+
id: string;
53+
qualification: string;
54+
school: string;
55+
startDate: Date;
56+
endDate: Date;
57+
descriptions: string[];
58+
}

src/routes/+layout.server.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

src/routes/+layout.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
// Static site generation (SSG)
2+
// since there's no dynamic data here, we can prerender
3+
// it so that it gets served as a static asset in production
4+
export const prerender = true;

src/routes/+page.svelte

Lines changed: 34 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script lang="ts">
2-
// Import layout data
3-
import type { LayoutData } from './$types';
2+
// User profile from file
3+
import data from '$lib/profile.yaml';
44
55
// Import Components
66
import Hero from '$lib/components/Hero.svelte';
@@ -9,8 +9,35 @@
99
import Skills from '$lib/components/Skills.svelte';
1010
import Projects from '$lib/components/Projects.svelte';
1111
12-
export let data: LayoutData;
13-
$: ({ profile, skills, experiences, projects } = data);
12+
const { profile, skills, experience, projects } = data;
13+
14+
const experienceArr = (experience as any[]).map((exp) => {
15+
return {
16+
...exp,
17+
startDate: exp.startDate ? new Date(exp.startDate) : undefined,
18+
endDate: exp.endDate ? new Date(exp.endDate) : null
19+
};
20+
});
21+
22+
const skillsArr = Object.entries(skills).flatMap(([category, skills]) => {
23+
return (skills as string[]).map((skill) => ({
24+
category,
25+
name: skill as string
26+
}));
27+
});
28+
29+
const projectsArr = Object.entries(projects).flatMap(([category, projects]) => {
30+
return (projects as any[]).map((project) => ({
31+
category,
32+
title: project.title,
33+
year: project.year,
34+
shortDescription: project.shortDescription,
35+
longDescriptions: project.longDescriptions || [],
36+
img: project.img,
37+
link: project.link,
38+
tags: project.tags || []
39+
}));
40+
});
1441
</script>
1542

1643
<svelte:head>
@@ -33,8 +60,8 @@
3360

3461
<Profile descriptions={profile.descriptions} />
3562

36-
<Skills {skills} />
63+
<Skills skills={skillsArr} />
3764

38-
<Experience {experiences} />
65+
<Experience experiences={experienceArr} />
3966

40-
<Projects {projects} />
67+
<Projects projects={projectsArr} />

0 commit comments

Comments
 (0)