Skip to content

Commit

Permalink
Merge pull request #3108 from odota/master
Browse files Browse the repository at this point in the history
[RELEASE] 2023-08-10
  • Loading branch information
howardchung authored Aug 10, 2023
2 parents cf76959 + e2d28fa commit e99deb0
Show file tree
Hide file tree
Showing 8 changed files with 199 additions and 164 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"ace-builds": "^1.4.7",
"core-js": "^3.6.4",
"dota2-emoticons": "^1.0.3",
"dotaconstants": "^7.16.0",
"dotaconstants": "^7.17.0",
"fuzzy": "^0.1.3",
"heatmap.js": "^2.0.5",
"history": "^4.10.1",
Expand Down
13 changes: 12 additions & 1 deletion src/actions/transformMatch.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ function generateExpandedUnitNames(strings) {
Object.keys(strings)
.filter(str => str.indexOf('npc_dota_') === 0)
.forEach((key) => {
// Currently, no unit goes up higher than 4
// Currently, no unit goes up higher than 4
for (let i = 1; i < 5; i += 1) {
expanded[key.replace('#', i)] = strings[key];
}
Expand Down Expand Up @@ -145,6 +145,16 @@ function generateVisionLog(match) {

function transformMatch(m) {
const { abilityIds, strings } = store.getState().app;

// lane winning
const lineResults = m.players.reduce((res, pl) => {
res[pl.isRadiant] = res[pl.isRadiant] || [];
res[pl.isRadiant][pl.lane] = res[pl.isRadiant][pl.lane] || 0;

res[pl.isRadiant][pl.lane] += pl.gold_t[10]
return res;
}, {});

const newPlayers = m.players.map((player) => {
const newPlayer = {
...player,
Expand All @@ -153,6 +163,7 @@ function transformMatch(m) {
kill_streaks_max: getMaxKeyOfObject(player.kill_streaks),
lh_ten: (player.lh_t || [])[10],
dn_ten: (player.dn_t || [])[10],
line_win: lineResults[player.isRadiant][player.lane] > lineResults[!player.isRadiant][player.lane],
analysis: analyzeMatch(m, player),
};

Expand Down
70 changes: 35 additions & 35 deletions src/components/ItemTooltip/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -189,69 +189,69 @@ const ItemTooltip = ({ item, inflictor }) => (
<Wrapper>
<Header>
<div className="header-content">
<img id="item-img" src={`${process.env.REACT_APP_IMAGE_CDN}${item}`} alt={item.dname} />
<img id="item-img" src={`${process.env.REACT_APP_IMAGE_CDN}${item.img}`} alt={item.dname} />
<HeaderText>
<div>{item.dname}</div>
<div id="gold">{item.tier ? "Neutral item" : <><img src={`${process.env.REACT_APP_IMAGE_CDN}/apps/dota2/images/tooltips/gold.png`} alt="Gold" />{item.cost}</>}</div>
</HeaderText>
</div>
</Header>
{(item.attrib && item.attrib.length > 0) &&
<Attributes>
{(item.attrib).map((attrib) => (
<Attribute key={attrib.key}>
<span id="header">{attrib.header} </span>
<span id="value">{`${attrib.value}`}</span>
<span id="footer"> {attrib.footer || ''}</span>
</Attribute>
))}
</Attributes>
<Attributes>
{(item.attrib).map((attrib) => (
<Attribute key={attrib.key}>
<span id="header">{attrib.header} </span>
<span id="value">{`${attrib.value}`}</span>
<span id="footer"> {attrib.footer || ''}</span>
</Attribute>
))}
</Attributes>
}
{['active', 'toggle', 'use', 'passive'].map((type) => {
if (item[type]) {
return item[type].map(ability =>
(
<Ability>
<div className="ability-header">
{`${itemAbilities[type].text}: ${ability.name}`}
<div className="resources">
{type === 'active' && item.mc &&
(
<Ability>
<div className="ability-header">
{`${itemAbilities[type].text}: ${ability.name}`}
<div className="resources">
{type === 'active' && item.mc &&
<span>
<ResourceIcon src={`${process.env.REACT_APP_IMAGE_CDN}/apps/dota2/images/tooltips/mana.png`} alt="Mana icon" />
<span className="values">{item.mc}</span>
</span>
}
{type === 'active' && item.cd &&
{type === 'active' && item.cd &&
<span>
<ResourceIcon src={`${process.env.REACT_APP_IMAGE_CDN}/apps/dota2/images/tooltips/cooldown.png`} alt="Cooldown icon" />
<span className="values">{item.cd}</span>
</span>
}
</div>
</div>
<div className="ability-text" ref={el => styleValues(el)}>
{ability.desc}
</div>
</Ability>
));
</div>
<div className="ability-text" ref={el => styleValues(el)}>
{ability.desc}
</div>
</Ability>
));
}
return null;
})}
{item.hint && item.hint?.map((hint) => <Hint>{hint}</Hint>)}
{item.lore && <Lore>{item.lore}</Lore>}
{item.components &&
<Components>
<div id="header">Components:</div>
{item.components.concat((items[`recipe_${inflictor}`] && [`recipe_${inflictor}`]) || []).filter(Boolean).map(component =>
items[component] &&
(
<div className="component">
<img src={`${process.env.REACT_APP_IMAGE_CDN}${items[component].img}`} alt="" />
<div id="cost">{items[component].cost}</div>
</div>
))
}
</Components>
<Components>
<div id="header">Components:</div>
{item.components.concat((items[`recipe_${inflictor}`] && [`recipe_${inflictor}`]) || []).filter(Boolean).map(component =>
items[component] &&
(
<div className="component">
<img src={`${process.env.REACT_APP_IMAGE_CDN}${items[component].img}`} alt="" />
<div id="cost">{items[component].cost}</div>
</div>
))
}
</Components>
}
</Wrapper>
);
Expand Down
12 changes: 11 additions & 1 deletion src/components/Match/Laning/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,18 +28,28 @@ class Laning extends React.Component {
this.setState({ ...this.state, selectedPlayer: playerSlot });
};

defaultSort = (r1, r2) => {
if (r1.isRadiant !== r2.isRadiant) {
return 1;
}

return r1.lane - r2.lane;
}

render() {
const {
match, strings, sponsorURL, sponsorIcon,
} = this.props;
const { laningColumns } = mcs(strings);

const tableData = [...match.players].sort(this.defaultSort);

return (
<StyledFlexContainer>
<StyledFlexElementFullWidth>
<Heading title={strings.heading_laning} />
<Table
data={match.players}
data={tableData}
columns={laningColumns(this.state, this.setSelectedPlayer)}
/>
</StyledFlexElementFullWidth>
Expand Down
8 changes: 8 additions & 0 deletions src/components/Match/StyledMatch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -394,3 +394,11 @@ export const StyledDmgTargetRow = styled.div`
}
}
`;

export const StyledLineWinnerSpan = styled.span`
& svg {
width: 20px !important;
height: 20px !important;
fill: ${constants.colorGolden};
}
`;
Loading

0 comments on commit e99deb0

Please sign in to comment.