From b1b486d51cc996b219a3b6551cd2101c1e70ea66 Mon Sep 17 00:00:00 2001 From: Nathan Blaylock Date: Sun, 7 Jul 2024 22:11:55 -0600 Subject: [PATCH] fix build errors --- README.md | 9 ++--- package.json | 2 +- src/routes/projects/+layout.svelte | 55 +++++++++++++++++------------- 3 files changed, 37 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index 0322959..6e64679 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,8 @@ 2. `npm run dev` ## Deploy: -1. Update package.json version -2. Commit files to new branch -3. Merge in to `master` branch. This triggers a GitHub action -4. Check the actions status at https://github.com/ngblaylock/nathanblaylock.com/actions \ No newline at end of file +1. Create a new branch from an issue and checkout locally +2. Test the build with `npm run build` and `npm run preview` +3. Update package.json version +4. Merge in to `master` branch. This triggers a GitHub action to deploy the site on gh-pages +5. Check the actions status at https://github.com/ngblaylock/nathanblaylock.com/actions \ No newline at end of file diff --git a/package.json b/package.json index 362ad36..44d4426 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "nathanblaylock.com", - "version": "2.0.3", + "version": "2.0.4", "private": true, "scripts": { "blunt": "node ./node_modules/@ngblaylock/blunt-images ./blunt.config.cjs", diff --git a/src/routes/projects/+layout.svelte b/src/routes/projects/+layout.svelte index 095c443..bb593b5 100644 --- a/src/routes/projects/+layout.svelte +++ b/src/routes/projects/+layout.svelte @@ -2,8 +2,8 @@ import { onMount } from 'svelte'; import { page } from '$app/stores'; import { projects } from '$lib/projectList'; + import Debug from '$components/Debug.svelte'; - let currentProject = ''; onMount(() => { // Set all external anchor links to go to a new tab. Markdown doesn't support it. let anchors = document.querySelectorAll('.project a:not([target="_blank"])'); @@ -14,32 +14,41 @@ a.setAttribute('target', '_blank'); } }); - currentProject = $page?.route.id?.replace('/projects/', '') || ''; }); - const defaultProject = { - route: '', - alt: '', - }; - $: previousProject = () => { + $: currentProject = $page.route.id?.replace('/projects/', ''); + + $: getNextProject = () => { if (!currentProject) { return defaultProject; } const currentProjectIndex = projects.findIndex((project) => project.route === currentProject); - if (currentProjectIndex == 0) { - return projects[projects.length - 1]; + if (currentProjectIndex == -1) { + return defaultProject; } - return projects[currentProjectIndex - 1]; + if (currentProjectIndex == projects.length - 1) { + return projects[0]; + } + return projects[currentProjectIndex + 1]; }; - $: nextProject = () => { + $: getPrevProject = () => { if (!currentProject) { return defaultProject; } const currentProjectIndex = projects.findIndex((project) => project.route === currentProject); - if (currentProjectIndex == projects.length - 1) { - return projects[0]; + if (currentProjectIndex == -1) { + return defaultProject; } - return projects[currentProjectIndex + 1]; + + if (currentProjectIndex == 0) { + return projects[projects.length - 1]; + } + return projects[currentProjectIndex - 1]; + }; + + const defaultProject = { + route: '', + alt: '', }; @@ -47,18 +56,16 @@
-
- {#if previousProject().route} - ⇽ {previousProject().alt} + {getPrevProject().alt} - {/if} - {#if nextProject().route} - {nextProject().alt} ⇾{getNextProject().alt} - {/if} -
+
+ {/if}