Update 6.6 data

This commit is contained in:
Sakura Knoll
2023-05-23 19:17:05 +09:00 Unverified
parent 07357fe6a9
commit c168e95224
35 changed files with 1084 additions and 213 deletions
+62 -47
View File
@@ -39,100 +39,100 @@ export const battlesuitFeatures = [
icon: 'feature-icons/physical',
value: 'physical',
label: 'Physical',
krLabel: '물리',
krLabel: '물리'
},
{
icon: 'feature-icons/fire-dmg',
value: 'fire-dmg',
label: 'Fire DMG',
krLabel: '화염 대미지',
krLabel: '화염 대미지'
},
{
icon: 'feature-icons/ice-dmg',
value: 'ice-dmg',
label: 'Ice DMG',
krLabel: '빙결 대미지',
krLabel: '빙결 대미지'
},
{
icon: 'feature-icons/lightning-dmg',
value: 'lightning-dmg',
label: 'Lightning DMG',
krLabel: '뇌전 대미지',
krLabel: '뇌전 대미지'
},
{
icon: 'feature-icons/freeze',
value: 'freeze',
label: 'Freeze',
krLabel: '빙결',
krLabel: '빙결'
},
{
icon: 'feature-icons/paralyze',
value: 'paralyze',
label: 'Paralyze',
krLabel: '마비',
krLabel: '마비'
},
{ icon: 'feature-icons/stun', value: 'stun', label: 'Stun', krLabel: '기절' },
{
icon: 'feature-icons/ignite',
value: 'ignite',
label: 'Ignite',
krLabel: '점화',
krLabel: '점화'
},
{
icon: 'feature-icons/bleed',
value: 'bleed',
label: 'Bleed',
krLabel: '출혈',
krLabel: '출혈'
},
{
icon: 'feature-icons/heavy-atk',
value: 'heavy-atk',
label: 'Heavy ATK',
krLabel: '강타',
krLabel: '강타'
},
{
icon: 'feature-icons/weaken',
value: 'weaken',
label: 'Weaken',
krLabel: '허약',
krLabel: '허약'
},
{
icon: 'feature-icons/impair',
value: 'impair',
label: 'Impair',
krLabel: '취약',
krLabel: '취약'
},
{
icon: 'feature-icons/time-mastery',
value: 'time-mastery',
label: 'Time Mastery',
krLabel: '시공',
krLabel: '시공'
},
{
icon: 'feature-icons/gather',
value: 'gather',
label: 'Gather',
krLabel: '흡인',
krLabel: '흡인'
},
{ icon: 'feature-icons/heal', value: 'heal', label: 'Heal', krLabel: '치료' },
{
icon: 'feature-icons/fast-atk',
value: 'fast-atk',
label: 'Fast ATK',
krLabel: '높은 빈도',
krLabel: '높은 빈도'
},
{
icon: 'feature-icons/burst',
value: 'burst',
label: 'Burst',
krLabel: '폭발, 버스트',
krLabel: '폭발, 버스트'
},
{
icon: 'feature-icons/aerial',
value: 'aerial',
label: 'Aerial',
krLabel: '대공',
},
krLabel: '대공'
}
]
export const battlesuitTypes = [
@@ -141,26 +141,26 @@ export const battlesuitTypes = [
value: 'biologic',
icon: 'type-icons/biologic',
label: 'Biologic',
krLabel: '생물',
krLabel: '생물'
},
{
value: 'psychic',
icon: 'type-icons/psychic',
label: 'Psychic',
krLabel: '이능',
krLabel: '이능'
},
{
value: 'quantum',
icon: 'type-icons/quantum',
label: 'Quantum',
krLabel: '양자',
krLabel: '양자'
},
{
value: 'imaginary',
icon: 'type-icons/imaginary',
label: 'Imaginary',
krLabel: '허수',
},
krLabel: '허수'
}
]
export const valkyries = [
@@ -168,138 +168,153 @@ export const valkyries = [
value: 'kiana',
icon: 'valkyrie-icons/kiana',
label: 'Kiana',
krLabel: '키아나',
krLabel: '키아나'
},
{ value: 'mei', icon: 'valkyrie-icons/mei', label: 'Mei', krLabel: '메이' },
{
value: 'bronya',
icon: 'valkyrie-icons/bronya',
label: 'Bronya',
krLabel: '브로냐',
krLabel: '브로냐'
},
{
value: 'himeko',
icon: 'valkyrie-icons/himeko',
label: 'Himeko',
krLabel: '히메코',
krLabel: '히메코'
},
{
value: 'theresa',
icon: 'valkyrie-icons/theresa',
label: 'Theresa',
krLabel: '테레사',
krLabel: '테레사'
},
{
value: 'fuhua',
icon: 'valkyrie-icons/fuhua',
label: 'Fu Hua',
krLabel: '후카',
krLabel: '후카'
},
{
value: 'rita',
icon: 'valkyrie-icons/rita',
label: 'Rita',
krLabel: '리타',
krLabel: '리타'
},
{
value: 'sakura',
icon: 'valkyrie-icons/sakura',
label: 'Sakura',
krLabel: '야에 사쿠라',
krLabel: '야에 사쿠라'
},
{
value: 'kallen',
icon: 'valkyrie-icons/kallen',
label: 'Kallen',
krLabel: '카렌',
krLabel: '카렌'
},
{
value: 'olenyevas',
icon: 'valkyrie-icons/olenyevas',
label: 'Olenyevas',
krLabel: '아린 자매',
krLabel: '아린 자매'
},
{
value: 'seele',
icon: 'valkyrie-icons/seele',
label: 'Seele',
krLabel: '제레',
krLabel: '제레'
},
{
value: 'durandal',
icon: 'valkyrie-icons/durandal',
label: 'Durandal',
krLabel: '듀란달',
krLabel: '듀란달'
},
{
value: 'fischl',
icon: 'valkyrie-icons/fischl',
label: 'Fischl',
krLabel: '피슬',
krLabel: '피슬'
},
{
value: 'elysia',
icon: 'valkyrie-icons/elysia',
label: 'Elysia',
krLabel: '엘리시아',
krLabel: '엘리시아'
},
{
value: 'mobius',
icon: 'valkyrie-icons/mobius',
label: 'Mobius',
krLabel: '뫼비우스',
krLabel: '뫼비우스'
},
{
value: 'raven',
icon: 'valkyrie-icons/raven',
label: 'Raven',
krLabel: '레이븐',
krLabel: '레이븐'
},
{
value: 'carole',
icon: 'valkyrie-icons/carole',
label: 'Carole',
krLabel: '캐롤',
krLabel: '캐롤'
},
{
value: 'pardofelis',
icon: 'valkyrie-icons/pardofelis',
label: 'Pardofelis',
krLabel: '파르도 필리스',
krLabel: '파르도 필리스'
},
{
value: 'aponia',
icon: 'valkyrie-icons/aponia',
label: 'Aponia',
krLabel: '아포니아',
krLabel: '아포니아'
},
{
value: 'eden',
icon: 'valkyrie-icons/eden',
label: 'Eden',
krLabel: '에덴',
krLabel: '에덴'
},
{
value: 'griseo',
icon: 'valkyrie-icons/griseo',
label: 'Griseo',
krLabel: '그리세오',
krLabel: '그리세오'
},
{
value: 'vill-v',
icon: 'valkyrie-icons/vill-v',
label: 'Vill-V',
krLabel: '빌-브이',
krLabel: '빌-브이'
},
{
value: 'sushang',
icon: 'valkyrie-icons/sushang',
label: 'Sushang',
krLabel: '이소상',
krLabel: '이소상'
},
{
value: 'asuka',
label: 'Asuka',
krLabel: '아스카',
value: 'ai',
label: 'Ai',
krLabel: '아이'
},
{
value: 'susannah',
label: 'Susannah',
krLabel: '수잔나'
},
{
value: 'misteln',
label: 'Misteln',
krLabel: '미스테린'
},
{
value: 'prometheus',
label: 'PROMETHEUS',
krLabel: '프로메테우스'
}
]
+5 -1
View File
@@ -60,8 +60,12 @@ export const erVersions = [
battlesuits: ['hof', 'hoo']
},
{
version: '6.4',
version: '6.5',
battlesuits: ['vq', 'sk']
},
{
version: '6.6',
battlesuits: ['dw', 'ta']
}
].reverse()
+16 -10
View File
@@ -21,6 +21,7 @@ export interface WeaponData {
| 'gauntlet'
| 'bow'
| 'chakram'
| 'javelin'
rarity: number
skills: WeaponSkill[]
version?: string
@@ -39,60 +40,65 @@ export const weaponCategories = [
value: 'pistol',
label: 'Pistols',
krLabel: '쌍권총',
icon: 'weapon-icons/weapon-pistol',
icon: 'weapon-icons/weapon-pistol'
},
{
value: 'katana',
label: 'Katanas',
krLabel: '태도',
icon: 'weapon-icons/weapon-katana',
icon: 'weapon-icons/weapon-katana'
},
{
value: 'cannon',
label: 'Cannons',
krLabel: '대포',
icon: 'weapon-icons/weapon-cannon',
icon: 'weapon-icons/weapon-cannon'
},
{
value: 'greatsword',
label: 'Greatswords',
krLabel: '대검',
icon: 'weapon-icons/weapon-claymore',
icon: 'weapon-icons/weapon-claymore'
},
{
value: 'cross',
label: 'Crosses',
krLabel: '십자가',
icon: 'weapon-icons/weapon-cross',
icon: 'weapon-icons/weapon-cross'
},
{
value: 'gauntlet',
label: 'Gauntlets',
krLabel: '건틀릿',
icon: 'weapon-icons/weapon-gauntlet',
icon: 'weapon-icons/weapon-gauntlet'
},
{
value: 'scythe',
label: 'Scythes',
krLabel: '낫',
icon: 'weapon-icons/weapon-scythe',
icon: 'weapon-icons/weapon-scythe'
},
{
value: 'lance',
label: 'Lances',
krLabel: '랜스',
icon: 'weapon-icons/weapon-lance',
icon: 'weapon-icons/weapon-lance'
},
{
value: 'bow',
label: 'Bows',
krLabel: '활',
icon: 'weapon-icons/weapon-bow',
icon: 'weapon-icons/weapon-bow'
},
{
value: 'chakram',
label: 'Chakram',
krLabel: '차크람',
icon: 'weapon-icons/weapon-chakram',
icon: 'weapon-icons/weapon-chakram'
},
{
value: 'javelin',
label: 'Javelin',
krLabel: '재블린'
}
]
+35 -62
View File
@@ -4,12 +4,7 @@ import { useCallback, useMemo, useState } from 'react'
import FilterButton from '../../../components/atoms/FilterButton'
import Breadcrumb from '../../../components/organisms/Breadcrumb'
import { listBattlesuits } from '../../../server/data/honkai3rd/battlesuits'
import {
BattlesuitData,
battlesuitFeatures,
battlesuitTypes,
valkyries,
} from '../../../lib/honkai3rd/battlesuits'
import { BattlesuitData, battlesuitFeatures, battlesuitTypes, valkyries } from '../../../lib/honkai3rd/battlesuits'
import BattlesuitCard from '../../../components/molecules/BattlesuitCard'
import { useRouter } from 'next/router'
import { NextPageContext } from 'next'
@@ -18,10 +13,7 @@ import { translate, useTranslation } from '../../../lib/i18n'
import Head from '../../../components/atoms/Head'
import Honkai3rdLayout from '../../../components/layouts/Honkai3rdLayout'
type BattlesuitListItemData = Pick<
BattlesuitData,
'id' | 'name' | 'features' | 'type' | 'valkyrie'
>
type BattlesuitListItemData = Pick<BattlesuitData, 'id' | 'name' | 'features' | 'type' | 'valkyrie'>
interface BattlesuitListPageProps {
battlesuits: BattlesuitListItemData[]
@@ -39,11 +31,7 @@ const valkyrieFilterOptions: {
label: string
icon?: string
krLabel?: string
}[] = [
{ value: 'all', label: 'All', krLabel: '전체' },
...battlesuitTypes,
...valkyries,
]
}[] = [{ value: 'all', label: 'All', krLabel: '전체' }, ...battlesuitTypes, ...valkyries]
const BattlesuitListPage = ({ battlesuits }: BattlesuitListPageProps) => {
const { query, locale } = useRouter()
@@ -59,9 +47,7 @@ const BattlesuitListPage = ({ battlesuits }: BattlesuitListPageProps) => {
return 'all'
}
return typeof query.valkyrie === 'string'
? query.valkyrie
: query.valkyrie[0]
return typeof query.valkyrie === 'string' ? query.valkyrie : query.valkyrie[0]
}, [query])
const featureFilter = useMemo(() => {
@@ -73,31 +59,22 @@ const BattlesuitListPage = ({ battlesuits }: BattlesuitListPageProps) => {
}, [query])
const battlesuitsFiteredByValkyrie = useMemo(() => {
return battlesuits.filter((battlesuit) =>
isValkyrieFilterMatching(battlesuit, valkyrieFilter)
)
return battlesuits.filter(battlesuit => isValkyrieFilterMatching(battlesuit, valkyrieFilter))
}, [battlesuits, valkyrieFilter])
const availableFeatureSet = battlesuitsFiteredByValkyrie.reduce(
(set, battlesuit) => {
battlesuit.features.forEach((feature) => set.add(feature))
return set
},
new Set()
)
const availableFeatureSet = battlesuitsFiteredByValkyrie.reduce((set, battlesuit) => {
battlesuit.features.forEach(feature => set.add(feature))
return set
}, new Set())
const battlesuitsFilteredByFeature = useMemo(() => {
return battlesuitsFiteredByValkyrie.filter((battlesuit) =>
isFeatureFilterMatching(battlesuit, featureFilter)
)
return battlesuitsFiteredByValkyrie.filter(battlesuit => isFeatureFilterMatching(battlesuit, featureFilter))
}, [battlesuitsFiteredByValkyrie, featureFilter])
return (
<Honkai3rdLayout>
<Head
title={`${t('common.battlesuits')} - ${t('common.honkai-3rd')} - ${t(
'common.abyss-lab'
)}`}
title={`${t('common.battlesuits')} - ${t('common.honkai-3rd')} - ${t('common.abyss-lab')}`}
description={t('battlesuits-list.description')}
canonicalHref={`/honkai3rd/battlesuits`}
/>
@@ -108,19 +85,19 @@ const BattlesuitListPage = ({ battlesuits }: BattlesuitListPageProps) => {
{ href: '/honkai3rd', label: t('common.honkai-3rd') },
{
href: '/honkai3rd/battlesuits',
label: t('common.battlesuits'),
},
label: t('common.battlesuits')
}
]}
/>
<Heading as='h1'>{t('battlesuits-list.heading')}</Heading>
<Heading as="h1">{t('battlesuits-list.heading')}</Heading>
<Box sx={{ display: ['block', 'none'], mb: 2 }}>
<Button
className={hiddenFilters ? '' : 'active'}
sx={{ px: 2, py: 1 }}
onClick={() => {
setHiddenFilters((previousValue) => !previousValue)
setHiddenFilters(previousValue => !previousValue)
}}
>
{t('battlesuits-list.filters')}
@@ -131,11 +108,11 @@ const BattlesuitListPage = ({ battlesuits }: BattlesuitListPageProps) => {
sx={{
display: 'block',
'&.hidden': {
display: ['none', 'block'],
},
display: ['none', 'block']
}
}}
>
<Heading as='h3'>{t('battlesuits-list.filter-by-valkyries')}</Heading>
<Heading as="h3">{t('battlesuits-list.filter-by-valkyries')}</Heading>
<Flex mb={2} sx={{ flexWrap: 'wrap' }}>
{valkyrieFilterOptions.map(({ value, label, icon, krLabel }) => {
return (
@@ -151,10 +128,10 @@ const BattlesuitListPage = ({ battlesuits }: BattlesuitListPageProps) => {
)
})}
</Flex>
<Heading as='h3'>{t('battlesuits-list.filter-by-features')}</Heading>
<Heading as="h3">{t('battlesuits-list.filter-by-features')}</Heading>
<Flex mb={2} sx={{ flexWrap: 'wrap' }}>
{featureFilterOptions
.filter((filterOption) => {
.filter(filterOption => {
if (filterOption.value === 'all') {
return true
}
@@ -179,13 +156,11 @@ const BattlesuitListPage = ({ battlesuits }: BattlesuitListPageProps) => {
<Flex
sx={{
flexWrap: 'wrap',
justifyContent: 'space-around',
justifyContent: 'space-around'
}}
>
{battlesuitsFilteredByFeature.map((battlesuit) => {
return (
<BattlesuitCard key={battlesuit.id} battlesuit={battlesuit} />
)
{battlesuitsFilteredByFeature.map(battlesuit => {
return <BattlesuitCard key={battlesuit.id} battlesuit={battlesuit} />
})}
</Flex>
</Box>
@@ -198,24 +173,21 @@ export default BattlesuitListPage
export async function getStaticProps({ locale }: NextPageContext) {
return {
props: {
battlesuits: listBattlesuits(locale).map((battlesuit) => {
battlesuits: listBattlesuits(locale).map(battlesuit => {
return {
id: battlesuit.id,
name: battlesuit.name,
features: battlesuit.features,
type: battlesuit.type,
valkyrie: battlesuit.valkyrie,
valkyrie: battlesuit.valkyrie
}
}),
...(await getI18NProps(locale)),
},
...(await getI18NProps(locale))
}
}
}
function isValkyrieFilterMatching(
battlesuit: BattlesuitListItemData,
valkyrieFilter: string
) {
function isValkyrieFilterMatching(battlesuit: BattlesuitListItemData, valkyrieFilter: string) {
switch (valkyrieFilter) {
case 'mecha':
case 'biologic':
@@ -245,7 +217,11 @@ function isValkyrieFilterMatching(
case 'aponia':
case 'eden':
case 'griseo':
case 'vill-v':
case 'sushang':
case 'ai':
case 'susannah':
case 'misteln':
case 'prometheus':
return battlesuit.valkyrie === valkyrieFilter
default:
case 'all':
@@ -253,12 +229,9 @@ function isValkyrieFilterMatching(
}
}
function isFeatureFilterMatching(
battlesuit: BattlesuitListItemData,
featureFilter: string
) {
function isFeatureFilterMatching(battlesuit: BattlesuitListItemData, featureFilter: string) {
if (featureFilter === 'all') {
return true
}
return battlesuit.features.some((feature) => feature === featureFilter)
return battlesuit.features.some(feature => feature === featureFilter)
}
+33 -65
View File
@@ -5,11 +5,7 @@ import SquareImageBox from '../../../components/atoms/SquareImageBox'
import Breadcrumb from '../../../components/organisms/Breadcrumb'
import { weaponCategories, WeaponData } from '../../../lib/honkai3rd/weapons'
import { generateI18NPaths, getI18NProps } from '../../../server/i18n'
import {
getWeaponById,
getWeaponMapByIds,
listWeapons,
} from '../../../server/data/honkai3rd/weapons'
import { getWeaponById, getWeaponMapByIds, listWeapons } from '../../../server/data/honkai3rd/weapons'
import { useTranslation } from '../../../lib/i18n'
import Head from '../../../components/atoms/Head'
import PageLink from '../../../components/atoms/PageLink'
@@ -26,29 +22,19 @@ interface WeaponShowPageProps {
weaponMap: { [key: string]: WeaponData }
}
const WeaponShowPage = ({
weapon,
battlesuitMap,
weaponMap,
}: WeaponShowPageProps) => {
const WeaponShowPage = ({ weapon, battlesuitMap, weaponMap }: WeaponShowPageProps) => {
const { t } = useTranslation()
const weaponCategoryName = t(`weapons-show.${weapon.category}`)
const weaponCategory = weaponCategories.find(
(category) => category.value === weapon.category
)
const weaponCategory = weaponCategories.find(category => category.value === weapon.category)
return (
<Honkai3rdLayout>
<Head
title={`${weapon.name} - ${t('common.honkai-3rd')} - ${t(
'common.abyss-lab'
)}`}
description={`${t('common.honkai-3rd')} ${t(
'weapons-show.weapon'
)} / ${'⭐'.repeat(weapon.rarity)} / ${weaponCategoryName} / ATK : ${
weapon.atk
} / CRT : ${weapon.crt}`}
title={`${weapon.name} - ${t('common.honkai-3rd')} - ${t('common.abyss-lab')}`}
description={`${t('common.honkai-3rd')} ${t('weapons-show.weapon')} / ${'⭐'.repeat(
weapon.rarity
)} / ${weaponCategoryName} / ATK : ${weapon.atk} / CRT : ${weapon.crt}`}
canonicalHref={`/honkai3rd/weapons/${weapon.id}`}
/>
@@ -59,12 +45,12 @@ const WeaponShowPage = ({
{ href: '/honkai3rd/weapons', label: t('common.weapons') },
{
href: `/honkai3rd/weapons/${weapon.id}`,
label: weapon.name,
},
label: weapon.name
}
]}
/>
<Heading as='h1'>{weapon.name}</Heading>
<Heading as="h1">{weapon.name}</Heading>
<Box mb={3}>
<SquareImageBox
@@ -79,7 +65,7 @@ const WeaponShowPage = ({
<PageLink
href={{
pathname: '/honkai3rd/weapons',
query: { category: weapon.category },
query: { category: weapon.category }
}}
>
<Flex>
@@ -103,39 +89,26 @@ const WeaponShowPage = ({
</Box>
{weapon.battlesuits != null && weapon.battlesuits.length > 0 && (
<Box sx={{ p: 2, borderTop: 'default' }}>
<Heading as='h4'>{t('weapons-show.best-on')}</Heading>
<Heading as="h4">{t('weapons-show.best-on')}</Heading>
{weapon.battlesuits.map(({ id: battlesuitId }) => {
return (
<BattlesuitCard
key={battlesuitId}
size='sm'
battlesuit={battlesuitMap[battlesuitId]}
/>
)
return <BattlesuitCard key={battlesuitId} size="sm" battlesuit={battlesuitMap[battlesuitId]} />
})}
</Box>
)}
{weapon.priWeapon != null && (
<Box sx={{ p: 2, borderTop: 'default' }}>
<Heading as='h4'>{t('weapons-show.pri-weapon')}</Heading>
<WeaponCard size='sm' weapon={weaponMap[weapon.priWeapon]} />
<Heading as="h4">{t('weapons-show.pri-weapon')}</Heading>
<WeaponCard size="sm" weapon={weaponMap[weapon.priWeapon]} />
</Box>
)}
{weapon.originalWeapons != null && weapon.originalWeapons.length > 0 && (
<Box sx={{ p: 2, borderTop: 'default' }}>
<Heading as="h4">{t('weapons-show.original-weapon')}</Heading>
{weapon.originalWeapons.map(originalWeaponId => {
return <WeaponCard key={originalWeaponId} size="sm" weapon={weaponMap[originalWeaponId]} />
})}
</Box>
)}
{weapon.originalWeapons != null &&
weapon.originalWeapons.length > 0 && (
<Box sx={{ p: 2, borderTop: 'default' }}>
<Heading as='h4'>{t('weapons-show.original-weapon')}</Heading>
{weapon.originalWeapons.map((originalWeaponId) => {
return (
<WeaponCard
key={originalWeaponId}
size='sm'
weapon={weaponMap[originalWeaponId]}
/>
)
})}
</Box>
)}
{/* {weapon.sources != null && (
<Box sx={{ p: 2, borderTop: 'default' }}>
<Heading as='h4'>{t('weapons-show.sources')}</Heading>
@@ -149,16 +122,16 @@ const WeaponShowPage = ({
</Card>
<Box>
{weapon.skills.map((skill) => {
{weapon.skills.map(skill => {
return (
<Card key={skill.name} mb={3}>
<Heading as='h3' p={2} m={0} sx={{ borderBottom: 'default' }}>
<Heading as="h3" p={2} m={0} sx={{ borderBottom: 'default' }}>
{skill.name}
</Heading>
<Paragraph
p={2}
sx={{
whiteSpace: 'pre-wrap',
whiteSpace: 'pre-wrap'
}}
>
{skill.description}
@@ -174,15 +147,10 @@ const WeaponShowPage = ({
export default WeaponShowPage
export async function getStaticProps({
params,
locale,
}: NextPageContext & { params: { weaponId: string } }) {
export async function getStaticProps({ params, locale }: NextPageContext & { params: { weaponId: string } }) {
const weapon = getWeaponById(params.weaponId, locale)
const battlesuitMap = getBattlesuitMapByIds(
weapon != null && weapon.battlesuits != null
? weapon.battlesuits.map(({ id }) => id)
: [],
weapon != null && weapon.battlesuits != null ? weapon.battlesuits.map(({ id }) => id) : [],
locale
)
@@ -202,20 +170,20 @@ export async function getStaticProps({
weapon,
battlesuitMap,
weaponMap,
...(await getI18NProps(locale)),
},
...(await getI18NProps(locale))
}
}
}
export async function getStaticPaths() {
return {
paths: generateI18NPaths(
listWeapons().map((weapon) => {
listWeapons().map(weapon => {
return {
params: { weaponId: weapon.id },
params: { weaponId: weapon.id }
}
})
),
fallback: false,
fallback: false
}
}
+13 -22
View File
@@ -14,19 +14,13 @@ import { useTranslation, translate } from '../../../lib/i18n'
import Head from '../../../components/atoms/Head'
import Honkai3rdLayout from '../../../components/layouts/Honkai3rdLayout'
type WeaponListItemData = Pick<
WeaponData,
'id' | 'name' | 'rarity' | 'category'
>
type WeaponListItemData = Pick<WeaponData, 'id' | 'name' | 'rarity' | 'category'>
interface WeaponListPageProps {
weaponDataList: WeaponListItemData[]
}
const weaponFilterOptions = [
{ value: 'all', label: 'All', krLabel: '전체', icon: undefined },
...weaponCategories,
]
const weaponFilterOptions = [{ value: 'all', label: 'All', krLabel: '전체', icon: undefined }, ...weaponCategories]
const WeaponListPage = ({ weaponDataList }: WeaponListPageProps) => {
const { query, locale } = useRouter()
@@ -37,13 +31,11 @@ const WeaponListPage = ({ weaponDataList }: WeaponListPageProps) => {
return 'all'
}
return typeof query.category === 'string'
? query.category
: query.category[0]
return typeof query.category === 'string' ? query.category : query.category[0]
}, [query])
const weaponList = useMemo(() => {
return weaponDataList.map((weapon) => {
return weaponDataList.map(weapon => {
const hidden = isWeaponHidden(weapon, categoryFilter)
return <WeaponCard key={weapon.id} weapon={weapon} hidden={hidden} />
})
@@ -53,9 +45,7 @@ const WeaponListPage = ({ weaponDataList }: WeaponListPageProps) => {
<Honkai3rdLayout>
<Box>
<Head
title={`${t('common.weapons')} - ${t('common.honkai-3rd')} - ${t(
'common.abyss-lab'
)}`}
title={`${t('common.weapons')} - ${t('common.honkai-3rd')} - ${t('common.abyss-lab')}`}
description={t('weapons-list.description')}
canonicalHref={`/honkai3rd/weapons`}
/>
@@ -64,13 +54,13 @@ const WeaponListPage = ({ weaponDataList }: WeaponListPageProps) => {
<Breadcrumb
items={[
{ href: '/honkai3rd', label: t('common.honkai-3rd') },
{ href: '/honkai3rd/weapons', label: t('common.weapons') },
{ href: '/honkai3rd/weapons', label: t('common.weapons') }
]}
/>
<Heading as='h1'>{t('weapons-list.weapons')}</Heading>
<Heading as="h1">{t('weapons-list.weapons')}</Heading>
<Box>
<Heading as='h3'>{t('weapons-list.filter-by-category')}</Heading>
<Heading as="h3">{t('weapons-list.filter-by-category')}</Heading>
<Flex mb={2} sx={{ flexWrap: 'wrap' }}>
{weaponFilterOptions.map(({ value, label, krLabel, icon }) => {
return (
@@ -89,7 +79,7 @@ const WeaponListPage = ({ weaponDataList }: WeaponListPageProps) => {
<Flex
sx={{
flexWrap: 'wrap',
justifyContent: 'space-around',
justifyContent: 'space-around'
}}
>
{weaponList}
@@ -105,11 +95,11 @@ export default WeaponListPage
export async function getStaticProps({ locale }: NextPageContext) {
return {
props: {
weaponDataList: listWeapons(locale).map((weapon) => {
weaponDataList: listWeapons(locale).map(weapon => {
return pick(['name', 'id', 'rarity', 'category'], weapon)
}),
...(await getI18NProps(locale)),
},
...(await getI18NProps(locale))
}
}
}
@@ -125,6 +115,7 @@ function isWeaponHidden(weapon: WeaponListItemData, filter: string): boolean {
case 'lance':
case 'bow':
case 'chakram':
case 'javelin':
return weapon.category !== filter
default:
case 'all':