Add down-, right- and left-wards arrows, still missing active state

This commit is contained in:
Melvin Valster
2019-07-22 22:48:05 +02:00
parent 9d91bc32fb
commit 1866951986
13 changed files with 136 additions and 12 deletions
+14 -1
View File
@@ -2,7 +2,8 @@ import React, { useCallback } from 'react'
import { Map } from 'immutable'
import { TalentSlot } from './TalentSlot';
import { getPointsInSpec } from '../lib/tree';
import { talentsBySpec, specNames } from '../data/talents';
import { talentsBySpec, specNames, talentsById } from '../data/talents'
import { Arrow } from './Arrow'
interface Props {
specId: number
@@ -27,6 +28,16 @@ export const TalentTree: React.FC<Props> = ({ specId, knownTalents, availablePoi
backgroundImage: `url("https://wow.zamimg.com/images/wow/talents/backgrounds/classic/${specId}.jpg")`
}
const arrows = talents
.filter((talent) => talent.requires.length > 0)
.map((talent) => {
return <Arrow
key={talent.id}
from={talentsById[talent.requires[0].id]}
to={talent}
/>
})
return (
<div className="tree">
<div className="tree__header">
@@ -45,6 +56,8 @@ export const TalentTree: React.FC<Props> = ({ specId, knownTalents, availablePoi
onRightClick={handleRightClick}
/>
)}
{arrows}
</div>
</div>
)