diff --git a/.htaccess b/.htaccess new file mode 100644 index 0000000..1103b18 --- /dev/null +++ b/.htaccess @@ -0,0 +1,66 @@ +# INFORMATION +# For new versions of this Gist go to: +# https://gist.github.com/julianpoemp/bcf277cb56d2420cc53ec630a04a3566 +# Version 1.1.0 +# +# Contributors: +# - RaschidJFR [https://gist.github.com/RaschidJFR/f6d21a03b0692f5c7a6a23954003f00b] +#------------- + +# INSTRUCTION: +# Place this file next to the app's index.html. +# There are two options for the redirection: +# Option 1) (default): Your app is directly on the root of the domain. +# Option 2): Your app is placed in a subfolder from the root of the domain. +# +# If you have issues with browser caching you can uncomment the BROWSER CACHING part + +#------------ REDIRECTION option 1) +# use this if your app is directly on the root of the domain, +# e.g. http://example_domain.com/index.html + + RewriteEngine On + # If an existing asset or directory is requested go to it as it is + RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR] + RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d + RewriteRule ^ - [L] + + RewriteRule ^ /index.html + +#------------ + +#------------ REDIRECTION option 2) +# Use this if your app is not directly on the root of the domain, +# e.g. http://example_domain.com/directory_path/index.html +# Important: replace directory_path with the relative path from +# the domain to the index.html. Keep the first "/". Don't forget to comment option 1). +# +# RewriteEngine On +# # If an existing asset or directory is requested go to it as it is +# RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -f [OR] +# RewriteCond %{DOCUMENT_ROOT}%{REQUEST_URI} -d +# RewriteRule ^ - [L] +# +# RewriteRule ^ /directory_path/index.html +# +#------------ + +# #------------ BROWSER CACHING +# disable browser caching in production. +# +# +# FileETag None +# Header unset ETag +# Header unset Pragma +# Header unset Cache-Control +# Header unset Last-Modified +# Header set Pragma "no-cache" +# Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate" +# Header set Expires "Mon, 10 Apr 1972 00:00:00 GMT" +# +# +# +# It is recommended to add these tags to your index.html, too: +# +# +# contact works!

+

Contact page

diff --git a/src/app/modules/contact/components/contact/contact.component.ts b/src/app/modules/contact/components/contact/contact.component.ts index 2126220..4d06139 100644 --- a/src/app/modules/contact/components/contact/contact.component.ts +++ b/src/app/modules/contact/components/contact/contact.component.ts @@ -1,4 +1,7 @@ import { Component, OnInit } from '@angular/core'; +import { Title } from '@angular/platform-browser'; +import { LoadingService } from 'src/app/modules/shared/loading.service'; +import { FormBuilder, FormGroup, FormControl, Validators } from '@angular/forms'; @Component({ selector: 'app-contact', @@ -6,10 +9,13 @@ import { Component, OnInit } from '@angular/core'; styleUrls: ['./contact.component.css'] }) export class ContactComponent implements OnInit { + public contactForm: FormGroup = new FormGroup({ + name: new FormControl('', [Validators.required]) + }); - constructor() { } + constructor(private readonly titleService: Title, private readonly loadingService: LoadingService) {} ngOnInit() { + this.titleService.setTitle('VideoGamer | Contact'); } - } diff --git a/src/app/modules/errors/components/errors/errors.component.css b/src/app/modules/errors/components/errors/errors.component.css new file mode 100644 index 0000000..e69de29 diff --git a/src/app/modules/errors/components/errors/errors.component.html b/src/app/modules/errors/components/errors/errors.component.html new file mode 100644 index 0000000..2d08090 --- /dev/null +++ b/src/app/modules/errors/components/errors/errors.component.html @@ -0,0 +1 @@ +

404 page

