Compare commits
No commits in common. "3076900a0778cdd135fe5660a53078474a2224ed" and "801250ea5f911bad3f91b6f72224470d26c9594a" have entirely different histories.
3076900a07
...
801250ea5f
2
.gitignore
vendored
2
.gitignore
vendored
@ -103,6 +103,7 @@ dist
|
|||||||
|
|
||||||
# vuepress v2.x temp and cache directory
|
# vuepress v2.x temp and cache directory
|
||||||
.temp
|
.temp
|
||||||
|
.cache
|
||||||
|
|
||||||
# Docusaurus cache and generated files
|
# Docusaurus cache and generated files
|
||||||
.docusaurus
|
.docusaurus
|
||||||
@ -131,4 +132,3 @@ dist
|
|||||||
|
|
||||||
#angular
|
#angular
|
||||||
.angular/
|
.angular/
|
||||||
/.DS_Store
|
|
||||||
|
@ -34,7 +34,7 @@
|
|||||||
"@angular-devkit/build-angular": "^14.1.3",
|
"@angular-devkit/build-angular": "^14.1.3",
|
||||||
"@angular/cli": "~14.1.3",
|
"@angular/cli": "~14.1.3",
|
||||||
"@angular/compiler-cli": "^14.1.0",
|
"@angular/compiler-cli": "^14.1.0",
|
||||||
"@schematics/angular": "^14.2.6",
|
"@types/dompurify": "2.2.3",
|
||||||
"@types/jasmine": "~4.0.0",
|
"@types/jasmine": "~4.0.0",
|
||||||
"jasmine-core": "~4.2.0",
|
"jasmine-core": "~4.2.0",
|
||||||
"karma": "~6.4.0",
|
"karma": "~6.4.0",
|
||||||
|
@ -5,6 +5,6 @@ const routes: Routes = [];
|
|||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
imports: [RouterModule.forRoot(routes)],
|
imports: [RouterModule.forRoot(routes)],
|
||||||
exports: [RouterModule],
|
exports: [RouterModule]
|
||||||
})
|
})
|
||||||
export class AppRoutingModule { }
|
export class AppRoutingModule { }
|
@ -1,7 +0,0 @@
|
|||||||
a {
|
|
||||||
padding: 10px;
|
|
||||||
|
|
||||||
&.active {
|
|
||||||
background: green;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,2 +0,0 @@
|
|||||||
<h1>{{game.title}}</h1>
|
|
||||||
<p>{{game.description}}</p>
|
|
@ -1,3 +0,0 @@
|
|||||||
:host {
|
|
||||||
display: block;
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { GameInfoComponent } from './game-info.component';
|
|
||||||
|
|
||||||
describe('GameInfoComponent', () => {
|
|
||||||
let component: GameInfoComponent;
|
|
||||||
let fixture: ComponentFixture<GameInfoComponent>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
declarations: [ GameInfoComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
|
|
||||||
fixture = TestBed.createComponent(GameInfoComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,15 +0,0 @@
|
|||||||
import { Component, Input, OnInit } from '@angular/core';
|
|
||||||
import { Game } from 'src/app/interfaces/game.interface';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-game-info[game]',
|
|
||||||
templateUrl: './game-info.component.html',
|
|
||||||
styleUrls: ['./game-info.component.scss'],
|
|
||||||
})
|
|
||||||
export class GameInfoComponent implements OnInit {
|
|
||||||
@Input() game!: Game;
|
|
||||||
|
|
||||||
constructor() {}
|
|
||||||
|
|
||||||
ngOnInit(): void {}
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
<div class="game" [ngClass]="{'active': active}">
|
|
||||||
<div class="game-title">{{game.title}}</div>
|
|
||||||
</div>
|
|
@ -1,11 +0,0 @@
|
|||||||
:host {
|
|
||||||
display: block;
|
|
||||||
|
|
||||||
.game {
|
|
||||||
|
|
||||||
&.active {
|
|
||||||
background-color: green;
|
|
||||||
color: #fff;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { GameItemComponent } from './game-item.component';
|
|
||||||
|
|
||||||
describe('GameItemComponent', () => {
|
|
||||||
let component: GameItemComponent;
|
|
||||||
let fixture: ComponentFixture<GameItemComponent>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
declarations: [ GameItemComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
|
|
||||||
fixture = TestBed.createComponent(GameItemComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,16 +0,0 @@
|
|||||||
import { Component, Input, OnInit } from '@angular/core';
|
|
||||||
import { Game } from 'src/app/interfaces/game.interface';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-game-item[game]',
|
|
||||||
templateUrl: './game-item.component.html',
|
|
||||||
styleUrls: ['./game-item.component.scss'],
|
|
||||||
})
|
|
||||||
export class GameItemComponent implements OnInit {
|
|
||||||
@Input() game!: Game;
|
|
||||||
@Input() active: boolean = false;
|
|
||||||
|
|
||||||
constructor() {}
|
|
||||||
|
|
||||||
ngOnInit(): void {}
|
|
||||||
}
|
|
@ -1,4 +0,0 @@
|
|||||||
<div class="games">
|
|
||||||
<app-game-item [active]="i === activeGame" *ngFor="let game of games; index as i" [game]="game" (click)="activeGame = i"></app-game-item>
|
|
||||||
</div>
|
|
||||||
<app-game-info *ngIf="activeGame !== null" [game]="games[activeGame]"></app-game-info>
|
|
@ -1,11 +0,0 @@
|
|||||||
:host {
|
|
||||||
display: flex;
|
|
||||||
|
|
||||||
.games {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.game-info {
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
|
||||||
|
|
||||||
import { GamesBarComponent } from './games-bar.component';
|
|
||||||
|
|
||||||
describe('GamesBarComponent', () => {
|
|
||||||
let component: GamesBarComponent;
|
|
||||||
let fixture: ComponentFixture<GamesBarComponent>;
|
|
||||||
|
|
||||||
beforeEach(async () => {
|
|
||||||
await TestBed.configureTestingModule({
|
|
||||||
declarations: [ GamesBarComponent ]
|
|
||||||
})
|
|
||||||
.compileComponents();
|
|
||||||
|
|
||||||
fixture = TestBed.createComponent(GamesBarComponent);
|
|
||||||
component = fixture.componentInstance;
|
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
|
||||||
|
|
||||||
it('should create', () => {
|
|
||||||
expect(component).toBeTruthy();
|
|
||||||
});
|
|
||||||
});
|
|
@ -1,26 +0,0 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
|
||||||
import { Game } from 'src/app/interfaces/game.interface';
|
|
||||||
import { GetGames } from 'src/app/services/go';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-games-bar',
|
|
||||||
templateUrl: './games-bar.component.html',
|
|
||||||
styleUrls: ['./games-bar.component.scss'],
|
|
||||||
})
|
|
||||||
export class GamesBarComponent implements OnInit {
|
|
||||||
games: Game[] = [];
|
|
||||||
activeGame: Game['id'] | null = null;
|
|
||||||
|
|
||||||
constructor() {}
|
|
||||||
|
|
||||||
ngOnInit(): void {
|
|
||||||
this.getGames();
|
|
||||||
}
|
|
||||||
|
|
||||||
getGames() {
|
|
||||||
GetGames().then((value) => {
|
|
||||||
console.log(value);
|
|
||||||
this.games = value;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,12 +0,0 @@
|
|||||||
import { NgModule } from '@angular/core';
|
|
||||||
import { CommonModule } from '@angular/common';
|
|
||||||
import { GamesBarComponent } from './games-bar.component';
|
|
||||||
import { GameItemComponent } from './game-item/game-item.component';
|
|
||||||
import { GameInfoComponent } from './game-info/game-info.component';
|
|
||||||
|
|
||||||
@NgModule({
|
|
||||||
declarations: [GamesBarComponent, GameItemComponent, GameInfoComponent],
|
|
||||||
imports: [CommonModule],
|
|
||||||
exports: [GamesBarComponent, GameItemComponent, GameInfoComponent],
|
|
||||||
})
|
|
||||||
export class GamesBarModule {}
|
|
@ -1,6 +0,0 @@
|
|||||||
export interface Game {
|
|
||||||
id: number;
|
|
||||||
title: string;
|
|
||||||
image: string;
|
|
||||||
description: string;
|
|
||||||
}
|
|
@ -1,32 +1,21 @@
|
|||||||
import { Game } from '../interfaces/game.interface';
|
|
||||||
|
|
||||||
export interface Go extends Window {
|
export interface Go extends Window {
|
||||||
GetGames: () => Promise<Game[]>;
|
GetVersion: () => string;
|
||||||
|
RunGame: () => string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface GoCallback extends Window {
|
export interface GoCallback extends Window {
|
||||||
SetVersion: (value: string) => void;
|
SetVersion: (value: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
let { GetGames } = window as unknown as Go;
|
let { GetVersion, RunGame} = window as unknown as Go;
|
||||||
let { SetVersion } = window as unknown as GoCallback;
|
let { SetVersion } = window as unknown as GoCallback;
|
||||||
|
|
||||||
let w = window as unknown as GoCallback;
|
export declare type GetVersionCallbackDetail = string;
|
||||||
|
|
||||||
// var register = function <Type>(name: string): void {
|
(<GoCallback>(<unknown>window)).SetVersion = function (value: string): void {
|
||||||
// const event = new CustomEvent<Type>(`${name}_Callback`, {
|
const event = new CustomEvent<string>('GetVersion_Callback', {
|
||||||
// detail: value
|
detail: value,
|
||||||
// })
|
});
|
||||||
// document.dispatchEvent(event)
|
document.dispatchEvent(event);
|
||||||
// };
|
};
|
||||||
|
export { GetVersion, SetVersion, RunGame};
|
||||||
// w.SetVersion = register<string>('SetVersion')
|
|
||||||
|
|
||||||
// (<GoCallback>(<unknown>window)).SetVersion = function <T>(value: T): void {
|
|
||||||
// const event = new CustomEvent<T>('GetVersion_Callback', {
|
|
||||||
// detail: value,
|
|
||||||
// });
|
|
||||||
// document.dispatchEvent(event);
|
|
||||||
// };
|
|
||||||
|
|
||||||
export { GetGames, SetVersion };
|
|
||||||
|
Loading…
Reference in New Issue
Block a user