feat: fill pages

This commit is contained in:
2025-11-11 19:12:21 +01:00
parent 3f828a754b
commit 9f1d4db0de
47 changed files with 2050 additions and 1274 deletions

View File

@@ -2,9 +2,7 @@
<UApp :locale="locales[locale]">
<AppNavbar />
<UMain>
<NuxtLayout>
<NuxtPage />
</NuxtLayout>
<NuxtPage />
</UMain>
<AppFooter />
</UApp>

View File

@@ -1,4 +1,3 @@
@import 'tailwindcss';
@import '@nuxt/ui';
@import './colors.css';
@import './ui/index.css';

View File

@@ -1,4 +1,5 @@
@layer base {
@import 'tailwindcss';
@theme {
--color-text-50: var(--text-50);
--color-text: var(--text);
--color-text-100: var(--text-100);
@@ -76,9 +77,9 @@
--text-weight-bold: 700;
--font-sans:
Noto Sans, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
Noto Sans, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji';
--font-title:
Wittgenstein, ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji",
"Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";
Wittgenstein, ui-sans-serif, system-ui, sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol',
'Noto Color Emoji';
}

View File

@@ -1,15 +1,15 @@
:root {
--ui-primary: var(--color-primary);
--ui-secondary: var(--color-secondary);
--ui-success: var(--color-accent);
--ui-primary: var(--primary);
--ui-secondary: var(--secondary);
--ui-success: var(--accent);
--ui-info: var(--ui-color-info-500);
--ui-warning: var(--ui-color-warning-500);
--ui-error: var(--ui-color-error-500);
}
.dark {
--ui-primary: var(--color-primary-dark);
--ui-secondary: var(--color-secondary-dark);
--ui-success: var(--color-accent);
--ui-primary: var(--primary);
--ui-secondary: var(--secondary);
--ui-success: var(--accent);
--ui-info: var(--ui-color-info-400);
--ui-warning: var(--ui-color-warning-400);
--ui-error: var(--ui-color-error-400);

View File

@@ -1,4 +1,4 @@
@import "./colors.css";
@import "./text.css";
@import "./background.css";
@import "./border.css";
@import './colors.css';
@import './text.css';
@import './background.css';
@import './border.css';

View File

@@ -1,15 +1,15 @@
:root {
--ui-text-dimmed: var(--text-400);
--ui-text-muted: var(--text-500);
--ui-text-dimmed: var(--text-800);
--ui-text-muted: var(--text-700);
--ui-text-toned: var(--text-600);
--ui-text: var(--text);
--ui-text-highlighted: var(--text-900);
--ui-text-inverted: var(--text-50);
}
.dark {
--ui-text-dimmed: var(--text-500);
--ui-text-muted: var(--text-400);
--ui-text-toned: var(--text-300);
--ui-text-dimmed: var(--text-800);
--ui-text-muted: var(--text-700);
--ui-text-toned: var(--text-600);
--ui-text: var(--text);
--ui-text-highlighted: var(--text);
--ui-text-inverted: var(--text-50);

View File

@@ -1,12 +1,14 @@
<template>
<UFooter>
<UFooter class="bg-background-200">
<template #left>
<p class="text-300 txt-sm">
Copyright &copy; {{ new Date().getFullYear() }}
</p>
<div class="flex flex-col gap-2">
<p class="text-text-800 text-sm">Copyright &copy; {{ new Date().getFullYear() }}</p>
<p class="text-text-800 text-sm">{{ $t('footer.versions.frontend') }}: {{ version }}</p>
<p class="text-text-800 text-sm">{{ $t('footer.versions.backend') }}: {{ meta?.version }}</p>
</div>
</template>
<UNavigationMenu :items="items" variant="link" />
<UNavigationMenu :items="items" variant="link" :orientation="orientation" />
<template #right>
<UButton
@@ -23,11 +25,24 @@
<script setup lang="ts">
import type { NavigationMenuItem } from '@nuxt/ui';
import { version } from '../../package.json';
const { isMobile } = useDevice();
const orientation = computed(() => (isMobile ? 'vertical' : 'horizontal'));
const { getMeta } = useBackend();
const meta = await getMeta();
const items = computed<NavigationMenuItem[]>(() => [
{
label: $t('footer.links.source'),
to: 'https://labs.phundrak.com/phundrak/phundrak.com',
},
{
label: $t('footer.links.nuxt'),
to: 'https://nuxt.com/',
},
{
label: $t('footer.links.rust'),
to: 'https://rust-lang.org/',
},
]);
</script>

View File

@@ -0,0 +1,13 @@
<template>
<div v-if="tools" class="flex flex-row gap-1 flex-wrap">
<UBadge v-for="tool in tools" :key="tool" size="md" variant="solid">
{{ tool }}
</UBadge>
</div>
</template>
<script setup lang="ts">
const { tools } = defineProps<{
tools: string[];
}>();
</script>

View File

@@ -0,0 +1,14 @@
<template>
<UPageCard class="bg-background-100 my-10">
<p class="text-xl">
<slot />
</p>
<UiBadgeList :tools="tools" />
</UPageCard>
</template>
<script setup lang="ts">
const { tools } = defineProps<{
tools: string[];
}>();
</script>

View File

@@ -0,0 +1,35 @@
<template>
<UPageCard class="bg-background-100 my-10">
<p class="text-xl">
{{ $t('pages.vocal-synthesis.projects') }}
</p>
<div class="flex flex-col max-w gap-10">
<div v-for="project in data?.projects" :key="project.title" class="flex flex-row max-w gap-5">
<div>
<div
class="bg-primary text-text-50 dark:bg-primary p-1 rounded-md min-w-13 w-13 h-13 min-h-13 flex justify-center my-2"
>
<UIcon :name="project.icon" class="size-11" />
</div>
</div>
<div class="flex flex-col">
<div class="flex flex-row gap-2 items-baseline">
<ULink :to="project.link" class="text-2xl">
{{ project.title }}
</ULink>
<UIcon v-if="external(project.link)" name="mdi:link" class="size-5" />
</div>
<div>
{{ project.description }}
</div>
</div>
</div>
</div>
</UPageCard>
</template>
<script setup lang="ts">
// Inject data provided by the page to avoid hydration issues with MDC components
const data = inject('pageData');
const external = (url: string) => url.startsWith('http');
</script>

View File

@@ -0,0 +1,8 @@
<template>
<UiBadgeListCard v-if="data" :tools="data.tools">{{ $t('pages.vocal-synthesis.tools') }}</UiBadgeListCard>
</template>
<script setup lang="ts">
// Inject data provided by the page to avoid hydration issues with MDC components
const data = inject('pageData');
</script>

View File

@@ -1,10 +1,6 @@
<template>
<UDropdownMenu
:key="locale"
:items="availableLocales"
:content="{ align: 'start' }"
>
<UButton color="neutral" variant="outline" icon="material-symbols:globe" />
<UDropdownMenu :key="locale" :items="availableLocales" :content="{ align: 'start' }">
<UButton color="neutral" variant="outline" icon="material-symbols:globe" :aria-label="$t('menu.language')" />
</UDropdownMenu>
</template>

View File

@@ -1,10 +1,6 @@
<template>
<UDropdownMenu
:key="colorMode.preference"
:items="themes"
:content="{ align: 'start' }"
>
<UButton color="neutral" variant="outline" :icon="icons[currentColor]" />
<UDropdownMenu :key="colorMode.preference" :items="themes" :content="{ align: 'start' }">
<UButton color="neutral" variant="outline" :icon="icons[currentColor]" :aria-label="$t('menu.theme')" />
</UDropdownMenu>
</template>

View File

@@ -0,0 +1,32 @@
import type { FetchOptions } from 'ofetch';
export const useApi = () => {
const config = useRuntimeConfig();
const apiFetch = $fetch.create({
baseURL: config.public.apiBase,
});
const get = <T>(url: string, options?: FetchOptions) => apiFetch<T>(url, { method: 'GET', ...options });
const post = <ResultT, PayloadT = Record<string, string | number | boolean>>(
url: string,
body?: PayloadT,
options?: FetchOptions,
) => apiFetch<ResultT>(url, { method: 'POST', body, ...options });
const put = <ResultT, PayloadT = Record<string, string | number | boolean>>(
url: string,
body?: PayloadT,
options?: FetchOptions,
) => apiFetch<ResultT>(url, { method: 'PUT', body, ...options });
const patch = <ResultT, PayloadT = Record<string, string | number | boolean>>(
url: string,
body?: PayloadT,
options?: FetchOptions,
) => apiFetch<ResultT>(url, { method: 'PATCH', body, ...options });
const del = <T>(url: string, options?: FetchOptions) => apiFetch<T>(url, { method: 'DELETE', ...options });
return { get, post, put, patch, del };
};

View File

@@ -0,0 +1,8 @@
export const useBackend = () => {
const api = useApi();
const getMeta = () => api.get<MetaResponse>('/meta');
const postContact = (contact: ContactRequest) => api.post<ContactRequest, ContactResponse>('/contact', contact);
return { getMeta, postContact };
};

View File

@@ -0,0 +1,65 @@
import { withLeadingSlash } from 'ufo';
import type { Collections } from '@nuxt/content';
export const useDataJson = (prefix: string) => {
const route = useRoute();
const { locale } = useI18n();
const slug = computed(() => {
// Use route.params.slug for dynamic routes, or route.path for static routes
const slugValue = route.params.slug || route.path;
return withLeadingSlash(String(slugValue));
});
const key = computed(() => prefix + '-' + slug.value);
const getData = async <T>(
collectionPrefix: string,
options: {
useFilter?: boolean;
fallbackToEnglish?: boolean;
extractMeta?: boolean;
} = {},
) => {
const { useFilter = false, fallbackToEnglish = false, extractMeta = false } = options;
const { data } = await useAsyncData(
key.value,
async () => {
const collection = (collectionPrefix + locale.value) as keyof Collections;
let content;
if (useFilter) {
// For data collections, use .all() and filter
const allData = await queryCollection(collection).all();
content = allData.filter((source) => source.meta.path == slug.value)[0];
} else {
// For page collections, use .path().first()
content = await queryCollection(collection).path(slug.value).first();
if (!content && fallbackToEnglish && locale.value !== 'en') {
content = await queryCollection('content_en').path(slug.value).first();
}
}
return extractMeta ? content?.meta : content;
},
{
watch: [locale], // Automatically refresh when locale changes
},
);
return data as Ref<T | null>;
};
const getJsonData = async (collectionPrefix: string = 'content_data_') => {
return getData(collectionPrefix, { useFilter: true, extractMeta: true });
};
const getPageContent = async (collectionPrefix: string = 'content_', fallbackToEnglish: boolean = true) => {
return getData(collectionPrefix, { fallbackToEnglish });
};
const getCachedData = () => {
const { data } = useNuxtData(key.value);
return data;
};
return { getJsonData, getPageContent, getCachedData };
};

View File

@@ -0,0 +1,27 @@
export interface MetaImageOptions {
url: string;
alt: string;
}
export interface MetaOptions {
title: string;
description: string;
image?: MetaImageOptions;
}
export const useMeta = (options: MetaOptions) => {
const titleSuffix = ' Lucien Cartier-Tilet';
useSeoMeta({
title: () => options.title + titleSuffix,
ogTitle: () => options.title + titleSuffix,
twitterTitle: () => options.title + titleSuffix,
description: () => options.description,
ogDescription: () => options.description,
twitterDescription: () => options.description,
twitterCard: options.image ? 'summary_large_image' : 'summary',
ogImage: () => options.image?.url,
ogImageAlt: () => options.image?.alt,
twitterImage: () => options.image?.url,
twitterImageAlt: () => options.image?.alt,
});
};

View File

@@ -0,0 +1,5 @@
<template>
<div class="text-center prose prose-lg mx-auto max-w-prose">
<slot />
</div>
</template>

View File

@@ -1,5 +1,5 @@
<template>
<div>
<div class="min-h-screen mx-auto px-4 py-8 max-w-6xl">
<slot />
</div>
</template>

View File

@@ -0,0 +1,22 @@
<template>
<NuxtLayout v-if="page" :name="page.meta?.layout ?? 'default'">
<ContentRenderer :value="page" />
</NuxtLayout>
<div v-else>
<h1>Page not found</h1>
<p>This page doesn&apos;t exist in {{ locale }} language.</p>
</div>
</template>
<script setup lang="ts">
const { getPageContent } = useDataJson('page');
const page = await getPageContent();
// Pre-fetch JSON data for MDC components to avoid hydration issues
const { getJsonData } = useDataJson('page-data');
const pageData = await getJsonData();
// Provide data to child MDC components
provide('pageData', pageData);
useMeta({ title: page.value?.title, description: page.value?.description });
</script>

View File

@@ -1,5 +0,0 @@
<template>
<div>
{{ $t('pages.contact.name') }}
</div>
</template>

View File

@@ -1,3 +0,0 @@
<template>
<h1>{{ $t('website.name') }}</h1>
</template>

View File

@@ -1,5 +0,0 @@
<template>
<div>
{{ $t('pages.languages.name') }}
</div>
</template>

View File

@@ -1,5 +1,47 @@
<template>
<div>
{{ $t('pages.resume.name') }}
</div>
<NuxtLayout name="default">
<h1 class="text-4xl text-highlighted font-bold mb-8">
{{ $t('pages.resume.name') }}
</h1>
<UPageCard class="bg-background-100 my-10">
<p>
{{ $t('pages.resume.experience') }}
</p>
<UTimeline v-model="valueExp" reverse :items="resumeContent?.experience" class="w-full">
<template #description="{ item }">
<div class="flex flex-col gap-2">
<p>
{{ item.description }}
</p>
<UiBadgeList :tools="item.tools" />
</div>
</template>
</UTimeline>
</UPageCard>
<UPageCard class="bg-background-100 my-10">
<p>
{{ $t('pages.resume.education') }}
</p>
<UTimeline v-model="valueEd" reverse :items="resumeContent?.education" class="w-full" />
</UPageCard>
<UiBadgeListCard :tools="resumeContent?.otherTools">{{ $t('pages.resume.tools') }}</UiBadgeListCard>
<UiBadgeListCard :tools="resumeContent?.devops">{{ $t('pages.resume.devops') }}</UiBadgeListCard>
<UiBadgeListCard :tools="resumeContent?.os">{{ $t('pages.resume.os') }}</UiBadgeListCard>
<UiBadgeListCard :tools="resumeContent?.programmingLanguages">{{
$t('pages.resume.programmingLanguages')
}}</UiBadgeListCard>
<UiBadgeListCard :tools="resumeContent?.frameworks">{{ $t('pages.resume.frameworks') }}</UiBadgeListCard>
</NuxtLayout>
</template>
<script setup lang="ts">
useMeta({
title: $t('pages.resume.name'),
description: $t('pages.resume.description'),
});
const { getJsonData } = useDataJson('resume');
const resumeContent = await getJsonData();
const arrLength = (array?: T[]) => (array ? array.length - 1 : 0);
const valueExp = computed(() => arrLength(resumeContent.value?.experience));
const valueEd = computed(() => arrLength(resumeContent.value?.education));
</script>

View File

@@ -1,5 +0,0 @@
<template>
<div>
{{ $t('pages.vocal-synthesis.name') }}
</div>
</template>

View File

@@ -0,0 +1,11 @@
export interface ContactRequest {
name: string;
email: string;
message: string;
website?: string | null;
}
export interface ContactResponse {
success: boolean;
message: string;
}

View File

@@ -0,0 +1,4 @@
export interface ApiError {
message: string;
success: boolean;
}

View File

@@ -0,0 +1,4 @@
export interface MetaResponse {
version: string;
name: string;
}

View File

@@ -1,3 +1,3 @@
export interface Dictionary<K, T> {
[key: K]: T
[key: K]: T;
}

View File

@@ -0,0 +1,13 @@
export interface ResumeExperience extends TimelineItem {
tools: string[];
}
export interface ResumeContent {
experience: ResumeExperience[];
education: TimelineItem[];
otherTools: string[];
devops: string[];
os: string[];
programmingLanguages: string[];
frameworks: string[];
}

View File