diff --git a/src/app/modules/errors/components/errors/errors.component.spec.ts b/src/app/modules/errors/components/errors/errors.component.spec.ts new file mode 100644 index 0000000..c569cf7 --- /dev/null +++ b/src/app/modules/errors/components/errors/errors.component.spec.ts @@ -0,0 +1,25 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; + +import { ErrorsComponent } from './errors.component'; + +describe('ErrorsComponent', () => { + let component: ErrorsComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ ErrorsComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(ErrorsComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/app/modules/errors/components/errors/errors.component.ts b/src/app/modules/errors/components/errors/errors.component.ts new file mode 100644 index 0000000..84be177 --- /dev/null +++ b/src/app/modules/errors/components/errors/errors.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-errors', + templateUrl: './errors.component.html', + styleUrls: ['./errors.component.css'] +}) +export class ErrorsComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/src/app/modules/errors/errors.module.ts b/src/app/modules/errors/errors.module.ts new file mode 100644 index 0000000..a73c573 --- /dev/null +++ b/src/app/modules/errors/errors.module.ts @@ -0,0 +1,19 @@ +import { NgModule } from '@angular/core'; +import { CommonModule } from '@angular/common'; +import { ErrorsComponent } from './components/errors/errors.component'; +import { Routes, RouterModule } from '@angular/router'; + +const routes: Routes = [ + { + path: '', + pathMatch: 'full', + component: ErrorsComponent + } +]; + +@NgModule({ + declarations: [ErrorsComponent], + imports: [CommonModule, RouterModule.forChild(routes)], + exports: [ErrorsComponent, RouterModule] +}) +export class ErrorsModule {} diff --git a/src/app/modules/home/components/home/home.component.html b/src/app/modules/home/components/home/home.component.html index 8b13789..1462211 100644 --- a/src/app/modules/home/components/home/home.component.html +++ b/src/app/modules/home/components/home/home.component.html @@ -1 +1,6 @@ - + + +

Welcome to VideoGamer

+
+ 2 +
diff --git a/src/app/modules/home/components/home/home.component.ts b/src/app/modules/home/components/home/home.component.ts index 1e408a0..5eccafd 100644 --- a/src/app/modules/home/components/home/home.component.ts +++ b/src/app/modules/home/components/home/home.component.ts @@ -1,17 +1,16 @@ import { Component, OnInit } from '@angular/core'; import { Title } from '@angular/platform-browser'; - +import { LoadingService } from 'src/app/modules/shared/loading.service'; @Component({ selector: 'app-home', templateUrl: './home.component.html', styleUrls: ['./home.component.css'] }) export class HomeComponent implements OnInit { - - constructor(private readonly titleService: Title) { } + constructor(private readonly titleService: Title, private readonly loadingService: LoadingService) {} ngOnInit() { - this.titleService.setTitle('Home page'); + this.loadingService.setLoading(true); + this.titleService.setTitle('VideoGamer | Home'); } - } diff --git a/src/app/modules/home/home.module.ts b/src/app/modules/home/home.module.ts index eaf0be9..0ec0c4e 100644 --- a/src/app/modules/home/home.module.ts +++ b/src/app/modules/home/home.module.ts @@ -2,6 +2,7 @@ import { NgModule } from '@angular/core'; import { CommonModule } from '@angular/common'; import { HomeComponent } from './components/home/home.component'; import { RouterModule, Routes } from '@angular/router'; +import { MatGridListModule } from '@angular/material/grid-list'; const routes: Routes = [ { @@ -13,7 +14,7 @@ const routes: Routes = [ @NgModule({ declarations: [HomeComponent], - imports: [CommonModule, RouterModule.forChild(routes)], - exports: [HomeComponent, RouterModule] + imports: [CommonModule, RouterModule.forChild(routes), MatGridListModule], + exports: [HomeComponent, RouterModule, MatGridListModule] }) export class HomeModule {} diff --git a/src/app/modules/layouts/video-gamer-layout/video-gamer-layout.module.ts b/src/app/modules/layouts/video-gamer-layout/video-gamer-layout.module.ts index c6e8879..f8e384a 100644 --- a/src/app/modules/layouts/video-gamer-layout/video-gamer-layout.module.ts +++ b/src/app/modules/layouts/video-gamer-layout/video-gamer-layout.module.ts @@ -17,7 +17,8 @@ const routes: Routes = [ }, { path: '**', - component: null + component: DefaultComponent, + loadChildren: () => import('../../errors/errors.module').then(mod => mod.ErrorsModule) } ]; diff --git a/src/app/modules/shared-components/components/footer/footer.component.css b/src/app/modules/shared-components/components/footer/footer.component.css index e69de29..7944dcb 100644 --- a/src/app/modules/shared-components/components/footer/footer.component.css +++ b/src/app/modules/shared-components/components/footer/footer.component.css @@ -0,0 +1,3 @@ +.text-center { + text-align: center !important; +} diff --git a/src/app/modules/shared-components/components/footer/footer.component.html b/src/app/modules/shared-components/components/footer/footer.component.html index 28c0d7d..39fdbca 100644 --- a/src/app/modules/shared-components/components/footer/footer.component.html +++ b/src/app/modules/shared-components/components/footer/footer.component.html @@ -1 +1,3 @@ -

footer works!

+ + Copyright 2019 © Stefan Bogdanovic + diff --git a/src/app/modules/shared-components/components/header/header.component.html b/src/app/modules/shared-components/components/header/header.component.html index 8d654b2..99cb8d2 100644 --- a/src/app/modules/shared-components/components/header/header.component.html +++ b/src/app/modules/shared-components/components/header/header.component.html @@ -1,5 +1,5 @@ - VideoGamer + VideoGamer diff --git a/src/app/modules/shared-components/components/loading-spinner/loading-spinner.component.ts b/src/app/modules/shared-components/components/loading-spinner/loading-spinner.component.ts index 0f333af..437e21e 100644 --- a/src/app/modules/shared-components/components/loading-spinner/loading-spinner.component.ts +++ b/src/app/modules/shared-components/components/loading-spinner/loading-spinner.component.ts @@ -6,7 +6,7 @@ import { Component, OnInit, Input } from '@angular/core'; styleUrls: ['./loading-spinner.component.css'] }) export class LoadingSpinnerComponent implements OnInit { - @Input() loading: boolean; + @Input() loading: boolean = true; constructor() {} diff --git a/src/app/modules/shared-components/material/material.module.ts b/src/app/modules/shared-components/material/material.module.ts index 2788889..d0fccd0 100644 --- a/src/app/modules/shared-components/material/material.module.ts +++ b/src/app/modules/shared-components/material/material.module.ts @@ -4,10 +4,11 @@ import { CommonModule } from '@angular/common'; import { MatToolbarModule } from '@angular/material/toolbar'; import { MatTabsModule } from '@angular/material/tabs'; import { MatButtonModule } from '@angular/material/button'; +import { MatGridListModule } from '@angular/material/grid-list'; @NgModule({ declarations: [], - imports: [CommonModule, MatToolbarModule, MatButtonModule, MatTabsModule], - exports: [MatToolbarModule, MatButtonModule, MatTabsModule] + imports: [CommonModule, MatToolbarModule, MatButtonModule, MatTabsModule, MatGridListModule], + exports: [MatToolbarModule, MatButtonModule, MatTabsModule, MatGridListModule] }) export class MaterialModule {} diff --git a/src/environments/environment.interface.ts b/src/environments/environment.interface.ts new file mode 100644 index 0000000..b87f578 --- /dev/null +++ b/src/environments/environment.interface.ts @@ -0,0 +1,4 @@ +export interface IEnvironment { + production: boolean; + apiKey: string; +} diff --git a/src/environments/environment.prod.ts b/src/environments/environment.prod.ts index 3612073..2e2584d 100644 --- a/src/environments/environment.prod.ts +++ b/src/environments/environment.prod.ts @@ -1,3 +1,6 @@ -export const environment = { - production: true +import { IEnvironment } from './environment.interface'; + +export const environment: IEnvironment = { + production: true, + apiKey: '' }; diff --git a/src/environments/environment.ts b/src/environments/environment.ts index 7b4f817..dff419f 100644 --- a/src/environments/environment.ts +++ b/src/environments/environment.ts @@ -1,9 +1,12 @@ +import { IEnvironment } from './environment.interface'; + // This file can be replaced during build by using the `fileReplacements` array. // `ng build --prod` replaces `environment.ts` with `environment.prod.ts`. // The list of file replacements can be found in `angular.json`. -export const environment = { - production: false +export const environment: IEnvironment = { + production: false, + apiKey: '' }; /*