diff --git a/components/common/MultiWeaponSelector.tsx b/components/common/MultiWeaponSelector.tsx index 97efb2ded..5c3b404f4 100644 --- a/components/common/MultiWeaponSelector.tsx +++ b/components/common/MultiWeaponSelector.tsx @@ -1,8 +1,7 @@ -import { Select, Tag, TagCloseButton, TagLabel } from "@chakra-ui/react"; -import { t } from "@lingui/macro"; +import { Tag, TagCloseButton, TagLabel } from "@chakra-ui/react"; import { useLingui } from "@lingui/react"; -import { salmonRunWeapons, weaponsWithHero } from "lib/lists/weaponsWithHero"; import WeaponImage from "./WeaponImage"; +import WeaponSelector from "./WeaponSelector"; interface Props { name?: string; @@ -12,19 +11,15 @@ interface Props { } const MultiWeaponSelector: React.FC = ({ - name, value, onChange, isSalmonRun, }) => { const { i18n } = useLingui(); - const weaponsArray: readonly string[] = isSalmonRun - ? salmonRunWeapons - : weaponsWithHero; return ( <> - + */} + { + if (!!selectedWeapon && !value.includes(selectedWeapon)) + onChange(value.concat(selectedWeapon)); + }} + pool={isSalmonRun ? "SALMON_RUN" : "WITH_ALTS"} + isDisabled={ + (isSalmonRun && value.length === 4) || + (!isSalmonRun && value.length === 5) + } + /> {value.map((wpn) => ( = ({ return undefined; }; - console.log({ borderColor }); - return ( = ({ @@ -22,7 +26,8 @@ const WeaponSelector: React.FC = ({ autoFocus, isMulti, menuIsOpen, - showAlts, + isDisabled, + pool, }) => { const { i18n } = useLingui(); const singleOption = (props: any) => ( @@ -38,27 +43,13 @@ const WeaponSelector: React.FC = ({ return ( ({ - label: i18n._(category.name), - options: category.weapons.map((weapon) => ({ - value: weapon, - label: i18n._(weapon), - })), - })) - : weaponsWithHeroCategorized.map((category) => ({ - label: i18n._(category.name), - options: category.weapons - .filter( - (wpn) => !wpn.includes("Hero") && !wpn.includes("Octo Shot") - ) - .map((weapon) => ({ - value: weapon, - label: i18n._(weapon), - })), - })) - } + options={getWeaponArray().map((category) => ({ + label: i18n._(category.name), + options: category.weapons.map((weapon) => ({ + value: weapon, + label: i18n._(weapon), + })), + }))} value={value ? { value, label: i18n._(value) } : undefined} setValue={setValue} isClearable={isClearable} @@ -70,8 +61,25 @@ const WeaponSelector: React.FC = ({ Option: singleOption, }} autoFocus={autoFocus} + isDisabled={isDisabled} /> ); + + function getWeaponArray() { + if (pool === "WITH_ALTS") return weaponsWithHeroCategorized; + if (pool === "SALMON_RUN") + return weaponsWithHeroCategorized.map((category) => ({ + ...category, + weapons: category.weapons.filter((wpn) => salmonRunWeapons.has(wpn)), + })); + + return weaponsWithHeroCategorized.map((category) => ({ + ...category, + weapons: category.weapons.filter( + (wpn) => !wpn.includes("Hero") && !wpn.includes("Octo Shot") + ), + })); + } }; export default WeaponSelector; diff --git a/components/sr/RotationSelector.tsx b/components/sr/RotationSelector.tsx index 5494858c7..f8be772f5 100644 --- a/components/sr/RotationSelector.tsx +++ b/components/sr/RotationSelector.tsx @@ -82,7 +82,6 @@ const RotationSelector: React.FC = ({ rotationId, setRotationId }) => { Weapons https://sendou.ink/markdown": "", - "Select weapon": "", - "Random": "", - "Random (Grizzco)": "", "Top 500": "", "Browser": "", "Tier Lists": "", @@ -66,6 +63,8 @@ "Mode": "Modus", "Month": "Monat", "Year": "Jahr", + "Random": "", + "Random (Grizzco)": "", "Selected rotation": "", "Change selection": "", "Stage": "", diff --git a/locale/el/messages.json b/locale/el/messages.json index caa744dff..33c9a5818 100644 --- a/locale/el/messages.json +++ b/locale/el/messages.json @@ -19,9 +19,6 @@ "Filter by ability": "Φιλτράρισμα ανά Ικανότητα", "Home": "", "Markdown is supported - <0>https://sendou.ink/markdown": "", - "Select weapon": "", - "Random": "", - "Random (Grizzco)": "", "Top 500": "", "Browser": "", "Tier Lists": "", @@ -66,6 +63,8 @@ "Mode": "Mode", "Month": "Μήνας", "Year": "Έτος", + "Random": "", + "Random (Grizzco)": "", "Selected rotation": "", "Change selection": "", "Stage": "", diff --git a/locale/en/messages.json b/locale/en/messages.json index 0e4829263..67769f3ca 100644 --- a/locale/en/messages.json +++ b/locale/en/messages.json @@ -19,9 +19,6 @@ "Filter by ability": "Filter by ability", "Home": "Home", "Markdown is supported - <0>https://sendou.ink/markdown": "Markdown is supported - <0>https://sendou.ink/markdown", - "Select weapon": "Select weapon", - "Random": "Random", - "Random (Grizzco)": "Random (Grizzco)", "Top 500": "Top 500", "Browser": "Browser", "Tier Lists": "Tier Lists", @@ -66,6 +63,8 @@ "Mode": "Mode", "Month": "Month", "Year": "Year", + "Random": "Random", + "Random (Grizzco)": "Random (Grizzco)", "Selected rotation": "Selected rotation", "Change selection": "Change selection", "Stage": "Stage", diff --git a/locale/es/messages.json b/locale/es/messages.json index 2ace30707..af5a6ccb5 100644 --- a/locale/es/messages.json +++ b/locale/es/messages.json @@ -19,9 +19,6 @@ "Filter by ability": "Filtrar por potenciador", "Home": "", "Markdown is supported - <0>https://sendou.ink/markdown": "", - "Select weapon": "", - "Random": "", - "Random (Grizzco)": "", "Top 500": "", "Browser": "", "Tier Lists": "", @@ -66,6 +63,8 @@ "Mode": "Modo", "Month": "Mes", "Year": "Año", + "Random": "", + "Random (Grizzco)": "", "Selected rotation": "", "Change selection": "", "Stage": "", diff --git a/locale/fr/messages.json b/locale/fr/messages.json index f0a34f52b..2c7acb9b5 100644 --- a/locale/fr/messages.json +++ b/locale/fr/messages.json @@ -19,9 +19,6 @@ "Filter by ability": "Filtrer par aptitudes", "Home": "", "Markdown is supported - <0>https://sendou.ink/markdown": "", - "Select weapon": "", - "Random": "", - "Random (Grizzco)": "", "Top 500": "", "Browser": "", "Tier Lists": "", @@ -66,6 +63,8 @@ "Mode": "Mode", "Month": "Mois", "Year": "Année", + "Random": "", + "Random (Grizzco)": "", "Selected rotation": "", "Change selection": "", "Stage": "", diff --git a/locale/it/messages.json b/locale/it/messages.json index dbdb84b46..f612f9381 100644 --- a/locale/it/messages.json +++ b/locale/it/messages.json @@ -19,9 +19,6 @@ "Filter by ability": "Filtra tramite abilità", "Home": "", "Markdown is supported - <0>https://sendou.ink/markdown": "", - "Select weapon": "", - "Random": "", - "Random (Grizzco)": "", "Top 500": "", "Browser": "", "Tier Lists": "", @@ -66,6 +63,8 @@ "Mode": "Modalità", "Month": "Mese", "Year": "Anno", + "Random": "", + "Random (Grizzco)": "", "Selected rotation": "", "Change selection": "", "Stage": "", diff --git a/locale/ja/messages.json b/locale/ja/messages.json index cc8b4d23c..afb9b5998 100644 --- a/locale/ja/messages.json +++ b/locale/ja/messages.json @@ -19,9 +19,6 @@ "Filter by ability": "", "Home": "", "Markdown is supported - <0>https://sendou.ink/markdown": "", - "Select weapon": "", - "Random": "", - "Random (Grizzco)": "", "Top 500": "", "Browser": "", "Tier Lists": "", @@ -66,6 +63,8 @@ "Mode": "", "Month": "", "Year": "", + "Random": "", + "Random (Grizzco)": "", "Selected rotation": "", "Change selection": "", "Stage": "", diff --git a/locale/ko/messages.json b/locale/ko/messages.json index ef86b1af2..094f8858a 100644 --- a/locale/ko/messages.json +++ b/locale/ko/messages.json @@ -19,9 +19,6 @@ "Filter by ability": "능력별로 거르기", "Home": "", "Markdown is supported - <0>https://sendou.ink/markdown": "", - "Select weapon": "", - "Random": "", - "Random (Grizzco)": "", "Top 500": "", "Browser": "", "Tier Lists": "", @@ -66,6 +63,8 @@ "Mode": "모드", "Month": "달", "Year": "년", + "Random": "", + "Random (Grizzco)": "", "Selected rotation": "", "Change selection": "", "Stage": "", diff --git a/locale/nl/messages.json b/locale/nl/messages.json index cc8b4d23c..afb9b5998 100644 --- a/locale/nl/messages.json +++ b/locale/nl/messages.json @@ -19,9 +19,6 @@ "Filter by ability": "", "Home": "", "Markdown is supported - <0>https://sendou.ink/markdown": "", - "Select weapon": "", - "Random": "", - "Random (Grizzco)": "", "Top 500": "", "Browser": "", "Tier Lists": "", @@ -66,6 +63,8 @@ "Mode": "", "Month": "", "Year": "", + "Random": "", + "Random (Grizzco)": "", "Selected rotation": "", "Change selection": "", "Stage": "", diff --git a/locale/pt/messages.json b/locale/pt/messages.json index adb0b3412..bc35bc853 100644 --- a/locale/pt/messages.json +++ b/locale/pt/messages.json @@ -19,9 +19,6 @@ "Filter by ability": "Filtrar por habilidade", "Home": "", "Markdown is supported - <0>https://sendou.ink/markdown": "", - "Select weapon": "", - "Random": "", - "Random (Grizzco)": "", "Top 500": "", "Browser": "", "Tier Lists": "", @@ -66,6 +63,8 @@ "Mode": "Modo", "Month": "Mês", "Year": "Ano", + "Random": "", + "Random (Grizzco)": "", "Selected rotation": "", "Change selection": "", "Stage": "", diff --git a/locale/ru/messages.json b/locale/ru/messages.json index cc8b4d23c..afb9b5998 100644 --- a/locale/ru/messages.json +++ b/locale/ru/messages.json @@ -19,9 +19,6 @@ "Filter by ability": "", "Home": "", "Markdown is supported - <0>https://sendou.ink/markdown": "", - "Select weapon": "", - "Random": "", - "Random (Grizzco)": "", "Top 500": "", "Browser": "", "Tier Lists": "", @@ -66,6 +63,8 @@ "Mode": "", "Month": "", "Year": "", + "Random": "", + "Random (Grizzco)": "", "Selected rotation": "", "Change selection": "", "Stage": "", diff --git a/locale/sv/messages.json b/locale/sv/messages.json index 09f93beda..6328cb720 100644 --- a/locale/sv/messages.json +++ b/locale/sv/messages.json @@ -19,9 +19,6 @@ "Filter by ability": "Filtrera efter effekt", "Home": "Hem", "Markdown is supported - <0>https://sendou.ink/markdown": "Markdown stöds - <0>https://sendou.ink/markdown", - "Select weapon": "Välj vapen", - "Random": "", - "Random (Grizzco)": "", "Top 500": "Topp 5000", "Browser": "Vy", "Tier Lists": "Trender", @@ -66,6 +63,8 @@ "Mode": "Spelläge", "Month": "Månad", "Year": "År", + "Random": "", + "Random (Grizzco)": "", "Selected rotation": "", "Change selection": "", "Stage": "",