Skip to content

Commit

Permalink
Fix showAll
Browse files Browse the repository at this point in the history
  • Loading branch information
andgein committed Aug 24, 2023
1 parent 58b6168 commit d6bdc36
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 5 deletions.
3 changes: 3 additions & 0 deletions scoreboard/src/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ export class GameModel {
selectedTeam: SelectedTeam | null;
service_infos: { [id: number]: IsServiceActive };

showAll: boolean;

constructor(info: Info) {
this.scoreboard = null;
this.allScoreboards = [];
Expand Down Expand Up @@ -99,6 +101,7 @@ export class GameModel {
this.slalineWidth = Math.ceil(this.roundsCount / this.slaPeriodLength);
this.active_services = this.services.map((_service, index) => index);
this.service_infos = {}
this.showAll = getParameterByName("showAll") !== null;
}

public almostDeadServices() {
Expand Down
4 changes: 2 additions & 2 deletions scoreboard/src/plusminusline.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ class Plusminusline extends Component<PlusminuslineProps> {
const minus = this.props.minus;
const maxsum = this.props.maxsum;
const className = (this.props.className === undefined) ? "" : " " + this.props.className;
const plusWidth = Math.max(plus > 0 ? 1 : 0, plus / maxsum * 99);
const minusWidth = Math.max(minus > 0 ? 1 : 0, minus / maxsum * 99);
const plusWidth = Math.max(plus > 0 ? 1 : 0, Math.min(100, plus / maxsum * 99));
const minusWidth = Math.max(minus > 0 ? 1 : 0, Math.min(100, minus / maxsum * 99));
const margin = minus > 0 && plus > 0 ? 1 : 0;
return (
<div className={"plusminusline" + className}>
Expand Down
4 changes: 2 additions & 2 deletions scoreboard/src/scoreboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ class Scoreboard extends Component<ScoreboardProps> {
this.teamRefs[i] = instance;
}} key={t.team_id} team={t} model={this.model!} handleClick={this.onTeamClick}
servicesFrom={this.servicesFrom} servicesTo={this.servicesTo} servicesCount={this.services_count_part}
showAll={this.model!.showAll}
/>
);
}
Expand Down Expand Up @@ -258,7 +259,6 @@ class Scoreboard extends Component<ScoreboardProps> {
if (almostDeadServices.length > 3)
almostDeadServicesDescriptions[almostDeadServicesDescriptions.length - 1] += " + ..."
}
console.log(almostDeadServices);
return (
<div className={this.additionalStyle === null ? "" : this.additionalStyle}>
{this.compactScoreboardWidth === 0 ? null :
Expand All @@ -279,7 +279,7 @@ class Scoreboard extends Component<ScoreboardProps> {
{this.logo && <div className={"contest-logo"}>
<img src={this.logo} alt="Contest logo"/>
</div>}
{almostDeadServices.length > 0 &&
{almostDeadServices.length > 0 && !this.model.showAll &&
<div key="almost-dead" className="service-header almost-dead">
<div className="attacksplot"></div>
<div className="service-name" style={{color: "white"}}>Old services</div>
Expand Down
2 changes: 1 addition & 1 deletion scoreboard/src/setupProxy.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { createProxyMiddleware } = require('http-proxy-middleware');

let target_host = 'http://10.10.10.10:8080/';
let target_host = 'http://10.10.10.10/';

module.exports = function (app) {
app.use(createProxyMiddleware('/logo.png', {target: target_host, ws: true, changeOrigin: true}));
Expand Down
4 changes: 4 additions & 0 deletions scoreboard/src/team.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ interface TeamProps {
servicesFrom: number;
servicesTo: number;
handleClick: (clickedTeamId: number, deselectCallback: () => void) => void;
showAll: boolean;
}

interface TeamComponentState {
Expand Down Expand Up @@ -93,6 +94,9 @@ class Team extends Component<TeamProps, TeamComponentState> {
sflags: arraySum(almostDeadServiceInfos.map(s => s.sflags)),
id: -1,
} as ServiceState;
if (this.props.showAll) {
almostDeadServices = [];
}
return (
<div>
<div className={"team " + (this.state.isSelected ? "team_selected" : "")} onClick={this.handleClick}>
Expand Down

0 comments on commit d6bdc36

Please sign in to comment.