Skip to content

Commit 9f6c119

Browse files
committed
Update descriptions
1 parent e162ca4 commit 9f6c119

File tree

4 files changed

+24
-15
lines changed

4 files changed

+24
-15
lines changed

pages/artifacts/[artifact].tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default function ArtifactWebpage({ artifact, location, guides }: Props &
2424
<meta name="twitter:card" content="summary" />
2525
<meta property="og:title" content={`${artifact.name} | Hu Tao`} />
2626
<meta property="og:description" content={`The ${artifact.name} artifact set${artifact.artis?.length ?? 0 > 0 ?
27-
` consists of ${artifact.artis?.length} pieces and is available in ${joinMulti(artifact.levels?.map(l => `${l} star`) ?? [])} variants. \nIt also has` :
27+
` consists of ${artifact.artis?.length} pieces and is available in ${joinMulti(artifact.levels?.map(l => `${l}`) ?? [])} star variants. \nIt also has` :
2828
" has"} ${joinMulti(artifact.bonuses?.map(b => `a ${b.count} piece set bonus: "${clean(b.desc)}"`) ?? [])}.`} />
2929
{artifact.artis?.[0]?.icon && <meta property="og:image" content={getIconPath(artifact.artis[0].icon)} />}
3030
</Head>

pages/characters/[char].tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export default function CharacterWebpage({ char, location, characterCurves, cost
3434
<title>{char.name} | Hu Tao</title>
3535
<meta name="twitter:card" content="summary" />
3636
<meta property="og:title" content={`${char.name} | Hu Tao`} />
37-
<meta property="og:description" content={getDescription(char, charElems)} />
37+
<meta property="og:description" content={getDescription(char, charElems, characterCurves)} />
3838
{char.icon && <meta property="og:image" content={getIconPath(char.icon)} />}
3939
</Head>
4040
<h2 className="font-semibold">
@@ -109,8 +109,21 @@ export default function CharacterWebpage({ char, location, characterCurves, cost
109109
)
110110
}
111111

112-
function getDescription(char: Character, charElems: ("Pyro" | "Electro" | "Cryo" | "Hydro" | "Anemo" | "Geo" | "Dendro")[]): string | undefined {
113-
return `${char.name} is a ${char.star ? `${char.star} star ` : ""}${joinMulti(charElems)} ${getWeaponLine()}.\n${getAscensionLine()}${getTalentLine()}${clean(char.desc)}`.trim()
112+
function getDescription(char: Character, charElems: ElementType[], characterCurves: CharacterCurves | null): string | undefined {
113+
return `${char.name} is a ${char.star ? `${char.star} star ` : ""}${joinMulti(charElems)} ${getWeaponLine()}.\n${getCharStatsLine()}\n${getAscensionLine()}${getTalentLine()}`.trim()
114+
115+
function getCharStatsLine() {
116+
if (isFullCharacter(char) && characterCurves)
117+
return getStatsLine(
118+
char.ascensions[char.ascensions.length - 1].maxLevel,
119+
getCharStatsAt(char, char.ascensions[char.ascensions.length - 1].maxLevel, char.ascensions.length - 1, characterCurves)
120+
)
121+
return ""
122+
}
123+
124+
function getStatsLine(level: number, stats: Record<string, number>) {
125+
return `Stats at level ${level}: ${joinMulti(Object.entries(stats).map(([name, value]) => `${stat(name, value)} ${name}`))}. \n`
126+
}
114127

115128
function getWeaponLine() {
116129
if (char.weaponType)

pages/materials/[material].tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,22 @@ export default function MaterialWebpage({ mat, location, guides, usedBy }: Props
2525
const usedByDesc = []
2626

2727
if (usedBy.charTalents.length > 0 && usedBy.charAscension.length > 0)
28-
usedByDesc.push(`${joinMulti([...usedBy.charTalents, ...usedBy.charAscension].filter((v, i, a) => a.indexOf(v) == i).map(x => x.name))} character talents/ascensions`)
28+
usedByDesc.push(`Used by ${joinMulti([...usedBy.charTalents, ...usedBy.charAscension].map(x => x.name).filter((v, i, a) => a.indexOf(v) == i))} character talents/ascensions.`)
2929
else if (usedBy.charTalents.length > 0)
30-
usedByDesc.push(`${joinMulti(usedBy.charTalents.map(x => x.name))} character talents`)
30+
usedByDesc.push(`Used by ${joinMulti(usedBy.charTalents.map(x => x.name))} character talents.`)
3131
else if (usedBy.charAscension.length > 0)
32-
usedByDesc.push(`${joinMulti(usedBy.charAscension.map(x => x.name))} character ascensions`)
32+
usedByDesc.push(`Used by ${joinMulti(usedBy.charAscension.map(x => x.name))} character ascensions.`)
3333

3434
if (usedBy.weaponAscension.length > 0)
35-
usedByDesc.push(`${joinMulti(usedBy.weaponAscension.map(x => x.name))} weapon ascensions`)
35+
usedByDesc.push(`Used by ${joinMulti(usedBy.weaponAscension.map(x => x.name))} weapon ascensions.`)
3636

3737
return (
3838
<Main>
3939
<Head>
4040
<title>{mat.name} | Hu Tao</title>
4141
<meta name="twitter:card" content="summary" />
4242
<meta property="og:title" content={`${mat.name} | Hu Tao`} />
43-
<meta property="og:description" content={`${mat.name} is a ${mat.stars ? `${mat.stars} star ` : ""}${mat.type}. \n${usedByDesc.length > 0 ? `Used by ${joinMulti(usedByDesc)}.\n ` : ""}${mat.desc ? clean(mat.desc ?? "") : ""}`.trim()} />
43+
<meta property="og:description" content={`${mat.name} is a ${mat.stars ? `${mat.stars} star ` : ""}${mat.type}. \n${usedByDesc.join("\n")}\n${mat.desc ? clean(mat.desc ?? "") : ""}`.trim()} />
4444
{mat.icon && <meta property="og:image" content={getIconPath(mat.icon)} />}
4545
</Head>
4646
<h2 className="font-semibold">

pages/weapons/[weapon].tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ export default function WeaponWebpage({ weapon, weaponCurves, costTemplates, loc
9090
}
9191

9292
function getDescription(weapon: Weapon, weaponCurves: WeaponCurves | null): string | undefined {
93-
return `${weapon.name} is a ${weapon.stars ? `${weapon.stars} star ` : ""}${weapon.weaponType}. \n{getAscensionCostsLine()}${getPlaceholderStatsLine()}${getStatsLineFromAsc()}${getRefinementLine()}`.trim()
93+
return `${weapon.name} is a ${weapon.stars ? `${weapon.stars} star ` : ""}${weapon.weaponType}. \n${getStatsLineFromAsc()}\n${getAscensionCostsLine()}${getRefinementLine()}`.trim()
9494

9595
function getRefinementLine() {
9696
if (weapon.refinements && weapon.refinements.length > 0)
@@ -102,10 +102,6 @@ function getDescription(weapon: Weapon, weaponCurves: WeaponCurves | null): stri
102102
weapon.ascensions[weapon.ascensions.length - 1].maxLevel,
103103
getWeaponStatsAt(weapon, weapon.ascensions[weapon.ascensions.length - 1].maxLevel, weapon.ascensions.length - 1, weaponCurves)
104104
)
105-
return ""
106-
}
107-
108-
function getPlaceholderStatsLine() {
109105
if (weapon.placeholderStats)
110106
return getStatsLine(weapon.placeholderStats.level, weapon.placeholderStats.stats)
111107
return ""
@@ -118,7 +114,7 @@ function getDescription(weapon: Weapon, weaponCurves: WeaponCurves | null): stri
118114
}
119115

120116
function getStatsLine(level: number, stats: Partial<Record<StatsName, number>>) {
121-
return `Stats at level ${level}: ${joinMulti(Object.entries(stats).map(([name, value]) => `${name}: ${stat(name, value)}`))}. \n`
117+
return `Stats at level ${level}: ${joinMulti(Object.entries(stats).map(([name, value]) => `${stat(name, value)} ${name}`))}. \n`
122118
}
123119
}
124120

0 commit comments

Comments
 (0)