Optimizations, characters in Gallery, etc.
This commit is contained in:
parent
95ec9f0a2b
commit
3823cc14d9
13 changed files with 97 additions and 40 deletions
|
@ -41,15 +41,14 @@ export default async function Home({
|
||||||
</Markdown>
|
</Markdown>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
<p>
|
<div className="navigation">
|
||||||
<ConditionalNull condition={curPage > 1}>
|
<ConditionalNull condition={curPage > 1}>
|
||||||
<Link href={`?page=${curPage - 1}`}>Previous</Link>
|
<Link href={`?page=${curPage - 1}`}>Previous</Link>
|
||||||
</ConditionalNull>
|
</ConditionalNull>
|
||||||
{" "}
|
|
||||||
<ConditionalNull condition={curPage * 10 < blogs.data.total_posts}>
|
<ConditionalNull condition={curPage * 10 < blogs.data.total_posts}>
|
||||||
<Link href={`?page=${curPage + 1}`}>Next</Link>
|
<Link href={`?page=${curPage + 1}`}>Next</Link>
|
||||||
</ConditionalNull>
|
</ConditionalNull>
|
||||||
</p>
|
</div>
|
||||||
</MainLayout>
|
</MainLayout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,7 +78,7 @@ export default async function Home({
|
||||||
return (
|
return (
|
||||||
<Link href={`/gallery/${img.slug}`} className={styles.CharacterContainerLink}>
|
<Link href={`/gallery/${img.slug}`} className={styles.CharacterContainerLink}>
|
||||||
<div style={{
|
<div style={{
|
||||||
backgroundImage: `linear-gradient(180deg, #000c 0%, #000c 50%, #0004 100%), url(${img.images[0]})`,
|
backgroundImage: `linear-gradient(0deg, #000c 0%, #000c 50%, #0004 100%), url(${img.images[0]})`,
|
||||||
}} className={styles.CharacterContainer}>
|
}} className={styles.CharacterContainer}>
|
||||||
<h2>{img.title}</h2>
|
<h2>{img.title}</h2>
|
||||||
<p>{new Date(img.created).toLocaleDateString()}</p>
|
<p>{new Date(img.created).toLocaleDateString()}</p>
|
||||||
|
|
|
@ -41,7 +41,7 @@ export default async function Home({
|
||||||
return (
|
return (
|
||||||
<Link href={`/characters/${character.id}`} className={styles.CharacterContainerLink}>
|
<Link href={`/characters/${character.id}`} className={styles.CharacterContainerLink}>
|
||||||
<div style={{
|
<div style={{
|
||||||
backgroundImage: `linear-gradient(180deg, #000c 0%, #000c 50%, #0004 100%), url(${charblogs.data.images[0]})`,
|
backgroundImage: `linear-gradient(0deg, #000c 0%, #000c 50%, #0004 100%), url(${charblogs.data.images[0]})`,
|
||||||
}} className={styles.CharacterContainer}>
|
}} className={styles.CharacterContainer}>
|
||||||
<h2>{character.name}</h2>
|
<h2>{character.name}</h2>
|
||||||
<p>{character.pronouns}</p>
|
<p>{character.pronouns}</p>
|
||||||
|
@ -50,15 +50,14 @@ export default async function Home({
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<div className="navigation">
|
||||||
<ConditionalNull condition={curPage > 1}>
|
<ConditionalNull condition={curPage > 1}>
|
||||||
<Link href={`?page=${curPage - 1}`}>Previous</Link>
|
<Link href={`?page=${curPage - 1}`}>Previous</Link>
|
||||||
</ConditionalNull>
|
</ConditionalNull>
|
||||||
{" "}
|
|
||||||
<ConditionalNull condition={curPage * 10 < charblogs.data.total_posts}>
|
<ConditionalNull condition={curPage * 10 < charblogs.data.total_posts}>
|
||||||
<Link href={`?page=${curPage + 1}`}>Next</Link>
|
<Link href={`?page=${curPage + 1}`}>Next</Link>
|
||||||
</ConditionalNull>
|
</ConditionalNull>
|
||||||
</p>
|
</div>
|
||||||
</MainLayout>
|
</MainLayout>
|
||||||
)
|
)
|
||||||
}
|
}
|
|
@ -11,6 +11,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.CharacterContainer {
|
.CharacterContainer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-end;
|
||||||
aspect-ratio: 1/1;
|
aspect-ratio: 1/1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
|
|
|
@ -2,6 +2,9 @@ import { MainLayout } from "@/layout/MainLayout/MainLayout";
|
||||||
import { notFound } from "next/navigation";
|
import { notFound } from "next/navigation";
|
||||||
import Markdown from "react-markdown";
|
import Markdown from "react-markdown";
|
||||||
import rehypeRaw from "rehype-raw";
|
import rehypeRaw from "rehype-raw";
|
||||||
|
import styles from "../style.module.css";
|
||||||
|
import Link from "next/link";
|
||||||
|
import { ConditionalNull } from "@/components/utility/Conditional";
|
||||||
|
|
||||||
export default async function Home({
|
export default async function Home({
|
||||||
params
|
params
|
||||||
|
@ -13,6 +16,32 @@ export default async function Home({
|
||||||
const blog = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts/${params.slug}`, { cache: 'no-store' }).then(x=>x.json());
|
const blog = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts/${params.slug}`, { cache: 'no-store' }).then(x=>x.json());
|
||||||
if (blog.data == null)
|
if (blog.data == null)
|
||||||
return notFound();
|
return notFound();
|
||||||
|
|
||||||
|
let allCharacters:{
|
||||||
|
id: string,
|
||||||
|
name: string,
|
||||||
|
description?: string[],
|
||||||
|
picture: string,
|
||||||
|
gender: string,
|
||||||
|
pronunciation: string,
|
||||||
|
pronouns: string,
|
||||||
|
spec?: string,
|
||||||
|
species: string,
|
||||||
|
age: number,
|
||||||
|
height: number,
|
||||||
|
relationships: {
|
||||||
|
id: string,
|
||||||
|
status: string,
|
||||||
|
}[]
|
||||||
|
}[] = [];
|
||||||
|
|
||||||
|
await (blog.data.tags.reduce(async (p:Promise<any>, tag:string) => {
|
||||||
|
const tagCharacter = await fetch(`https://blog.abtmtr.link/api/collections/characters/posts/${tag}`, { next: { revalidate: 1800 } }).then(x=>x.json());
|
||||||
|
if (tagCharacter.data == null) return;
|
||||||
|
|
||||||
|
allCharacters.push(JSON.parse(tagCharacter.data.body.replace(/[“”]/g, "\"")));
|
||||||
|
}, Promise.resolve()));
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MainLayout currentPage={`/gallery/${params.slug}`} title="Gallery" subtitle="via img.abtmtr.link" backButton>
|
<MainLayout currentPage={`/gallery/${params.slug}`} title="Gallery" subtitle="via img.abtmtr.link" backButton>
|
||||||
<h1>{blog.data.title}</h1>
|
<h1>{blog.data.title}</h1>
|
||||||
|
@ -22,6 +51,23 @@ export default async function Home({
|
||||||
}}>
|
}}>
|
||||||
<Markdown rehypePlugins={[rehypeRaw]}>{blog.data.body}</Markdown>
|
<Markdown rehypePlugins={[rehypeRaw]}>{blog.data.body}</Markdown>
|
||||||
</div>
|
</div>
|
||||||
|
<ConditionalNull condition={allCharacters.length >= 1}><h2>Characters</h2></ConditionalNull>
|
||||||
|
<div className={styles.ImageContainerGrid}>
|
||||||
|
{allCharacters.map(async (character) => {
|
||||||
|
const charblogs = await fetch(`https://img.abtmtr.link/api/collections/mtr/posts/${character.picture}`).then(x=>x.json());
|
||||||
|
console.log(charblogs?.data?.images?.[0]);
|
||||||
|
return (
|
||||||
|
<Link href={`/characters/${character.id}`} className={styles.ImageContainerLink}>
|
||||||
|
<div style={{
|
||||||
|
backgroundImage: `linear-gradient(0deg, #000c 0%, #000c 50%, #0004 100%), url(${charblogs.data.images[0]})`,
|
||||||
|
}} className={styles.ImageContainer}>
|
||||||
|
<h2>{character.name}</h2>
|
||||||
|
<p>{character.pronouns}</p>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
</MainLayout>
|
</MainLayout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,7 +31,7 @@ export default async function Home({
|
||||||
}) => (
|
}) => (
|
||||||
<Link href={`/gallery/${post.slug}`} className={styles.ImageContainerLink}>
|
<Link href={`/gallery/${post.slug}`} className={styles.ImageContainerLink}>
|
||||||
<div style={{
|
<div style={{
|
||||||
backgroundImage: `linear-gradient(180deg, #000c 0%, #000c 50%, #0004 100%), url(${post.images?.[0]})`,
|
backgroundImage: `linear-gradient(0deg, #000c 0%, #000c 50%, #0004 100%), url(${post.images?.[0]})`,
|
||||||
}} className={styles.ImageContainer}>
|
}} className={styles.ImageContainer}>
|
||||||
<h2>{post.title}</h2>
|
<h2>{post.title}</h2>
|
||||||
<p>Posted {new Date(post.created).toLocaleDateString()}</p>
|
<p>Posted {new Date(post.created).toLocaleDateString()}</p>
|
||||||
|
@ -39,15 +39,14 @@ export default async function Home({
|
||||||
</Link>
|
</Link>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<div className="navigation">
|
||||||
<ConditionalNull condition={curPage > 1}>
|
<ConditionalNull condition={curPage > 1}>
|
||||||
<Link href={`?page=${curPage - 1}`}>Previous</Link>
|
<Link href={`?page=${curPage - 1}`}>Previous</Link>
|
||||||
</ConditionalNull>
|
</ConditionalNull>
|
||||||
{" "}
|
|
||||||
<ConditionalNull condition={curPage * 10 < blogs.data.total_posts}>
|
<ConditionalNull condition={curPage * 10 < blogs.data.total_posts}>
|
||||||
<Link href={`?page=${curPage + 1}`}>Next</Link>
|
<Link href={`?page=${curPage + 1}`}>Next</Link>
|
||||||
</ConditionalNull>
|
</ConditionalNull>
|
||||||
</p>
|
</div>
|
||||||
</MainLayout>
|
</MainLayout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.ImageContainer {
|
.ImageContainer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: flex-end;
|
||||||
aspect-ratio: 1/1;
|
aspect-ratio: 1/1;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
padding: 16px;
|
padding: 16px;
|
||||||
|
|
|
@ -39,15 +39,14 @@ export default async function Home({
|
||||||
</Markdown>
|
</Markdown>
|
||||||
</div>
|
</div>
|
||||||
))}
|
))}
|
||||||
<p>
|
<div className="navigation">
|
||||||
<ConditionalNull condition={curPage > 1}>
|
<ConditionalNull condition={curPage > 1}>
|
||||||
<Link href={`?page=${curPage - 1}`}>Previous</Link>
|
<Link href={`?page=${curPage - 1}`}>Previous</Link>
|
||||||
</ConditionalNull>
|
</ConditionalNull>
|
||||||
{" "}
|
|
||||||
<ConditionalNull condition={curPage * 10 < blogs.data.total_posts}>
|
<ConditionalNull condition={curPage * 10 < blogs.data.total_posts}>
|
||||||
<Link href={`?page=${curPage + 1}`}>Next</Link>
|
<Link href={`?page=${curPage + 1}`}>Next</Link>
|
||||||
</ConditionalNull>
|
</ConditionalNull>
|
||||||
</p>
|
</div>
|
||||||
</MainLayout>
|
</MainLayout>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@
|
||||||
border-right: 1px solid var(--neutral);
|
border-right: 1px solid var(--neutral);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.MainLayout_Aside.Modifier_Open {}
|
||||||
.MainLayout_Inner {
|
.MainLayout_Inner {
|
||||||
max-width: 100%;
|
max-width: 100%;
|
||||||
max-height: 100%;
|
max-height: 100%;
|
||||||
|
|
|
@ -16,7 +16,5 @@ export function MainLayout({
|
||||||
sidebar?: React.ReactNode,
|
sidebar?: React.ReactNode,
|
||||||
currentPage: string
|
currentPage: string
|
||||||
}) {
|
}) {
|
||||||
return (<>
|
return <Desktop title={title} subtitle={subtitle} backButton={backButton} sidebar={sidebar ?? SidebarMain({currentPage})}>{children}</Desktop>
|
||||||
<Desktop title={title} subtitle={subtitle} backButton={backButton} sidebar={sidebar ?? SidebarMain({currentPage})}>{children}</Desktop>
|
|
||||||
</>)
|
|
||||||
}
|
}
|
|
@ -13,7 +13,11 @@
|
||||||
gap: 8px;
|
gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.Main_List_CurrentLink button {
|
.Main_List>a {
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.Main_List_CurrentLink>div {
|
||||||
background-color: var(--bg-2);
|
background-color: var(--bg-2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -9,58 +9,58 @@ export function SidebarMain({currentPage}:{currentPage:string}) {
|
||||||
</div> */}
|
</div> */}
|
||||||
<div className={styles.Main_List}>
|
<div className={styles.Main_List}>
|
||||||
<Link href="/" className={currentPage === "/" ? styles.Main_List_CurrentLink : ""} tabIndex={-1}>
|
<Link href="/" className={currentPage === "/" ? styles.Main_List_CurrentLink : ""} tabIndex={-1}>
|
||||||
<button className={`fw ${styles.Main_List_Button}`}>
|
<div className={`fw ${styles.Main_List_Button}`}>
|
||||||
<span className="icon">home</span>
|
<span className="icon">home</span>
|
||||||
<span>Root</span>
|
<span>Root</span>
|
||||||
</button>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
<Link href="/projects/" className={currentPage.includes("/projects/") ? styles.Main_List_CurrentLink : ""} tabIndex={-1}>
|
<Link href="/projects/" className={currentPage.includes("/projects/") ? styles.Main_List_CurrentLink : ""} tabIndex={-1}>
|
||||||
<button className={`fw ${styles.Main_List_Button}`}>
|
<div className={`fw ${styles.Main_List_Button}`}>
|
||||||
<span className="icon">folder</span>
|
<span className="icon">folder</span>
|
||||||
<span>Projects</span>
|
<span>Projects</span>
|
||||||
</button>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
<Link href="/characters/" className={currentPage.includes("/characters/") ? styles.Main_List_CurrentLink : ""} tabIndex={-1}>
|
<Link href="/characters/" className={currentPage.includes("/characters/") ? styles.Main_List_CurrentLink : ""} tabIndex={-1}>
|
||||||
<button className={`fw ${styles.Main_List_Button}`}>
|
<div className={`fw ${styles.Main_List_Button}`}>
|
||||||
<span className="icon">group</span>
|
<span className="icon">group</span>
|
||||||
<span>Characters</span>
|
<span>Characters</span>
|
||||||
</button>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
<Link href="/blog/" className={currentPage.includes("/blog/") ? styles.Main_List_CurrentLink : ""} tabIndex={-1}>
|
<Link href="/blog/" className={currentPage.includes("/blog/") ? styles.Main_List_CurrentLink : ""} tabIndex={-1}>
|
||||||
<button className={`fw ${styles.Main_List_Button}`}>
|
<div className={`fw ${styles.Main_List_Button}`}>
|
||||||
<span className="icon">description</span>
|
<span className="icon">description</span>
|
||||||
<span>Blog</span>
|
<span>Blog</span>
|
||||||
</button>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
<Link href="/gallery/" className={currentPage.includes("/gallery/") ? styles.Main_List_CurrentLink : ""} tabIndex={-1}>
|
<Link href="/gallery/" className={currentPage.includes("/gallery/") ? styles.Main_List_CurrentLink : ""} tabIndex={-1}>
|
||||||
<button className={`fw ${styles.Main_List_Button}`}>
|
<div className={`fw ${styles.Main_List_Button}`}>
|
||||||
<span className="icon">image</span>
|
<span className="icon">image</span>
|
||||||
<span>Gallery</span>
|
<span>Gallery</span>
|
||||||
</button>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
<Link href="/stories/" className={currentPage.includes("/stories/") ? styles.Main_List_CurrentLink : ""} tabIndex={-1}>
|
<Link href="/stories/" className={currentPage.includes("/stories/") ? styles.Main_List_CurrentLink : ""} tabIndex={-1}>
|
||||||
<button className={`fw ${styles.Main_List_Button}`}>
|
<div className={`fw ${styles.Main_List_Button}`}>
|
||||||
<span className="icon">book</span>
|
<span className="icon">book</span>
|
||||||
<span>Stories</span>
|
<span>Stories</span>
|
||||||
</button>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
<Link href="/links/" className={currentPage.includes("/links/") ? styles.Main_List_CurrentLink : ""} tabIndex={-1}>
|
<Link href="/links/" className={currentPage.includes("/links/") ? styles.Main_List_CurrentLink : ""} tabIndex={-1}>
|
||||||
<button className={`fw ${styles.Main_List_Button}`}>
|
<div className={`fw ${styles.Main_List_Button}`}>
|
||||||
<span className="icon">link</span>
|
<span className="icon">link</span>
|
||||||
<span>Links</span>
|
<span>Links</span>
|
||||||
</button>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
<Link href="/oao/" className={currentPage.includes("/oao/") ? styles.Main_List_CurrentLink : ""} tabIndex={-1}>
|
<Link href="/oao/" className={currentPage.includes("/oao/") ? styles.Main_List_CurrentLink : ""} tabIndex={-1}>
|
||||||
<button className={`fw ${styles.Main_List_Button}`}>
|
<div className={`fw ${styles.Main_List_Button}`}>
|
||||||
<span className="icon">campaign</span>
|
<span className="icon">campaign</span>
|
||||||
<span>Opinions & Objections</span>
|
<span>Opinions & Objections</span>
|
||||||
</button>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
<Link href="/about/" className={currentPage.includes("/about/") ? styles.Main_List_CurrentLink : ""} tabIndex={-1}>
|
<Link href="/about/" className={currentPage.includes("/about/") ? styles.Main_List_CurrentLink : ""} tabIndex={-1}>
|
||||||
<button className={`fw ${styles.Main_List_Button}`}>
|
<div className={`fw ${styles.Main_List_Button}`}>
|
||||||
<span className="icon">info</span>
|
<span className="icon">info</span>
|
||||||
<span>About</span>
|
<span>About</span>
|
||||||
</button>
|
</div>
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</>
|
</>
|
||||||
|
|
|
@ -78,7 +78,7 @@ button:hover {
|
||||||
opacity: 0.75;
|
opacity: 0.75;
|
||||||
}
|
}
|
||||||
|
|
||||||
button.fw {
|
div.fw {
|
||||||
padding: 8px;
|
padding: 8px;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-radius: 4px;
|
border-radius: 4px;
|
||||||
|
@ -86,11 +86,11 @@ button.fw {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
button.fw a {
|
div.fw a {
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
button.fw:hover {
|
div.fw:hover {
|
||||||
background-color: var(--bg-2);
|
background-color: var(--bg-2);
|
||||||
opacity: 1;
|
opacity: 1;
|
||||||
}
|
}
|
||||||
|
@ -102,3 +102,9 @@ img.headerImage {
|
||||||
image-rendering: crisp-edges;
|
image-rendering: crisp-edges;
|
||||||
background-color: var(--bg-1);
|
background-color: var(--bg-1);
|
||||||
}
|
}
|
||||||
|
.navigation {
|
||||||
|
margin: 16px 0;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
gap: 16px;
|
||||||
|
}
|
Loading…
Reference in a new issue