From a8158ec3de0cb93c10dce560f974a0aff7adf6ab Mon Sep 17 00:00:00 2001 From: Hannah dagemark Date: Fri, 14 Aug 2026 22:39:57 +0200 Subject: [PATCH] Update header to fetch services from backend if possible --- .env.example | 2 ++ .gitignore | 1 + components/layout/Header.tsx | 70 +++++++++++++++++++++++++++++------- 3 files changed, 61 insertions(+), 12 deletions(-) create mode 100644 .env.example diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..015028c --- /dev/null +++ b/.env.example @@ -0,0 +1,2 @@ +FRONTEND_URL= +BACKEND_URL= \ No newline at end of file diff --git a/.gitignore b/.gitignore index 5ef6a52..7b8da95 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,7 @@ yarn-error.log* # env files (can opt-in for committing if needed) .env* +!.env.example # vercel .vercel diff --git a/components/layout/Header.tsx b/components/layout/Header.tsx index 1c1b42c..19eeb69 100644 --- a/components/layout/Header.tsx +++ b/components/layout/Header.tsx @@ -1,15 +1,61 @@ import Hyperlink from "@/components/ui/Hyperlink"; +import { getServices } from "@/lib/api/helpers/services"; +import { Service } from "@/lib/api/types"; -export default function Header() { +const defaultServices: Service[] = [ + { + id: null, + title: "Git Repos", + description: null, + priority: 1, + link: "dagemark.se/git", + }, + { + id: null, + title: "Nextcloud Drive", + description: null, + priority: 3, + link: "dagemark.se/drive", + }, + { + id: null, + title: "Game Servers", + description: null, + priority: 4, + link: "gserver.dagemark.se", + }, + { + id: null, + title: "Immich Album", + description: null, + priority: 5, + link: "album.dagemark.se", + }, + { + id: null, + title: "Jellyfin Streaming", + description: null, + priority: 2, + link: "streaming.dagemark.se", + }, +]; + +export default async function Header() { + let services = await getServices(); + if (services.length < 1) { + services = defaultServices; + } return ( -
- -
- ) -} \ No newline at end of file +
+ +
+ ); +}