diff --git a/src/hook.server.ts b/src/hook.server.ts deleted file mode 100644 index 1f21c47..0000000 --- a/src/hook.server.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { initMongo } from "$lib/database"; - -initMongo().then(() => { - console.log('Mongo started'); -}).catch(e => {console.error(e)}) \ No newline at end of file diff --git a/src/lib/articles/latest.svelte b/src/lib/articles/latest.svelte deleted file mode 100644 index e6ee427..0000000 --- a/src/lib/articles/latest.svelte +++ /dev/null @@ -1,21 +0,0 @@ - - -{#each articles as article} -
-

This is Title {article}

-

This is blurb {article}

-
-{/each} - - diff --git a/src/lib/content-boxes/FullWidthContent.svelte b/src/lib/content-boxes/FullWidthContent.svelte index cd2e48b..154ed4b 100644 --- a/src/lib/content-boxes/FullWidthContent.svelte +++ b/src/lib/content-boxes/FullWidthContent.svelte @@ -10,6 +10,7 @@ background-color: var(--main-text-color); color: rgb(46, 46, 46); margin: 0; + margin-bottom: 10px; padding: 0; } div { diff --git a/src/lib/database.ts b/src/lib/database.ts deleted file mode 100644 index 886b7ce..0000000 --- a/src/lib/database.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { MongoClient } from "mongodb"; - -const MongoUri = "" -const MongoDatabase = "" - -const Client = new MongoClient(MongoUri) - -export async function initMongo() { - Client.connect() -} - -export default Client.db(MongoDatabase) \ No newline at end of file diff --git a/src/lib/database/mongo.ts b/src/lib/database/mongo.ts new file mode 100644 index 0000000..12e106e --- /dev/null +++ b/src/lib/database/mongo.ts @@ -0,0 +1,12 @@ +import { MongoClient } from 'mongodb'; + +const MongoUri = 'mongodb://owl:twittwoo@localhost:27017/'; + +let dbClient: MongoClient | null = null; + +export async function mongoConnect() { + if (!dbClient) { + dbClient = await MongoClient.connect(MongoUri) + } + return dbClient +} \ No newline at end of file diff --git a/src/lib/language-logos/Logos.svelte b/src/lib/language-logos/Logos.svelte index 305480b..f76d686 100644 --- a/src/lib/language-logos/Logos.svelte +++ b/src/lib/language-logos/Logos.svelte @@ -26,4 +26,8 @@ padding-left: 5px; padding-right: 5px; } + + a { + text-decoration: none; + } diff --git a/src/lib/posts/PostsSummary.svelte b/src/lib/posts/PostsSummary.svelte new file mode 100644 index 0000000..dab0f21 --- /dev/null +++ b/src/lib/posts/PostsSummary.svelte @@ -0,0 +1,40 @@ + + + + +
+

{article.title}

+

{article.summary}

+
+
+
+ + diff --git a/src/lib/posts/types.ts b/src/lib/posts/types.ts new file mode 100644 index 0000000..e92b340 --- /dev/null +++ b/src/lib/posts/types.ts @@ -0,0 +1,20 @@ +export interface ArticleSummary { + title: string; + author: string; + tags: string[]; + pusblished: boolean; + date: Date; + summary: string; + slug: string; +} + +export interface Article { + title: string; + author: string; + tags: string[]; + pusblished: boolean; + date: Date; + summary: string; + slug: string; + content: string; +} \ No newline at end of file diff --git a/src/lib/projects/ProjectSummary.svelte b/src/lib/projects/ProjectSummary.svelte new file mode 100644 index 0000000..37f6293 --- /dev/null +++ b/src/lib/projects/ProjectSummary.svelte @@ -0,0 +1,30 @@ + + +
+

{project.name}

+ +

{project.summary}

