From f734cf6daaf5d38d5aa3f0fd01e2f9ae07f60353 Mon Sep 17 00:00:00 2001 From: KeziahMoselle Date: Sat, 6 May 2023 01:32:33 +0200 Subject: [PATCH] feat: add other stories --- src/components/Layout/StoriesLayout.tsx | 8 +- src/pages/database/stories/anecdotes.tsx | 102 +++++++++++++++++ src/pages/database/stories/characters.tsx | 107 +++++++++++++++++ src/pages/database/stories/companions.tsx | 9 +- src/pages/database/stories/costumes.tsx | 10 +- src/pages/database/stories/events.tsx | 108 ++++++++++++++++++ src/pages/database/stories/ex-characters.tsx | 105 +++++++++++++++++ src/pages/database/stories/lost-archives.tsx | 98 ++++++++++++++++ src/pages/database/stories/main.tsx | 4 +- src/pages/database/stories/memoirs.tsx | 9 +- src/pages/database/stories/rod-characters.tsx | 105 +++++++++++++++++ src/pages/database/stories/weapons.tsx | 9 +- 12 files changed, 643 insertions(+), 31 deletions(-) create mode 100644 src/pages/database/stories/anecdotes.tsx create mode 100644 src/pages/database/stories/characters.tsx create mode 100644 src/pages/database/stories/events.tsx create mode 100644 src/pages/database/stories/ex-characters.tsx create mode 100644 src/pages/database/stories/lost-archives.tsx create mode 100644 src/pages/database/stories/rod-characters.tsx diff --git a/src/components/Layout/StoriesLayout.tsx b/src/components/Layout/StoriesLayout.tsx index fbfe793f..b0985b21 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 00000000..116e610d --- /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 00000000..36e9aee3 --- /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 159fa067..7733f0d1 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 12ed2a4a..57aa4753 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 00000000..8f933d72 --- /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 00000000..9b4f7f49 --- /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 00000000..680d2dcd --- /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 f89102be..02567d29 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 649a6923..0d29215f 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({
)}
- +
); }