move most options to database
This commit is contained in:
parent
4b06313caa
commit
a0d7b52ccb
8 changed files with 93 additions and 52 deletions
|
@ -1,5 +1,4 @@
|
|||
---
|
||||
import { Picture as AstroPic } from "astro:assets";
|
||||
const { src, alt, nsfw } = Astro.props;
|
||||
---
|
||||
|
||||
|
|
|
@ -1,40 +1,44 @@
|
|||
---
|
||||
import { Image } from "astro:assets";
|
||||
import config from "../../config.yaml";
|
||||
import Social from "./Social.astro";
|
||||
const {} = Astro.props;
|
||||
import pb from "../lib/pb";
|
||||
|
||||
const avatarRec = await pb
|
||||
.collection("images")
|
||||
.getFirstListItem("useAsAvatar=true");
|
||||
|
||||
const icon = await pb.files.getUrl(avatarRec, avatarRec.file);
|
||||
const socials = await pb.collection("socials").getFullList();
|
||||
|
||||
const config = {
|
||||
icon,
|
||||
socials,
|
||||
title: import.meta.env.PUBLIC_TITLE,
|
||||
description: import.meta.env.PUBLIC_DESCRIPTION,
|
||||
};
|
||||
---
|
||||
|
||||
<aside>
|
||||
<div class="p-4">
|
||||
<a href="/">
|
||||
{
|
||||
config.icon && (
|
||||
<Image
|
||||
class={"icon"}
|
||||
src={config.icon}
|
||||
width={10}
|
||||
height={10}
|
||||
alt={""}
|
||||
/>
|
||||
icon && (
|
||||
<Image class={"icon"} src={icon} width={10} height={10} alt={""} />
|
||||
)
|
||||
}
|
||||
<h1 class="font-bold text-2xl pt-4">{config.title}</h1></a
|
||||
>
|
||||
<p class="pt-4">{config.description}</p>
|
||||
<p class="pt-4 max-w-[50rem] text-wrap">{config.description}</p>
|
||||
<br />
|
||||
<div class="flex flex-col">
|
||||
<h1 class="font-bold text-2xl pt-4">Socials</h1>
|
||||
<div
|
||||
id="socials"
|
||||
class="flex gap-4 columns-2 md:columns-4 pt-4"
|
||||
>
|
||||
{
|
||||
config.socials &&
|
||||
config.socials.map((s) => (
|
||||
<Social href={s.url} text={s.name} icon={s.icon} />
|
||||
))
|
||||
}
|
||||
<div id="socials" class="flex gap-4 columns-2 md:columns-4 pt-4">
|
||||
{
|
||||
config.socials &&
|
||||
config.socials.map((s) => (
|
||||
<Social href={s.url} text={s.name} icon={s.icon} />
|
||||
))
|
||||
}
|
||||
</div>
|
||||
<!-- Links to Subpages -->
|
||||
<br />
|
||||
|
|
|
@ -1,8 +1,21 @@
|
|||
---
|
||||
import { Image } from "astro:assets";
|
||||
import config from "../../config.yaml";
|
||||
import Social from "./Social.astro";
|
||||
const {} = Astro.props;
|
||||
import pb from "../lib/pb";
|
||||
|
||||
const avatarRec = await pb
|
||||
.collection("images")
|
||||
.getFirstListItem("useAsAvatar=true");
|
||||
|
||||
const icon = await pb.files.getUrl(avatarRec, avatarRec.file);
|
||||
const socials = await pb.collection("socials").getFullList();
|
||||
|
||||
const config = {
|
||||
icon,
|
||||
socials,
|
||||
title: import.meta.env.PUBLIC_TITLE,
|
||||
description: import.meta.env.PUBLIC_DESCRIPTION,
|
||||
};
|
||||
---
|
||||
|
||||
<aside>
|
||||
|
|
|
@ -1,8 +1,26 @@
|
|||
---
|
||||
import config from "../../config.yaml";
|
||||
import Sidebar from "../components/Sidebar.astro";
|
||||
|
||||
const { title, background } = config;
|
||||
import pb from "../lib/pb";
|
||||
|
||||
const avatarRec = await pb
|
||||
.collection("images")
|
||||
.getFirstListItem("useAsAvatar=true");
|
||||
const backgroundRec = await pb
|
||||
.collection("images")
|
||||
.getFirstListItem("useAsBackground=true");
|
||||
|
||||
const icon = await pb.files.getUrl(avatarRec, avatarRec.file);
|
||||
const background = await pb.files.getUrl(backgroundRec, backgroundRec.file);
|
||||
const socials = await pb.collection("socials").getFullList();
|
||||
|
||||
const config = {
|
||||
icon,
|
||||
socials,
|
||||
background,
|
||||
title: import.meta.env.PUBLIC_TITLE,
|
||||
description: import.meta.env.PUBLIC_DESCRIPTION,
|
||||
};
|
||||
|
||||
export const prerender = false;
|
||||
---
|
||||
|
@ -15,7 +33,7 @@ export const prerender = false;
|
|||
<meta name="viewport" content="width=device-width" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
<title>{title}</title>
|
||||
<title>{config.title}</title>
|
||||
</head>
|
||||
<body>
|
||||
<div
|
||||
|
@ -26,7 +44,7 @@ export const prerender = false;
|
|||
<slot />
|
||||
</body>
|
||||
</html>
|
||||
<style define:vars={{ background: `url(${background})` }}>
|
||||
<style define:vars={{ background: `url(${config.background})` }}>
|
||||
.container {
|
||||
width: calc(100% - 25rem);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,30 @@
|
|||
---
|
||||
import config from "../../config.yaml";
|
||||
import Lightbox from "../components/Lightbox.astro";
|
||||
import Sidebar from "../components/Sidebar.astro";
|
||||
import pb from "../lib/pb";
|
||||
|
||||
const { title, background } = config;
|
||||
export const prerender = false
|
||||
|
||||
const avatarRec = await pb
|
||||
.collection("images")
|
||||
.getFirstListItem("useAsAvatar=true");
|
||||
const backgroundRec = await pb
|
||||
.collection("images")
|
||||
.getFirstListItem("useAsBackground=true");
|
||||
|
||||
const icon = await pb.files.getUrl(avatarRec, avatarRec.file);
|
||||
const background = await pb.files.getUrl(backgroundRec, backgroundRec.file);
|
||||
const socials = await pb.collection("socials").getFullList();
|
||||
|
||||
const config = {
|
||||
icon,
|
||||
socials,
|
||||
background,
|
||||
title: import.meta.env.PUBLIC_TITLE,
|
||||
description: import.meta.env.PUBLIC_DESCRIPTION,
|
||||
};
|
||||
|
||||
console.log(config);
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
|
@ -14,7 +35,7 @@ const { title, background } = config;
|
|||
<meta name="viewport" content="width=device-width" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<meta name="generator" content={Astro.generator} />
|
||||
<title>{title}</title>
|
||||
<title>{config.title}</title>
|
||||
</head>
|
||||
<body>
|
||||
<Lightbox />
|
||||
|
@ -31,7 +52,7 @@ const { title, background } = config;
|
|||
</body>
|
||||
</html>
|
||||
|
||||
<style define:vars={{ background: `url(${background})` }}>
|
||||
<style define:vars={{ background: `url(${config.background})` }}>
|
||||
@media screen(md) {
|
||||
.container {
|
||||
width: calc(100% - 25rem);
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
---
|
||||
import config from "../../config.yaml";
|
||||
import pb from "../lib/pb";
|
||||
export const prerender = false
|
||||
const backgroundRec = await pb.collection('images').getFirstListItem('useAsBackground=true');
|
||||
const background = await pb.files.getUrl(backgroundRec, backgroundRec.file);
|
||||
---
|
||||
|
||||
<!doctype html>
|
||||
|
@ -18,7 +22,7 @@ import config from "../../config.yaml";
|
|||
</body>
|
||||
</html>
|
||||
|
||||
<style define:vars={{ background: `url(${config.background})` }}>
|
||||
<style define:vars={{ background: `url(${background})` }}>
|
||||
.container {
|
||||
width: calc(100% - 25rem);
|
||||
}
|
||||
|
|
|
@ -1,27 +1,9 @@
|
|||
---
|
||||
// import type { GetStaticPaths } from "astro";
|
||||
import Gallery from "../../layouts/Gallery.astro";
|
||||
import Image from "../../components/Image.astro";
|
||||
import pb from "../../lib/pb";
|
||||
export async function getStaticPaths() {
|
||||
const paths = await pb
|
||||
.collection("characters")
|
||||
.getFullList({
|
||||
sort: "-created",
|
||||
})
|
||||
.then((r) => r);
|
||||
|
||||
// console.log(paths);
|
||||
|
||||
return paths.map(({ slug }) => {
|
||||
return {
|
||||
params: { slug },
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
const { slug } = Astro.params;
|
||||
|
||||
const imageCollection = await pb.collection("images").getFullList({
|
||||
sort: "-created",
|
||||
filter: `(character.slug~"${slug}")`,
|
||||
|
|
|
@ -7,8 +7,8 @@ const characters = await pb
|
|||
.collection("characters")
|
||||
// @ts-ignore
|
||||
.getFullList({ expand: ["icon"] });
|
||||
export const prerender = false
|
||||
|
||||
export const prerender = false;
|
||||
---
|
||||
|
||||
<CharacterList>
|
||||
|
|
Loading…
Add table
Reference in a new issue