diff --git a/src/actions/index.js b/src/actions/index.js index 2d3f5e3a71..d512a51766 100644 --- a/src/actions/index.js +++ b/src/actions/index.js @@ -91,6 +91,9 @@ export const getAbilities = () => async (dispatch) => { export const getHeroAbilities = () => async (dispatch) => { dispatch({ type: 'heroAbilities', payload: await import('dotaconstants/build/hero_abilities.json') }); }; +export const getHeroAghs = () => async (dispatch) => { + dispatch({ type: 'heroAghs', payload: await import('dotaconstants/build/aghs_desc.json') }); +}; export const getNeutralAbilities = () => async (dispatch) => { dispatch({ type: 'neutralAbilities', payload: await import('dotaconstants/build/neutral_abilities.json') }); }; diff --git a/src/components/AghsTooltip/index.jsx b/src/components/AghsTooltip/index.jsx new file mode 100644 index 0000000000..865dc1b66f --- /dev/null +++ b/src/components/AghsTooltip/index.jsx @@ -0,0 +1,163 @@ +import React from 'react'; +import propTypes, { string } from 'prop-types'; +import styled from 'styled-components'; +import constants from '../constants'; +import AbilityTooltip from '../AbilityTooltip'; + +const Wrapper = styled.div` + position: relative; + width: 300px; + background: #131519; + background: linear-gradient(135deg, #131519, #1f2228); + overflow: hidden; + border: 2px solid #27292b; + + & > div:nth-child(2) { + position: relative; + border-top: 1px solid #080D15; + } +`; + +const InnerWrapper = styled.div` + overflow: hidden; +`; + +const Header = styled.div` + background: linear-gradient(to right, #51565F , #303338); + position: relative; +`; + +const HeaderContent = styled.div` + position: relative; + display: flex; + height: 50px; + padding: 13px; + white-space: nowrap; + + & img { + display: inline-block; + height: 100%; + border: 1px solid #080D15; + } + + & .name { + font-size: ${constants.fontSizeCommon}; + text-transform: uppercase; + color: ${constants.primaryTextColor}; + font-weight: bold; + text-shadow: 1px 1px black; + overflow: hidden; + white-space: nowrap; + text-overflow: ellipsis; + letter-spacing: 1px; + } +`; + +const UpgradeTypeWrapper = styled.div` + + display: flex; + flex-direction: row; + padding: 2px 0px; + margin: 2px 0px; + border-radius: 4px; + + & .upgrade_type_text { + background-color: #1c2e50; + color: #DDDDDD; + font-size: ${constants.fontSizeTiny}; + display: inline-flex; + text-transform: uppercase; + letter-spacing: 1px; + padding: 2px 4px; + } + + & .upgrade_type_filler { + display: inline-flex; + } + +`; + +const HeaderText = styled.div` + padding-left: 10px; + display: flex; + flex-direction: column; + +`; + + +const HeaderBgImg = styled.div` + position: absolute; + left: -20px; + height: 100%; + width: 20%; + background: ${({ img }) => `linear-gradient(rgba(0,0,0,0.5), rgba(0,0,0,0.5)), url('${process.env.REACT_APP_IMAGE_CDN}${img}')`}; + background-color: transparent; + background-repeat: no-repeat; + transform: scale(4); + filter: blur(15px); +`; + +const Description = styled.div` + position: relative; + padding: 13px; + color: #95a5a6; + text-shadow: 1px 1px black; +`; + + +const Break = styled.div` + margin-left: 13px; + margin-right: 13px; + height: 1px; + background-color: #080D15; +`; + + +const AghsTooltip = (props) => { + + const aghs = props.aghs; + + const renderToolTip = (aghs) => { + if(aghs.new_skill === true) { + // display ability type TT + return ( + + ) + } + else{ + return ( + // display minimal description + +
+ + + + +
{aghs.skill_name_loc}
+ +
Ability Upgrade
+
+ + + +
+ + {aghs.desc} + +
+ ) + } + } + + return ( + + {renderToolTip(aghs)} + + ); +} + +AghsTooltip.propTypes = { + aghs: propTypes.shape({}).isRequired, +}; + +export default AghsTooltip; diff --git a/src/components/Hero/Abilities.jsx b/src/components/Hero/Abilities.jsx index f1cba0345d..22cfd8665e 100644 --- a/src/components/Hero/Abilities.jsx +++ b/src/components/Hero/Abilities.jsx @@ -2,8 +2,10 @@ import React from 'react'; import { connect } from 'react-redux'; import styled from 'styled-components'; import propTypes from 'prop-types'; + import Ability from './Ability'; import Talents from './Talents'; +import Aghs from './Aghs'; const Wrapper = styled.div` align-items: center; @@ -75,10 +77,13 @@ const Abilities = ({ hero, abilities, heroAbilities }) => { return ( - {renderAbilities(heroAbs.skills)} + {renderAbilities(heroAbs.skills)} + + + ); }; diff --git a/src/components/Hero/Ability.jsx b/src/components/Hero/Ability.jsx index 8d6396aef5..f3b942dfce 100644 --- a/src/components/Hero/Ability.jsx +++ b/src/components/Hero/Ability.jsx @@ -38,7 +38,7 @@ const AbilityIcon = styled.img` const AbilityManaComsumption = styled.div` background: ${constants.colorBlackMuted}; color: ${constants.colorMana}; - border-radius: 2px 0 0 0; + border-radius: 4px 0 4px 0; font-weight: 600; bottom: 0; font-size: 10px; diff --git a/src/components/Hero/Aghs.jsx b/src/components/Hero/Aghs.jsx new file mode 100644 index 0000000000..a542cb4af0 --- /dev/null +++ b/src/components/Hero/Aghs.jsx @@ -0,0 +1,122 @@ +import React from 'react'; +import { connect } from 'react-redux'; +import styled from 'styled-components'; +import nanoid from 'nanoid'; +import propTypes from 'prop-types'; +import ReactTooltip from 'react-tooltip'; + +import constants from '../constants'; +import AghsTooltip from '../AghsTooltip'; + +const Wrapper = styled.div` + background: linear-gradient(to bottom, ${constants.colorBlueMuted}, ${constants.primarySurfaceColor}); + border-radius: 4px; + box-shadow: 0 2px 2px rgba(0, 0, 0, .3); + position: relative; + + .__react_component_tooltip { + opacity: 1 !important; + padding: 0px !important; +`; + +const AghsSlot = styled.div` + border-radius: 4px; + display: flex; + flex-direction: column; + height: auto; + opacity: 1; + overflow: hidden; + transition: opacity .2s, box-shadow .4s, transform .2s; + width: 100%; + + .solid_line { + border-top: 1px solid #1e1e1f; + margin: 2px 5px 2px 5px; + } +`; + +const IconWrapper = styled.div` + display: block; + overflow: hidden; + margin-right: auto; + margin-left: auto; + + &:hover { + opacity: 1; + box-shadow: 0 0 150px rgba(255, 255, 255, .4); + transform: scale(1.1); + } +`; + +const AghsIcon = styled.img` + display: block; + overflow: hidden; + margin-right: auto; + margin-left: auto; + width: 66%; + height: 66%; +`; + +const ShardIcon = styled.img` + display: block; + overflow: hidden; + margin-right: auto; + margin-left: auto; + width: 66%; + height: 66%; +`; + + +const Aghs = ({heroAghs, hero_npc_name, skills}) => { + const ttId = nanoid(); + const ttId2 = nanoid(); + + const hero_name = hero_npc_name; + const agh_element = heroAghs[hero_name]; + + agh_element.scepter.skillObj = skills.find(skill => { + return skill.data.dname === agh_element.scepter.skill_name_loc; + }).data; + agh_element.shard.skillObj = skills.find(skill => { + return skill.data.dname === agh_element.shard.skill_name_loc; + }).data; + + + + //const scepter_img = skills[0].key + skills[0].data.img; + + + return ( + + + + + + + + + +
+ + + + + + + + + + ); +}; + +Aghs.propTypes = { + heroAghs: propTypes.shape({}).isRequired, + skills: propTypes.array.isRequired, + hero_npc_name: propTypes.string.isRequired, +}; + +const mapStateToProps = state => ({ + heroAghs: state.app.heroAghs +}); + +export default connect(mapStateToProps)(Aghs); diff --git a/src/index.js b/src/index.js index 84b7a6876f..8ede8f6b01 100644 --- a/src/index.js +++ b/src/index.js @@ -5,7 +5,7 @@ import { render, hydrate } from 'react-dom'; import { Provider } from 'react-redux'; import { BrowserRouter } from 'react-router-dom'; import store from './store'; -import { getMetadata, getStrings, getAbilities, getHeroAbilities, getNeutralAbilities, getAbilityIds } from './actions'; +import { getMetadata, getStrings, getAbilities, getHeroAbilities, getHeroAghs, getNeutralAbilities, getAbilityIds } from './actions'; import App from './components/App'; // import { unregister } from './common/serviceWorker'; @@ -15,6 +15,7 @@ store.dispatch(getMetadata()); store.dispatch(getStrings()); store.dispatch(getAbilities()); store.dispatch(getHeroAbilities()); +store.dispatch(getHeroAghs()); store.dispatch(getNeutralAbilities()); store.dispatch(getAbilityIds()); diff --git a/src/reducers/index.js b/src/reducers/index.js index 7c0f33b0fb..fda28c5c60 100644 --- a/src/reducers/index.js +++ b/src/reducers/index.js @@ -46,6 +46,7 @@ export default combineReducers({ strings: (state = {}, action) => ((action && action.type === 'strings') ? action.payload : state), abilities: (state = {}, action) => ((action && action.type === 'abilities') ? action.payload : state), heroAbilities: (state = {}, action) => ((action && action.type === 'heroAbilities') ? action.payload : state), + heroAghs: (state = {}, action) => ((action && action.type === 'heroAghs') ? action.payload : state), neutralAbilities: (state = {}, action) => ((action && action.type === 'neutralAbilities') ? action.payload : state), abilityIds: (state = {}, action) => ((action && action.type === 'abilityIds') ? action.payload : state), form,