diff --git a/src/components/Layout/StoriesLayout.tsx b/src/components/Layout/StoriesLayout.tsx index fbfe793..b0985b2 100644 --- a/src/components/Layout/StoriesLayout.tsx +++ b/src/components/Layout/StoriesLayout.tsx @@ -9,15 +9,15 @@ const ITEMS = [ }, { label: "Characters", - href: "/database/stories/character", + href: "/database/stories/characters", }, { label: "EX characters", - href: "/database/stories/ex-character", + href: "/database/stories/ex-characters", }, { label: "Recollections of Dusk", - href: "/database/stories/rod-character", + href: "/database/stories/rod-characters", }, { label: "Events", @@ -30,6 +30,7 @@ const ITEMS = [ { label: "Hidden stories", href: "/database/stories/hidden-stories", + disabled: true, }, { label: "Lost archives", @@ -65,6 +66,7 @@ export default function StoriesLayout({ children }): JSX.Element { href={item.href} className={classNames( "flex items-center justify-center text-center p-4 transition-colors ease-out-cubic relative bordered", + item.disabled ? "pointer-events-none opacity-40" : "", router.asPath.includes(item.href) ? "active bg-beige active" : "bg-grey-lighter" diff --git a/src/pages/database/stories/anecdotes.tsx b/src/pages/database/stories/anecdotes.tsx new file mode 100644 index 0000000..116e610 --- /dev/null +++ b/src/pages/database/stories/anecdotes.tsx @@ -0,0 +1,102 @@ +import Layout from "@components/Layout"; +import Meta from "@components/Meta"; +import Link from "next/link"; +import SVG from "react-inlinesvg"; +import prisma from "@libs/prisma"; +import { card_story } from "@prisma/client"; +import { CDN_URL } from "@config/constants"; +import { useState } from "react"; +import { FormControl, InputLabel, MenuItem, Select } from "@mui/material"; +import Squares from "@components/decorations/Squares"; +import StoriesLayout from "@components/Layout/StoriesLayout"; + +interface Props { + anecdotes: card_story[]; +} + +export default function DatabaseStories({ anecdotes }: Props): JSX.Element { + const [anecdoteIndex, setAnecdoteIndex] = useState(anecdotes[0].id); + + return ( + + + + + + +
+
+ + Anecdote + + +
+ +
+ + {anecdotes + .filter((anecdote) => anecdote.id === anecdoteIndex) + .map((anecdote) => ( +
+ {anecdote.stories.map(({ story, image_path }, index) => ( +
+ {`Story +

+
+ ))} +
+ ))} +
+
+
+
+ ); +} + +export async function getStaticProps() { + const anecdotes = await prisma.dump.card_story.findMany(); + + return { + props: JSON.parse( + JSON.stringify({ + anecdotes, + }) + ), + }; +} diff --git a/src/pages/database/stories/characters.tsx b/src/pages/database/stories/characters.tsx new file mode 100644 index 0000000..36e9aee --- /dev/null +++ b/src/pages/database/stories/characters.tsx @@ -0,0 +1,107 @@ +import Layout from "@components/Layout"; +import Meta from "@components/Meta"; +import Link from "next/link"; +import SVG from "react-inlinesvg"; +import prisma from "@libs/prisma"; +import { character } from "@prisma/client"; +import { CDN_URL } from "@config/constants"; +import { useState } from "react"; +import { FormControl, InputLabel, MenuItem, Select } from "@mui/material"; +import Squares from "@components/decorations/Squares"; +import StoriesLayout from "@components/Layout/StoriesLayout"; + +interface Props { + characters: character[]; +} + +export default function DatabaseStories({ characters }: Props): JSX.Element { + const [characterIndex, setCharacterIndex] = useState( + characters[0].character_id + ); + + return ( + + + + + + +
+
+ + Character + + +
+ +
+ + {characters + .filter((character) => character.character_id === characterIndex) + .map((character) => ( +
+ {character.character_stories.map( + ({ story, image_path }, index) => ( +
+ {`Story +

+
+ ) + )} +
+ ))} +
+
+
+
+ ); +} + +export async function getStaticProps() { + const characters = await prisma.dump.character.findMany(); + + return { + props: JSON.parse( + JSON.stringify({ + characters: characters.filter( + (character) => character.character_stories.length > 0 + ), + }) + ), + }; +} diff --git a/src/pages/database/stories/companions.tsx b/src/pages/database/stories/companions.tsx index 159fa06..7733f0d 100644 --- a/src/pages/database/stories/companions.tsx +++ b/src/pages/database/stories/companions.tsx @@ -11,6 +11,7 @@ import { Box } from "@mui/system"; import { StoriesNavbar } from "./index"; import { useSettingsStore } from "@store/settings"; import CompanionThumbnail from "@components/CompanionThumbnail"; +import StoriesLayout from "@components/Layout/StoriesLayout"; interface DatabaseStoriesCompanionsProps { companions: companion[]; @@ -56,11 +57,7 @@ export default function DatabaseStoriesCompanions({ cover="https://nierrein.guide/cover-stories.jpg" /> -
-

Companions stories

- - - +
{ @@ -127,7 +124,7 @@ export default function DatabaseStoriesCompanions({
))} -
+ ); } diff --git a/src/pages/database/stories/costumes.tsx b/src/pages/database/stories/costumes.tsx index 12ed2a4..57aa475 100644 --- a/src/pages/database/stories/costumes.tsx +++ b/src/pages/database/stories/costumes.tsx @@ -18,6 +18,7 @@ import { NextPageContext } from "next"; import { Box } from "@mui/system"; import { StoriesNavbar } from "./index"; import { useSettingsStore } from "@store/settings"; +import StoriesLayout from "@components/Layout/StoriesLayout"; interface DatabaseStoriesCostumesProps { costumes: costume[]; @@ -96,11 +97,7 @@ export default function DatabaseStoriesCostumes({ cover="https://nierrein.guide/cover-stories.jpg" /> -
-

Costumes stories

- - - +
{ @@ -164,7 +161,6 @@ export default function DatabaseStoriesCostumes({ />
-
{costumes .filter((costume) => { @@ -215,7 +211,7 @@ export default function DatabaseStoriesCostumes({
)} -
+ ); } diff --git a/src/pages/database/stories/events.tsx b/src/pages/database/stories/events.tsx new file mode 100644 index 0000000..8f933d7 --- /dev/null +++ b/src/pages/database/stories/events.tsx @@ -0,0 +1,108 @@ +import Layout from "@components/Layout"; +import Meta from "@components/Meta"; +import Link from "next/link"; +import SVG from "react-inlinesvg"; +import prisma from "@libs/prisma"; +import { event } from "@prisma/client"; +import { CDN_URL } from "@config/constants"; +import { useState } from "react"; +import { FormControl, InputLabel, MenuItem, Select } from "@mui/material"; +import Squares from "@components/decorations/Squares"; +import StoriesLayout from "@components/Layout/StoriesLayout"; + +interface Props { + events: event[]; +} + +export default function DatabaseStories({ events }: Props): JSX.Element { + const [eventIndex, setEventIndex] = useState(events[0].id); + + return ( + + + + + + +
+
+ + Event + + +
+ +
+ + {events + .filter((event) => event.id === eventIndex) + .map((event) => ( +
+ {event.stories.map(({ story, image_path }, index) => ( +
+ {`Story +

+
+ ))} +
+ ))} +
+
+
+
+ ); +} + +export async function getStaticProps() { + const events = await prisma.dump.event.findMany(); + + return { + props: JSON.parse( + JSON.stringify({ + events, + }) + ), + }; +} diff --git a/src/pages/database/stories/ex-characters.tsx b/src/pages/database/stories/ex-characters.tsx new file mode 100644 index 0000000..9b4f7f4 --- /dev/null +++ b/src/pages/database/stories/ex-characters.tsx @@ -0,0 +1,105 @@ +import Layout from "@components/Layout"; +import Meta from "@components/Meta"; +import Link from "next/link"; +import SVG from "react-inlinesvg"; +import prisma from "@libs/prisma"; +import { character } from "@prisma/client"; +import { CDN_URL } from "@config/constants"; +import { useState } from "react"; +import { FormControl, InputLabel, MenuItem, Select } from "@mui/material"; +import Squares from "@components/decorations/Squares"; +import StoriesLayout from "@components/Layout/StoriesLayout"; + +interface Props { + characters: character[]; +} + +export default function DatabaseStories({ characters }: Props): JSX.Element { + const [characterIndex, setCharacterIndex] = useState( + characters[0].character_id + ); + + return ( + + + + + + +
+
+ + EX Character + + +
+ +
+ + {characters + .filter((character) => character.character_id === characterIndex) + .map((character) => ( +
+ {character.ex_stories.map(({ story, image_path }, index) => ( +
+ {`Story +

+
+ ))} +
+ ))} +
+
+
+
+ ); +} + +export async function getStaticProps() { + const characters = await prisma.dump.character.findMany(); + + return { + props: JSON.parse( + JSON.stringify({ + characters: characters.filter( + (character) => character.ex_stories.length > 0 + ), + }) + ), + }; +} diff --git a/src/pages/database/stories/lost-archives.tsx b/src/pages/database/stories/lost-archives.tsx new file mode 100644 index 0000000..680d2dc --- /dev/null +++ b/src/pages/database/stories/lost-archives.tsx @@ -0,0 +1,98 @@ +import Layout from "@components/Layout"; +import Meta from "@components/Meta"; +import Link from "next/link"; +import SVG from "react-inlinesvg"; +import prisma from "@libs/prisma"; +import { lost_archive } from "@prisma/client"; +import { CDN_URL } from "@config/constants"; +import { useState } from "react"; +import { FormControl, InputLabel, MenuItem, Select } from "@mui/material"; +import Squares from "@components/decorations/Squares"; +import StoriesLayout from "@components/Layout/StoriesLayout"; + +interface Props { + lostArchives: lost_archive[]; +} + +export default function DatabaseStories({ lostArchives }: Props): JSX.Element { + const [lostArchiveIndex, setLostArchiveIndex] = useState(lostArchives[0].id); + + return ( + + + + + + +
+
+ + Lost Archive + + +
+ +
+ + {lostArchives + .filter((lostArchive) => lostArchive.id === lostArchiveIndex) + .map((lostArchive) => ( +
+ {`${lostArchive.name} +

+
+ ))} +
+
+
+
+ ); +} + +export async function getStaticProps() { + const lostArchives = await prisma.dump.lost_archive.findMany(); + + return { + props: JSON.parse( + JSON.stringify({ + lostArchives, + }) + ), + }; +} diff --git a/src/pages/database/stories/main.tsx b/src/pages/database/stories/main.tsx index f89102b..02567d2 100644 --- a/src/pages/database/stories/main.tsx +++ b/src/pages/database/stories/main.tsx @@ -102,7 +102,7 @@ export default function DatabaseStories({
-
+
Arc { + setCharacterIndex(e.target.value); + }} + > + {characters.map((character) => ( + + {character.name} + + ))} + + +
+ +
+ + {characters + .filter((character) => character.character_id === characterIndex) + .map((character) => ( +
+ {character.rod_stories.map(({ story, image_path }, index) => ( +
+ {`Story +

+
+ ))} +
+ ))} +
+
+ + + ); +} + +export async function getStaticProps() { + const characters = await prisma.dump.character.findMany(); + + return { + props: JSON.parse( + JSON.stringify({ + characters: characters.filter( + (character) => character.rod_stories.length > 0 + ), + }) + ), + }; +} diff --git a/src/pages/database/stories/weapons.tsx b/src/pages/database/stories/weapons.tsx index 649a692..0d29215 100644 --- a/src/pages/database/stories/weapons.tsx +++ b/src/pages/database/stories/weapons.tsx @@ -17,6 +17,7 @@ import { Box } from "@mui/system"; import { StoriesNavbar } from "./index"; import WeaponThumbnail from "@components/WeaponThumbnail"; import { useSettingsStore } from "@store/settings"; +import StoriesLayout from "@components/Layout/StoriesLayout"; interface DatabaseStoriesWeaponsProps { weapons: (weapon & { @@ -82,11 +83,7 @@ export default function DatabaseStoriesWeapons({ cover="https://nierrein.guide/cover-stories.jpg" /> -
-

Weapons stories

- - - +
{ @@ -197,7 +194,7 @@ export default function DatabaseStoriesWeapons({
)}
- +
); }