diff --git a/components/WeaponSearchFilterBar/index.tsx b/components/WeaponSearchFilterBar/index.tsx index e75f6ec4..09047988 100644 --- a/components/WeaponSearchFilterBar/index.tsx +++ b/components/WeaponSearchFilterBar/index.tsx @@ -15,12 +15,8 @@ import { emptyRarityState, emptyWeaponSeriesState, } from '~utils/emptyStates' -import { - elements, - proficiencies, - rarities, - weaponSeries, -} from '~utils/stateValues' +import { elements, proficiencies, rarities } from '~utils/stateValues' +import { weaponSeries } from '~utils/weaponSeries' interface Props { sendFilters: (filters: { [key: string]: number[] }) => void @@ -128,6 +124,45 @@ const WeaponSearchFilterBar = (props: Props) => { props.sendFilters(filters) } + const renderWeaponSeries = () => { + const numColumns = 3 + return ( + + {Array.from({ length: numColumns }, () => 0).map((x, i) => { + return renderWeaponSeriesGroup(i) + })} + + ) + } + + const renderWeaponSeriesGroup = (index: number) => { + return ( + + {weaponSeries + .slice( + index * Math.ceil(weaponSeries.length / 3), + (index + 1) * Math.ceil(weaponSeries.length / 3) + ) + .map((x, i) => { + return renderSingleWeaponSeries(x.id, x.slug) + })} + + ) + } + + const renderSingleWeaponSeries = (id: number, slug: string) => { + return ( + + {t(`series.${slug}`)} + + ) + } + useEffect(() => { sendFilters() }, [rarityState, elementState, proficiencyState, seriesState]) @@ -254,58 +289,7 @@ const WeaponSearchFilterBar = (props: Props) => { {t('filters.labels.series')} -
- - {Array.from(Array(weaponSeries.length / 3)).map((x, i) => { - return ( - - {t(`series.${weaponSeries[i]}`)} - - ) - })} - - - {Array.from(Array(weaponSeries.length / 3)).map((x, i) => { - return ( - - {t(`series.${weaponSeries[i + weaponSeries.length / 3]}`)} - - ) - })} - - - {Array.from(Array(weaponSeries.length / 3)).map((x, i) => { - return ( - - {t( - `series.${weaponSeries[i + 2 * (weaponSeries.length / 3)]}` - )} - - ) - })} - -
+
{renderWeaponSeries()}
) diff --git a/public/locales/en/common.json b/public/locales/en/common.json index 483638e1..4c33cec2 100644 --- a/public/locales/en/common.json +++ b/public/locales/en/common.json @@ -100,7 +100,7 @@ "bahamut": "Bahamut", "epic": "Epic", "ennead": "Ennead", - "cosmos": "Cosmos", + "cosmic": "Cosmic", "ancestral": "Ancestral", "superlative": "Superlative", "vintage": "Vintage", @@ -109,7 +109,8 @@ "new_world": "New World Foundation", "revenant": "Revenant", "proving": "Proving Grounds", - "disaster": "Disaster" + "disaster": "Disaster", + "illustrious": "Illustrious" }, "recency": { "all_time": "All time", diff --git a/public/locales/ja/common.json b/public/locales/ja/common.json index 9b2b7114..160f156e 100644 --- a/public/locales/ja/common.json +++ b/public/locales/ja/common.json @@ -100,7 +100,7 @@ "bahamut": "バハムートウェポン", "epic": "エピックウェポン", "ennead": "エニアドシリーズ", - "cosmos": "コスモスシリーズ", + "cosmic": "コスモスシリーズ", "ancestral": "アンセスタルシリーズ", "superlative": "スペリオシリーズ", "vintage": "ヴィンテージシリーズ", @@ -109,7 +109,8 @@ "new_world": "新世界の礎", "revenant": "天星器", "proving": "ブレイブグラウンド", - "disaster": "災害シリーズ" + "disaster": "災害シリーズ", + "luminous": "ルミナス" }, "recency": { "all_time": "全ての期間", diff --git a/utils/emptyStates.tsx b/utils/emptyStates.tsx index ae134f44..f0e3270e 100644 --- a/utils/emptyStates.tsx +++ b/utils/emptyStates.tsx @@ -100,12 +100,16 @@ export const emptyWeaponSeriesState: WeaponSeriesState = { id: 3, checked: false, }, - ultima: { - id: 17, + revenant: { + id: 4, checked: false, }, - bahamut: { - id: 16, + primal: { + id: 6, + checked: false, + }, + beast: { + id: 7, checked: false, }, regalia: { @@ -116,10 +120,6 @@ export const emptyWeaponSeriesState: WeaponSeriesState = { id: 9, checked: false, }, - primal: { - id: 6, - checked: false, - }, olden_primal: { id: 10, checked: false, @@ -128,26 +128,30 @@ export const emptyWeaponSeriesState: WeaponSeriesState = { id: 11, checked: false, }, - beast: { - id: 7, - checked: false, - }, - rose: { - id: 15, + hollowsky: { + id: 12, checked: false, }, xeno: { id: 13, checked: false, }, - hollowsky: { - id: 12, - checked: false, - }, astral: { id: 14, checked: false, }, + rose: { + id: 15, + checked: false, + }, + bahamut: { + id: 16, + checked: false, + }, + ultima: { + id: 17, + checked: false, + }, epic: { id: 18, checked: false, @@ -156,7 +160,7 @@ export const emptyWeaponSeriesState: WeaponSeriesState = { id: 19, checked: false, }, - cosmos: { + cosmic: { id: 20, checked: false, }, @@ -176,6 +180,10 @@ export const emptyWeaponSeriesState: WeaponSeriesState = { id: 24, checked: false, }, + proving: { + id: 25, + checked: false, + }, sephira: { id: 28, checked: false, @@ -184,6 +192,14 @@ export const emptyWeaponSeriesState: WeaponSeriesState = { id: 29, checked: false, }, + disaster: { + id: 30, + checked: false, + }, + illustrious: { + id: 31, + checked: false, + }, } export const emptyPaginationObject = { diff --git a/utils/weaponSeries.tsx b/utils/weaponSeries.tsx index 5c53e65c..84b7b9f8 100644 --- a/utils/weaponSeries.tsx +++ b/utils/weaponSeries.tsx @@ -116,4 +116,8 @@ export const weaponSeries: WeaponSeries[] = [ id: 30, slug: 'disaster', }, + { + id: 31, + slug: 'illustrious', + }, ]