Merge branch 'game' into 'main'
Game Created a GameModule that will contain all the functionality required to play. The routing and imports of AppModule are adjusted accordingly. See merge request daniel/rona-frontend!2
This commit is contained in:
@@ -1,15 +1,20 @@
|
|||||||
import { NgModule } from '@angular/core';
|
import { NgModule } from '@angular/core';
|
||||||
import { Routes, RouterModule } from '@angular/router';
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { AuthGuard } from './account/auth.guard';
|
import { AuthGuard } from './account/auth.guard';
|
||||||
import { LoginComponent } from './account/login/login.component';
|
import { LoginComponent } from './account/login/login.component';
|
||||||
import { RegisterComponent } from './account/register/register.component';
|
import { RegisterComponent } from './account/register/register.component';
|
||||||
|
|
||||||
|
|
||||||
|
const gameModule = () => import('./game/game.module').then(x => x.GameModule);
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: '', component: AppComponent, canActivate: [AuthGuard] },
|
{ path: '', component: AppComponent, canActivate: [AuthGuard] },
|
||||||
|
// { path: '', redirectTo: '/game', pathMatch: 'prefix', canActivate: [AuthGuard] },
|
||||||
{ path: 'login', component: LoginComponent },
|
{ path: 'login', component: LoginComponent },
|
||||||
{ path: 'register', component: RegisterComponent },
|
{ path: 'register', component: RegisterComponent },
|
||||||
|
{ path: 'game', loadChildren: gameModule, canActivate: [AuthGuard] },
|
||||||
{ path: '**', redirectTo: '' },
|
{ path: '**', redirectTo: '' },
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -12,22 +12,15 @@ import { MatInputModule } from '@angular/material/input';
|
|||||||
|
|
||||||
import { AppRoutingModule } from './app-routing.module';
|
import { AppRoutingModule } from './app-routing.module';
|
||||||
import { AppComponent } from './app.component';
|
import { AppComponent } from './app.component';
|
||||||
import { ChatComponent } from './chat/chat.component';
|
|
||||||
import { EntryComponent } from './chat/entry/entry.component';
|
|
||||||
import { InputComponent } from './chat/input/input.component';
|
|
||||||
import { LoginComponent } from './account/login/login.component';
|
import { LoginComponent } from './account/login/login.component';
|
||||||
import { TestComponent } from './test/test.component';
|
|
||||||
import { RegisterComponent } from './account/register/register.component';
|
import { RegisterComponent } from './account/register/register.component';
|
||||||
import { fakeBackendProvider } from './utils/fake-backend';
|
import { fakeBackendProvider } from './utils/fake-backend';
|
||||||
|
import { GameModule } from './game/game.module';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [
|
declarations: [
|
||||||
AppComponent,
|
AppComponent,
|
||||||
ChatComponent,
|
|
||||||
EntryComponent,
|
|
||||||
InputComponent,
|
|
||||||
LoginComponent,
|
LoginComponent,
|
||||||
TestComponent,
|
|
||||||
RegisterComponent
|
RegisterComponent
|
||||||
],
|
],
|
||||||
imports: [
|
imports: [
|
||||||
@@ -41,10 +34,13 @@ import { fakeBackendProvider } from './utils/fake-backend';
|
|||||||
MatInputModule,
|
MatInputModule,
|
||||||
ReactiveFormsModule,
|
ReactiveFormsModule,
|
||||||
AppRoutingModule,
|
AppRoutingModule,
|
||||||
|
GameModule,
|
||||||
],
|
],
|
||||||
providers: [
|
providers: [
|
||||||
fakeBackendProvider,
|
fakeBackendProvider,
|
||||||
],
|
],
|
||||||
|
exports: [
|
||||||
|
],
|
||||||
bootstrap: [AppComponent]
|
bootstrap: [AppComponent]
|
||||||
})
|
})
|
||||||
export class AppModule { }
|
export class AppModule { }
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
#chat-log {
|
#chat-log {
|
||||||
height: calc(99% - 34px);
|
height: calc(99% - 34px);
|
||||||
overflow-y: scroll;
|
overflow-y: scroll;
|
||||||
|
background-color: goldenrod;
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,8 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
import { Entry } from './entry/entry';
|
import { Entry } from './entry/entry';
|
||||||
import { Message } from './message';
|
import { Message } from './message';
|
||||||
import {SocketService} from '../socket/socket.service';
|
import { SocketService } from '../../socket/socket.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-chat',
|
selector: 'app-chat',
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import {SocketService} from '../../socket/socket.service';
|
import { Message } from '../message';
|
||||||
import {Message} from '../message';
|
import { Events } from '../../../socket/events-enum';
|
||||||
import {Events} from '../../socket/events-enum';
|
import { SocketService } from '../../../socket/socket.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-input',
|
selector: 'app-input',
|
||||||
18
src/app/game/game-routing.module.ts
Normal file
18
src/app/game/game-routing.module.ts
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { Routes, RouterModule } from '@angular/router';
|
||||||
|
import { GameComponent } from './game.component';
|
||||||
|
import { TestComponent } from './test/test.component';
|
||||||
|
|
||||||
|
const routes: Routes = [
|
||||||
|
{ path: '', component: GameComponent,
|
||||||
|
children: [
|
||||||
|
{ path: '', redirectTo: 'test', pathMatch: 'prefix' },
|
||||||
|
{ path: 'test', component: TestComponent },
|
||||||
|
]}
|
||||||
|
];
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
imports: [RouterModule.forChild(routes)],
|
||||||
|
exports: [RouterModule]
|
||||||
|
})
|
||||||
|
export class GameRoutingModule { }
|
||||||
7
src/app/game/game.component.css
Normal file
7
src/app/game/game.component.css
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
#game-items {
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
#navbar {
|
||||||
|
background-color: #333333;
|
||||||
|
}
|
||||||
11
src/app/game/game.component.html
Normal file
11
src/app/game/game.component.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<div fxLayout="row" id="game-items">
|
||||||
|
<div fxFlex="48px" id="navbar">
|
||||||
|
<app-navbar></app-navbar>
|
||||||
|
</div>
|
||||||
|
<div fxFlex>
|
||||||
|
<router-outlet></router-outlet>
|
||||||
|
</div>
|
||||||
|
<div fxFlex="20%">
|
||||||
|
<app-chat></app-chat>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
25
src/app/game/game.component.spec.ts
Normal file
25
src/app/game/game.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { GameComponent } from './game.component';
|
||||||
|
|
||||||
|
describe('GameComponent', () => {
|
||||||
|
let component: GameComponent;
|
||||||
|
let fixture: ComponentFixture<GameComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ GameComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(GameComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
15
src/app/game/game.component.ts
Normal file
15
src/app/game/game.component.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-game',
|
||||||
|
templateUrl: './game.component.html',
|
||||||
|
styleUrls: ['./game.component.css']
|
||||||
|
})
|
||||||
|
export class GameComponent implements OnInit {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
35
src/app/game/game.module.ts
Normal file
35
src/app/game/game.module.ts
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
import { NgModule } from '@angular/core';
|
||||||
|
import { CommonModule } from '@angular/common';
|
||||||
|
import { FlexModule } from '@angular/flex-layout';
|
||||||
|
|
||||||
|
import { MatCardModule } from '@angular/material/card';
|
||||||
|
|
||||||
|
import { GameRoutingModule } from './game-routing.module';
|
||||||
|
import { GameComponent } from './game.component';
|
||||||
|
import { ChatComponent } from './chat/chat.component';
|
||||||
|
import { EntryComponent } from './chat/entry/entry.component';
|
||||||
|
import { InputComponent } from './chat/input/input.component';
|
||||||
|
import { NavbarComponent } from './navbar/navbar.component';
|
||||||
|
import { TestComponent } from './test/test.component';
|
||||||
|
|
||||||
|
|
||||||
|
@NgModule({
|
||||||
|
declarations: [
|
||||||
|
GameComponent,
|
||||||
|
NavbarComponent,
|
||||||
|
ChatComponent,
|
||||||
|
TestComponent,
|
||||||
|
EntryComponent,
|
||||||
|
InputComponent,
|
||||||
|
],
|
||||||
|
exports: [
|
||||||
|
NavbarComponent
|
||||||
|
],
|
||||||
|
imports: [
|
||||||
|
CommonModule,
|
||||||
|
GameRoutingModule,
|
||||||
|
FlexModule,
|
||||||
|
MatCardModule,
|
||||||
|
]
|
||||||
|
})
|
||||||
|
export class GameModule { }
|
||||||
8
src/app/game/navbar/navbar.component.css
Normal file
8
src/app/game/navbar/navbar.component.css
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
.nav-img {
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nav-item {
|
||||||
|
margin: 2px 4px;
|
||||||
|
}
|
||||||
11
src/app/game/navbar/navbar.component.html
Normal file
11
src/app/game/navbar/navbar.component.html
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
<div fxLayout="column" fxLayoutAlign=" center">
|
||||||
|
<a routerLink="test">
|
||||||
|
<img class="nav-img" src="assets/build_circle-24px.svg" alt="TODO">
|
||||||
|
</a>
|
||||||
|
<a routerLink="test">
|
||||||
|
<img class="nav-img" src="assets/build_circle-24px.svg" alt="TODO">
|
||||||
|
</a>
|
||||||
|
<a routerLink="test">
|
||||||
|
<img class="nav-img" src="assets/build_circle-24px.svg" alt="TODO">
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
25
src/app/game/navbar/navbar.component.spec.ts
Normal file
25
src/app/game/navbar/navbar.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||||
|
|
||||||
|
import { NavbarComponent } from './navbar.component';
|
||||||
|
|
||||||
|
describe('NavbarComponent', () => {
|
||||||
|
let component: NavbarComponent;
|
||||||
|
let fixture: ComponentFixture<NavbarComponent>;
|
||||||
|
|
||||||
|
beforeEach(async(() => {
|
||||||
|
TestBed.configureTestingModule({
|
||||||
|
declarations: [ NavbarComponent ]
|
||||||
|
})
|
||||||
|
.compileComponents();
|
||||||
|
}));
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
fixture = TestBed.createComponent(NavbarComponent);
|
||||||
|
component = fixture.componentInstance;
|
||||||
|
fixture.detectChanges();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should create', () => {
|
||||||
|
expect(component).toBeTruthy();
|
||||||
|
});
|
||||||
|
});
|
||||||
15
src/app/game/navbar/navbar.component.ts
Normal file
15
src/app/game/navbar/navbar.component.ts
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import { Component, OnInit } from '@angular/core';
|
||||||
|
|
||||||
|
@Component({
|
||||||
|
selector: 'app-navbar',
|
||||||
|
templateUrl: './navbar.component.html',
|
||||||
|
styleUrls: ['./navbar.component.css']
|
||||||
|
})
|
||||||
|
export class NavbarComponent implements OnInit {
|
||||||
|
|
||||||
|
constructor() { }
|
||||||
|
|
||||||
|
ngOnInit(): void {
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import { Component, OnInit } from '@angular/core';
|
import { Component, OnInit } from '@angular/core';
|
||||||
import { HttpClient } from '@angular/common/http';
|
import { HttpClient } from '@angular/common/http';
|
||||||
import {SocketService} from '../socket/socket.service';
|
import {SocketService} from '../../socket/socket.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-test',
|
selector: 'app-test',
|
||||||
1
src/assets/build_circle-24px.svg
Normal file
1
src/assets/build_circle-24px.svg
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<svg xmlns="http://www.w3.org/2000/svg" enable-background="new 0 0 24 24" height="24" viewBox="0 0 24 24" width="24"><g><rect fill="none" height="24" width="24"/><rect fill="none" height="24" width="24"/></g><g><g><path d="M12,2C6.48,2,2,6.48,2,12c0,5.52,4.48,10,10,10s10-4.48,10-10 C22,6.48,17.52,2,12,2z M16.54,15.85l-0.69,0.69c-0.39,0.39-1.02,0.39-1.41,0l-3.05-3.05c-1.22,0.43-2.64,0.17-3.62-0.81 c-1.11-1.11-1.3-2.79-0.59-4.1l2.35,2.35l1.41-1.41L8.58,7.17c1.32-0.71,2.99-0.52,4.1,0.59c0.98,0.98,1.24,2.4,0.81,3.62 l3.05,3.05C16.93,14.82,16.93,15.46,16.54,15.85z" fill-rule="evenodd"/></g></g></svg>
|
||||||
|
After Width: | Height: | Size: 602 B |
Reference in New Issue
Block a user