diff --git a/public/images/down.png b/public/images/arrows/down.png similarity index 100% rename from public/images/down.png rename to public/images/arrows/down.png diff --git a/public/images/down2.png b/public/images/arrows/down2.png similarity index 100% rename from public/images/down2.png rename to public/images/arrows/down2.png diff --git a/public/images/arrows/left.png b/public/images/arrows/left.png new file mode 100644 index 0000000..d3cf716 Binary files /dev/null and b/public/images/arrows/left.png differ diff --git a/public/images/arrows/leftdown.png b/public/images/arrows/leftdown.png new file mode 100644 index 0000000..5545d47 Binary files /dev/null and b/public/images/arrows/leftdown.png differ diff --git a/public/images/arrows/right.png b/public/images/arrows/right.png new file mode 100644 index 0000000..0b9cbce Binary files /dev/null and b/public/images/arrows/right.png differ diff --git a/public/images/arrows/rightdown.png b/public/images/arrows/rightdown.png new file mode 100644 index 0000000..6cf1bd1 Binary files /dev/null and b/public/images/arrows/rightdown.png differ diff --git a/src/App.scss b/src/App.scss index 870190a..8642602 100644 --- a/src/App.scss +++ b/src/App.scss @@ -1,3 +1,5 @@ +@import "sass/config"; + body { background-color: #111; font-family: Verdana; diff --git a/src/components/Arrow.scss b/src/components/Arrow.scss new file mode 100644 index 0000000..9237f1d --- /dev/null +++ b/src/components/Arrow.scss @@ -0,0 +1,76 @@ +@import "../sass/config"; + +.arrow { + $arrow-width: 15px; + position: absolute; + + &--right, + &--left { + height: $arrow-width; + + // Rows + @for $i from 0 through 6 { + &[data-row="#{$i}"] { + top: 12px + $row-offset + (($i) * $row-distance); + } + } + + // Lengths + @for $i from 0 through 3 { + &[data-length="#{$i}"] { + width: 1px + ($col-gutter * $i) + ($icon-size * ($i - 1)); + } + } + } + + &--right { + background: url('/images/arrows/right.png'); + background-position: center right; + + // Cols + @for $i from 0 through 3 { + &[data-col="#{$i}"] { + left: 3px + $col-offset + ($col-distance * $i) + $icon-size; + } + } + } + + &--left { + background: url('/images/arrows/left.png'); + background-position: center left; + + // Cols + @for $i from 0 through 3 { + &[data-col="#{$i}"] { + left: -3px + $col-offset + ($col-gutter * ($i - 1)) + $icon-size; + } + } + } + + &--down { + width: $arrow-width; + background: url('/images/arrows/down.png'); + background-position: center bottom; + + // Rows + @for $i from 0 through 6 { + &[data-row="#{$i}"] { + top: $row-offset + (($i) * $row-distance) + 40px; + } + } + + // Cols + @for $i from 0 through 3 { + &[data-col="#{$i}"] { + left: 5px + $col-offset + ($col-distance * $i) + floor($arrow-width / 2); + } + } + + // Lengths + @for $i from 0 through 3 { + &[data-length="#{$i}"] { + height: 2px + ($row-offset * $i) + ($icon-size * ($i - 1)); + } + } + } +} \ No newline at end of file diff --git a/src/components/Arrow.tsx b/src/components/Arrow.tsx new file mode 100644 index 0000000..1304284 --- /dev/null +++ b/src/components/Arrow.tsx @@ -0,0 +1,29 @@ +import './Arrow.scss' +import React, { FC } from 'react' +import classNames from 'classnames' + +interface Props { + from: TalentData + to: TalentData +} + +export const Arrow: FC = ({ from, to }) => { + const length = to.row === from.row + ? Math.abs(to.col - from.col) + : to.row - from.row + + const props = { + 'data-col': from.col, + 'data-row': from.row, + 'data-length': length, + } + + const className = classNames('arrow', { + 'arrow--down': to.row > from.row, + 'arrow--right': to.row === from.row && to.col > from.col, + 'arrow--left': to.row === from.row && to.col < from.col, + 'arrow--right-down': to.row === from.row + 1 && to.col === from.col + 1 + }) + + return
+} \ No newline at end of file diff --git a/src/components/ClassPicker.tsx b/src/components/ClassPicker.tsx index f22ebf8..aa6fbc6 100644 --- a/src/components/ClassPicker.tsx +++ b/src/components/ClassPicker.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { NavLink, Link } from 'react-router-dom' +import { Link } from 'react-router-dom' import { classByName } from '../data/classes' import { Icon } from './Icon' import classNames from 'classnames' diff --git a/src/components/TalentSlot.scss b/src/components/TalentSlot.scss index 457508f..0a481b2 100644 --- a/src/components/TalentSlot.scss +++ b/src/components/TalentSlot.scss @@ -1,13 +1,4 @@ -$row-offset: 30px; -$row-distance: 70px; - -$col-offset: 44px; -$col-distance: 56px; - -$color-yellow: #ffd100; -$color-green: #1eff00; -$color-dark-green: #40bf40; -$color-subtle: #9d9d9d; +@import "../sass/config"; .talent { position: absolute; diff --git a/src/components/TalentTree.tsx b/src/components/TalentTree.tsx index 00dedb7..4706c14 100644 --- a/src/components/TalentTree.tsx +++ b/src/components/TalentTree.tsx @@ -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 = ({ 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 + }) + return (
@@ -45,6 +56,8 @@ export const TalentTree: React.FC = ({ specId, knownTalents, availablePoi onRightClick={handleRightClick} /> )} + + {arrows}
) diff --git a/src/sass/_config.scss b/src/sass/_config.scss new file mode 100644 index 0000000..6188427 --- /dev/null +++ b/src/sass/_config.scss @@ -0,0 +1,13 @@ +$icon-size: 40px; + +$row-offset: 30px; +$row-distance: $icon-size + $row-offset; + +$col-offset: 44px; +$col-gutter: 16px; +$col-distance: $icon-size + $col-gutter; + +$color-yellow: #ffd100; +$color-green: #1eff00; +$color-dark-green: #40bf40; +$color-subtle: #9d9d9d;