diff --git a/public/locales/en-US/common.json b/public/locales/en-US/common.json index a1ca070b..04118a2a 100644 --- a/public/locales/en-US/common.json +++ b/public/locales/en-US/common.json @@ -144,10 +144,11 @@ } }, "elysian-realm": { + "elysian-realm": "Elysian Realm", + "battlesuits": "Battlesuits", "signets": "Signets", "remembrance-sigil": "Remembrance Sigil", "supports": "Supports", - "no-upgrades": "No Upgrades Available", "nexus-signets": "Nexus Signets", "normal-signets": "Normal Signets", "exclusive-signets": "Exclusive Signets" diff --git a/public/locales/ko-KR/common.json b/public/locales/ko-KR/common.json index e3d37833..1e53faf5 100644 --- a/public/locales/ko-KR/common.json +++ b/public/locales/ko-KR/common.json @@ -38,13 +38,13 @@ "description": "붕괴 3rd 성흔 목록", "stigmata-single": "성흔 (단일)", "set-list": "세트 일람", - "show-set-list": "단일 성흔 목록" + "show-set-list": "세트 성흔 목록으로 보기" }, "stigmata-set-list": { "description": "붕괴 3rd 성흔 세트 목록", "stigmata-set": "성흔 (세트)", "set-list": "세트 일람", - "show-signle-list": "단일 성흔 목록" + "show-signle-list": "단일 성흔 목록으로 보기" }, "stigmata-show": { "stigmata": "성흔", @@ -86,58 +86,12 @@ "ultimate": "필살기", "team": "팀" }, - "versions": { - "version": "업데이트", - "list-page-description": "붕괴 3rd 업데이트 정보 목록", - "all-versions": "모든 업데이트", - "versions": "업데이트", - "previous": "이전 버전", - "next": "다음 버전", - "current": "현재 버전", - "new-battlesuits": "신규 발키리", - "new-weapons": "신규 무기", - "new-stigmata-sets": "신규 성흔 세트", - "weekly-bosses": "주간 보스", - "super-string": "초끈 공간", - "memorial-arena": "기억 전장", - "supply-events": "보급 이벤트", - "supply-events-disclaimer": "주의: 보급 일정은 글로벌 아메리카 서버 기준으로 작성되어 있습니다. 수작업으로 갱신하기에 정확하지 않은 부분이 있을 수도 있습니다. 보급 가차를 돌리기 전에 게임 내 정보를 꼭 다시 한번 확인해주세요." - }, - "sources": { - "sprit-weapon-foundry": { - "label": "진영 무기 단조", - "description": "150 x 네겐트로피 허수 코어, 300 x 플로지스톤 에테르, 1 x 50 레벨 진영 무기(190 x G1 결정, 80 x 붕괴의 파편, 400 x 플로지스톤 에테르)로 단조." - }, - "dorm-equipment-supply": { - "label": "본부 장비 보급", - "description": "보급마다 200 x 수정을 소모. 뽑지 않기를 추천함. 대부분의 아이템들은 치환 공간에서 구할 수 있음." - }, - "focused-supply": { - "label": "집중 보급", - "description": "보급마다 280 x 수정을 소모." - }, - "pri-weapon-foundry": { - "label": "초월 무기 단조", - "description": "원형 무기 획득 후, 100 x 아인슈타인 토러스, 15 x 나노 세라믹, 50 x 초전도 금속성 수소, 1 x 같은 종류의 50레벨 5성 보급 무기로 단조." - }, - "weapon-exchange": { - "label": "치환 공간", - "description": "4000 x 무장 공명으로 교환." - }, - "stigmata-exchange": { - "label": "치환 공간", - "description": "6000 x 성흔 공명으로 교환." - }, - "special-divine-key-supply": { - "label": "신의 열쇠 보급", - "description": "천명 무기고나 화력 보급등 특수 보급 이벤트에서만 획득 가능. 보급마다 280 x 수정을 소모." - } - }, "elysian-realm": { + "elysian-realm": "과거의 낙원", + "battlesuits": "발키리", "signets": "각인", "remembrance-sigil": "회상의 증명", "supports": "지원 발키리", - "no-upgrades": "레벨업 불가능", "nexus-signets": "증폭 각인", "normal-signets": "일반 각인", "exclusive-signets": "전용 각인" diff --git a/src/components/atoms/BattlesuitFeatureLabel.tsx b/src/components/atoms/BattlesuitFeatureLabel.tsx deleted file mode 100644 index f8864c1e..00000000 --- a/src/components/atoms/BattlesuitFeatureLabel.tsx +++ /dev/null @@ -1,41 +0,0 @@ -/** @jsxImportSource theme-ui */ -import { Flex, Text } from '@theme-ui/components' -import { useRouter } from 'next/router' -import { assetsBucketBaseUrl } from '../../lib/consts' -import { battlesuitFeatures } from '../../lib/honkai3rd/battlesuits' -import { translate } from '../../lib/i18n' -import SquareImageBox from './SquareImageBox' - -interface BattlesuitFeatureLabelProps { - feature: string -} - -const BattlesuitFeatureLabel = ({ feature }: BattlesuitFeatureLabelProps) => { - const { locale } = useRouter() - const featureData = battlesuitFeatures.find( - (aFeature) => aFeature.value === feature - ) - if (featureData == null) { - return {feature} - } - - const { label, icon, krLabel } = featureData - - const translatedLabel = translate(locale, { 'ko-KR': krLabel }, label) - - return ( - - {featureData != null && ( - - )} - {translatedLabel} - - ) -} - -export default BattlesuitFeatureLabel diff --git a/src/components/atoms/NavItem.tsx b/src/components/atoms/NavItem.tsx index 733a561a..aa301d3e 100644 --- a/src/components/atoms/NavItem.tsx +++ b/src/components/atoms/NavItem.tsx @@ -8,9 +8,10 @@ import SquareImageBox from '../atoms/SquareImageBox' type NavItemTarget = 'battlesuits' | 'stigmata' | 'weapons' | 'elfs' | 'elysian-realm' | 'media' interface NavItemProps { target: NavItemTarget + size?: 'md' | 'lg' } -const NavItem = ({ target }: NavItemProps) => { +const NavItem = ({ target, size = 'md' }: NavItemProps) => { const { t } = useTranslation() return ( @@ -23,12 +24,13 @@ const NavItem = ({ target }: NavItemProps) => { p: 1 }} > - + {t(`common.${target}`)} diff --git a/src/components/atoms/TypeLabel.tsx b/src/components/atoms/TypeLabel.tsx deleted file mode 100644 index 73b06ca7..00000000 --- a/src/components/atoms/TypeLabel.tsx +++ /dev/null @@ -1,54 +0,0 @@ -/** @jsxImportSource theme-ui */ -import { Flex, Text } from '@theme-ui/components' -import { useRouter } from 'next/router' -import { assetsBucketBaseUrl } from '../../lib/consts' -import { battlesuitTypes } from '../../lib/honkai3rd/battlesuits' -import { translate } from '../../lib/i18n' -import { capitalize } from '../../lib/string' -import SquareImageBox from './SquareImageBox' - -interface TypeLabelProps { - type: string -} - -const TypeLabel = ({ type }: TypeLabelProps) => { - const battlesuitType = battlesuitTypes.find((aType) => aType.value === type) - - const { locale } = useRouter() - const label = - battlesuitType != null - ? translate( - locale, - { 'ko-KR': battlesuitType.krLabel }, - battlesuitType.label - ) - : capitalize(type) - - return ( - - {isValidType(type) && ( - - )} - {label} - - ) -} - -export default TypeLabel - -function isValidType(type: string): boolean { - switch (type) { - case 'mecha': - case 'biologic': - case 'psychic': - case 'quantum': - case 'imaginary': - return true - } - return false -} diff --git a/src/components/atoms/ValkyrieLabel.tsx b/src/components/atoms/ValkyrieLabel.tsx deleted file mode 100644 index 3dee2806..00000000 --- a/src/components/atoms/ValkyrieLabel.tsx +++ /dev/null @@ -1,36 +0,0 @@ -/** @jsxImportSource theme-ui */ -import { Flex, Text } from '@theme-ui/components' -import { useRouter } from 'next/router' -import { assetsBucketBaseUrl } from '../../lib/consts' -import { valkyries } from '../../lib/honkai3rd/battlesuits' -import { translate } from '../../lib/i18n' -import SquareImageBox from './SquareImageBox' - -interface ValkyrieLabelProps { - valkyrie: string -} - -const ValkyrieLabel = ({ valkyrie }: ValkyrieLabelProps) => { - const { icon, label, krLabel } = valkyries.find( - (aValkyrie) => aValkyrie.value === valkyrie - ) || { label: valkyrie, krLabel: valkyrie } - const { locale } = useRouter() - - const translatedLabel = translate(locale, { 'ko-KR': krLabel }, label) - - return ( - - {icon && ( - - )} - {translatedLabel} - - ) -} - -export default ValkyrieLabel diff --git a/src/components/v2/BattlesuitCatalogItemCard.tsx b/src/components/v2/BattlesuitCatalogItemCard.tsx index ff675025..e9934f2e 100644 --- a/src/components/v2/BattlesuitCatalogItemCard.tsx +++ b/src/components/v2/BattlesuitCatalogItemCard.tsx @@ -20,7 +20,6 @@ const BattlesuitCatalogItemCard = ({ battlesuit, label = false }: BattlesuitCata textAlign: 'center', overflow: 'hidden', width: 110, - marginLeft: -10, textOverflow: 'ellipsis', whiteSpace: 'nowrap' }} diff --git a/src/lib/i18n.ts b/src/lib/i18n.ts index 849867d6..2a4ee643 100644 --- a/src/lib/i18n.ts +++ b/src/lib/i18n.ts @@ -1,4 +1,5 @@ import { useTranslation } from 'next-i18next' +import { useRouter } from 'next/router' export function translate( targetLocale: string = 'en_US', @@ -9,3 +10,8 @@ export function translate( } export { useTranslation } + +export function useLocale() { + const { locale } = useRouter() + return locale || 'en-US' +} diff --git a/src/lib/v2/data/er.ts b/src/lib/v2/data/er.ts index 2a975f0a..21a066ed 100644 --- a/src/lib/v2/data/er.ts +++ b/src/lib/v2/data/er.ts @@ -1,16 +1,16 @@ export const signetGroups = [ - { id: '1', name: '[구원]의 각인', icon: 'Kevin' }, - { id: '2', name: '[황금]의 각인', icon: 'Eden' }, - { id: '3', name: '[오멸]의 각인', icon: 'Kalpas' }, - { id: '4', name: '[천혜]의 각인', icon: 'Su' }, - { id: '5', name: '[찰나]의 각인', icon: 'Sakura' }, - { id: '6', name: '[무한]의 각인', icon: 'Mobius' }, - { id: '7', name: '[부생]의 각인', icon: 'Hua' }, - // { id: '8', name: '[■■]의 각인', icon: 'Elysia' }, - // { id: '9', name: '[■■]의 각인', icon: 'Elysia' }, - { id: '10', name: '[계율]의 각인', icon: 'Aponia' }, - { id: '11', name: '[나선]의 각인', icon: 'Verve' }, - { id: '12', name: '[욱광]의 각인', icon: 'Kosma' }, - { id: '13', name: '[번성]의 각인', icon: 'Griseo' }, - { id: '14', name: '[환몽]의 각인', icon: 'Pardofelis' } + { id: '1', icon: 'Kevin' }, + { id: '2', icon: 'Eden' }, + { id: '3', icon: 'Kalpas' }, + { id: '4', icon: 'Su' }, + { id: '5', icon: 'Sakura' }, + { id: '6', icon: 'Mobius' }, + { id: '7', icon: 'Hua' }, + // { id: '8', icon: 'Elysia' }, + // { id: '9', icon: 'Elysia' }, + { id: '10', icon: 'Aponia' }, + { id: '11', icon: 'Verve' }, + { id: '12', icon: 'Kosma' }, + { id: '13', icon: 'Griseo' }, + { id: '14', icon: 'Pardofelis' } ] diff --git a/src/lib/v2/data/text.ts b/src/lib/v2/data/text.ts index 379249a9..d91f3f36 100644 --- a/src/lib/v2/data/text.ts +++ b/src/lib/v2/data/text.ts @@ -1,6 +1,24 @@ import { AttributeType, CharacterType, SkillType, StigmaType, TagType, WeaponType } from './types' -export function getAttributeLabel(type: AttributeType) { +export function getAttributeLabel(type: AttributeType, locale: string) { + if (locale === 'en-US') { + switch (type) { + case 'bio': + return 'Biologic' + case 'psy': + return 'Psychic' + case 'mech': + return 'Mecha' + case 'qua': + return 'Quantum' + case 'img': + return 'IMG' + case 'none': + return 'None' + default: + return `Unknown Attribute Type (${type})` + } + } switch (type) { case 'bio': return '생물' @@ -19,7 +37,35 @@ export function getAttributeLabel(type: AttributeType) { } } -export function getWeaponTypeLabel(type: WeaponType) { +export function getWeaponTypeLabel(type: WeaponType, locale: string) { + if (locale === 'en-US') { + switch (type) { + case 'pistols': + return 'Pistols' + case 'katana': + return 'Blade' + case 'cannon': + return 'Heavy' + case 'cross': + return 'Cross' + case '2-handed': + return '2-Handed' + case 'scythe': + return 'Scythe' + case 'lance': + return 'Lance' + case 'fists': + return 'Fists' + case 'bow': + return 'Bow' + case 'chakram': + return 'Chakram' + case 'javelin': + return 'Javelin' + default: + return `Unknown Weapon Type (${type})` + } + } switch (type) { case 'pistols': return '쌍권총' @@ -48,7 +94,19 @@ export function getWeaponTypeLabel(type: WeaponType) { } } -export function getStigmaTypeLabel(type: StigmaType) { +export function getStigmaTypeLabel(type: StigmaType, locale: string) { + if (locale === 'en-US') { + switch (type) { + case 'top': + return 'Top' + case 'mid': + return 'Mid' + case 'bot': + return 'Bot' + default: + return `Unknown Stigma Type (${type})` + } + } switch (type) { case 'top': return '상단' @@ -61,7 +119,29 @@ export function getStigmaTypeLabel(type: StigmaType) { } } -export function getSkillTypeLabel(type: SkillType) { +export function getSkillTypeLabel(type: SkillType, locale: string) { + if (locale === 'en-US') { + switch (type) { + case 'leader': + return 'Leader Skill' + case 'passive': + return 'Passive' + case 'evasion': + return 'Evade' + case 'special': + return 'Special Attack' + case 'ultimate': + return 'Ultimate' + case 'basic': + return 'Basic Skill' + case 'sp': + return 'SP Skill' + case 'none': + return 'None' + default: + return `Unknown Skill Type (${type})` + } + } switch (type) { case 'leader': return '리더 스킬' @@ -70,7 +150,7 @@ export function getSkillTypeLabel(type: SkillType) { case 'evasion': return '회피' case 'special': - return '기본 공격' + return '특수 공격' case 'ultimate': return '필살기' case 'basic': @@ -84,7 +164,7 @@ export function getSkillTypeLabel(type: SkillType) { } } -export function getCharacterTypeLabel(type: CharacterType, locale: string = 'en-US') { +export function getCharacterTypeLabel(type: CharacterType, locale: string) { if (locale === 'en-US') { switch (type) { case 'kiana': @@ -249,8 +329,8 @@ export function getCharacterTypeLabel(type: CharacterType, locale: string = 'en- } } -export function getTagTypeLabel(type: TagType, locale: string = 'en-US') { - if (type) { +export function getTagTypeLabel(type: TagType, locale: string) { + if (locale === 'en-US') { switch (type) { case 'branch': return 'Branch' @@ -362,7 +442,21 @@ export function getTagTypeLabel(type: TagType, locale: string = 'en-US') { } } -export function getErSignetTypeLabel(quality: number) { +export function getErSignetTypeLabel(quality: number, locale: string) { + if (locale === 'en-US') { + switch (quality) { + case 1: + return 'Normal Signet' + case 2: + return 'Enhanced Signet' + case 3: + return 'Core Signet' + case 4: + return 'Exclusive Signet' + default: + return `Unknown (${quality})` + } + } switch (quality) { case 1: return '일반 각인' @@ -373,6 +467,75 @@ export function getErSignetTypeLabel(quality: number) { case 4: return '전용 각인' default: - return `Unknown (${quality})` + return `Unknown Signet Type(${quality})` + } +} + +export function getSignetGroupLabel(id: string, locale: string) { + if (locale === 'en-US') { + switch (id) { + case '1': + return 'Deliverance' + case '2': + return 'Gold' + case '3': + return 'Decimation' + case '4': + return 'Bodhi' + case '5': + return 'Setsuna' + case '6': + return 'Infinity' + case '7': + return 'Vicissitude' + case '8': + return '■■' + case '9': + return '■■' + case '10': + return 'Discipline' + case '11': + return 'Helix' + case '12': + return 'Daybreak' + case '13': + return 'Stars' + case '14': + return 'Reverie' + default: + return `Unknown Signet Group (${id})` + } + } + switch (id) { + case '1': + return '[구원]의 각인' + case '2': + return '[황금]의 각인' + case '3': + return '[오멸]의 각인' + case '4': + return '[천혜]의 각인' + case '5': + return '[찰나]의 각인' + case '6': + return '[무한]의 각인' + case '7': + return '[부생]의 각인' + case '8': + return '[■■]의 각인' + case '9': + return '[■■]의 각인' + case '10': + return '[계율]의 각인' + case '11': + return '[나선]의 각인' + case '12': + return '[욱광]의 각인' + case '13': + return '[번성]의 각인' + case '14': + return '[환몽]의 각인' + default: + return `Unknown Signet Group (${id})` } } diff --git a/src/lib/v2/data/utils.ts b/src/lib/v2/data/utils.ts index 34bb1686..e50b41ae 100644 --- a/src/lib/v2/data/utils.ts +++ b/src/lib/v2/data/utils.ts @@ -1,4 +1,4 @@ -import { BattlesuitSkill, CharacterType, TagType } from './types' +import { AttributeType, BattlesuitSkill, CharacterType, TagType } from './types' export function sortBattlesuitSkill(a: BattlesuitSkill, b: BattlesuitSkill) { return reversedSkillTypeOrder.indexOf(b.skillType) - reversedSkillTypeOrder.indexOf(a.skillType) @@ -6,6 +6,8 @@ export function sortBattlesuitSkill(a: BattlesuitSkill, b: BattlesuitSkill) { const reversedSkillTypeOrder = ['leader', 'passive', 'evasion', 'special', 'ultimate', 'basic', 'sp', 'none'].reverse() +export const attributeTypes: AttributeType[] = ['bio', 'psy', 'mech', 'qua', 'img'] + export const characterFilterTypes: CharacterType[] = [ 'kiana', 'mei', @@ -56,6 +58,6 @@ export const tagFilterTypes: TagType[] = [ 'gather', 'heal', 'fast-atk', - 'aerial', - 'burst' + 'burst', + 'aerial' ] diff --git a/src/pages/honkai3rd/battlesuits/[battlesuitId].tsx b/src/pages/honkai3rd/battlesuits/[battlesuitId].tsx index c9dccc8a..c6d8f28d 100644 --- a/src/pages/honkai3rd/battlesuits/[battlesuitId].tsx +++ b/src/pages/honkai3rd/battlesuits/[battlesuitId].tsx @@ -26,6 +26,7 @@ import Honkai3rdLayout from '../../../components/layouts/Honkai3rdLayout' import { generateI18NPaths, getI18NProps } from '../../../server/i18n' import Head from '../../../components/atoms/Head' import { useTranslation } from 'next-i18next' +import { useLocale } from '../../../lib/i18n' interface BattlesuitShowPageProps { battlesuit: Battlesuit @@ -33,6 +34,8 @@ interface BattlesuitShowPageProps { const BattlesuitShowPage = ({ battlesuit }: BattlesuitShowPageProps) => { const { t } = useTranslation() + const locale = useLocale() + return ( { battlesuit.attributeType } / ${battlesuit.tags .map(tag => { - return getTagTypeLabel(tag) + return getTagTypeLabel(tag, locale) }) .join(', ')}`} canonicalHref={`/honkai3rd/battlesuits/${battlesuit.id}`} @@ -65,16 +68,16 @@ const BattlesuitShowPage = ({ battlesuit }: BattlesuitShowPageProps) => { - {getCharacterTypeLabel(battlesuit.character)} + {getCharacterTypeLabel(battlesuit.character, locale)} - {getAttributeLabel(battlesuit.attributeType)} + {getAttributeLabel(battlesuit.attributeType, locale)} - {getWeaponTypeLabel(battlesuit.weapon)} + {getWeaponTypeLabel(battlesuit.weapon, locale)} @@ -82,7 +85,7 @@ const BattlesuitShowPage = ({ battlesuit }: BattlesuitShowPageProps) => { return ( - {getTagTypeLabel(tag)} + {getTagTypeLabel(tag, locale)} ) })} @@ -108,7 +111,7 @@ const BattlesuitShowPage = ({ battlesuit }: BattlesuitShowPageProps) => { )} - {getSkillTypeLabel(skill.skillType)} + {getSkillTypeLabel(skill.skillType, locale)} {formatSkillInfo(skill)} diff --git a/src/pages/honkai3rd/battlesuits/index.tsx b/src/pages/honkai3rd/battlesuits/index.tsx index aa3df967..6a64b13e 100644 --- a/src/pages/honkai3rd/battlesuits/index.tsx +++ b/src/pages/honkai3rd/battlesuits/index.tsx @@ -1,7 +1,7 @@ /** @jsxImportSource theme-ui */ import { Box, Heading } from '@theme-ui/components' import { NextPageContext } from 'next' -import { Flex, Link, Text } from 'theme-ui' +import { Flex, Text } from 'theme-ui' import { loadBattlesuitCatalog } from '../../../lib/v2/server/loadData' import { BattlesuitCatalogItem, TagType } from '../../../lib/v2/data/types' import BattlesuitCatalogItemCard from '../../../components/v2/BattlesuitCatalogItemCard' @@ -11,13 +11,15 @@ import { useTranslation } from 'next-i18next' import Breadcrumb from '../../../components/organisms/Breadcrumb' import { getI18NProps } from '../../../server/i18n' import FilterButton from '../../../components/atoms/FilterButton' -import { translate } from '../../../lib/i18n' -import { characterFilterTypes } from '../../../lib/v2/data/utils' +import { useLocale } from '../../../lib/i18n' +import { attributeTypes, characterFilterTypes, tagFilterTypes } from '../../../lib/v2/data/utils' import { useRouter } from 'next/router' import { useMemo } from 'react' -import { getCharacterTypeLabel, getTagTypeLabel } from '../../../lib/v2/data/text' +import { getAttributeLabel, getCharacterTypeLabel, getTagTypeLabel } from '../../../lib/v2/data/text' import ChibiIcon from '../../../components/v2/ChibiIcon' import TagIcon from '../../../components/v2/TagIcon' +import AttributeIcon from '../../../components/v2/AttributeIcon' +import PageLink from '../../../components/atoms/PageLink' interface BattlesuitListPageProps { battlesuitCatalog: BattlesuitCatalogItem[] @@ -25,7 +27,8 @@ interface BattlesuitListPageProps { const BattlesuitListPage = ({ battlesuitCatalog }: BattlesuitListPageProps) => { const { t } = useTranslation() - const { locale, query } = useRouter() + const { query } = useRouter() + const locale = useLocale() const valkyrieFilter = useMemo(() => { if (query.valkyrie == null) { @@ -49,16 +52,28 @@ const BattlesuitListPage = ({ battlesuitCatalog }: BattlesuitListPageProps) => { return true } - return valkyrieFilter === battlesuit.character + switch (valkyrieFilter) { + case 'bio': + case 'psy': + case 'mech': + case 'qua': + case 'img': + return battlesuit.attributeType === valkyrieFilter + } + + return battlesuit.character === valkyrieFilter }) }, [battlesuitCatalog, valkyrieFilter]) - const tagFilterTypes = useMemo(() => { + const tagFilterTypeOptions = useMemo(() => { const tagSet = battlesuitsFilteredByValkyrie.reduce>((set, battlesuit) => { battlesuit.tags.forEach(tag => set.add(tag)) return set }, new Set()) - return [...tagSet] + + return [...tagSet].sort((a, b) => { + return tagFilterTypes.indexOf(a) - tagFilterTypes.indexOf(b) + }) }, [battlesuitsFilteredByValkyrie]) return ( @@ -83,26 +98,36 @@ const BattlesuitListPage = ({ battlesuitCatalog }: BattlesuitListPageProps) => { {t('battlesuits-list.filter-by-valkyries')} + {attributeTypes.map(type => { + const active = type === valkyrieFilter + + return ( + + + + {getAttributeLabel(type, locale)} + + + ) + })} {characterFilterTypes.map(type => { const active = type === valkyrieFilter return ( - - {translate(locale, { 'ko-KR': getCharacterTypeLabel(type, 'ko-KR') }, getCharacterTypeLabel(type))} - + {getCharacterTypeLabel(type, locale)} ) })} - {tagFilterTypes.length > 0 && ( + {tagFilterTypeOptions.length > 0 && ( <> {t('battlesuits-list.filter-by-features')} - {tagFilterTypes.map(type => { + {tagFilterTypeOptions.map(type => { const active = type === tagFilter return ( { > - - {translate(locale, { 'ko-KR': getTagTypeLabel(type, 'ko-KR') }, getTagTypeLabel(type))} - + {getTagTypeLabel(type, locale)} ) @@ -134,12 +157,13 @@ const BattlesuitListPage = ({ battlesuitCatalog }: BattlesuitListPageProps) => { } return battlesuit.tags.findIndex(tag => tag === tagFilter) > -1 }) + .sort(sortBattlesuits) .map(battlesuit => { return ( - + - + ) })} @@ -152,9 +176,35 @@ const BattlesuitListPage = ({ battlesuitCatalog }: BattlesuitListPageProps) => { export default BattlesuitListPage export async function getStaticProps({ locale }: NextPageContext) { - const battlesuitCatalog = loadBattlesuitCatalog() + const battlesuitCatalog = loadBattlesuitCatalog(locale).filter(item => { + // APHO 2 + if (item.id.match(/90[0-9]{2}/)) { + return false + } + switch (item.id) { + // Durandal Story Only + case '805': + // Bronya Story Only? + case '316': + // APHO 1 + case '1411': + case '1304': + case '1203': + return false + } + + return true + }) return { props: { battlesuitCatalog, ...(await getI18NProps(locale)) } } } + +function sortBattlesuits(a: BattlesuitCatalogItem, b: BattlesuitCatalogItem) { + return getOrderIndex(b) - getOrderIndex(a) + + function getOrderIndex(battlesuit: BattlesuitCatalogItem) { + return parseInt(battlesuit.id) + } +} diff --git a/src/pages/honkai3rd/elfs/[elfId].tsx b/src/pages/honkai3rd/elfs/[elfId].tsx index 90ea0cec..e5e01030 100644 --- a/src/pages/honkai3rd/elfs/[elfId].tsx +++ b/src/pages/honkai3rd/elfs/[elfId].tsx @@ -128,7 +128,7 @@ const ElfShowPage = ({ elf }: ElfShowPageProps) => { export default ElfShowPage export async function getStaticProps({ locale, params }: NextPageContext & { params: { elfId: string } }) { - const elf = loadElfData(params.elfId) + const elf = loadElfData(params.elfId, locale) return { props: { elf, ...(await getI18NProps(locale)) } diff --git a/src/pages/honkai3rd/elfs/index.tsx b/src/pages/honkai3rd/elfs/index.tsx index 34399e4d..67960350 100644 --- a/src/pages/honkai3rd/elfs/index.tsx +++ b/src/pages/honkai3rd/elfs/index.tsx @@ -1,7 +1,7 @@ /** @jsxImportSource theme-ui */ import { Box, Card, Heading } from '@theme-ui/components' import { NextPageContext } from 'next' -import { Flex, Link } from 'theme-ui' +import { Flex } from 'theme-ui' import { ElfCatalogItem } from '../../../lib/v2/data/types' import { loadElfCatalog } from '../../../lib/v2/server/loadData' import RarityBar from '../../../components/v2/RarityBar' @@ -11,6 +11,7 @@ import Head from '../../../components/atoms/Head' import { useTranslation } from 'next-i18next' import { getI18NProps } from '../../../server/i18n' import Breadcrumb from '../../../components/organisms/Breadcrumb' +import PageLink from '../../../components/atoms/PageLink' interface ElfListPageProps { elfs: ElfCatalogItem[] @@ -34,7 +35,7 @@ const ElfListPage = ({ elfs }: ElfListPageProps) => { { href: '/honkai3rd/elfs', label: t('common.elfs') } ]} /> - Elfs + {t('elfs-list.elfs')} {elfs .sort((a, b) => { @@ -49,7 +50,7 @@ const ElfListPage = ({ elfs }: ElfListPageProps) => { .map(elf => { return ( - + @@ -61,7 +62,7 @@ const ElfListPage = ({ elfs }: ElfListPageProps) => { {elf.fullName} - + ) })} @@ -74,7 +75,7 @@ const ElfListPage = ({ elfs }: ElfListPageProps) => { export default ElfListPage export async function getStaticProps({ locale }: NextPageContext) { - const elfs = loadElfCatalog() + const elfs = loadElfCatalog(locale) return { props: { elfs, ...(await getI18NProps(locale)) } diff --git a/src/pages/honkai3rd/er/battlesuits/[battlesuitId].tsx b/src/pages/honkai3rd/er/battlesuits/[battlesuitId].tsx index 363c509c..cc52b2c3 100644 --- a/src/pages/honkai3rd/er/battlesuits/[battlesuitId].tsx +++ b/src/pages/honkai3rd/er/battlesuits/[battlesuitId].tsx @@ -134,8 +134,8 @@ const BattlesuitShowPage = ({ battlesuit, erBattlesuit }: BattlesuitShowPageProp export default BattlesuitShowPage export async function getStaticProps({ locale, params }: NextPageContext & { params: { battlesuitId: string } }) { - const battlesuit = loadBattlesuitData(params.battlesuitId) - const erBattlesuit = loadErBattlesuit(params.battlesuitId) + const battlesuit = loadBattlesuitData(params.battlesuitId, locale) + const erBattlesuit = loadErBattlesuit(params.battlesuitId, locale) return { props: { battlesuit, erBattlesuit, ...(await getI18NProps(locale)) } diff --git a/src/pages/honkai3rd/er/index.tsx b/src/pages/honkai3rd/er/index.tsx index 22236858..6f6da0dc 100644 --- a/src/pages/honkai3rd/er/index.tsx +++ b/src/pages/honkai3rd/er/index.tsx @@ -21,6 +21,8 @@ import Breadcrumb from '../../../components/organisms/Breadcrumb' import { useTranslation } from 'next-i18next' import { getI18NProps } from '../../../server/i18n' import PageLink from '../../../components/atoms/PageLink' +import { getSignetGroupLabel } from '../../../lib/v2/data/text' +import { useLocale } from '../../../lib/i18n' interface ErPageProps { erBattlesuitCatalog: ErBattlesuitCatalogItem[] @@ -31,6 +33,7 @@ interface ErPageProps { const ErPage = ({ erBattlesuitCatalog, battlesuitCatalog, erSupports, erSigils }: ErPageProps) => { const { t } = useTranslation() + const locale = useLocale() const battlesuitCatalogMap = useMemo(() => { return battlesuitCatalog.reduce((map, item) => { @@ -57,9 +60,9 @@ const ErPage = ({ erBattlesuitCatalog, battlesuitCatalog, erSupports, erSigils } } ]} /> - Elysian Realm + {t('elysian-realm.elysian-realm')} - Signets + {t('elysian-realm.signets')} {signetGroups.map(signetGroup => { return ( @@ -71,7 +74,7 @@ const ErPage = ({ erBattlesuitCatalog, battlesuitCatalog, erSupports, erSigils } originalSize={120} size={40} /> - {signetGroup.name} + {getSignetGroupLabel(signetGroup.id, locale)} @@ -79,7 +82,7 @@ const ErPage = ({ erBattlesuitCatalog, battlesuitCatalog, erSupports, erSigils } })} - Battlesuits + {t('elysian-realm.battlesuits')} {erBattlesuitCatalog.map(erBattlesuit => { const battlesuit = battlesuitCatalogMap.get(erBattlesuit.battlesuit)! @@ -93,7 +96,7 @@ const ErPage = ({ erBattlesuitCatalog, battlesuitCatalog, erSupports, erSigils } })} - Supports + {t('elysian-realm.supports')} {erSupports.map(support => { @@ -109,14 +112,13 @@ const ErPage = ({ erBattlesuitCatalog, battlesuitCatalog, erSupports, erSigils } {battlesuit.fullName} - {/* */} ) })} - Sigils + {t('elysian-realm.remembrance-sigil')} {erSigils.map(sigil => { @@ -137,13 +139,13 @@ const ErPage = ({ erBattlesuitCatalog, battlesuitCatalog, erSupports, erSigils } export default ErPage export async function getStaticProps({ locale }: NextPageContext) { - const erBattlesuitCatalog = loadErBattlesuitCatalog() - const battlesuitCatalog = loadBattlesuitCatalog() - const erSupports = loadErSupports().map(support => { + const erBattlesuitCatalog = loadErBattlesuitCatalog(locale) + const battlesuitCatalog = loadBattlesuitCatalog(locale) + const erSupports = loadErSupports(locale).map(support => { return support.battlesuit }) - const erSigils = loadErSigils().map(sigil => { + const erSigils = loadErSigils(locale).map(sigil => { return { id: sigil.id, name: sigil.name diff --git a/src/pages/honkai3rd/er/sigils.tsx b/src/pages/honkai3rd/er/sigils.tsx index 6ca381ba..28d0c8fc 100644 --- a/src/pages/honkai3rd/er/sigils.tsx +++ b/src/pages/honkai3rd/er/sigils.tsx @@ -22,7 +22,7 @@ const SigilsPage = ({ erSigils }: SigilsPageProps) => { title={`${t('elysian-realm.remembrance-sigil')} (${t('common.elysian-realm')}) - ${t( 'common.honkai-3rd' )} - ${t('common.abyss-lab')}`} - description={`${t('common.elysian-realm')} ${t('elysian-realm.supports')}`} + description={`${t('common.elysian-realm')} ${t('elysian-realm.remembrance-sigil')}`} canonicalHref={`/honkai3rd/er/sigils`} /> @@ -41,7 +41,7 @@ const SigilsPage = ({ erSigils }: SigilsPageProps) => { ]} /> - ER Sigils + {t('elysian-realm.remembrance-sigil')} {erSigils.map(sigil => { @@ -76,7 +76,7 @@ const SigilsPage = ({ erSigils }: SigilsPageProps) => { export default SigilsPage export async function getStaticProps({ locale }: NextPageContext) { - const erSigils = loadErSigils() + const erSigils = loadErSigils(locale) return { props: { erSigils, ...(await getI18NProps(locale)) } diff --git a/src/pages/honkai3rd/er/signets/[groupId].tsx b/src/pages/honkai3rd/er/signets/[groupId].tsx index 58469724..42465866 100644 --- a/src/pages/honkai3rd/er/signets/[groupId].tsx +++ b/src/pages/honkai3rd/er/signets/[groupId].tsx @@ -6,12 +6,13 @@ import { Fragment, useMemo } from 'react' import { assetsBucketBaseUrl } from '../../../../lib/consts' import { signetGroups } from '../../../../lib/v2/data/er' import SquareImage from '../../../../components/v2/SquareImage' -import { getErSignetTypeLabel } from '../../../../lib/v2/data/text' +import { getErSignetTypeLabel, getSignetGroupLabel } from '../../../../lib/v2/data/text' import Honkai3rdLayout from '../../../../components/layouts/Honkai3rdLayout' import Head from '../../../../components/atoms/Head' import { useTranslation } from 'next-i18next' import Breadcrumb from '../../../../components/organisms/Breadcrumb' import { generateI18NPaths, getI18NProps } from '../../../../server/i18n' +import { useLocale } from '../../../../lib/i18n' interface BattlesuitShowPageProps { group: ErSignetGroup @@ -20,6 +21,7 @@ interface BattlesuitShowPageProps { const BattlesuitShowPage = ({ signets, group }: BattlesuitShowPageProps) => { const { t } = useTranslation() + const locale = useLocale() const signetSets = useMemo(() => { const signetSetMap = signets.reduce>((map, signet) => { @@ -56,7 +58,7 @@ const BattlesuitShowPage = ({ signets, group }: BattlesuitShowPageProps) => { }, { href: `/honkai3rd/er/signets/${group.id}`, - label: group.name + label: getSignetGroupLabel(group.id, locale) } ]} /> @@ -77,7 +79,7 @@ const BattlesuitShowPage = ({ signets, group }: BattlesuitShowPageProps) => { {signet.name} - {getErSignetTypeLabel(signet.quality)} + {getErSignetTypeLabel(signet.quality, locale)} {signet.desc} @@ -100,7 +102,7 @@ const BattlesuitShowPage = ({ signets, group }: BattlesuitShowPageProps) => { export default BattlesuitShowPage export async function getStaticProps({ locale, params }: NextPageContext & { params: { groupId: string } }) { - const signets = loadErSignets(params.groupId) + const signets = loadErSignets(params.groupId, locale) const group = signetGroups.find(group => group.id === params.groupId) return { diff --git a/src/pages/honkai3rd/er/supports.tsx b/src/pages/honkai3rd/er/supports.tsx index e4e7ccd6..575df556 100644 --- a/src/pages/honkai3rd/er/supports.tsx +++ b/src/pages/honkai3rd/er/supports.tsx @@ -52,7 +52,7 @@ const SupportsPage = ({ } ]} /> - ER Supports + {t('elysian-realm.supports')} {erSupports.map(support => { @@ -84,8 +84,8 @@ const SupportsPage = ({ export default SupportsPage export async function getStaticProps({ locale }: NextPageContext) { - const battlesuitCatalog = loadBattlesuitCatalog() - const erSupports = loadErSupports() + const battlesuitCatalog = loadBattlesuitCatalog(locale) + const erSupports = loadErSupports(locale) return { props: { battlesuitCatalog, erSupports, ...(await getI18NProps(locale)) } diff --git a/src/pages/honkai3rd/stigmata-sets/[stigmataSetId].tsx b/src/pages/honkai3rd/stigmata-sets/[stigmataSetId].tsx index c1e3d158..67ef04a3 100644 --- a/src/pages/honkai3rd/stigmata-sets/[stigmataSetId].tsx +++ b/src/pages/honkai3rd/stigmata-sets/[stigmataSetId].tsx @@ -187,9 +187,9 @@ const StigmataSetShowPage = ({ stigmataSet, stigmata }: StigmataSetShowPage) => export default StigmataSetShowPage export async function getStaticProps({ locale, params }: NextPageContext & { params: { stigmataSetId: string } }) { - const stigmataSet = loadStigmataSetData(params.stigmataSetId) + const stigmataSet = loadStigmataSetData(params.stigmataSetId, locale) const stigmata = stigmataSet.stigmaIdList.map(id => { - return loadStigmaData(id) + return loadStigmaData(id, locale) }) return { diff --git a/src/pages/honkai3rd/stigmata-sets/index.tsx b/src/pages/honkai3rd/stigmata-sets/index.tsx index d48ff700..744b60b1 100644 --- a/src/pages/honkai3rd/stigmata-sets/index.tsx +++ b/src/pages/honkai3rd/stigmata-sets/index.tsx @@ -94,7 +94,7 @@ const StigmataSetListPage = ({ stigmataSetCatalog }: StigmataSetListPageProps) = export default StigmataSetListPage export async function getStaticProps({ locale }: NextPageContext) { - const stigmataSetCatalog = loadStigmataSetCatalog() + const stigmataSetCatalog = loadStigmataSetCatalog(locale) return { props: { stigmataSetCatalog, ...(await getI18NProps(locale)) } diff --git a/src/pages/honkai3rd/stigmata/[stigmaId].tsx b/src/pages/honkai3rd/stigmata/[stigmaId].tsx index 64a52ea2..8cd8bc1a 100644 --- a/src/pages/honkai3rd/stigmata/[stigmaId].tsx +++ b/src/pages/honkai3rd/stigmata/[stigmaId].tsx @@ -15,6 +15,7 @@ import Head from '../../../components/atoms/Head' import { useTranslation } from 'next-i18next' import Breadcrumb from '../../../components/organisms/Breadcrumb' import PageLink from '../../../components/atoms/PageLink' +import { useLocale } from '../../../lib/i18n' interface StigmaShowPageProps { rootStigma: RootStigma @@ -23,6 +24,7 @@ interface StigmaShowPageProps { const StigmaShowPage = ({ rootStigma, stigmataSetCatalogItem }: StigmaShowPageProps) => { const { t } = useTranslation() + const locale = useLocale() const stigma = rootStigma.stigmata[rootStigma.stigmata.length - 1] @@ -70,7 +72,7 @@ const StigmaShowPage = ({ rootStigma, stigmataSetCatalogItem }: StigmaShowPagePr {replaceNewLine(stigma.description)} - {getStigmaTypeLabel(stigma.type)} + {getStigmaTypeLabel(stigma.type, locale)} HP : {hp} / ATK : {atk} / DEF : {def} / CRT : {crt} (at Max Lv {stigma.maxLv}) @@ -148,7 +150,7 @@ const StigmaShowPage = ({ rootStigma, stigmataSetCatalogItem }: StigmaShowPagePr )} - {/*
{JSON.stringify(weapon, null, 2)}
*/} + {/*
{JSON.stringify(stigma, null, 2)}
*/}
) @@ -157,14 +159,14 @@ const StigmaShowPage = ({ rootStigma, stigmataSetCatalogItem }: StigmaShowPagePr export default StigmaShowPage export async function getStaticProps({ locale, params }: NextPageContext & { params: { stigmaId: string } }) { - const rootStigma = loadStigmaData(params.stigmaId) + const rootStigma = loadStigmaData(params.stigmaId, locale) const setId = rootStigma.stigmata[0].setId let stigmataSetCatalogItem: StigmataSetCatalogItem | null = null if (setId !== '0') { - const stigmataSet = loadStigmataSetData(setId) + const stigmataSet = loadStigmataSetData(setId, locale) const setStigmataList = stigmataSet.stigmaIdList.map(id => { - const targetRootStigma = params.stigmaId === id ? rootStigma : loadStigmaData(id) + const targetRootStigma = params.stigmaId === id ? rootStigma : loadStigmaData(id, locale) const maxedStigma = targetRootStigma.stigmata[targetRootStigma.stigmata.length - 1] return { id: targetRootStigma.id, diff --git a/src/pages/honkai3rd/stigmata/index.tsx b/src/pages/honkai3rd/stigmata/index.tsx index 8211cb7d..cb5a7265 100644 --- a/src/pages/honkai3rd/stigmata/index.tsx +++ b/src/pages/honkai3rd/stigmata/index.tsx @@ -26,7 +26,7 @@ const StigmataListPage = ({ stigmataCatalog }: StigmataListPageProps) => { { href: '/honkai3rd/stigmata', label: t('common.stigmata') } ]} /> - Stigmata (Single) + {t('stigmata-list.stigmata-single')} {t('stigmata-list.show-set-list')} @@ -70,7 +70,7 @@ const StigmataListPage = ({ stigmataCatalog }: StigmataListPageProps) => { export default StigmataListPage export async function getStaticProps({ locale }: NextPageContext) { - const stigmataCatalog = loadStigmataCatalog() + const stigmataCatalog = loadStigmataCatalog(locale) return { props: { stigmataCatalog, ...(await getI18NProps(locale)) } diff --git a/src/pages/honkai3rd/weapons/[weaponId].tsx b/src/pages/honkai3rd/weapons/[weaponId].tsx index 94435aa8..1bdf0682 100644 --- a/src/pages/honkai3rd/weapons/[weaponId].tsx +++ b/src/pages/honkai3rd/weapons/[weaponId].tsx @@ -13,6 +13,7 @@ import Head from '../../../components/atoms/Head' import { useTranslation } from 'next-i18next' import { generateI18NPaths, getI18NProps } from '../../../server/i18n' import Breadcrumb from '../../../components/organisms/Breadcrumb' +import { useLocale } from '../../../lib/i18n' interface WeaponShowPageProps { rootWeapon: RootWeaponData @@ -20,9 +21,11 @@ interface WeaponShowPageProps { const WeaponShowPage = ({ rootWeapon }: WeaponShowPageProps) => { const { t } = useTranslation() + const locale = useLocale() + const weapon = rootWeapon.weapons[rootWeapon.weapons.length - 1] - const weaponTypeLabel = getWeaponTypeLabel(weapon.type) + const weaponTypeLabel = getWeaponTypeLabel(weapon.type, locale) const atk = Math.floor(weapon.attackBase + weapon.attackAdd * (weapon.maxLv - 1)) const crt = Math.floor(weapon.criticalBase + weapon.criticalAdd * (weapon.maxLv - 1)) @@ -54,7 +57,7 @@ const WeaponShowPage = ({ rootWeapon }: WeaponShowPageProps) => { {replaceNewLine(weapon.description)} - {getWeaponTypeLabel(weapon.type)} + {getWeaponTypeLabel(weapon.type, locale)} ATK : {atk} / CRT : {crt} (at Max Lv {weapon.maxLv}) @@ -112,7 +115,7 @@ const WeaponShowPage = ({ rootWeapon }: WeaponShowPageProps) => { export default WeaponShowPage export async function getStaticProps({ locale, params }: NextPageContext & { params: { weaponId: string } }) { - const rootWeapon = loadWeaponData(params.weaponId) + const rootWeapon = loadWeaponData(params.weaponId, locale) return { props: { rootWeapon, ...(await getI18NProps(locale)) } diff --git a/src/pages/honkai3rd/weapons/index.tsx b/src/pages/honkai3rd/weapons/index.tsx index 0d1d0ec2..bdedcce4 100644 --- a/src/pages/honkai3rd/weapons/index.tsx +++ b/src/pages/honkai3rd/weapons/index.tsx @@ -72,7 +72,7 @@ const WeaponListPage = ({ weaponCatalog }: WeaponListPageProps) => { export default WeaponListPage export async function getStaticProps({ locale }: NextPageContext) { - const weaponCatalog = loadWeaponCatalog() + const weaponCatalog = loadWeaponCatalog(locale) return { props: { weaponCatalog, ...(await getI18NProps(locale)) }