-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: format project using prettier
- Loading branch information
Showing
7 changed files
with
199 additions
and
199 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,66 +1,66 @@ | ||
import { Component, HostListener, OnInit } from '@angular/core'; | ||
import { Subject } from 'rxjs'; | ||
import { Router } from '@angular/router'; | ||
import { MatDialog } from '@angular/material/dialog'; | ||
import { RouterOutlet } from '@angular/router'; | ||
|
||
import { IdleTimeoutComponent } from './idle-timeout/idle-timeout.component'; | ||
import { routeTransitionAnimations } from './route-transition-animations'; | ||
import { environment } from '../environments/environment'; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.scss'], | ||
animations: [routeTransitionAnimations], | ||
standalone: true, | ||
imports: [RouterOutlet], | ||
}) | ||
export class AppComponent implements OnInit { | ||
title = 'Teknisk Museum'; | ||
|
||
userActivity = 0; | ||
userInactive = new Subject<any>(); | ||
|
||
isDialogOpen = false; | ||
inactivityTime = environment.inactivityTime; | ||
|
||
constructor(private router: Router, public dialog: MatDialog) {} | ||
|
||
ngOnInit(): void { | ||
this.setDialogTimeout(); | ||
this.userInactive.subscribe(() => { | ||
if (this.router.url !== '/' && this.router.url !== '/admin') { | ||
this.openDialog(); | ||
} | ||
}); | ||
} | ||
|
||
openDialog() { | ||
if (!this.isDialogOpen) { | ||
this.dialog | ||
.open(IdleTimeoutComponent) | ||
.afterClosed() | ||
.subscribe(() => { | ||
this.isDialogOpen = false; | ||
}); | ||
this.isDialogOpen = true; | ||
} | ||
} | ||
|
||
setDialogTimeout() { | ||
this.userActivity = window.setTimeout(() => this.userInactive.next(undefined), this.inactivityTime); | ||
} | ||
|
||
prepareRoute(outlet: RouterOutlet) { | ||
const animationState = 'animationState'; | ||
return outlet && outlet.activatedRouteData && outlet.activatedRouteData[animationState]; | ||
} | ||
|
||
@HostListener('window:mousemove') | ||
@HostListener('document:touchmove') | ||
refreshUserState() { | ||
clearTimeout(this.userActivity); | ||
this.setDialogTimeout(); | ||
} | ||
} | ||
import { Component, HostListener, OnInit } from '@angular/core'; | ||
import { Subject } from 'rxjs'; | ||
import { Router } from '@angular/router'; | ||
import { MatDialog } from '@angular/material/dialog'; | ||
import { RouterOutlet } from '@angular/router'; | ||
|
||
import { IdleTimeoutComponent } from './idle-timeout/idle-timeout.component'; | ||
import { routeTransitionAnimations } from './route-transition-animations'; | ||
import { environment } from '../environments/environment'; | ||
|
||
@Component({ | ||
selector: 'app-root', | ||
templateUrl: './app.component.html', | ||
styleUrls: ['./app.component.scss'], | ||
animations: [routeTransitionAnimations], | ||
standalone: true, | ||
imports: [RouterOutlet], | ||
}) | ||
export class AppComponent implements OnInit { | ||
title = 'Teknisk Museum'; | ||
|
||
userActivity = 0; | ||
userInactive = new Subject<any>(); | ||
|
||
isDialogOpen = false; | ||
inactivityTime = environment.inactivityTime; | ||
|
||
constructor(private router: Router, public dialog: MatDialog) {} | ||
|
||
ngOnInit(): void { | ||
this.setDialogTimeout(); | ||
this.userInactive.subscribe(() => { | ||
if (this.router.url !== '/' && this.router.url !== '/admin') { | ||
this.openDialog(); | ||
} | ||
}); | ||
} | ||
|
||
openDialog() { | ||
if (!this.isDialogOpen) { | ||
this.dialog | ||
.open(IdleTimeoutComponent) | ||
.afterClosed() | ||
.subscribe(() => { | ||
this.isDialogOpen = false; | ||
}); | ||
this.isDialogOpen = true; | ||
} | ||
} | ||
|
||
setDialogTimeout() { | ||
this.userActivity = window.setTimeout(() => this.userInactive.next(undefined), this.inactivityTime); | ||
} | ||
|
||
prepareRoute(outlet: RouterOutlet) { | ||
const animationState = 'animationState'; | ||
return outlet && outlet.activatedRouteData && outlet.activatedRouteData[animationState]; | ||
} | ||
|
||
@HostListener('window:mousemove') | ||
@HostListener('document:touchmove') | ||
refreshUserState() { | ||
clearTimeout(this.userActivity); | ||
this.setDialogTimeout(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,40 @@ | ||
import { trigger, transition, style, query, animateChild, group, animate } from '@angular/animations'; | ||
|
||
export const routeTransitionAnimations = trigger('triggerName', [ | ||
transition('welcome => game', [ | ||
style({ position: 'relative' }), | ||
query(':enter, :leave', [ | ||
style({ | ||
position: 'absolute', | ||
top: 0, | ||
right: 0, | ||
width: '100%', | ||
}), | ||
]), | ||
query(':enter', [style({ right: '-100%', opacity: 0 })]), | ||
query(':leave', animateChild()), | ||
group([ | ||
query(':leave', [animate('0.4s ease-out', style({ right: '100%', opacity: 0 }))]), | ||
query(':enter', [animate('0.4s ease-out', style({ right: '0%', opacity: 1 }))]), | ||
]), | ||
query(':enter', animateChild()), | ||
]), | ||
transition('game => welcome, game => game', [ | ||
style({ position: 'relative' }), | ||
query(':enter, :leave', [ | ||
style({ | ||
position: 'absolute', | ||
top: 0, | ||
left: 0, | ||
width: '100%', | ||
}), | ||
]), | ||
query(':enter', [style({ left: '-100%', opacity: 0 })]), | ||
query(':leave', animateChild()), | ||
group([ | ||
query(':leave', [animate('0.4s ease-out', style({ left: '100%', opacity: 0 }))]), | ||
query(':enter', [animate('0.4s ease-out', style({ left: '0%', opacity: 1 }))]), | ||
]), | ||
query(':enter', animateChild()), | ||
]), | ||
]); | ||
import { trigger, transition, style, query, animateChild, group, animate } from '@angular/animations'; | ||
|
||
export const routeTransitionAnimations = trigger('triggerName', [ | ||
transition('welcome => game', [ | ||
style({ position: 'relative' }), | ||
query(':enter, :leave', [ | ||
style({ | ||
position: 'absolute', | ||
top: 0, | ||
right: 0, | ||
width: '100%', | ||
}), | ||
]), | ||
query(':enter', [style({ right: '-100%', opacity: 0 })]), | ||
query(':leave', animateChild()), | ||
group([ | ||
query(':leave', [animate('0.4s ease-out', style({ right: '100%', opacity: 0 }))]), | ||
query(':enter', [animate('0.4s ease-out', style({ right: '0%', opacity: 1 }))]), | ||
]), | ||
query(':enter', animateChild()), | ||
]), | ||
transition('game => welcome, game => game', [ | ||
style({ position: 'relative' }), | ||
query(':enter, :leave', [ | ||
style({ | ||
position: 'absolute', | ||
top: 0, | ||
left: 0, | ||
width: '100%', | ||
}), | ||
]), | ||
query(':enter', [style({ left: '-100%', opacity: 0 })]), | ||
query(':leave', animateChild()), | ||
group([ | ||
query(':leave', [animate('0.4s ease-out', style({ left: '100%', opacity: 0 }))]), | ||
query(':enter', [animate('0.4s ease-out', style({ left: '0%', opacity: 1 }))]), | ||
]), | ||
query(':enter', animateChild()), | ||
]), | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,48 +1,48 @@ | ||
import { Routes } from '@angular/router'; | ||
import { WelcomeComponent } from './welcome/welcome.component'; | ||
import { GameComponent } from './game/game.component'; | ||
import { routes as r } from './shared/models/routes'; | ||
import { GameResultComponent } from './game/game-result/game-result.component'; | ||
import { GameDrawComponent } from './game/game-draw/game-draw.component'; | ||
import { AdminComponent } from './admin/admin.component'; | ||
import { InfoComponent } from './admin/info/info.component'; | ||
import { authGuard } from './admin/auth-guard'; | ||
import { MultiplayerComponent } from './game/game-multiplayer/multiplayer.component'; | ||
|
||
export const routes: Routes = [ | ||
{ | ||
path: r.LANDING, | ||
component: WelcomeComponent, | ||
data: { animationState: 'welcome' }, | ||
}, | ||
{ | ||
path: r.SINGLEPLAYER, | ||
component: GameComponent, | ||
data: { animationState: 'game' }, | ||
}, | ||
{ | ||
path: r.MULTIPLAYER, | ||
component: MultiplayerComponent, | ||
}, | ||
{ | ||
path: 'summary', | ||
component: GameResultComponent, | ||
}, | ||
{ | ||
path: 'summary/multiplayer', | ||
component: GameResultComponent, | ||
}, | ||
{ | ||
path: 'drawing', | ||
component: GameDrawComponent, | ||
}, | ||
{ | ||
path: 'admin', | ||
component: AdminComponent, | ||
}, | ||
{ | ||
path: 'admin/info', | ||
component: InfoComponent, | ||
canActivate: [authGuard], | ||
}, | ||
]; | ||
import { Routes } from '@angular/router'; | ||
import { WelcomeComponent } from './welcome/welcome.component'; | ||
import { GameComponent } from './game/game.component'; | ||
import { routes as r } from './shared/models/routes'; | ||
import { GameResultComponent } from './game/game-result/game-result.component'; | ||
import { GameDrawComponent } from './game/game-draw/game-draw.component'; | ||
import { AdminComponent } from './admin/admin.component'; | ||
import { InfoComponent } from './admin/info/info.component'; | ||
import { authGuard } from './admin/auth-guard'; | ||
import { MultiplayerComponent } from './game/game-multiplayer/multiplayer.component'; | ||
|
||
export const routes: Routes = [ | ||
{ | ||
path: r.LANDING, | ||
component: WelcomeComponent, | ||
data: { animationState: 'welcome' }, | ||
}, | ||
{ | ||
path: r.SINGLEPLAYER, | ||
component: GameComponent, | ||
data: { animationState: 'game' }, | ||
}, | ||
{ | ||
path: r.MULTIPLAYER, | ||
component: MultiplayerComponent, | ||
}, | ||
{ | ||
path: 'summary', | ||
component: GameResultComponent, | ||
}, | ||
{ | ||
path: 'summary/multiplayer', | ||
component: GameResultComponent, | ||
}, | ||
{ | ||
path: 'drawing', | ||
component: GameDrawComponent, | ||
}, | ||
{ | ||
path: 'admin', | ||
component: AdminComponent, | ||
}, | ||
{ | ||
path: 'admin/info', | ||
component: InfoComponent, | ||
canActivate: [authGuard], | ||
}, | ||
]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
export const environment = { | ||
production: true, | ||
WS_ENDPOINT: 'wss://teknisk-museum-backend.azurewebsites.net', | ||
// TEKNISKBACKEND_ENDPOINT :'https://tekniskback.azurewebsites.net', | ||
TEKNISKBACKEND_ENDPOINT: 'https://teknisk-museum-backend-singleplayer.azurewebsites.net', | ||
inactivityTime: 60 * 1000, | ||
PAIR_ID: 'f368b28b-4d39-4362-8c8c-c1f230c64fb0', | ||
}; | ||
export const environment = { | ||
production: true, | ||
WS_ENDPOINT: 'wss://teknisk-museum-backend.azurewebsites.net', | ||
// TEKNISKBACKEND_ENDPOINT :'https://tekniskback.azurewebsites.net', | ||
TEKNISKBACKEND_ENDPOINT: 'https://teknisk-museum-backend-singleplayer.azurewebsites.net', | ||
inactivityTime: 60 * 1000, | ||
PAIR_ID: 'f368b28b-4d39-4362-8c8c-c1f230c64fb0', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
export const environment = { | ||
production: false, | ||
WS_ENDPOINT: 'ws://localhost:8000', | ||
TEKNISKBACKEND_ENDPOINT : 'http://localhost:8000', | ||
inactivityTime: 60 * 1000, | ||
PAIR_ID: 'dev-1' | ||
}; | ||
export const environment = { | ||
production: false, | ||
WS_ENDPOINT: 'ws://localhost:8000', | ||
TEKNISKBACKEND_ENDPOINT: 'http://localhost:8000', | ||
inactivityTime: 60 * 1000, | ||
PAIR_ID: 'dev-1', | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
export const environment = { | ||
production: true, | ||
WS_ENDPOINT: 'wss://tekniskmuseumbackendmultiplayer.azurewebsites.net', | ||
// TEKNISKBACKEND_ENDPOINT :'https://tekniskback.azurewebsites.net', | ||
TEKNISKBACKEND_ENDPOINT :'https://tekniskmuseumbackendsingleplayer-dev.azurewebsites.net', | ||
inactivityTime: 60 * 1000, | ||
PAIR_ID: 'teknisk-1' | ||
}; | ||
export const environment = { | ||
production: true, | ||
WS_ENDPOINT: 'wss://tekniskmuseumbackendmultiplayer.azurewebsites.net', | ||
// TEKNISKBACKEND_ENDPOINT :'https://tekniskback.azurewebsites.net', | ||
TEKNISKBACKEND_ENDPOINT: 'https://tekniskmuseumbackendsingleplayer-dev.azurewebsites.net', | ||
inactivityTime: 60 * 1000, | ||
PAIR_ID: 'teknisk-1', | ||
}; |
Oops, something went wrong.