import React, { useCallback } from 'react' import { Map } from 'immutable' import { TalentSlot } from './TalentSlot'; import { getPointsInSpec, canLearnTalent } from '../lib/tree'; import { talentsBySpec, specNames, talentsById } from '../data/talents' import { Arrow } from './Arrow' interface Props { specId: number availablePoints: number knownTalents: Map onTalentPress: TalentClickHandler } export const TalentTree: React.FC = ({ specId, knownTalents, availablePoints, onTalentPress }) => { const talents = Object.values(talentsBySpec[specId]) const handleClick = useCallback( (talentId) => onTalentPress(specId, talentId, 1), [specId, onTalentPress] ) const handleRightClick = useCallback( (talentId) => onTalentPress(specId, talentId, -1), [specId, onTalentPress] ) const bodyStyle = { 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 0 || canLearnTalent(knownTalents, talent)} /> }) return (

{specNames[specId]} ({getPointsInSpec(specId, knownTalents)})

{talents.map((talent) => )} {arrows}
) } ;(TalentTree as any).whyDidYouRender = true