diff --git a/components/common/MultiWeaponSelector.tsx b/components/common/MultiWeaponSelector.tsx index eed749feb..97efb2ded 100644 --- a/components/common/MultiWeaponSelector.tsx +++ b/components/common/MultiWeaponSelector.tsx @@ -1,17 +1,27 @@ import { Select, Tag, TagCloseButton, TagLabel } from "@chakra-ui/react"; import { t } from "@lingui/macro"; import { useLingui } from "@lingui/react"; -import { weaponsWithHero } from "lib/lists/weaponsWithHero"; +import { salmonRunWeapons, weaponsWithHero } from "lib/lists/weaponsWithHero"; import WeaponImage from "./WeaponImage"; interface Props { - name: string; + name?: string; value: string[]; onChange: (value: string[]) => void; + isSalmonRun?: boolean; } -const MultiWeaponSelector: React.FC = ({ name, value, onChange }) => { +const MultiWeaponSelector: React.FC = ({ + name, + value, + onChange, + isSalmonRun, +}) => { const { i18n } = useLingui(); + + const weaponsArray: readonly string[] = isSalmonRun + ? salmonRunWeapons + : weaponsWithHero; return ( <> setStage(e.target.value)} + > + {salmonRunStages.map((stage) => ( + + ))} + + + + Weapons + + + + {filteredRotations && ( + + + Rotation + + + + )} + + ); + + function getFilteredRotations() { + if (!data) return null; + if (!stage || weapons.length < 1) return null; + return data.filter((rotation) => { + return ( + rotation.stage === stage && + weapons.every((wpn) => rotation.weapons.includes(wpn)) + ); + }); + } +}; + +export default RotationSelector; diff --git a/lib/lists/weaponsWithHero.ts b/lib/lists/weaponsWithHero.ts index 1ac5c3602..d015352ac 100644 --- a/lib/lists/weaponsWithHero.ts +++ b/lib/lists/weaponsWithHero.ts @@ -142,6 +142,59 @@ export const weaponsWithHero = [ "Kensa Undercover Brella", ] as const; +export const salmonRunWeapons = [ + "Sploosh-o-matic", + "Splattershot Jr.", + "Splash-o-matic", + "Aerospray MG", + "Splattershot", + ".52 Gal", + "N-ZAP '85", + "Splattershot Pro", + ".96 Gal", + "Jet Squelcher", + "L-3 Nozzlenose", + "H-3 Nozzlenose", + "Squeezer", + "Luna Blaster", + "Blaster", + "Range Blaster", + "Rapid Blaster", + "Rapid Blaster Pro", + "Clash Blaster", + "Carbon Roller", + "Splat Roller", + "Dynamo Roller", + "Flingza Roller", + "Inkbrush", + "Octobrush", + "Classic Squiffer", + "Splat Charger", + "Splatterscope", + "E-liter 4K", + "E-liter 4K Scope", + "Bamboozler 14 Mk I", + "Goo Tuber", + "Slosher", + "Tri-Slosher", + "Sloshing Machine", + "Bloblobber", + "Explosher", + "Mini Splatling", + "Heavy Splatling", + "Hydra Splatling", + "Ballpoint Splatling", + "Nautilus 47", + "Dapple Dualies", + "Splat Dualies", + "Glooga Dualies", + "Dualie Squelchers", + "Dark Tetra Dualies", + "Splat Brella", + "Tenta Brella", + "Undercover Brella", +] as const; + export const weaponsWithHeroCategorized: readonly { name: string; weapons: readonly string[]; diff --git a/pages/api/sr/rotations.ts b/pages/api/sr/rotations.ts index f6683179b..7bfa46aba 100644 --- a/pages/api/sr/rotations.ts +++ b/pages/api/sr/rotations.ts @@ -1,18 +1,12 @@ import { NextApiRequest, NextApiResponse } from "next"; -import prisma from "prisma/client"; +import { getAllSalmonRunRotations } from "prisma/queries/getAllSalmonRunRotations"; const rotationsHandler = async (req: NextApiRequest, res: NextApiResponse) => { if (req.method !== "GET") { return res.status(405).end(); } - const rotations = await prisma.salmonRunRotation.findMany({ - where: { startTime: { lt: new Date() } }, - orderBy: { id: "desc" }, - select: { id: true, startTime: true, weapons: true, stage: true }, - }); - - res.status(200).json(rotations); + res.status(200).json(await getAllSalmonRunRotations()); }; export default rotationsHandler; diff --git a/pages/sr/leaderboards.tsx b/pages/sr/leaderboards.tsx new file mode 100644 index 000000000..215456e2a --- /dev/null +++ b/pages/sr/leaderboards.tsx @@ -0,0 +1,23 @@ +import { Button } from "@chakra-ui/react"; +import { t, Trans } from "@lingui/macro"; +import Breadcrumbs from "components/common/Breadcrumbs"; +import AddRecordModal from "components/sr/AddRecordModal"; +import { useState } from "react"; + +const SalmonRunLeaderboardsPage = ({}) => { + const [showModal, setShowModal] = useState(true); + + return ( + <> + {showModal && setShowModal(false)} />} + + + + ); +}; + +export default SalmonRunLeaderboardsPage; diff --git a/prisma/queries/getAllSalmonRunRotations.ts b/prisma/queries/getAllSalmonRunRotations.ts new file mode 100644 index 000000000..8c2ff6995 --- /dev/null +++ b/prisma/queries/getAllSalmonRunRotations.ts @@ -0,0 +1,13 @@ +import { Prisma } from "@prisma/client"; +import prisma from "prisma/client"; + +export type GetAllSalmonRunRotationsData = Prisma.PromiseReturnType< + typeof getAllSalmonRunRotations +>; + +export const getAllSalmonRunRotations = async () => + prisma.salmonRunRotation.findMany({ + where: { startTime: { lt: new Date() } }, + orderBy: { id: "desc" }, + select: { id: true, startTime: true, weapons: true, stage: true }, + }); diff --git a/public/weapons/RANDOM.png b/public/weapons/RANDOM.png new file mode 100644 index 000000000..04eee67de Binary files /dev/null and b/public/weapons/RANDOM.png differ diff --git a/public/weapons/RANDOM_GRIZZCO.png b/public/weapons/RANDOM_GRIZZCO.png new file mode 100644 index 000000000..db8ea4afd Binary files /dev/null and b/public/weapons/RANDOM_GRIZZCO.png differ