Skip to content

Commit c933dba

Browse files
committed
Improve talent layout
1 parent db8d918 commit c933dba

File tree

4 files changed

+55
-31
lines changed

4 files changed

+55
-31
lines changed

components/Main.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Component } from "react"
33
export default class Main extends Component<{className?: string, homePage?: true}> {
44
render() {
55
const classes =
6-
(!this.props.homePage ? "max-w-4xl w-full px-1" : "") +
6+
(!this.props.homePage ? "max-w-5xl w-full px-1" : "") +
77
(this.props.className ?? "")
88

99
return (

pages/characters/[name].tsx

Lines changed: 50 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,12 @@ export default function CharacterWebpage({ char, location, characterCurves, cost
5050
Table of Contents
5151
{isFullCharacter(char) && characterCurves && <TOC href="#stats" title="Stats" />}
5252
{char.ascensionCosts && costTemplates && <TOC href="#ascensions" title="Ascensions" />}
53-
{char.media.videos && <TOC href="#videos" title={Object.keys(char.media.videos).length > 1 ? "Videos" : "Video"} />}
5453
{char.meta && <TOC href="#meta" title="Meta" />}
54+
{char.media.videos && <TOC href="#videos" title={Object.keys(char.media.videos).length > 1 ? "Videos" : "Video"} />}
5555
{char.skills && char.skills.map((s, i) => (<>
5656
{multiskill && <div>{s.ult?.type ?? `Skillset #${i}`}</div>}
5757
{s.talents && <TOC depth={multiskill ? 1 : 0} href={`#talents${i > 0 ? `-${i}` : ""}`} title="Talents" />}
58-
{s.passive && <TOC depth={multiskill ? 1 : 0} href={`#passive${i > 0 ? `-${i}` : ""}`} title="Passive" />}
58+
{s.passive && <TOC depth={multiskill ? 1 : 0} href={`#passive${i > 0 ? `-${i}` : ""}`} title="Passives" />}
5959
{s.constellations && <TOC depth={multiskill ? 1 : 0} href={`#const${i > 0 ? `-${i}` : ""}`} title="Constellations" />}
6060
</>))}
6161
</div>
@@ -96,11 +96,11 @@ export default function CharacterWebpage({ char, location, characterCurves, cost
9696
{char.ascensionCosts && <AscensionCosts costs={char.ascensionCosts} />}
9797
{char.skills && <TalentCosts skills={char.skills} />}
9898
{guides && guides.length > 0 && <Guides guides={guides} />}
99-
<div className="clear-both"/>
99+
<div className="clear-both" />
100100
{isFullCharacter(char) && characterCurves && <Stats char={char} curves={characterCurves} />}
101101
{char.ascensionCosts && costTemplates && <FullAscensionCosts template={char.ascensionCosts} costTemplates={costTemplates} />}
102-
{char.media.videos && <Videos videos={char.media.videos} />}
103102
{char.meta && <Meta meta={char.meta} />}
103+
{char.media.videos && <Videos videos={char.media.videos} />}
104104
{char.skills && costTemplates && <CharacterSkills skills={char.skills} costTemplates={costTemplates} />}
105105
</div>
106106
</Main>
@@ -243,9 +243,9 @@ function Stats({ char, curves }: { char: CharacterFull, curves: Record<CurveEnum
243243
}
244244

245245
function Meta({ meta }: { meta: Meta }) {
246-
return <>
246+
return <div>
247247
<h3 className="text-lg font-bold pt-1" id="meta">Meta:</h3>
248-
<table className={`table-auto ${styles.table} mb-2`}>
248+
<table className={`table-auto ${styles.table} mb-2 w-full`}>
249249
<tbody className="divide-y divide-gray-200 dark:divide-gray-500">
250250
{meta.title && <tr><td>Title</td><td>{meta.title}</td></tr>}
251251
{meta.birthDay && meta.birthMonth && <tr><td>Title</td><td>{
@@ -269,16 +269,16 @@ function Meta({ meta }: { meta: Meta }) {
269269
{meta.cvKorean && <tr><td>Korean voice actor</td><td>{meta.cvKorean}</td></tr>}
270270
</tbody>
271271
</table>
272-
</>
272+
</div>
273273
}
274274

275275
function Videos({ videos }: { videos: Record<string, string> }) {
276276
const multiple = Object.keys(videos).length > 1
277277

278-
return <>
278+
return <div>
279279
<h3 className="text-lg font-bold pt-1" id="videos">{multiple ? "Videos" : "Video"}:</h3>
280280
{Object.entries(videos).map(([name, link]) => <Video key={name} name={name} link={link} />)}
281-
</>
281+
</div>
282282
}
283283

284284
function Video({ name, link }: { name: string, link: string }) {
@@ -302,33 +302,40 @@ function Guides({ guides }: { guides: string[][] }) {
302302
function CharacterSkills({ skills, costTemplates }: { skills: Skills[], costTemplates: CostTemplates }) {
303303
return <>
304304
{skills.map((skill, i) => {
305-
return <>
305+
return <div key={i}>
306306
{(skill.talents || skill.ult) && <>
307307
<h3 className="text-lg font-bold pt-1" id={`talents${i > 0 ? `-${i}` : ""}`}>Talents:</h3>
308308
{[...(skill.talents ?? []), skill.ult].map(s => s && <Talent costTemplates={costTemplates} talent={s} key={s.name} />)}
309309
</>}
310310
{skill.passive && <>
311-
<h3 className="text-lg font-bold pt-1" id={`passive${i > 0 ? `-${i}` : ""}`}>Passive:</h3>
311+
<h3 className="text-lg font-bold pt-1" id={`passive${i > 0 ? `-${i}` : ""}`}>Passives:</h3>
312312
{skill.passive.map(p => p && <Passive passive={p} key={p.name} />)}
313313
</>}
314314
{skill.constellations && <>
315315
<h3 className="text-lg font-bold pt-1" id={`const${i > 0 ? `-${i}` : ""}`}>Constellations:</h3>
316316
{skill.constellations.map(c => c && <Constellation c={c} key={c.name} />)}
317317
</>}
318-
</>
318+
</div>
319319
})}
320320
</>
321321
}
322322

323323
function Talent({ talent, costTemplates }: { talent: Skill, costTemplates: CostTemplates }) {
324-
325-
return <div>
326-
<div className="font-semibold">{talent.name}</div>
327-
{talent.icon && <Icon icon={talent} className="rounded-xl w-12 inline-block" />}
328-
<ReactMarkdown>{(talent.desc?.replace(/ ?\$\{.*?\}/g, "") ?? "")}</ReactMarkdown>
324+
return <div className="border p-1 rounded-xl mb-2 border-opacity-75">
325+
<div className="flex flex-row items-center">
326+
{talent.icon && <Icon icon={talent} className="rounded-xl w-16 h-16 mr-2" />}
327+
<div className="font-bold">{talent.name}</div>
328+
</div>
329+
<div className="flex flex-wrap md:flex-nowrap md:flex-row pb-1">
330+
<div className={(talent.video || talent.videomp4) ? "max-w-2xl pl-1" : "pl-1"}>
331+
<ReactMarkdown>{(talent.desc?.replace(/ ?\$\{.*?\}/g, "") ?? "")}</ReactMarkdown>
332+
</div>
333+
{(talent.video || talent.videomp4) && <div className="p-2 flex flex-col justify-around items-center w-full">
334+
{talent.videomp4 ? <video src={talent.videomp4} autoPlay loop className="w-full" /> : <img src={talent.video} alt="Talent video" className="w-full" />}
335+
</div>}
336+
</div>
329337
{talent.talentTable && <TalentTable table={talent.talentTable} />}
330338
{talent.costs && !Array.isArray(talent.costs) && <TalentCost template={talent.costs} costTemplates={costTemplates} />}
331-
{talent.video}
332339
</div>
333340
}
334341

@@ -337,7 +344,9 @@ function TalentCost({ template, costTemplates }: { template: CostTemplate, costT
337344
const maxCostWidth = costs?.reduce((p, c) => Math.max(p, c.items.length), 1) ?? 1
338345
const [expanded, setExpanded] = useState(false)
339346

340-
return <table className={`table-auto w-full ${styles.table} mb-2 ${expanded ? "" : "cursor-pointer"} sm:text-sm md:text-base text-xs`} onClick={() => setExpanded(true)}>
347+
return <>
348+
<div className="font-bold">Talent costs:</div>
349+
<table className={`table-auto w-full ${styles.table} mb-2 ${expanded ? "" : "cursor-pointer"} sm:text-sm md:text-base text-xs`} onClick={() => setExpanded(true)}>
341350
<thead className="font-semibold divide-x divide-gray-200 dark:divide-gray-500">
342351
<td>Lv.</td>
343352
<td>Mora</td>
@@ -366,6 +375,7 @@ function TalentCost({ template, costTemplates }: { template: CostTemplate, costT
366375
</tr>}
367376
</tbody>
368377
</table>
378+
</>
369379
}
370380

371381
function TalentTable({ table }: { table: (TalentTable | TalentValue)[] }) {
@@ -390,7 +400,8 @@ function TalentTable({ table }: { table: (TalentTable | TalentValue)[] }) {
390400
return j
391401
}
392402

393-
return <div className="overflow-x-auto">
403+
return <div className="overflow-x-auto pt-1">
404+
<div className="font-bold">Talent values:</div>
394405
<table className={`${maxLevel > 3 ? "table-auto" : "table-fixed"} w-full ${styles.table} mb-2 sm:text-sm md:text-base text-xs`}>
395406
<thead className="font-semibold divide-x divide-gray-200 dark:divide-gray-500">
396407
<td>Name</td>
@@ -408,19 +419,29 @@ function TalentTable({ table }: { table: (TalentTable | TalentValue)[] }) {
408419
}
409420

410421
function Passive({ passive }: { passive: Passive }) {
411-
return <div>
412-
<div className="font-semibold">{passive.name}</div>
413-
{passive.icon && <Icon icon={passive} className="rounded-xl w-12 inline-block" />}
414-
<ReactMarkdown>{(passive.desc?.replace(/ ?\$\{.*?\}/g, "") ?? "")}</ReactMarkdown>
415-
{passive.minAscension != undefined && <div>Unlocks at ascension {passive.minAscension}</div>}
422+
return <div className="border p-1 rounded-xl mb-2 border-opacity-75">
423+
<div className="flex flex-row items-center">
424+
{passive.icon && <Icon icon={passive} className="rounded-xl w-16 h-16 mr-2" />}
425+
<div className="font-bold">{passive.name}</div>
426+
</div>
427+
<div className="flex flex-col pb-1">
428+
<ReactMarkdown>{(passive.desc?.replace(/ ?\$\{.*?\}/g, "") ?? "")}</ReactMarkdown>
429+
{passive.minAscension != undefined && <div className="italic font-semibold pt-2">
430+
{passive.minAscension == 0 ? "Unlocked by default" : `Unlocks at ascension ${passive.minAscension}`}
431+
</div>}
432+
</div>
416433
</div>
417434
}
418435

419436
function Constellation({ c }: { c: Constellation }) {
420-
return <div>
421-
<div className="font-semibold">{c.name}</div>
422-
{c.icon && <Icon icon={c} className="rounded-xl w-12 inline-block" />}
423-
<ReactMarkdown>{(c.desc?.replace(/ ?\$\{.*?\}/g, "") ?? "")}</ReactMarkdown>
437+
return <div className="border p-1 rounded-xl mb-2 border-opacity-75">
438+
<div className="flex flex-row items-center">
439+
{c.icon && <Icon icon={c} className="rounded-xl w-16 h-16 mr-2" />}
440+
<div className="font-bold">{c.name}</div>
441+
</div>
442+
<div className="flex flex-col pb-1">
443+
<ReactMarkdown>{(c.desc?.replace(/ ?\$\{.*?\}/g, "") ?? "")}</ReactMarkdown>
444+
</div>
424445
</div>
425446
}
426447

public/global.css

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ blockquote {
33
margin-bottom: 0.5rem/* 8px */;
44
border-left-width: 2px;
55
}
6-
6+
strong {
7+
font-weight: 600;
8+
}
79
a {
810
--tw-text-opacity: 1;
911
color: rgb(30 64 175 / var(--tw-text-opacity));

utils/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,7 @@ export interface Skill {
163163
costs?: CostTemplate
164164
type?: string
165165
video?: string
166+
videomp4?: string
166167
icon?: string
167168
}
168169

0 commit comments

Comments
 (0)