Review changes, check files should exist before GET

This commit is contained in:
Elliptic Ellipsis
2021-12-31 03:02:25 +00:00
parent 945af1be1a
commit cfb65c808a
11 changed files with 33 additions and 39 deletions
@@ -5,14 +5,14 @@ import { faChartLine, faExternalLinkAlt } from '@fortawesome/free-solid-svg-icon
import { GamesService } from '../../games.service';
/**
* Displays a game's name, decomp progress, and links.
* Displays an externally-linked game's name, decomp progress, and links.
*/
@Component({
selector: 'external-game',
templateUrl: './external-game.component.html',
styleUrls: ['./external-game.component.scss']
selector: 'external-game-summary',
templateUrl: './external-game-summary.component.html',
styleUrls: ['./external-game-summary.component.scss']
})
export class ExternalGameComponent implements OnChanges {
export class ExternalGameSummaryComponent implements OnChanges {
constructor(private gamesService: GamesService) { }
@@ -36,10 +36,13 @@ export class ExternalGameComponent implements OnChanges {
chart = faChartLine;
ngOnChanges(): void {
this.gamesService.getGameShield(`${this.data.shieldURL}`).subscribe(
res => this.total = res.message,
err => console.error(err)
);
if (this.data.shieldURL) {
this.gamesService.getGameShield(`${this.data.shieldURL}`).subscribe(
res => this.total = res.message,
err => console.error(err)
);
}
}
}
@@ -1,4 +1,4 @@
<div fxLayout="row wrap" fxLayoutAlign="center">
<game-summary fxFlex="25%" fxFlex.xs="100%" fxFlex.sm="33%" *ngFor="let game of games" [data]="game"></game-summary>
<external-game fxFlex="25%" fxFlex.xs="100%" fxFlex.sm="33%" *ngFor="let game of externalGames" [data]="game"></external-game>
<external-game-summary fxFlex="25%" fxFlex.xs="100%" fxFlex.sm="33%" *ngFor="let game of externalGames" [data]="game"></external-game-summary>
</div>
@@ -7,13 +7,7 @@ h2 {
width: max-content;
}
game-summary {
flex-grow: 0;
margin-bottom: 12px;
margin-right: 1em;
}
external-game {
game-summary, external-game-summary {
flex-grow: 0;
margin-bottom: 12px;
margin-right: 1em;
@@ -19,7 +19,7 @@ export class GameSummariesComponent implements OnInit {
*/
games: IGame[] = [];
/**
* List of external games to use for "ExternalGame" components.
* List of external games to use for "ExternalGameSummary" components.
*/
externalGames: IExternalGame[] = [];
@@ -24,19 +24,18 @@ export class GameSummaryComponent implements OnChanges {
*/
total?: string;
/**
* Icon definition.
* Icon definitions.
*/
github = faGithub;
/**
* Icon definition.
*/
trello = faTrello;
ngOnChanges(): void {
this.gamesService.getGameShield(`${this.data.shieldURL}`).subscribe(
res => this.total = res.message,
err => console.error(err)
);
if (this.data.shieldURL) {
this.gamesService.getGameShield(`${this.data.shieldURL}`).subscribe(
res => this.total = res.message,
err => console.error(err)
);
}
}
}
+9 -7
View File
@@ -39,13 +39,15 @@ export class GameComponent implements OnInit {
}
else {
this.game = res[index];
forkJoin([
this.gamesService.getGameCSV(this.game.csvs.nonmatching),
this.gamesService.getGameCSV(this.game.csvs.matching)
]).subscribe(
res => this.csvData = res,
err => console.error(err)
);
if (this.game.progressMeta.length > 0) {
forkJoin([
this.gamesService.getGameCSV(this.game.csvs.nonmatching),
this.gamesService.getGameCSV(this.game.csvs.matching)
]).subscribe(
res => this.csvData = res,
err => console.error(err)
);
}
}
},
err => {
+2 -2
View File
@@ -5,7 +5,7 @@ import { GamesService } from './games.service';
import { GameSummariesComponent } from './game-summaries/game-summaries.component';
import { GameSummaryComponent } from './game-summaries/game-summary/game-summary.component';
import { GameComponent } from './game/game.component';
import { ExternalGameComponent } from './game-summaries/external-game/external-game.component'
import { ExternalGameSummaryComponent } from './game-summaries/external-game-summary/external-game-summary.component'
import { MatButtonModule } from '@angular/material/button';
import { MatCardModule } from '@angular/material/card';
import { MatGridListModule } from '@angular/material/grid-list';
@@ -52,7 +52,7 @@ export function markedOptionsFactory(): MarkedOptions {
GameProgressComponent,
GameChartComponent,
GameFAQComponent,
ExternalGameComponent
ExternalGameSummaryComponent
],
imports: [
CommonModule,
-4
View File
@@ -167,10 +167,6 @@ export interface ISubdivision {
* Describes a game's shield output.
*/
export interface IShield {
/**
* Always 1.
*/
schemaVersion: number;
/**
* Static label in left half.
*/