mirror of
https://github.com/lexogrine/dota2-react-hud.git
synced 2026-05-04 04:23:10 +02:00
fixed missing heroes, items and team logo error
This commit is contained in:
+2
-4
@@ -6,8 +6,6 @@ import { Dota2, DOTA2GSI, PlayerExtension } from 'dotagsi';
|
||||
import { io } from "socket.io-client";
|
||||
import { loadAvatarURL } from './api/avatars';
|
||||
import { Match } from './api/interfaces';
|
||||
import Statistics from './HUD/GameHUD/ObservedStatistics';
|
||||
import TopSideBar from './HUD/GameHUD/TopSideBar';
|
||||
import "./HUD/GameHUD/gamehud.scss";
|
||||
import { exampleData } from './example';
|
||||
import { initiateConnection } from './HUD/Camera/mediaStream';
|
||||
@@ -130,7 +128,7 @@ class App extends React.Component<any, { game: Dota2 | null, steamids: string[],
|
||||
});
|
||||
|
||||
socket.on("refreshHUD", () => {
|
||||
window.top.location.reload();
|
||||
window.top && window.top.location.reload();
|
||||
});
|
||||
|
||||
DOTA2.on('data', data => {
|
||||
@@ -189,7 +187,7 @@ class App extends React.Component<any, { game: Dota2 | null, steamids: string[],
|
||||
|
||||
|
||||
}).catch(() => {
|
||||
dataLoader.match = null;
|
||||
//dataLoader.match = null;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
@@ -13,7 +13,7 @@ const ObservedPlayer = ({ players, player, team, show}: { show: boolean, player:
|
||||
<div className="team_box">
|
||||
<div className={`${player.team_name} team_bar`}></div>
|
||||
<div className="team_logo">
|
||||
{team && team.id ? <img src={`${apiUrl}api/teams/logo/${team.id}`} /> : null}
|
||||
{team && team.id && team.logo ? <img src={`${apiUrl}api/teams/logo/${team.id}`} /> : null}
|
||||
</div>
|
||||
</div>
|
||||
<div className="username shadowed-text">{player.name} { player.kills ? <div className="player_kills">
|
||||
|
||||
@@ -2,15 +2,15 @@ import React from 'react';
|
||||
import { Draft, Team, Faction, Player, TeamDraft } from 'dotagsi';
|
||||
import TopSideBar from './TopSideBar';
|
||||
|
||||
const Statistics = ({ player, type, teamId, show}: { player: Player | null, type: Faction, teamId: string, show: boolean}) => {
|
||||
const Statistics = ({ player, type, team, show}: { player: Player | null, type: Faction, team: Team, show: boolean}) => {
|
||||
if (!player) {
|
||||
|
||||
return <TopSideBar type={type} teamId={teamId} show={show}>
|
||||
return <TopSideBar type={type} team={team} show={show}>
|
||||
|
||||
</TopSideBar>
|
||||
}
|
||||
const { gpm, xpm, kills, deaths, assists } = player;
|
||||
return <TopSideBar type={type} teamId={teamId} show={show}>
|
||||
return <TopSideBar type={type} team={team} show={show}>
|
||||
<div className="gpm_xpm_container">
|
||||
GPM <strong className="shadowed-text">{gpm}</strong> / XPM <strong className="shadowed-text">{xpm}</strong>
|
||||
</div>
|
||||
|
||||
@@ -2,14 +2,14 @@ import React from 'react';
|
||||
import { Draft, Team, Faction, Player, TeamDraft } from 'dotagsi';
|
||||
import { apiUrl } from '../../api/api';
|
||||
|
||||
const TopSideBar = ({ children, type, teamId, show }: { children: any, type: Faction, teamId: string, show: boolean }) => {
|
||||
const TopSideBar = ({ children, type, team, show }: { children: any, type: Faction, team: Team, show: boolean }) => {
|
||||
return <div className={`top_side_bar ${type === 'radiant' ? 'left':'right'} ${!show ? 'hide':''}`}>
|
||||
{type === 'radiant' ? (
|
||||
<div className="logo_and_type">
|
||||
<div className={`type_color ${type}`}>
|
||||
|
||||
</div>
|
||||
<img src={`${apiUrl}api/teams/logo/${teamId}`}/>
|
||||
{ team && team.id && team.logo && <img src={`${apiUrl}api/teams/logo/${team.id}`}/>}
|
||||
</div>
|
||||
) : null}
|
||||
{children}
|
||||
@@ -18,7 +18,7 @@ const TopSideBar = ({ children, type, teamId, show }: { children: any, type: Fac
|
||||
<div className={`type_color ${type}`}>
|
||||
|
||||
</div>
|
||||
<img src={`${apiUrl}api/teams/logo/${teamId}`}/>
|
||||
{ team && team.id && team.logo && <img src={`${apiUrl}api/teams/logo/${team.id}`}/>}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
@@ -130,10 +130,10 @@ export default class Layout extends React.Component<Props, State> {
|
||||
<Statistics
|
||||
player={game.player}
|
||||
type="radiant"
|
||||
teamId={game.map.radiant && game.map.radiant.id || ''}
|
||||
team={game.map.radiant}
|
||||
show={view === 'game'}
|
||||
/>
|
||||
<TopSideBar type="dire" teamId={game.map.dire && game.map.dire.id || ''} show={view === 'game'}>
|
||||
<TopSideBar type="dire" team={game.map.dire} show={view === 'game'}>
|
||||
<span>{this.state.text}</span>
|
||||
|
||||
</TopSideBar>
|
||||
|
||||
@@ -72,7 +72,7 @@ const Scoreboard = ({ map, players, match, show }: { players: Player[], match: M
|
||||
return <>
|
||||
<div className={`top_board ${!show ? 'hide' : ''}`}>
|
||||
<div className="team_logo">
|
||||
{map.radiant.id ? <img src={`${apiUrl}api/teams/logo/${map.radiant.id}`} /> : null}
|
||||
{map.radiant.id && map.radiant.logo ? <img src={`${apiUrl}api/teams/logo/${map.radiant.id}`} /> : null}
|
||||
</div>
|
||||
{map.radiant.name}
|
||||
<div className="score_info">
|
||||
@@ -93,7 +93,7 @@ const Scoreboard = ({ map, players, match, show }: { players: Player[], match: M
|
||||
</div>
|
||||
{map.dire.name}
|
||||
<div className="team_logo">
|
||||
{map.dire.id ? <img src={`${apiUrl}api/teams/logo/${map.dire.id}`} /> : null}
|
||||
{map.dire.id && map.dire.logo ? <img src={`${apiUrl}api/teams/logo/${map.dire.id}`} /> : null}
|
||||
</div>
|
||||
</div>
|
||||
<div className={`players_scoreboard ${!show ? 'hide' : ''}`}>
|
||||
|
||||
Reference in New Issue
Block a user