+
+ + \ No newline at end of file diff --git a/src/lib/projects/fetch.ts b/src/lib/projects/fetch.ts deleted file mode 100644 index 6b0229d..0000000 --- a/src/lib/projects/fetch.ts +++ /dev/null @@ -1,10 +0,0 @@ -import type { Project } from './types'; - -export async function fetchProjects(number: number | string): Promise { - if (number === 'all') { - // Fetch All Projects - } else if (typeof number === 'number') { - // Fetch {number} random projects - } - return []; -} diff --git a/src/lib/projects/types.ts b/src/lib/projects/types.ts index 93f31f3..9174d2a 100644 --- a/src/lib/projects/types.ts +++ b/src/lib/projects/types.ts @@ -3,4 +3,6 @@ export interface Project { tag: string; imagePath: string; summary: string; + lang: string[]; + plat: string[]; } diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte index 7349970..444546c 100644 --- a/src/routes/+page.svelte +++ b/src/routes/+page.svelte @@ -1,8 +1,8 @@
-

{title}

-

Published: {date}

-

Author: {author}

- +
+

{#each post.tags as tag} + {tag} + {/each}
+ {post.date}
+ {post.author}

+ + diff --git a/src/routes/posts/[slug]/+page.ts b/src/routes/posts/[slug]/+page.ts deleted file mode 100644 index 7e944ff..0000000 --- a/src/routes/posts/[slug]/+page.ts +++ /dev/null @@ -1,27 +0,0 @@ -interface PostData { - Content: ConstructorOfATypedSvelteComponent; - title: string; - date: string; - author: string; -} - -const defaultSlug = 'notFound'; - -export async function load({ params }) { - let post; - try { - post = await import(`../markdown/${params.slug}.md`); - } catch { - post = await import(`../markdown/${defaultSlug}.md`); - } - const { title, date, author } = post.metadata; - const Content = post.default; - - const postData: PostData = { - Content, - title, - date, - author - }; - return postData; -} diff --git a/src/routes/posts/tags/+page.svelte b/src/routes/posts/tag/+page.svelte similarity index 100% rename from src/routes/posts/tags/+page.svelte rename to src/routes/posts/tag/+page.svelte diff --git a/src/routes/posts/tag/[tag]/+page.server.ts b/src/routes/posts/tag/[tag]/+page.server.ts new file mode 100644 index 0000000..2723867 --- /dev/null +++ b/src/routes/posts/tag/[tag]/+page.server.ts @@ -0,0 +1,19 @@ +import { mongoConnect } from "$lib/database/mongo"; + + +export async function load({ params }) { + const tag = params.tag; + const db = await mongoConnect() + const query = { + tags: { + $in: [ + tag + ] + } + } + const col = db.db('fredboniface').collection('posts') + const res = col.find(query) + const posts = await res.toArray() + + return {data: JSON.stringify(posts)} +} diff --git a/src/routes/posts/tag/[tag]/+page.svelte b/src/routes/posts/tag/[tag]/+page.svelte new file mode 100644 index 0000000..80c4a7c --- /dev/null +++ b/src/routes/posts/tag/[tag]/+page.svelte @@ -0,0 +1,15 @@ + + +

Testing

+ +{#each posts as article} + +{/each} diff --git a/src/routes/posts/tags/[slug]/+page.server.ts b/src/routes/posts/tags/[slug]/+page.server.ts deleted file mode 100644 index 5b91e6c..0000000 --- a/src/routes/posts/tags/[slug]/+page.server.ts +++ /dev/null @@ -1,27 +0,0 @@ -interface PostData { - Content: ConstructorOfATypedSvelteComponent; - title: string; - date: string; - author: string; -} - -const defaultSlug = 'notFound'; - -export async function load({ params }) { - let post; - try { - post = await import(`../markdown/${params.slug}.md`); - } catch { - post = await import(`../markdown/${defaultSlug}.md`); - } - const { title, date, author } = post.metadata; - const Content = post.default; - - const postData: PostData = { - Content, - title, - date, - author - }; - return postData; -} \ No newline at end of file diff --git a/src/routes/posts/tags/[slug]/+page.svelte b/src/routes/posts/tags/[slug]/+page.svelte deleted file mode 100644 index e69de29..0000000 diff --git a/src/routes/projects/+page.svelte b/src/routes/projects/+page.svelte index 4c4cf67..b328825 100644 --- a/src/routes/projects/+page.svelte +++ b/src/routes/projects/+page.svelte @@ -10,7 +10,7 @@
-

OwlBoard

+

OwlBoard


Working full time on the 'iron road', left me wanting a faster way to get the information I needed. OwlBoard evolved from Athena and grew to provide more - information that frontline rail colleagues need. Read more... + information that frontline rail colleagues need.

-

map-dots

+

map-dots


+

I like to collect data, I am just not always sure what to do with that data. map-dots takes in