added admin control panel
This commit is contained in:
@@ -6,6 +6,24 @@ interface Props {
|
||||
}
|
||||
|
||||
const { title } = Astro.props;
|
||||
|
||||
const API_URL = (typeof process !== 'undefined' ? process.env.PUBLIC_API_URL : import.meta.env.PUBLIC_API_URL) || 'http://localhost:3000';
|
||||
|
||||
let siteConfig = {
|
||||
title: "Narlblog",
|
||||
favicon: "/favicon.svg",
|
||||
theme: "catppuccin-mocha"
|
||||
};
|
||||
|
||||
try {
|
||||
const res = await fetch(`${API_URL}/api/config`);
|
||||
if (res.ok) {
|
||||
siteConfig = await res.json();
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Failed to fetch config:", e);
|
||||
}
|
||||
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
@@ -13,9 +31,9 @@ const { title } = Astro.props;
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<link rel="icon" href={siteConfig.favicon} />
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
<title>{title} | Narlblog</title>
|
||||
<title>{title} | {siteConfig.title}</title>
|
||||
</head>
|
||||
<body class="bg-base text-text selection:bg-surface2 selection:text-text">
|
||||
<div class="fixed inset-0 z-[-1] bg-[radial-gradient(ellipse_at_top,_var(--tw-gradient-stops))] from-surface0 via-base to-base"></div>
|
||||
@@ -23,11 +41,12 @@ const { title } = Astro.props;
|
||||
<nav class="max-w-4xl mx-auto px-6 py-8">
|
||||
<header class="glass px-6 py-4 flex items-center justify-between">
|
||||
<a href="/" class="text-2xl font-bold bg-clip-text text-transparent bg-gradient-to-r from-mauve to-blue">
|
||||
Narlblog
|
||||
{siteConfig.title}
|
||||
</a>
|
||||
<div class="flex gap-4">
|
||||
<a href="/" class="text-subtext0 hover:text-text transition-colors">Home</a>
|
||||
<a href="https://github.com/narl" target="_blank" class="text-subtext0 hover:text-text transition-colors">About</a>
|
||||
<a href="/admin" class="text-subtext0 hover:text-mauve transition-colors">Admin</a>
|
||||
</div>
|
||||
</header>
|
||||
</nav>
|
||||
@@ -37,7 +56,7 @@ const { title } = Astro.props;
|
||||
</main>
|
||||
|
||||
<footer class="max-w-4xl mx-auto px-6 py-8 text-center text-sm text-subtext0">
|
||||
© {new Date().getFullYear()} Narlblog. Built with Rust & Astro.
|
||||
© {new Date().getFullYear()} {siteConfig.title}. Built with Rust & Astro.
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user