Getting there now

This commit is contained in:
Fred Boniface 2023-08-21 23:08:13 +01:00
parent c2d3d9006e
commit f728b54b02
16 changed files with 150 additions and 124 deletions

View File

@ -17,7 +17,7 @@
<EmptyCard><p class="message">Awaiting posts</p></EmptyCard> <EmptyCard><p class="message">Awaiting posts</p></EmptyCard>
{:then posts} {:then posts}
{#each posts as post} {#each posts as post}
<PostCard {post} /><br /> <PostCard {post} />
{/each} {/each}
{:catch} {:catch}
<EmptyCard><p class="message">Unable to fetch posts</p></EmptyCard> <EmptyCard><p class="message">Unable to fetch posts</p></EmptyCard>

View File

@ -4,32 +4,29 @@
import ProjectCard from './cards/ProjectCard.svelte'; import ProjectCard from './cards/ProjectCard.svelte';
async function getProjects() { async function getProjects() {
const res = await fetch('/projects/all') const res = await fetch('/projects/all');
const json = await res.json() const json = await res.json();
console.log(json) console.log(json);
return json return json;
} }
</script> </script>
{#await getProjects()} {#await getProjects()}
<EmptyCard> <EmptyCard>
<p class="message"> <p class="message">Fetching Projects...</p>
Fetching Projects... </EmptyCard>
</p>
</EmptyCard>
{:then projects} {:then projects}
{#each projects as project} {#each projects as project}
<ProjectCard {project} />
<ProjectCard {project} /> {/each}
{/each}
{:catch} {:catch}
<EmptyCard> <EmptyCard>
<p class="message">Unable to fetch projects</p> <p class="message">Unable to fetch projects</p>
</EmptyCard> </EmptyCard>
{/await} {/await}
<style> <style>
.message{ .message {
color:var(--light-text-color) color: var(--light-text-color);
} }
</style> </style>

View File

@ -4,16 +4,13 @@
<style> <style>
.card-container { .card-container {
display: flex; background-color: var(--main-text-color);
flex-wrap: wrap;
justify-content: center;
align-items: baseline;
row-gap: 15px;
background-color: var(--overlay-color);
width: 90%; width: 90%;
height: auto; height: auto;
margin: auto; margin: auto;
padding: 10px 5px 10px 5px; padding: 10px 5px 10px 5px;
border-radius: 10px; border-radius: 10px;
margin-top: 5px;
margin-bottom: 5px;
} }
</style> </style>

View File

@ -9,12 +9,28 @@
<a href="/posts/{post.slug}"> <a href="/posts/{post.slug}">
<EmptyCard> <EmptyCard>
<h1 class="post-title">{post.title}</h1> <h1 class="post-title">{post.title}</h1>
<h2 class="post-date">{post.date}</h2> <h2 class="post-date">{new Date(post.date).toLocaleDateString()}</h2>
<br /> <br />
<p class="post-summary">{post.summary}</p> <p class="post-summary">{post.summary}</p>
<br /> <br />
{#each post.tags as tag} <div class="tag-container">
<PostTag {tag} /> {#each post.tags as tag}
{/each} <PostTag {tag} />
{/each}
</div>
</EmptyCard> </EmptyCard>
</a> </a>
<style>
a {
text-decoration: none;
color: var(--dark-text-color);
}
.tag-container {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
}
</style>

View File

@ -2,13 +2,20 @@
import Logos from '$lib/language-logos/Logos.svelte'; import Logos from '$lib/language-logos/Logos.svelte';
import EmptyCard from './EmptyCard.svelte'; import EmptyCard from './EmptyCard.svelte';
export let project export let project;
</script> </script>
<a href="/posts/tag/{project.name.toLowerCase()}"> <a href="/posts/tag/{project.name.toLowerCase()}">
<EmptyCard> <EmptyCard>
<h1>{project.name}</h1> <h1>{project.name}</h1>
<Logos langs={project.langs} plats={project.plats} /> <Logos langs={project.langs} plats={project.plats} />
<p>{project.description}</p> <p>{project.description}</p>
</EmptyCard> </EmptyCard>
</a> </a>
<style>
a {
text-decoration: none;
color: var(--dark-text-color);
}
</style>

View File

@ -17,21 +17,31 @@
</script> </script>
<EmptyCard> <EmptyCard>
{#await fetchTags()} <div class="tag-box">
<p class="message">Loading Tags...</p> {#await fetchTags()}
{:then tags} <p class="message">Loading Tags...</p>
{#each tags as tag} {:then tags}
<div class="tag-link"> {#each tags as tag}
<PostTag {tag} /> <div class="tag-link">
</div> <PostTag {tag} />
{/each} </div>
{:catch} {/each}
<p class="message">Unable to load tags</p> {:catch}
{/await} <p class="message">Unable to load tags</p>
{/await}
</div>
</EmptyCard> </EmptyCard>
<style> <style>
.message { .message {
color: var(--light-text-color); color: var(--light-text-color);
} }
.tag-box {
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: baseline;
row-gap: 15px;
}
</style> </style>

View File

@ -1,20 +1,34 @@
<script lang="ts"> <script lang="ts">
const currentYear: number = new Date().getFullYear(); const currentYear: number = new Date().getFullYear();
const footerLinks = [
{
img: '/logos/git.svg',
link: 'https://git.fjla.uk/explore',
alt: 'See my work on Gitea'
}
];
</script> </script>
<footer> <footer>
<p> <p>
&copy; Fred Boniface 2022-{currentYear} &copy; Fred Boniface 2022-{currentYear}
</p> </p>
<p>
{#each footerLinks as link}
<a href={link.link}>
<img class="link-image" src={link.img} alt={link.alt} title={link.alt} /></a
>
{/each}
</p>
</footer> </footer>
<style> <style>
footer { footer {
position: relative; margin-top: auto;
width: 100%; width: 100%;
background-color: transparent; background-color: transparent;
height: 30px; height: auto;
bottom: 0;
} }
footer p { footer p {
padding: 0; padding: 0;
@ -23,16 +37,10 @@
margin-top: 9px; margin-top: 9px;
text-align: center; text-align: center;
font-family: monospace; font-family: monospace;
color: var(--light-text-color);
} }
@media screen and (min-height: 600px) {
footer { .link-image {
position: fixed; height: 20px;
bottom: 0;
left: 0;
}
footer p {
padding-top: 0px;
margin-top: 6px;
}
} }
</style> </style>

View File

@ -13,7 +13,7 @@
<style> <style>
header { header {
font-family: shadowsintolight; font-family: shadowsintolight;
font-size: 30px; font-size: 4.8vw;
font-weight: bolder; font-weight: bolder;
margin: 0px; margin: 0px;
padding: 0px; padding: 0px;
@ -31,4 +31,10 @@
h2 { h2 {
margin-top: 0px; margin-top: 0px;
} }
@media (min-width: 490px) {
header {
font-size: 23px;
}
}
</style> </style>

View File

@ -8,14 +8,14 @@
{#each langs as lang} {#each langs as lang}
{#await languageNames.get(lang) then langName} {#await languageNames.get(lang) then langName}
<a href="/posts/tag/{langName}"> <a href="/posts/tag/{langName}">
<img src="/logos/color/{lang}.svg" alt={langName} /> <img src="/logos/color/{lang}.svg" alt="{langName} logo" title={langName} />
</a> </a>
{/await} {/await}
{/each} {/each}
<br /> <br />
{#each plats as plat} {#each plats as plat}
<a href="/posts/tag/{plat.toLowerCase()}"> <a href="/posts/tag/{plat.toLowerCase()}">
<img src="/logos/color/{plat}.svg" alt={plat} /> <img src="/logos/color/{plat}.svg" alt="{plat} logo" title={plat} />
</a> </a>
{/each} {/each}

View File

@ -6,15 +6,21 @@
import DevBanner from '$lib/DevBanner.svelte'; import DevBanner from '$lib/DevBanner.svelte';
</script> </script>
{#if dev} <div id="page-content">
<DevBanner /> {#if dev}
{/if} <DevBanner />
{/if}
<Navigation /> <Navigation />
<slot />
<slot /> <Footer />
</div>
<Footer />
<style> <style>
#page-content {
display: flex;
flex-direction: column;
min-height: 100vh;
min-height: 100svh;
}
</style> </style>

View File

@ -89,9 +89,7 @@
margin: auto; margin: auto;
margin-top: 10px; margin-top: 10px;
border-radius: 100px; border-radius: 100px;
border-style: solid; border: none;
border-color: var(--accent-color);
border-width: 3px;
max-height: 150px; max-height: 150px;
height: 30vw; height: 30vw;
} }
@ -124,10 +122,6 @@
img { img {
margin: 0; /* Remove any margin */ margin: 0; /* Remove any margin */
padding: 0; /* Remove any padding */ padding: 0; /* Remove any padding */
border-radius: 100px;
border-style: solid;
border-color: var(--accent-color);
border-width: 3px;
max-height: 150px; max-height: 150px;
height: 100%; /* Fill the height of the #header-visual container */ height: 100%; /* Fill the height of the #header-visual container */
} }

View File

@ -1 +1,11 @@
<h1>Posts</h1> <script lang="ts">
import LatestPosts from '$lib/card-collections/LatestPosts.svelte';
import PostCard from '$lib/card-collections/cards/PostCard.svelte';
import Header from '$lib/header.svelte';
const title = "Things I've Written";
</script>
<Header {title} />
<LatestPosts number={20} />

View File

@ -27,7 +27,8 @@
}) })
.catch((error) => { .catch((error) => {
console.error( console.error(
'Error copying code to clipboard, this may be due to privacy settings in your browser' 'Error copying code to clipboard, this may be due to privacy settings in your browser',
error
); );
}); });
}); });
@ -56,6 +57,8 @@
</div> </div>
<div class="side-column"> <div class="side-column">
<h2>Projects</h2>
<Projects /> <Projects />
</div> </div>
</div> </div>

View File

@ -1,5 +0,0 @@
import type { Project } from '$lib/projects/types';
export async function load({ params }) {
// Fetch all projects
}

View File

@ -1,45 +1,22 @@
<script lang="ts"> <script lang="ts">
import GitLink from '$lib/GitLink.svelte'; import ProjectCard from '$lib/card-collections/cards/ProjectCard.svelte';
import FullWidthContent from '$lib/content-boxes/FullWidthContent.svelte';
import Header from '$lib/header.svelte'; import Header from '$lib/header.svelte';
import Logos from '$lib/language-logos/Logos.svelte';
const title: string = "Stuff I've Done"; const title: string = "Stuff I've Done";
async function getProjects() {
return await (await fetch('/projects/all')).json();
}
</script> </script>
<Header {title} /> <Header {title} />
<main>
<FullWidthContent>
<h1><a href="/posts/tag/owlboard">OwlBoard</a></h1>
<br />
<GitLink url={'https://git.fjla.uk/owlboard'} />
<Logos
langs={['js', 'ts', 'py', 'go', 'html', 'css']}
plats={['svelte', 'express', 'mongo', 'redis']}
/>
<p>
Working full time on the 'iron road', left me wanting a faster way to get the information I
needed. OwlBoard evolved from <a href="/articles/athena">Athena</a> and grew to provide more information
that frontline rail colleagues need.
</p>
</FullWidthContent>
<FullWidthContent>
<h1><a href="/posts/tag/map-dots">map-dots</a></h1>
<br />
<GitLink url={'https://git.fjla.uk/fred.boniface/map-dots'} />
<Logos langs={['go', 'py']} plats={[]} />
<p>
I like to collect data, I am just not always sure what to do with that data. map-dots takes in
location history data and produces imagery. It can also run as a server and the map-dots-fetch
script can be used to fetch and save configurable images.
</p>
</FullWidthContent>
</main>
<style> {#await getProjects()}
h1 { <p class="messages">Fetching projects</p>
margin-bottom: 8px; {:then projects}
padding-top: 5px; {#each projects as project}
font-family: shadowsintolight; <ProjectCard {project} />
} {/each}
</style> {:catch}
<p class="messages">Error fetching projects</p>
{/await}

View File

@ -7,6 +7,6 @@ import { mongoConnect } from '$lib/database/mongo.server';
export async function GET({ url }) { export async function GET({ url }) {
const db = await mongoConnect(); const db = await mongoConnect();
const col = db.db('fredboniface').collection('projects'); const col = db.db('fredboniface').collection('projects');
const res = await col.find().toArray() const res = await col.find().toArray();
return json(res) return json(res);
} }