Update 6.5 data
This commit is contained in:
@@ -1,13 +1,5 @@
|
||||
/** @jsxImportSource theme-ui */
|
||||
import {
|
||||
Box,
|
||||
Card,
|
||||
Flex,
|
||||
Heading,
|
||||
Paragraph,
|
||||
Text,
|
||||
Image,
|
||||
} from '@theme-ui/components'
|
||||
import { Box, Card, Flex, Heading, Paragraph, Text, Image } from '@theme-ui/components'
|
||||
import { NextPageContext } from 'next'
|
||||
import React from 'react'
|
||||
import BattlesuitFeatureLabel from '../../../components/atoms/BattlesuitFeatureLabel'
|
||||
@@ -22,13 +14,10 @@ import {
|
||||
battlesuitFeatures,
|
||||
BattlesuitSkillGroup,
|
||||
battlesuitTypes,
|
||||
valkyries,
|
||||
valkyries
|
||||
} from '../../../lib/honkai3rd/battlesuits'
|
||||
import { generateI18NPaths, getI18NProps } from '../../../server/i18n'
|
||||
import {
|
||||
getBattlesuitById,
|
||||
listBattlesuits,
|
||||
} from '../../../server/data/honkai3rd/battlesuits'
|
||||
import { getBattlesuitById, listBattlesuits } from '../../../server/data/honkai3rd/battlesuits'
|
||||
import { translate, useTranslation } from '../../../lib/i18n'
|
||||
import { useRouter } from 'next/router'
|
||||
import Head from '../../../components/atoms/Head'
|
||||
@@ -51,44 +40,31 @@ interface BattlesuitShowPageProps {
|
||||
stigmataMap: StigmataObjectMap
|
||||
}
|
||||
|
||||
const BattlesuitShowPage = ({
|
||||
battlesuit,
|
||||
weaponMap,
|
||||
stigmataMap,
|
||||
}: BattlesuitShowPageProps) => {
|
||||
const BattlesuitShowPage = ({ battlesuit, weaponMap, stigmataMap }: BattlesuitShowPageProps) => {
|
||||
const { t } = useTranslation()
|
||||
const { locale } = useRouter()
|
||||
|
||||
const { label: valkyrieLabel, krLabel } = valkyries.find(
|
||||
(aValkyrie) => aValkyrie.value === battlesuit.valkyrie
|
||||
) || { label: battlesuit.valkyrie, krLabel: battlesuit.valkyrie }
|
||||
const { label: valkyrieLabel, krLabel } = valkyries.find(aValkyrie => aValkyrie.value === battlesuit.valkyrie) || {
|
||||
label: battlesuit.valkyrie,
|
||||
krLabel: battlesuit.valkyrie
|
||||
}
|
||||
|
||||
const valkyrieName = translate(locale, { 'ko-KR': krLabel }, valkyrieLabel)
|
||||
|
||||
const battlesuitType = battlesuitTypes.find(
|
||||
(aType) => aType.value === battlesuit.type
|
||||
)
|
||||
const battlesuitType = battlesuitTypes.find(aType => aType.value === battlesuit.type)
|
||||
const battlesuitTypeLabel = battlesuitType
|
||||
? translate(
|
||||
locale,
|
||||
{ 'ko-KR': battlesuitType.krLabel },
|
||||
battlesuitType.label
|
||||
)
|
||||
? translate(locale, { 'ko-KR': battlesuitType.krLabel }, battlesuitType.label)
|
||||
: capitalize(battlesuit.type)
|
||||
|
||||
return (
|
||||
<Honkai3rdLayout>
|
||||
<Head
|
||||
title={`${battlesuit.name} - ${t('common.honkai-3rd')} - ${t(
|
||||
'common.abyss-lab'
|
||||
)}`}
|
||||
title={`${battlesuit.name} - ${t('common.honkai-3rd')} - ${t('common.abyss-lab')}`}
|
||||
description={`${t('common.honkai-3rd')} ${t(
|
||||
'battlesuit-show.battlesuit'
|
||||
)} / ${valkyrieName} / ${battlesuitTypeLabel} / ${battlesuit.features
|
||||
.map((feature) => {
|
||||
const featureData = battlesuitFeatures.find(
|
||||
(aFeature) => aFeature.value === feature
|
||||
)
|
||||
.map(feature => {
|
||||
const featureData = battlesuitFeatures.find(aFeature => aFeature.value === feature)
|
||||
if (featureData == null) {
|
||||
return feature
|
||||
}
|
||||
@@ -107,16 +83,16 @@ const BattlesuitShowPage = ({
|
||||
{ href: '/honkai3rd', label: t('common.honkai-3rd') },
|
||||
{
|
||||
href: '/honkai3rd/battlesuits',
|
||||
label: t('common.battlesuits'),
|
||||
label: t('common.battlesuits')
|
||||
},
|
||||
{
|
||||
href: `/honkai3rd/battlesuits/${battlesuit.id}`,
|
||||
label: battlesuit.name,
|
||||
},
|
||||
label: battlesuit.name
|
||||
}
|
||||
]}
|
||||
/>
|
||||
|
||||
<Heading as='h1'>{battlesuit.name}</Heading>
|
||||
<Heading as="h1">{battlesuit.name}</Heading>
|
||||
|
||||
<Box mb={3}>
|
||||
<Box
|
||||
@@ -124,7 +100,7 @@ const BattlesuitShowPage = ({
|
||||
position: 'relative',
|
||||
overflow: 'hidden',
|
||||
width: '100%',
|
||||
maxWidth: [300, 400],
|
||||
maxWidth: [300, 400]
|
||||
}}
|
||||
>
|
||||
<Image
|
||||
@@ -138,7 +114,7 @@ const BattlesuitShowPage = ({
|
||||
|
||||
<Card
|
||||
sx={{
|
||||
overflow: 'hidden',
|
||||
overflow: 'hidden'
|
||||
}}
|
||||
mb={3}
|
||||
>
|
||||
@@ -146,7 +122,7 @@ const BattlesuitShowPage = ({
|
||||
<PageLink
|
||||
href={{
|
||||
pathname: '/honkai3rd/battlesuits',
|
||||
query: { valkyrie: battlesuit.valkyrie },
|
||||
query: { valkyrie: battlesuit.valkyrie }
|
||||
}}
|
||||
>
|
||||
<ValkyrieLabel valkyrie={battlesuit.valkyrie} />
|
||||
@@ -156,20 +132,20 @@ const BattlesuitShowPage = ({
|
||||
<PageLink
|
||||
href={{
|
||||
pathname: '/honkai3rd/battlesuits',
|
||||
query: { valkyrie: battlesuit.type },
|
||||
query: { valkyrie: battlesuit.type }
|
||||
}}
|
||||
>
|
||||
<TypeLabel type={battlesuit.type} />
|
||||
</PageLink>
|
||||
</Box>
|
||||
<Flex p={2} sx={{ flexWrap: 'wrap', rowGap: 1 }}>
|
||||
{battlesuit.features.map((feature) => {
|
||||
{battlesuit.features.map(feature => {
|
||||
return (
|
||||
<Box mr={2} key={feature}>
|
||||
<PageLink
|
||||
href={{
|
||||
pathname: '/honkai3rd/battlesuits',
|
||||
query: { feature: feature },
|
||||
query: { feature: feature }
|
||||
}}
|
||||
>
|
||||
<BattlesuitFeatureLabel feature={feature} />
|
||||
@@ -185,44 +161,30 @@ const BattlesuitShowPage = ({
|
||||
sx={{
|
||||
mb: 3,
|
||||
p: 2,
|
||||
overflow: 'hidden',
|
||||
overflow: 'hidden'
|
||||
}}
|
||||
>
|
||||
{battlesuit.equipment.map((equipmentItem) => {
|
||||
{battlesuit.equipment.map(equipmentItem => {
|
||||
return (
|
||||
<Box key={equipmentItem.type}>
|
||||
<Heading
|
||||
as='h3'
|
||||
as="h3"
|
||||
sx={{
|
||||
mb: 1,
|
||||
mb: 1
|
||||
}}
|
||||
>
|
||||
{t(`battlesuit-show.equipmentTypes.${equipmentItem.type}`)}
|
||||
</Heading>
|
||||
<Flex sx={{ mx: -1 }}>
|
||||
{equipmentItem.weapon != null && (
|
||||
<WeaponCard
|
||||
size='sm'
|
||||
weapon={weaponMap[equipmentItem.weapon]}
|
||||
/>
|
||||
)}
|
||||
{equipmentItem.weapon != null && <WeaponCard size="sm" weapon={weaponMap[equipmentItem.weapon]} />}
|
||||
{equipmentItem.stigmataTop != null && (
|
||||
<StigmataCard
|
||||
size='sm'
|
||||
stigmata={stigmataMap[equipmentItem.stigmataTop]}
|
||||
/>
|
||||
<StigmataCard size="sm" stigmata={stigmataMap[equipmentItem.stigmataTop]} />
|
||||
)}
|
||||
{equipmentItem.stigmataMid != null && (
|
||||
<StigmataCard
|
||||
size='sm'
|
||||
stigmata={stigmataMap[equipmentItem.stigmataMid]}
|
||||
/>
|
||||
<StigmataCard size="sm" stigmata={stigmataMap[equipmentItem.stigmataMid]} />
|
||||
)}
|
||||
{equipmentItem.stigmataBot != null && (
|
||||
<StigmataCard
|
||||
size='sm'
|
||||
stigmata={stigmataMap[equipmentItem.stigmataBot]}
|
||||
/>
|
||||
<StigmataCard size="sm" stigmata={stigmataMap[equipmentItem.stigmataBot]} />
|
||||
)}
|
||||
</Flex>
|
||||
</Box>
|
||||
@@ -231,41 +193,20 @@ const BattlesuitShowPage = ({
|
||||
</Card>
|
||||
)}
|
||||
|
||||
<BattlesuitSkillGroupCard
|
||||
heading={t('battlesuit-show.leader')}
|
||||
skillGroup={battlesuit.leader}
|
||||
/>
|
||||
<BattlesuitSkillGroupCard heading={t('battlesuit-show.leader')} skillGroup={battlesuit.leader} />
|
||||
|
||||
<BattlesuitSkillGroupCard
|
||||
heading={t('battlesuit-show.passive')}
|
||||
skillGroup={battlesuit.passive}
|
||||
/>
|
||||
<BattlesuitSkillGroupCard heading={t('battlesuit-show.passive')} skillGroup={battlesuit.passive} />
|
||||
|
||||
<BattlesuitSkillGroupCard
|
||||
heading={t('battlesuit-show.evasion')}
|
||||
skillGroup={battlesuit.evasion}
|
||||
/>
|
||||
<BattlesuitSkillGroupCard heading={t('battlesuit-show.evasion')} skillGroup={battlesuit.evasion} />
|
||||
|
||||
<BattlesuitSkillGroupCard
|
||||
heading={t('battlesuit-show.special-attack')}
|
||||
skillGroup={battlesuit.special}
|
||||
/>
|
||||
<BattlesuitSkillGroupCard heading={t('battlesuit-show.special-attack')} skillGroup={battlesuit.special} />
|
||||
|
||||
<BattlesuitSkillGroupCard
|
||||
heading={t('battlesuit-show.ultimate')}
|
||||
skillGroup={battlesuit.ultimate}
|
||||
/>
|
||||
<BattlesuitSkillGroupCard heading={t('battlesuit-show.ultimate')} skillGroup={battlesuit.ultimate} />
|
||||
|
||||
<BattlesuitSkillGroupCard
|
||||
heading={t('battlesuit-show.basic-attack')}
|
||||
skillGroup={battlesuit.basic}
|
||||
/>
|
||||
<BattlesuitSkillGroupCard heading={t('battlesuit-show.basic-attack')} skillGroup={battlesuit.basic} />
|
||||
|
||||
{battlesuit.sp != null && (
|
||||
<BattlesuitSkillGroupCard
|
||||
heading={t('battlesuit-show.sp-skill')}
|
||||
skillGroup={battlesuit.sp}
|
||||
/>
|
||||
<BattlesuitSkillGroupCard heading={t('battlesuit-show.sp-skill')} skillGroup={battlesuit.sp} />
|
||||
)}
|
||||
</Box>
|
||||
</Honkai3rdLayout>
|
||||
@@ -274,10 +215,7 @@ const BattlesuitShowPage = ({
|
||||
|
||||
export default BattlesuitShowPage
|
||||
|
||||
export async function getStaticProps({
|
||||
params,
|
||||
locale,
|
||||
}: NextPageContext & { params: { battlesuitId: string } }) {
|
||||
export async function getStaticProps({ params, locale }: NextPageContext & { params: { battlesuitId: string } }) {
|
||||
const battlesuit = getBattlesuitById(params.battlesuitId, locale)!
|
||||
const { weaponIds, stigmataIds } = (battlesuit.equipment || []).reduce<{
|
||||
weaponIds: string[]
|
||||
@@ -285,11 +223,7 @@ export async function getStaticProps({
|
||||
}>(
|
||||
(acc, equipmentItem) => {
|
||||
acc.weaponIds.push(equipmentItem.weapon)
|
||||
acc.stigmataIds.push(
|
||||
equipmentItem.stigmataTop,
|
||||
equipmentItem.stigmataMid,
|
||||
equipmentItem.stigmataBot
|
||||
)
|
||||
acc.stigmataIds.push(equipmentItem.stigmataTop, equipmentItem.stigmataMid, equipmentItem.stigmataBot)
|
||||
return acc
|
||||
},
|
||||
{ weaponIds: [], stigmataIds: [] }
|
||||
@@ -303,21 +237,21 @@ export async function getStaticProps({
|
||||
battlesuit,
|
||||
weaponMap,
|
||||
stigmataMap,
|
||||
...(await getI18NProps(locale)),
|
||||
},
|
||||
...(await getI18NProps(locale))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export async function getStaticPaths() {
|
||||
return {
|
||||
paths: generateI18NPaths(
|
||||
listBattlesuits().map((battlesuit) => {
|
||||
listBattlesuits().map(battlesuit => {
|
||||
return {
|
||||
params: { battlesuitId: battlesuit.id },
|
||||
params: { battlesuitId: battlesuit.id }
|
||||
}
|
||||
})
|
||||
),
|
||||
fallback: false,
|
||||
fallback: false
|
||||
}
|
||||
}
|
||||
|
||||
@@ -326,19 +260,16 @@ interface BattlesuitSkillGroupCardProps {
|
||||
skillGroup: BattlesuitSkillGroup
|
||||
}
|
||||
|
||||
const BattlesuitSkillGroupCard = ({
|
||||
heading,
|
||||
skillGroup,
|
||||
}: BattlesuitSkillGroupCardProps) => {
|
||||
const BattlesuitSkillGroupCard = ({ heading, skillGroup }: BattlesuitSkillGroupCardProps) => {
|
||||
return (
|
||||
<Card mb={3}>
|
||||
<Box
|
||||
sx={{
|
||||
p: 2,
|
||||
borderBottom: 'default',
|
||||
borderBottom: 'default'
|
||||
}}
|
||||
>
|
||||
<Heading as='h2' mb={1}>
|
||||
<Heading as="h2" mb={1}>
|
||||
{skillGroup.core.name}
|
||||
</Heading>
|
||||
<SecondaryLabel>{heading}</SecondaryLabel>
|
||||
@@ -348,26 +279,19 @@ const BattlesuitSkillGroupCard = ({
|
||||
{skillGroup.core.description}
|
||||
</Paragraph>
|
||||
|
||||
{skillGroup.subskills.map((subskill) => {
|
||||
{skillGroup.subskills.map(subskill => {
|
||||
return (
|
||||
<React.Fragment key={subskill.name}>
|
||||
<Heading as='h3' p={2} m={0} sx={{ borderBottom: 'default' }}>
|
||||
<Heading as="h3" p={2} m={0} sx={{ borderBottom: 'default' }}>
|
||||
<Flex sx={{ alignItems: 'center' }}>
|
||||
<Text>{subskill.name}</Text>
|
||||
{subskill.requiredRank != null ? (
|
||||
/^[0-9]/.test(subskill.requiredRank) ? (
|
||||
<Box
|
||||
ml={2}
|
||||
sx={{ height: 30, lineHeight: '30px', fontSize: 2 }}
|
||||
>
|
||||
<Box ml={2} sx={{ height: 30, lineHeight: '30px', fontSize: 2 }}>
|
||||
⭐{subskill.requiredRank.slice(0, 1)}
|
||||
</Box>
|
||||
) : (
|
||||
<BattlesuitRankIcon
|
||||
rank={subskill.requiredRank}
|
||||
size={30}
|
||||
ml={2}
|
||||
/>
|
||||
<BattlesuitRankIcon rank={subskill.requiredRank} size={30} ml={2} />
|
||||
)
|
||||
) : (
|
||||
<Box sx={{ height: 30 }} />
|
||||
@@ -380,7 +304,7 @@ const BattlesuitSkillGroupCard = ({
|
||||
sx={{
|
||||
whiteSpace: 'pre-wrap',
|
||||
borderBottom: 'default',
|
||||
'&:last-child': { borderBottom: 'none' },
|
||||
'&:last-child': { borderBottom: 'none' }
|
||||
}}
|
||||
>
|
||||
{subskill.description}
|
||||
|
||||
@@ -14,10 +14,7 @@ import { getWeaponMapByIds } from '../../../../server/data/honkai3rd/weapons'
|
||||
import { StigmataData } from '../../../../lib/honkai3rd/stigmata'
|
||||
import { getStigmataMapByIds } from '../../../../server/data/honkai3rd/stigmata'
|
||||
import { getSignetGroupById } from '../../../../server/data/honkai3rd/elysianRealm'
|
||||
import {
|
||||
erBattlesuits,
|
||||
SignetSet,
|
||||
} from '../../../../lib/honkai3rd/elysianRealm'
|
||||
import { erBattlesuits, SignetSet } from '../../../../lib/honkai3rd/elysianRealm'
|
||||
import SignetCard from '../../../../components/molecules/SignetCard'
|
||||
|
||||
type WeaponObjectMap = { [key: string]: WeaponData }
|
||||
@@ -30,22 +27,15 @@ interface BattlesuitShowPageProps {
|
||||
signetSet: SignetSet
|
||||
}
|
||||
|
||||
const BattlesuitShowPage = ({
|
||||
battlesuit,
|
||||
weaponMap,
|
||||
stigmataMap,
|
||||
signetSet,
|
||||
}: BattlesuitShowPageProps) => {
|
||||
const BattlesuitShowPage = ({ battlesuit, weaponMap, stigmataMap, signetSet }: BattlesuitShowPageProps) => {
|
||||
const { t } = useTranslation()
|
||||
return (
|
||||
<Honkai3rdLayout>
|
||||
<Head
|
||||
title={`${battlesuit.name} (${t('common.elysian-realm')}) - ${t(
|
||||
'common.honkai-3rd'
|
||||
)} - ${t('common.abyss-lab')}`}
|
||||
description={`${t('common.honkai-3rd')} ${t(
|
||||
'common.elysian-realm'
|
||||
)} ${t('battlesuit-show.battlesuit')}`}
|
||||
title={`${battlesuit.name} (${t('common.elysian-realm')}) - ${t('common.honkai-3rd')} - ${t(
|
||||
'common.abyss-lab'
|
||||
)}`}
|
||||
description={`${t('common.honkai-3rd')} ${t('common.elysian-realm')} ${t('battlesuit-show.battlesuit')}`}
|
||||
canonicalHref={`/honkai3rd/elysian-realm/battlesuits/${battlesuit.id}`}
|
||||
/>
|
||||
|
||||
@@ -55,16 +45,16 @@ const BattlesuitShowPage = ({
|
||||
{ href: '/honkai3rd', label: t('common.honkai-3rd') },
|
||||
{
|
||||
href: '/honkai3rd/elysian-realm',
|
||||
label: t('common.elysian-realm'),
|
||||
label: t('common.elysian-realm')
|
||||
},
|
||||
{
|
||||
href: `/honkai3rd/elysian-realm/battlesuits/${battlesuit.id}`,
|
||||
label: battlesuit.name,
|
||||
},
|
||||
label: battlesuit.name
|
||||
}
|
||||
]}
|
||||
/>
|
||||
|
||||
<Heading as='h1'>{battlesuit.name}</Heading>
|
||||
<Heading as="h1">{battlesuit.name}</Heading>
|
||||
|
||||
<Box mb={3}>
|
||||
<Box
|
||||
@@ -72,7 +62,7 @@ const BattlesuitShowPage = ({
|
||||
position: 'relative',
|
||||
overflow: 'hidden',
|
||||
width: '100%',
|
||||
maxWidth: [300, 400],
|
||||
maxWidth: [300, 400]
|
||||
}}
|
||||
>
|
||||
<Image
|
||||
@@ -84,10 +74,10 @@ const BattlesuitShowPage = ({
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
<Heading as='h2'>{t('elysian-realm.exclusive-signets')}</Heading>
|
||||
<Heading as="h2">{t('elysian-realm.exclusive-signets')}</Heading>
|
||||
|
||||
<Box>
|
||||
{signetSet.signets.map((signet) => {
|
||||
{signetSet.signets.map(signet => {
|
||||
return <SignetCard key={signet.id} signet={signet} />
|
||||
})}
|
||||
</Box>
|
||||
@@ -98,10 +88,7 @@ const BattlesuitShowPage = ({
|
||||
|
||||
export default BattlesuitShowPage
|
||||
|
||||
export async function getStaticProps({
|
||||
params,
|
||||
locale,
|
||||
}: NextPageContext & { params: { battlesuitId: string } }) {
|
||||
export async function getStaticProps({ params, locale }: NextPageContext & { params: { battlesuitId: string } }) {
|
||||
try {
|
||||
const battlesuit = getBattlesuitById(params.battlesuitId, locale)!
|
||||
const { weaponIds, stigmataIds } = (battlesuit.equipment || []).reduce<{
|
||||
@@ -110,11 +97,7 @@ export async function getStaticProps({
|
||||
}>(
|
||||
(acc, equipmentItem) => {
|
||||
acc.weaponIds.push(equipmentItem.weapon)
|
||||
acc.stigmataIds.push(
|
||||
equipmentItem.stigmataTop,
|
||||
equipmentItem.stigmataMid,
|
||||
equipmentItem.stigmataBot
|
||||
)
|
||||
acc.stigmataIds.push(equipmentItem.stigmataTop, equipmentItem.stigmataMid, equipmentItem.stigmataBot)
|
||||
return acc
|
||||
},
|
||||
{ weaponIds: [], stigmataIds: [] }
|
||||
@@ -124,7 +107,7 @@ export async function getStaticProps({
|
||||
const stigmataMap = getStigmataMapByIds(stigmataIds)
|
||||
|
||||
const signetGroup = getSignetGroupById('elysia', locale)
|
||||
const signetSet = signetGroup.sets.find((set) => {
|
||||
const signetSet = signetGroup.sets.find(set => {
|
||||
return set.id === `elysia-${params.battlesuitId}`
|
||||
})
|
||||
|
||||
@@ -134,8 +117,8 @@ export async function getStaticProps({
|
||||
weaponMap,
|
||||
stigmataMap,
|
||||
signetSet,
|
||||
...(await getI18NProps(locale)),
|
||||
},
|
||||
...(await getI18NProps(locale))
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
@@ -145,12 +128,12 @@ export async function getStaticProps({
|
||||
export async function getStaticPaths() {
|
||||
return {
|
||||
paths: generateI18NPaths(
|
||||
erBattlesuits.map((battlesuitId) => {
|
||||
erBattlesuits.map(battlesuitId => {
|
||||
return {
|
||||
params: { battlesuitId: battlesuitId },
|
||||
params: { battlesuitId: battlesuitId }
|
||||
}
|
||||
})
|
||||
),
|
||||
fallback: false,
|
||||
fallback: false
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user