From f4319c4165f9699197c9ccc0b87bc881697d3fec Mon Sep 17 00:00:00 2001 From: itsfinniii <102350242+itsfinniii@users.noreply.github.com> Date: Sat, 28 Mar 2026 16:59:57 +0100 Subject: [PATCH] Add project posts to the website --- .../src/components/projects/ProjectPost.astro | 39 +++++++++++++++++++ astro/src/content/projects/projects.ts | 6 ++- astro/src/graphql/projects/getProject.graphql | 2 +- astro/src/pages/[...route].astro | 3 +- astro/src/types/projects/project.d.ts | 1 + 5 files changed, 48 insertions(+), 3 deletions(-) create mode 100644 astro/src/components/projects/ProjectPost.astro diff --git a/astro/src/components/projects/ProjectPost.astro b/astro/src/components/projects/ProjectPost.astro new file mode 100644 index 0000000..c5ddb87 --- /dev/null +++ b/astro/src/components/projects/ProjectPost.astro @@ -0,0 +1,39 @@ +--- +import CalendarIcon from '@/icons/CalendarIcon.astro'; +import { getImageUrl } from '@/lib/images'; +import { markdownToHtml } from '@/lib/markdown'; +import { Image } from 'astro:assets'; + +interface Props { + project: ProjectPost; +} + +const { project } = Astro.props; +--- + +
+
+
+

{project.title}

+
+ +
{project.date}
+
+
+ +
+ {project.title} +
+ +
+
+
diff --git a/astro/src/content/projects/projects.ts b/astro/src/content/projects/projects.ts index 2ddb203..4bf275e 100644 --- a/astro/src/content/projects/projects.ts +++ b/astro/src/content/projects/projects.ts @@ -28,6 +28,7 @@ export async function getAllProjects(settings: GlobalSettings): Promise { -const client = await createDirectusConnection(); + const client = await createDirectusConnection(); const result = await client.query(print(getLastProjectsQuery), { date: formatDate(new Date(), "%Y-%M-%D"), amount: amount @@ -164,6 +166,7 @@ const client = await createDirectusConnection(); exists: true, type: "ProjectPost", lastModified: new Date(), + id: projectRecord["id"], title: projectRecord["title"], content: projectRecord["content"], date: projectRecord["date"], @@ -236,6 +239,7 @@ export async function getAllPaginatedProjects(settings: GlobalSettings, page: nu exists: true, type: "ProjectPost", lastModified: new Date(), + id: projectRecord["id"], title: projectRecord["title"], content: projectRecord["content"], date: projectRecord["date"], diff --git a/astro/src/graphql/projects/getProject.graphql b/astro/src/graphql/projects/getProject.graphql index 7bb4f6d..b4b68ef 100644 --- a/astro/src/graphql/projects/getProject.graphql +++ b/astro/src/graphql/projects/getProject.graphql @@ -27,7 +27,7 @@ query getAllProjects($route: String!) { thumbnail { id, created_on, - filename_download, + filename_disk, width, height }, diff --git a/astro/src/pages/[...route].astro b/astro/src/pages/[...route].astro index 9fc2d9b..0bf6269 100644 --- a/astro/src/pages/[...route].astro +++ b/astro/src/pages/[...route].astro @@ -9,6 +9,7 @@ import BlogIndex from "@/components/blogs/BlogIndex.astro"; import ProjectIndex from "@/components/projects/ProjectIndex.astro"; import Webpage from "@/components/webpage/Webpage.astro"; import BlogPost from "@/components/blogs/BlogPost.astro"; +import ProjectPost from "@/components/projects/ProjectPost.astro"; export async function getStaticPaths() { const settings = await getSettings(); @@ -135,7 +136,7 @@ console.log(page); tags: [] }}> -
ProjectPost
+
) } diff --git a/astro/src/types/projects/project.d.ts b/astro/src/types/projects/project.d.ts index 7963090..bc38564 100644 --- a/astro/src/types/projects/project.d.ts +++ b/astro/src/types/projects/project.d.ts @@ -2,6 +2,7 @@ type ProjectPost = { type: "ProjectPost"; exists: boolean; + id: string; title: string; url: string; date: string;