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;
|
const { src, alt, nsfw } = Astro.props;
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -1,40 +1,44 @@
|
||||||
---
|
---
|
||||||
import { Image } from "astro:assets";
|
import { Image } from "astro:assets";
|
||||||
import config from "../../config.yaml";
|
|
||||||
import Social from "./Social.astro";
|
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>
|
<aside>
|
||||||
<div class="p-4">
|
<div class="p-4">
|
||||||
<a href="/">
|
<a href="/">
|
||||||
{
|
{
|
||||||
config.icon && (
|
icon && (
|
||||||
<Image
|
<Image class={"icon"} src={icon} width={10} height={10} alt={""} />
|
||||||
class={"icon"}
|
|
||||||
src={config.icon}
|
|
||||||
width={10}
|
|
||||||
height={10}
|
|
||||||
alt={""}
|
|
||||||
/>
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
<h1 class="font-bold text-2xl pt-4">{config.title}</h1></a
|
<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 />
|
<br />
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<h1 class="font-bold text-2xl pt-4">Socials</h1>
|
<h1 class="font-bold text-2xl pt-4">Socials</h1>
|
||||||
<div
|
<div id="socials" class="flex gap-4 columns-2 md:columns-4 pt-4">
|
||||||
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} />
|
||||||
config.socials &&
|
))
|
||||||
config.socials.map((s) => (
|
}
|
||||||
<Social href={s.url} text={s.name} icon={s.icon} />
|
|
||||||
))
|
|
||||||
}
|
|
||||||
</div>
|
</div>
|
||||||
<!-- Links to Subpages -->
|
<!-- Links to Subpages -->
|
||||||
<br />
|
<br />
|
||||||
|
|
|
@ -1,8 +1,21 @@
|
||||||
---
|
---
|
||||||
import { Image } from "astro:assets";
|
import { Image } from "astro:assets";
|
||||||
import config from "../../config.yaml";
|
|
||||||
import Social from "./Social.astro";
|
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>
|
<aside>
|
||||||
|
|
|
@ -1,8 +1,26 @@
|
||||||
---
|
---
|
||||||
import config from "../../config.yaml";
|
|
||||||
import Sidebar from "../components/Sidebar.astro";
|
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;
|
export const prerender = false;
|
||||||
---
|
---
|
||||||
|
@ -15,7 +33,7 @@ export const prerender = false;
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||||
<meta name="generator" content={Astro.generator} />
|
<meta name="generator" content={Astro.generator} />
|
||||||
<title>{title}</title>
|
<title>{config.title}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div
|
<div
|
||||||
|
@ -26,7 +44,7 @@ export const prerender = false;
|
||||||
<slot />
|
<slot />
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
<style define:vars={{ background: `url(${background})` }}>
|
<style define:vars={{ background: `url(${config.background})` }}>
|
||||||
.container {
|
.container {
|
||||||
width: calc(100% - 25rem);
|
width: calc(100% - 25rem);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,30 @@
|
||||||
---
|
---
|
||||||
import config from "../../config.yaml";
|
|
||||||
import Lightbox from "../components/Lightbox.astro";
|
import Lightbox from "../components/Lightbox.astro";
|
||||||
import Sidebar from "../components/Sidebar.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>
|
<!doctype html>
|
||||||
|
@ -14,7 +35,7 @@ const { title, background } = config;
|
||||||
<meta name="viewport" content="width=device-width" />
|
<meta name="viewport" content="width=device-width" />
|
||||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||||
<meta name="generator" content={Astro.generator} />
|
<meta name="generator" content={Astro.generator} />
|
||||||
<title>{title}</title>
|
<title>{config.title}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<Lightbox />
|
<Lightbox />
|
||||||
|
@ -31,7 +52,7 @@ const { title, background } = config;
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
<style define:vars={{ background: `url(${background})` }}>
|
<style define:vars={{ background: `url(${config.background})` }}>
|
||||||
@media screen(md) {
|
@media screen(md) {
|
||||||
.container {
|
.container {
|
||||||
width: calc(100% - 25rem);
|
width: calc(100% - 25rem);
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
---
|
---
|
||||||
import config from "../../config.yaml";
|
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>
|
<!doctype html>
|
||||||
|
@ -18,7 +22,7 @@ import config from "../../config.yaml";
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
||||||
<style define:vars={{ background: `url(${config.background})` }}>
|
<style define:vars={{ background: `url(${background})` }}>
|
||||||
.container {
|
.container {
|
||||||
width: calc(100% - 25rem);
|
width: calc(100% - 25rem);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,27 +1,9 @@
|
||||||
---
|
---
|
||||||
// import type { GetStaticPaths } from "astro";
|
|
||||||
import Gallery from "../../layouts/Gallery.astro";
|
import Gallery from "../../layouts/Gallery.astro";
|
||||||
import Image from "../../components/Image.astro";
|
import Image from "../../components/Image.astro";
|
||||||
import pb from "../../lib/pb";
|
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 { slug } = Astro.params;
|
||||||
|
|
||||||
const imageCollection = await pb.collection("images").getFullList({
|
const imageCollection = await pb.collection("images").getFullList({
|
||||||
sort: "-created",
|
sort: "-created",
|
||||||
filter: `(character.slug~"${slug}")`,
|
filter: `(character.slug~"${slug}")`,
|
||||||
|
|
|
@ -7,8 +7,8 @@ const characters = await pb
|
||||||
.collection("characters")
|
.collection("characters")
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
.getFullList({ expand: ["icon"] });
|
.getFullList({ expand: ["icon"] });
|
||||||
export const prerender = false
|
|
||||||
|
|
||||||
|
export const prerender = false;
|
||||||
---
|
---
|
||||||
|
|
||||||
<CharacterList>
|
<CharacterList>
|
||||||
|
|
Loading…
Add table
Reference in a new issue