feat: add portfolio, blog, and contact features, update theme styling, refine imports, and clean up unused code (#2)

Reviewed-on: #2
This commit is contained in:
2025-03-13 19:50:43 +00:00
parent 3d892a44a8
commit eafda93bd0
15 changed files with 983 additions and 152 deletions

49
public/manifest.json Normal file
View File

@ -0,0 +1,49 @@
{
"name": "Jan-Marlon Leibl | Fullstack Developer",
"short_name": "JL Portfolio",
"description": "Personal website and portfolio of Jan-Marlon Leibl, Fullstack Developer",
"start_url": "/",
"display": "standalone",
"background_color": "#0A0A0A",
"theme_color": "#0A0A0A",
"orientation": "portrait-primary",
"screenshots": [
{
"src": "/screenshots/mobile.png",
"sizes": "375x812",
"type": "image/png",
"form_factor": "narrow",
"label": "Jan-Marlon Leibl's Portfolio (Mobile)"
},
{
"src": "/screenshots/desktop.png",
"sizes": "1280x800",
"type": "image/png",
"form_factor": "wide",
"label": "Jan-Marlon Leibl's Portfolio (Desktop)"
}
],
"shortcuts": [
{
"name": "About Me",
"short_name": "About",
"description": "Learn more about Jan-Marlon Leibl",
"url": "/#about",
"icons": [{ "src": "/icons/about-icon.png", "sizes": "192x192" }]
},
{
"name": "My Work",
"short_name": "Work",
"description": "View Jan-Marlon's portfolio projects",
"url": "/#work",
"icons": [{ "src": "/icons/work-icon.png", "sizes": "192x192" }]
},
{
"name": "Contact",
"short_name": "Contact",
"description": "Get in touch with Jan-Marlon",
"url": "/#contact",
"icons": [{ "src": "/icons/contact-icon.png", "sizes": "192x192" }]
}
]
}

7
public/robots.txt Normal file
View File

@ -0,0 +1,7 @@
# www.robotstxt.org/
# Allow crawling of all content
User-agent: *
Allow: /
# Optimize crawling
Crawl-delay: 10

122
public/service-worker.js Normal file
View File

@ -0,0 +1,122 @@
const CACHE_NAME = 'jleibl-portfolio-v1';
const PRECACHE_ASSETS = [
'/',
'/index.html',
'/manifest.json',
];
const STYLE_ASSETS = [
'/styles/global.css',
'/styles/theme.css'
];
const IMAGE_ASSETS = [
'/images/profile-image.jpg'
];
const ALL_ASSETS = [
...PRECACHE_ASSETS,
...STYLE_ASSETS,
...IMAGE_ASSETS
];
self.addEventListener('install', event => {
self.skipWaiting();
event.waitUntil(
caches.open(CACHE_NAME)
.then(cache => {
console.log('Opened cache');
return cache.addAll(PRECACHE_ASSETS);
})
);
});
self.addEventListener('activate', event => {
event.waitUntil(
caches.keys().then(cacheNames => {
return Promise.all(
cacheNames.map(cacheName => {
if (cacheName !== CACHE_NAME) {
console.log('Deleting old cache:', cacheName);
return caches.delete(cacheName);
}
})
);
})
);
return self.clients.claim();
});
function shouldCache(url) {
if (url.origin === self.location.origin) {
if (url.pathname.endsWith('.html') ||
url.pathname.endsWith('.css') ||
url.pathname.endsWith('.js') ||
url.pathname.endsWith('.jpg') ||
url.pathname.endsWith('.jpeg') ||
url.pathname.endsWith('.png') ||
url.pathname.endsWith('.svg') ||
url.pathname.endsWith('.webp') ||
url.pathname.endsWith('.woff') ||
url.pathname.endsWith('.woff2') ||
url.pathname.endsWith('.json')) {
return true;
}
if (url.pathname === '/') {
return true;
}
}
return false;
}
self.addEventListener('fetch', event => {
if (event.request.mode === 'navigate' || shouldCache(new URL(event.request.url))) {
event.respondWith(
caches.match(event.request)
.then(response => {
if (response) {
return response;
}
const fetchRequest = event.request.clone();
return fetch(fetchRequest)
.then(response => {
if (!response || response.status !== 200 || response.type !== 'basic') {
return response;
}
const responseToCache = response.clone();
if (shouldCache(new URL(event.request.url))) {
caches.open(CACHE_NAME)
.then(cache => {
cache.put(event.request, responseToCache);
});
}
return response;
})
.catch(error => {
console.log('Fetch failed:', error);
if (event.request.mode === 'navigate') {
return caches.match('/');
}
return null;
});
})
);
}
});
self.addEventListener('message', event => {
if (event.data && event.data.type === 'SKIP_WAITING') {
self.skipWaiting();
}
});