From de9aefa996bf60eb048d7c3612a53f9e17f4bbac Mon Sep 17 00:00:00 2001 From: Remmy Cat Stock <3317423+remmycat@users.noreply.github.com> Date: Sun, 23 Oct 2022 16:12:49 +0200 Subject: [PATCH] Unify MapPoolSelector components --- .../components/MapPoolSelector.tsx | 2 +- app/routes/calendar/$id/index.tsx | 2 +- app/routes/calendar/new.tsx | 2 +- app/routes/maps.tsx | 68 +------------------ 4 files changed, 5 insertions(+), 69 deletions(-) rename app/{routes/calendar => }/components/MapPoolSelector.tsx (97%) diff --git a/app/routes/calendar/components/MapPoolSelector.tsx b/app/components/MapPoolSelector.tsx similarity index 97% rename from app/routes/calendar/components/MapPoolSelector.tsx rename to app/components/MapPoolSelector.tsx index 62215babf..a9c54813c 100644 --- a/app/routes/calendar/components/MapPoolSelector.tsx +++ b/app/components/MapPoolSelector.tsx @@ -19,7 +19,7 @@ export function MapPoolSelector({ stageId: StageId; }) => void; }) { - const { t } = useTranslation(["game-misc", "calendar"]); + const { t } = useTranslation(["game-misc"]); const isPresentational = !handleMapPoolChange; diff --git a/app/routes/calendar/$id/index.tsx b/app/routes/calendar/$id/index.tsx index 714e686c8..4e2b27a66 100644 --- a/app/routes/calendar/$id/index.tsx +++ b/app/routes/calendar/$id/index.tsx @@ -39,7 +39,7 @@ import { userPage, } from "~/utils/urls"; import { actualNumber, id } from "~/utils/zod"; -import { MapPoolSelector } from "../components/MapPoolSelector"; +import { MapPoolSelector } from "~/components/MapPoolSelector"; import { Tags } from "../components/Tags"; export const links: LinksFunction = () => { diff --git a/app/routes/calendar/new.tsx b/app/routes/calendar/new.tsx index af102411e..0c5c850cd 100644 --- a/app/routes/calendar/new.tsx +++ b/app/routes/calendar/new.tsx @@ -58,7 +58,7 @@ import { safeJSONParse, toArray, } from "~/utils/zod"; -import { MapPoolSelector } from "./components/MapPoolSelector"; +import { MapPoolSelector } from "~/components/MapPoolSelector"; import { Tags } from "./components/Tags"; const MIN_DATE = new Date(Date.UTC(2015, 4, 28)); diff --git a/app/routes/maps.tsx b/app/routes/maps.tsx index ff152df1a..2cf364247 100644 --- a/app/routes/maps.tsx +++ b/app/routes/maps.tsx @@ -7,20 +7,17 @@ import type { import type { ShouldReloadFunction } from "@remix-run/react"; import { Link } from "@remix-run/react"; import { useLoaderData, useSearchParams } from "@remix-run/react"; -import clsx from "clsx"; import * as React from "react"; import { useTranslation } from "react-i18next"; import { useCopyToClipboard } from "react-use"; import invariant from "tiny-invariant"; import { Button } from "~/components/Button"; -import { Image } from "~/components/Image"; import { Label } from "~/components/Label"; import { Main } from "~/components/Main"; import { Toggle } from "~/components/Toggle"; import { db } from "~/db"; import { i18next } from "~/modules/i18n"; import { - modes, stageIds, type ModeShort, type ModeWithStage, @@ -38,13 +35,9 @@ import { import type { MapPool } from "~/modules/map-pool-serializer/types"; import styles from "~/styles/maps.css"; import { makeTitle } from "~/utils/strings"; -import { - calendarEventPage, - ipLabsMaps, - modeImageUrl, - stageImageUrl, -} from "~/utils/urls"; +import { calendarEventPage, ipLabsMaps } from "~/utils/urls"; import { type SendouRouteHandle } from "~/utils/remix"; +import { MapPoolSelector } from "~/components/MapPoolSelector"; const AMOUNT_OF_MAPS_IN_MAP_LIST = stageIds.length * 2; @@ -180,63 +173,6 @@ function useSearchParamMapPool() { }; } -function MapPoolSelector({ - mapPool, - handleMapPoolChange, -}: { - mapPool: MapPool; - handleMapPoolChange: (args: { mode: ModeShort; stageId: StageId }) => void; -}) { - const { t } = useTranslation(["game-misc"]); - - return ( -