Compare commits

..

7 Commits

8 changed files with 39 additions and 25 deletions

View File

@ -1,8 +0,0 @@
export interface Session {
id: string;
icon: string;
title: string;
status?: string;
version: string;
expires: Date;
}

View File

@ -1,5 +1,5 @@
import { Component, Input, OnInit } from '@angular/core';
import { Session } from '../interfaces/session';
import { Session } from 'src/app/interfaces/session.interface';
@Component({
selector: 'skirda-session[session]',

View File

@ -1,7 +1,7 @@
import { Component, OnInit } from '@angular/core';
import { Title } from '@angular/platform-browser';
import { Game } from 'src/app/interfaces/game.interface';
import { GetGames } from 'src/app/services/go';
import { GoGetGames } from 'src/app/services/go';
@Component({
selector: 'app-games-bar',
@ -19,7 +19,7 @@ export class GamesBarComponent implements OnInit {
}
getGames() {
if (GetGames == undefined){
if (GoGetGames == undefined){
var fakeGame: Game = {
gameId: "Fake Game",
title: "Fake game",
@ -30,7 +30,7 @@ export class GamesBarComponent implements OnInit {
this.activeGame = this.games[0]
}
else{
GetGames().then((value) => {
GoGetGames().then((value) => {
console.log(value);
this.games = value;
if (this.games.length > 0){

View File

@ -1,6 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { Game } from 'src/app/interfaces/game.interface'
import { GetGames } from 'src/app/services/go';
import { GoGetGames } from 'src/app/services/go';
@Component({
selector: 'app-menu-games',
@ -27,11 +27,11 @@ export class MenuGamesComponent implements OnInit {
constructor() { }
ngOnInit(): void {
if (GetGames == undefined){
if (GoGetGames == undefined){
this.games = this.fakeGames
}
else{
GetGames().then((value) => {
GoGetGames().then((value) => {
console.log(value);
this.games = value;
});

View File

@ -3,7 +3,7 @@
</skirda-section-label>
<div class="sessions">
<skirda-session
[routerLink]="['/session/' + session.id]" routerLinkActive="active"
[routerLink]="['/session/' + session.gameId]" routerLinkActive="active"
*ngFor="let session of sessions; index as i"
[session]="session"
></skirda-session>

View File

@ -1,5 +1,6 @@
import { Component, OnInit } from '@angular/core';
import { Session } from 'projects/ui/src/lib/interfaces/session';
import { Session } from 'src/app/interfaces/session.interface';
import { GoGetSessions } from 'src/app/services/go';
@Component({
selector: 'app-menu-sessions',
@ -7,9 +8,9 @@ import { Session } from 'projects/ui/src/lib/interfaces/session';
styleUrls: ['./menu-sessions.component.scss'],
})
export class MenuSessionsComponent implements OnInit {
sessions: Session[] = [
fakeSessions: Session[] = [
{
id: 'minecraft-001',
gameId: 'minecraft-001',
icon: '/assets/games/minecraft/icon.png',
title: 'Minecraft',
version: '1.19.2',
@ -17,22 +18,32 @@ export class MenuSessionsComponent implements OnInit {
expires: new Date('2022-10-30'),
},
{
id: 'minecraft-002',
gameId: 'minecraft-002',
icon: '/assets/games/garrysmod/icon.png',
title: 'Minecraft 2',
version: '1.12-dev',
expires: new Date('2022-10-27T20:00:00'),
},
{
id: 'minecraft-003',
gameId: 'minecraft-003',
icon: '/assets/games/minecraft/icon.png',
title: 'Minecraft 3',
version: '1.7.10',
expires: new Date('2022-10-30T20:00:00'),
},
];
sessions: Session[] = [];
constructor() {}
ngOnInit(): void {}
ngOnInit(): void {
if(GoGetSessions == undefined){
this.sessions = this.fakeSessions
}
else {
GoGetSessions().then((value) => {
this.sessions = value
})
}
}
}

View File

@ -0,0 +1,9 @@
export interface Session {
gameId: string;
icon: string;
title: string;
status?: string;
version: string;
expires: Date;
}

View File

@ -1,7 +1,9 @@
import { Game } from '../interfaces/game.interface';
import { Session } from '../interfaces/session.interface';
export interface Go extends Window {
GetGames: () => Promise<Game[]>;
GoGetGames: () => Promise<Game[]>;
GoGetSessions: () => Promise<Session[]>
GoRunGame: (gameId: string) => void;
}
@ -9,7 +11,7 @@ export interface GoCallback extends Window {
SetVersion: (value: string) => void;
}
let { GetGames, GoRunGame } = window as unknown as Go;
let { GoGetGames, GoRunGame, GoGetSessions } = window as unknown as Go;
let { SetVersion } = window as unknown as GoCallback;
let w = window as unknown as GoCallback;
@ -30,4 +32,4 @@ let w = window as unknown as GoCallback;
// document.dispatchEvent(event);
// };
export { GetGames, SetVersion, GoRunGame };
export { GoGetGames, GoGetSessions, SetVersion, GoRunGame };