dcvdvdvd
This commit is contained in:
@@ -45,6 +45,7 @@ if( $data == false ){
|
||||
$userDatap["firstName"] = $data['firstName'];
|
||||
$userDatap["lastName"] = $data['lastName'];
|
||||
$userDatap["email"] = $data['email'];
|
||||
$userDatap["art"] = $data['art'];
|
||||
$userDatap["token"] = (string)$token;
|
||||
|
||||
echo( json_encode( $userDatap ) );
|
||||
|
||||
@@ -5,6 +5,7 @@ import { GameGridComponent } from './game-grid/game-grid.component'
|
||||
import { ViewCardComponent } from './view-card/view-card.component'
|
||||
import { LoginComponent } from './login/login.component'
|
||||
import { RegisterComponent } from './register/register.component'
|
||||
import { UserComponent } from './user/user.component'
|
||||
import { AuthGuard } from './_guards/index';
|
||||
|
||||
const routes: Routes = [
|
||||
@@ -13,9 +14,8 @@ const routes: Routes = [
|
||||
{ path: 'view-card', component: ViewCardComponent, canActivate: [AuthGuard] },
|
||||
{ path: 'view-card/:gid', component: ViewCardComponent, canActivate: [AuthGuard] },
|
||||
{ path: 'login', component: LoginComponent },
|
||||
{ path: 'register', component: RegisterComponent }
|
||||
|
||||
|
||||
{ path: 'register', component: RegisterComponent },
|
||||
{ path: 'user', component: UserComponent }
|
||||
];
|
||||
|
||||
@NgModule({
|
||||
|
||||
@@ -38,6 +38,7 @@ import { fakeBackendProvider } from './_helpers/index';
|
||||
import { AlertComponent } from './_directives/index';
|
||||
import { AuthGuard } from './_guards/index';
|
||||
import { AlertService, AuthenticationService, UserService } from './_services/index';
|
||||
import { UserComponent } from './user/user.component';
|
||||
|
||||
|
||||
|
||||
@@ -49,6 +50,7 @@ import { AlertService, AuthenticationService, UserService } from './_services/in
|
||||
LoginComponent,
|
||||
RegisterComponent,
|
||||
AlertComponent,
|
||||
UserComponent,
|
||||
],
|
||||
imports: [
|
||||
BrowserModule,
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<span class="example-fill-remaining-space"></span>
|
||||
|
||||
|
||||
<button class="mat-button userButton" mat-button >
|
||||
<button class="mat-button userButton" [routerLink]="['/user']" mat-button >
|
||||
<img src="https://i.pinimg.com/280x280_RS/88/42/df/8842df04cd938aa654c865742253c276.jpg" > <span *ngIf="isEmptyObject(currentUser)">{{currentUser.username}}</span>
|
||||
</button>
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
<button class="menuButton" mat-button routerLink="/view-card">New Game</button>
|
||||
|
||||
<mat-menu #settingsMenu="matMenu">
|
||||
<button mat-menu-item>Settings</button>
|
||||
<button mat-menu-item>Help</button>
|
||||
<button mat-menu-item (click)="logOut()">Log out</button>
|
||||
</mat-menu>
|
||||
|
||||
|
||||
51
src/app/user/user.component.css
Normal file
51
src/app/user/user.component.css
Normal file
@@ -0,0 +1,51 @@
|
||||
|
||||
.button-center{
|
||||
margin: 2px auto;
|
||||
text-align:center;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.example-fill-remaining-space {
|
||||
/* This fills the remaining space, by using flexbox.
|
||||
Every toolbar row uses a flexbox row layout. */
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.menuButton{
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.userButton{
|
||||
|
||||
}
|
||||
.userButton img{
|
||||
width:35px;
|
||||
height:35px;
|
||||
border-radius: 50%;
|
||||
}
|
||||
|
||||
.gameSearchInput{
|
||||
margin-left:25px;
|
||||
border: 0;
|
||||
border-radius: 4px;
|
||||
color: #555;
|
||||
font-size: 16px;
|
||||
font-weight: 600;
|
||||
height: 50%;
|
||||
line-height: 20px;
|
||||
outline: none;
|
||||
padding: 0 0 0 15px;
|
||||
width: 80%;
|
||||
}
|
||||
|
||||
.app-toolbar {
|
||||
position: sticky;
|
||||
position: -webkit-sticky; /* For macOS/iOS Safari */
|
||||
top: 0; /* Sets the sticky toolbar to be on top */
|
||||
z-index: 1000; /* Ensure that your app's content doesn't overlap the toolbar */
|
||||
}
|
||||
|
||||
.card-img-top{
|
||||
width:250px;
|
||||
height:auto;
|
||||
}
|
||||
61
src/app/user/user.component.html
Normal file
61
src/app/user/user.component.html
Normal file
@@ -0,0 +1,61 @@
|
||||
<mat-toolbar color="primary" class="app-toolbar">
|
||||
<mat-icon >videogame_asset</mat-icon>
|
||||
|
||||
|
||||
<span class="example-fill-remaining-space"></span>
|
||||
|
||||
|
||||
<button class="mat-button userButton" [routerLink]="['/user']" mat-button >
|
||||
<img src="https://i.pinimg.com/280x280_RS/88/42/df/8842df04cd938aa654c865742253c276.jpg" > <span *ngIf="isEmptyObject(currentUser)">{{currentUser.username}}</span>
|
||||
</button>
|
||||
|
||||
|
||||
<button class="menuButton" mat-button routerLink="/view-card">New Game</button>
|
||||
|
||||
<mat-menu #settingsMenu="matMenu">
|
||||
<button mat-menu-item (click)="logOut()">Log out</button>
|
||||
</mat-menu>
|
||||
|
||||
<button class="mat-icon-button" mat-icon-button [matMenuTriggerFor]="settingsMenu">
|
||||
<mat-icon>menu</mat-icon>
|
||||
</button>
|
||||
|
||||
</mat-toolbar>
|
||||
|
||||
<div class="lrContainer">
|
||||
<mat-card class="lrCard">
|
||||
|
||||
<form novalidate (ngSubmit)="onSubmit(form.value)" [formGroup]="form" class="flex-container" >
|
||||
|
||||
<div class="card">
|
||||
<div class="row">
|
||||
<div class="" id="gameImageHeaderContainer">
|
||||
<img class="card-img-top" [src]="imageSample" alt="">
|
||||
<button md-mini-fab type="button" onclick="document.getElementById('fileToUpload').click()">
|
||||
<label for="fileToUpload"><mat-icon>add</mat-icon></label>
|
||||
</button>
|
||||
<input [formControlName]="'Art'" [id]="'Art'" [type]="'hidden'" [name]="'Art'">
|
||||
<input type="file" id="fileToUpload" [name]="'fileToUpload'" (change)="handleFileInput($event)" style="display:none;">
|
||||
|
||||
<br />
|
||||
<hr />
|
||||
|
||||
<div class="buttonArea">
|
||||
<button mat-button class="button-center" routerLink="/game-grid">Cancel</button>
|
||||
<button mat-raised-button color="primary" type="submit" class="button-center" [disabled]="!form.valid" >Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="card card-2x">
|
||||
<div class="flex-container">
|
||||
<div class="card">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</mat-card>
|
||||
</div>
|
||||
25
src/app/user/user.component.spec.ts
Normal file
25
src/app/user/user.component.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { UserComponent } from './user.component';
|
||||
|
||||
describe('UserComponent', () => {
|
||||
let component: UserComponent;
|
||||
let fixture: ComponentFixture<UserComponent>;
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [ UserComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
}));
|
||||
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(UserComponent);
|
||||
component = fixture.componentInstance;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
});
|
||||
49
src/app/user/user.component.ts
Normal file
49
src/app/user/user.component.ts
Normal file
@@ -0,0 +1,49 @@
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { Router, ActivatedRoute } from '@angular/router';
|
||||
|
||||
@Component({
|
||||
selector: 'app-user',
|
||||
templateUrl: './user.component.html',
|
||||
styleUrls: ['./user.component.css']
|
||||
})
|
||||
export class UserComponent implements OnInit {
|
||||
|
||||
currentUser;
|
||||
|
||||
constructor(
|
||||
private route: ActivatedRoute,
|
||||
private router: Router
|
||||
){
|
||||
}
|
||||
|
||||
ngOnInit(){
|
||||
this.currentUser = JSON.parse(localStorage.getItem('currentUser'));
|
||||
buildForm();
|
||||
}
|
||||
|
||||
buildForm(){
|
||||
|
||||
const formGroup = {};
|
||||
|
||||
formGroup["firstName"] = new FormControl( this.currentUser.firstName, this.mapValidators({ required: true }) );
|
||||
formGroup["lastName"] = new FormControl( this.currentUser.lastName, this.mapValidators({ required: true }) );
|
||||
formGroup["email"] = new FormControl( this.currentUser.email, this.mapValidators({ required: true }) );
|
||||
formGroup["art"] = new FormControl( this.currentUser.art, this.mapValidators({ required: false }) );
|
||||
|
||||
|
||||
this.form = new FormGroup(formGroup);
|
||||
|
||||
if( this.currentUser.art.length != 0 ){
|
||||
//this.imageSample = "http://pugludos.com/community/uploads/"+this.currentUser.art+"/" + this.userData.Art + ".png";
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
isEmptyObject(obj) {
|
||||
return (obj != undefined);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
<span class="example-fill-remaining-space"></span>
|
||||
|
||||
|
||||
<button class="mat-button userButton" mat-button >
|
||||
<button class="mat-button userButton" [routerLink]="['/user']" mat-button >
|
||||
<img src="https://i.pinimg.com/280x280_RS/88/42/df/8842df04cd938aa654c865742253c276.jpg" > <span *ngIf="isEmptyObject(currentUser)">{{currentUser.username}}</span>
|
||||
</button>
|
||||
|
||||
@@ -52,14 +52,14 @@
|
||||
<div class="buttonArea">
|
||||
|
||||
<button mat-button class="button-center" routerLink="/game-grid">
|
||||
Cancel Changes
|
||||
Cancel
|
||||
</button>
|
||||
|
||||
<button mat-button class="button-center" (click)="removeGame()" >
|
||||
<button *ngIf="notNewGame" mat-button class="button-center" (click)="removeGame()" >
|
||||
Remove Game
|
||||
</button>
|
||||
|
||||
<button mat-raised-button color="primary" type="submit" class="button-center" [disabled]="!form.valid" >Submit Changes</button>
|
||||
<button mat-raised-button color="primary" type="submit" class="button-center" [disabled]="!form.valid" >Submit</button>
|
||||
|
||||
</div>
|
||||
|
||||
@@ -186,18 +186,18 @@
|
||||
[formControlName]="'Genre'"
|
||||
[id]="'Genre'">
|
||||
|
||||
<mat-option [value]="sports">sports</mat-option>
|
||||
<mat-option [value]="platformer">platformer</mat-option>
|
||||
<mat-option [value]="lightgun">lightgun</mat-option>
|
||||
<mat-option [value]="fighter">fighter</mat-option>
|
||||
<mat-option [value]="rpg">rpg</mat-option>
|
||||
<mat-option [value]="strategy">strategy</mat-option>
|
||||
<mat-option [value]="adventure">adventure</mat-option>
|
||||
<mat-option [value]="racing">racing</mat-option>
|
||||
<mat-option [value]="fps">fps</mat-option>
|
||||
<mat-option [value]="action">action</mat-option>
|
||||
<mat-option [value]="simulation">simulation</mat-option>
|
||||
<mat-option [value]="card">card</mat-option>
|
||||
<mat-option [value]="'sports'">sports</mat-option>
|
||||
<mat-option [value]="'platformer'">platformer</mat-option>
|
||||
<mat-option [value]="'lightgun'">lightgun</mat-option>
|
||||
<mat-option [value]="'fighter'">fighter</mat-option>
|
||||
<mat-option [value]="'rpg'">rpg</mat-option>
|
||||
<mat-option [value]="'strategy'">strategy</mat-option>
|
||||
<mat-option [value]="'adventure'">adventure</mat-option>
|
||||
<mat-option [value]="'racing'">racing</mat-option>
|
||||
<mat-option [value]="'fps'">fps</mat-option>
|
||||
<mat-option [value]="'action'">action</mat-option>
|
||||
<mat-option [value]="'simulation'">simulation</mat-option>
|
||||
<mat-option [value]="'card'">card</mat-option>
|
||||
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
@@ -216,21 +216,20 @@
|
||||
<mat-form-field>
|
||||
<mat-select class="form-control" name="System"
|
||||
[formControlName]="'System'"
|
||||
[id]="'System'"
|
||||
>
|
||||
[id]="'System'">
|
||||
|
||||
<mat-option [value]="SNES">SNES</mat-option>
|
||||
<mat-option [value]="N64">N64</mat-option>
|
||||
<mat-option [value]="PS1">PS1</mat-option>
|
||||
<mat-option [value]="PS2">PS2</mat-option>
|
||||
<mat-option [value]="GB">GB</mat-option>
|
||||
<mat-option [value]="GBA">GBA</mat-option>
|
||||
<mat-option [value]="DS">DS</mat-option>
|
||||
<mat-option [value]="NES">NES</mat-option>
|
||||
<mat-option [value]="GC">GC</mat-option>
|
||||
<mat-option [value]="PSP">PSP</mat-option>
|
||||
<mat-option [value]="360">360</mat-option>
|
||||
<mat-option [value]="WII">WII</mat-option>
|
||||
<mat-option [value]="'SNES'">SNES</mat-option>
|
||||
<mat-option [value]="'N64'">N64</mat-option>
|
||||
<mat-option [value]="'PS1'">PS1</mat-option>
|
||||
<mat-option [value]="'PS2'">PS2</mat-option>
|
||||
<mat-option [value]="'GB'">GB</mat-option>
|
||||
<mat-option [value]="'GBA'">GBA</mat-option>
|
||||
<mat-option [value]="'DS'">DS</mat-option>
|
||||
<mat-option [value]="'NES'">NES</mat-option>
|
||||
<mat-option [value]="'GC'">GC</mat-option>
|
||||
<mat-option [value]="'PSP'">PSP</mat-option>
|
||||
<mat-option [value]="'360'">360</mat-option>
|
||||
<mat-option [value]="'WII'">WII</mat-option>
|
||||
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
@@ -21,6 +21,7 @@ export class ViewCardComponent implements OnInit {
|
||||
imageSample = "http://lazypug.net/globalAssets/images/temp1.png";
|
||||
overlay;
|
||||
currentUser;
|
||||
notNewGame;
|
||||
|
||||
|
||||
constructor(
|
||||
@@ -35,10 +36,12 @@ export class ViewCardComponent implements OnInit {
|
||||
this.overlay = false;
|
||||
if( this.gid != null ){
|
||||
this.gameSubscription = this.gamesService.getGameById( this.gid, this.currentUser.token, this.currentUser.id ).subscribe( data => {
|
||||
this.notNewGame = true;
|
||||
this.gameData = data;
|
||||
this.buildForm();
|
||||
});
|
||||
}else{
|
||||
this.notNewGame = false;
|
||||
this.gameData = new Game();
|
||||
this.buildForm();
|
||||
}
|
||||
@@ -89,6 +92,7 @@ export class ViewCardComponent implements OnInit {
|
||||
this.router.navigateByUrl("/game-grid");
|
||||
});
|
||||
}else{
|
||||
console.log( form );
|
||||
this.gameSubscription = this.gamesService.putGameById( form, this.gid, this.currentUser.token ).subscribe( data => {
|
||||
this.router.navigateByUrl("/game-grid");
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user