diff --git a/.editorconfig b/.editorconfig
index 6e87a00..9b73521 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -4,7 +4,7 @@ root = true
[*]
charset = utf-8
indent_style = space
-indent_size = 2
+indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true
diff --git a/Dockerfile b/Dockerfile
new file mode 100644
index 0000000..eadeec0
--- /dev/null
+++ b/Dockerfile
@@ -0,0 +1,8 @@
+FROM nginx:alpine
+
+COPY nginx/conf.d /etc/nginx/nginx.conf
+
+WORKDIR /usr/share/nginx/html
+COPY dist/app/ .
+
+EXPOSE 80
diff --git a/angular.json b/angular.json
index fea680c..57b3d8f 100644
--- a/angular.json
+++ b/angular.json
@@ -1,139 +1,138 @@
{
- "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
- "version": 1,
- "newProjectRoot": "projects",
- "projects": {
- "retns-frontend": {
- "root": "",
- "sourceRoot": "src",
- "projectType": "application",
- "prefix": "app",
- "schematics": {
- "@schematics/angular:component": {
- "styleext": "scss"
- }
- },
- "architect": {
- "build": {
- "builder": "@angular-devkit/build-angular:browser",
- "options": {
- "outputPath": "dist/retns-frontend",
- "index": "src/index.html",
- "main": "src/main.ts",
- "polyfills": "src/polyfills.ts",
- "tsConfig": "src/tsconfig.app.json",
- "assets": [
- "src/favicon.ico",
- "src/assets"
- ],
- "styles": [
- "src/styles.scss"
- ],
- "scripts": []
- },
- "configurations": {
- "production": {
- "fileReplacements": [
- {
- "replace": "src/environments/environment.ts",
- "with": "src/environments/environment.prod.ts"
+ "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
+ "version": 1,
+ "newProjectRoot": "projects",
+ "projects": {
+ "retns-frontend": {
+ "root": "",
+ "sourceRoot": "src",
+ "projectType": "application",
+ "prefix": "app",
+ "schematics": {
+ "@schematics/angular:component": {
+ "styleext": "scss"
}
- ],
- "optimization": true,
- "outputHashing": "all",
- "sourceMap": false,
- "extractCss": true,
- "namedChunks": false,
- "aot": true,
- "extractLicenses": true,
- "vendorChunk": false,
- "buildOptimizer": true,
- "budgets": [
- {
- "type": "initial",
- "maximumWarning": "2mb",
- "maximumError": "5mb"
+ },
+ "architect": {
+ "build": {
+ "builder": "@angular-devkit/build-angular:browser",
+ "options": {
+ "outputPath": "dist/retns-frontend",
+ "index": "src/index.html",
+ "main": "src/main.ts",
+ "polyfills": "src/polyfills.ts",
+ "tsConfig": "src/tsconfig.app.json",
+ "assets": [
+ "src/favicon.ico",
+ "src/assets"
+ ],
+ "styles": [
+ "src/styles.scss"
+ ],
+ "scripts": [
+ "node_modules/jquery/dist/jquery.js",
+ "node_modules/bootstrap/dist/js/bootstrap.bundle.min.js"
+ ]
+ },
+ "configurations": {
+ "production": {
+ "fileReplacements": [{
+ "replace": "src/environments/environment.ts",
+ "with": "src/environments/environment.prod.ts"
+ }],
+ "optimization": true,
+ "outputHashing": "all",
+ "sourceMap": false,
+ "extractCss": true,
+ "namedChunks": false,
+ "aot": true,
+ "extractLicenses": true,
+ "vendorChunk": false,
+ "buildOptimizer": true,
+ "budgets": [{
+ "type": "initial",
+ "maximumWarning": "2mb",
+ "maximumError": "5mb"
+ }]
+ }
+ }
+ },
+ "serve": {
+ "builder": "@angular-devkit/build-angular:dev-server",
+ "options": {
+ "browserTarget": "retns-frontend:build"
+ },
+ "configurations": {
+ "production": {
+ "browserTarget": "retns-frontend:build:production"
+ }
+ }
+ },
+ "extract-i18n": {
+ "builder": "@angular-devkit/build-angular:extract-i18n",
+ "options": {
+ "browserTarget": "retns-frontend:build"
+ }
+ },
+ "test": {
+ "builder": "@angular-devkit/build-angular:karma",
+ "options": {
+ "main": "src/test.ts",
+ "polyfills": "src/polyfills.ts",
+ "tsConfig": "src/tsconfig.spec.json",
+ "karmaConfig": "src/karma.conf.js",
+ "styles": [
+ "src/styles.scss"
+ ],
+ "scripts": [],
+ "assets": [
+ "src/favicon.ico",
+ "src/assets"
+ ]
+ }
+ },
+ "lint": {
+ "builder": "@angular-devkit/build-angular:tslint",
+ "options": {
+ "tsConfig": [
+ "src/tsconfig.app.json",
+ "src/tsconfig.spec.json"
+ ],
+ "exclude": [
+ "**/node_modules/**"
+ ]
+ }
}
- ]
}
- }
},
- "serve": {
- "builder": "@angular-devkit/build-angular:dev-server",
- "options": {
- "browserTarget": "retns-frontend:build"
- },
- "configurations": {
- "production": {
- "browserTarget": "retns-frontend:build:production"
+ "retns-frontend-e2e": {
+ "root": "e2e/",
+ "projectType": "application",
+ "prefix": "",
+ "architect": {
+ "e2e": {
+ "builder": "@angular-devkit/build-angular:protractor",
+ "options": {
+ "protractorConfig": "e2e/protractor.conf.js",
+ "devServerTarget": "retns-frontend:serve"
+ },
+ "configurations": {
+ "production": {
+ "devServerTarget": "retns-frontend:serve:production"
+ }
+ }
+ },
+ "lint": {
+ "builder": "@angular-devkit/build-angular:tslint",
+ "options": {
+ "tsConfig": "e2e/tsconfig.e2e.json",
+ "exclude": [
+ "**/node_modules/**"
+ ]
+ }
+ }
}
- }
- },
- "extract-i18n": {
- "builder": "@angular-devkit/build-angular:extract-i18n",
- "options": {
- "browserTarget": "retns-frontend:build"
- }
- },
- "test": {
- "builder": "@angular-devkit/build-angular:karma",
- "options": {
- "main": "src/test.ts",
- "polyfills": "src/polyfills.ts",
- "tsConfig": "src/tsconfig.spec.json",
- "karmaConfig": "src/karma.conf.js",
- "styles": [
- "src/styles.scss"
- ],
- "scripts": [],
- "assets": [
- "src/favicon.ico",
- "src/assets"
- ]
- }
- },
- "lint": {
- "builder": "@angular-devkit/build-angular:tslint",
- "options": {
- "tsConfig": [
- "src/tsconfig.app.json",
- "src/tsconfig.spec.json"
- ],
- "exclude": [
- "**/node_modules/**"
- ]
- }
}
- }
},
- "retns-frontend-e2e": {
- "root": "e2e/",
- "projectType": "application",
- "prefix": "",
- "architect": {
- "e2e": {
- "builder": "@angular-devkit/build-angular:protractor",
- "options": {
- "protractorConfig": "e2e/protractor.conf.js",
- "devServerTarget": "retns-frontend:serve"
- },
- "configurations": {
- "production": {
- "devServerTarget": "retns-frontend:serve:production"
- }
- }
- },
- "lint": {
- "builder": "@angular-devkit/build-angular:tslint",
- "options": {
- "tsConfig": "e2e/tsconfig.e2e.json",
- "exclude": [
- "**/node_modules/**"
- ]
- }
- }
- }
- }
- },
- "defaultProject": "retns-frontend"
-}
\ No newline at end of file
+ "defaultProject": "retns-frontend"
+}
diff --git a/build.sh b/build.sh
new file mode 100755
index 0000000..9eb77c2
--- /dev/null
+++ b/build.sh
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+npm --no-git-tag-version --tag-version-prefix="" version patch
+ng build --prod --aot
+docker build -t fergalmoran/retns-frontent .
+docker push fergalmoran/retns-frontent
diff --git a/nginx/conf.d b/nginx/conf.d
new file mode 100644
index 0000000..458df6a
--- /dev/null
+++ b/nginx/conf.d
@@ -0,0 +1,36 @@
+worker_processes 1;
+
+events {
+ worker_connections 1024;
+}
+
+http {
+ server {
+ listen 80;
+ server_name retns.fergl.ie;
+ return 301 http://retns.fergl.ie$request_uri;
+ }
+ server {
+ listen 80;
+ server_name retns.fergl.ie;
+
+ root /usr/share/nginx/html;
+ index index.html index.htm;
+ include /etc/nginx/mime.types;
+
+ add_header X-Frame-Options SAMEORIGIN;
+ add_header X-Content-Type-Options nosniff;
+ add_header X-XSS-Protection "1; mode=block";
+ add_header Strict-Transport-Security "max-age=31536000; includeSubdomains; preload";
+
+ gzip on;
+ gzip_min_length 1000;
+ gzip_proxied expired no-cache no-store private auth;
+ gzip_types text/plain text/css application/json application/javascript application/x-javascript text/xml application/xml application/xml+rss text/javascript;
+
+ location / {
+ try_files $uri $uri/ /index.html;
+ }
+ }
+}
+
diff --git a/package-lock.json b/package-lock.json
index d0a4779..f44c926 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -716,6 +716,11 @@
}
}
},
+ "@fortawesome/fontawesome-free-webfonts": {
+ "version": "1.0.9",
+ "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-free-webfonts/-/fontawesome-free-webfonts-1.0.9.tgz",
+ "integrity": "sha512-nLgl6b6a+tXaoJJnSRw0hjN8cWM/Q5DhxKAwI9Xr0AiC43lQ2F98vQ1KLA6kw5OoYeAyisGGqmlwtBj0WqOI5Q=="
+ },
"@ngtools/webpack": {
"version": "7.0.7",
"resolved": "https://registry.npmjs.org/@ngtools/webpack/-/webpack-7.0.7.tgz",
@@ -1665,6 +1670,11 @@
"multicast-dns-service-types": "^1.1.0"
}
},
+ "bootstrap": {
+ "version": "4.2.1",
+ "resolved": "https://registry.npmjs.org/bootstrap/-/bootstrap-4.2.1.tgz",
+ "integrity": "sha512-tt/7vIv3Gm2mnd/WeDx36nfGGHleil0Wg8IeB7eMrVkY0fZ5iTaBisSh8oNANc2IBsCc6vCgCNTIM/IEN0+50Q=="
+ },
"brace-expansion": {
"version": "1.1.11",
"resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
@@ -5621,6 +5631,11 @@
"integrity": "sha1-43zwsX8ZnM4jvqcbIDk5Uka07E4=",
"dev": true
},
+ "jquery": {
+ "version": "3.3.1",
+ "resolved": "https://registry.npmjs.org/jquery/-/jquery-3.3.1.tgz",
+ "integrity": "sha512-Ubldcmxp5np52/ENotGxlLe6aGMvmF4R8S6tZjsP6Knsaxd/xp3Zrh50cG93lR6nPXyUFwzN3ZSOQI0wRJNdGg=="
+ },
"js-base64": {
"version": "2.5.1",
"resolved": "https://registry.npmjs.org/js-base64/-/js-base64-2.5.1.tgz",
@@ -6402,6 +6417,11 @@
"minimist": "0.0.8"
}
},
+ "moment": {
+ "version": "2.24.0",
+ "resolved": "https://registry.npmjs.org/moment/-/moment-2.24.0.tgz",
+ "integrity": "sha512-bV7f+6l2QigeBBZSM/6yTNq4P2fNpSWj/0e7jQcy87A8e7o2nAfP/34/2ky5Vw4B9S446EtIhodAzkFCcR4dQg=="
+ },
"move-concurrently": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/move-concurrently/-/move-concurrently-1.0.1.tgz",
diff --git a/package.json b/package.json
index 4894298..2c9fde1 100644
--- a/package.json
+++ b/package.json
@@ -20,7 +20,11 @@
"@angular/platform-browser": "~7.0.0",
"@angular/platform-browser-dynamic": "~7.0.0",
"@angular/router": "~7.0.0",
+ "@fortawesome/fontawesome-free-webfonts": "^1.0.9",
+ "bootstrap": "^4.2.1",
"core-js": "^2.5.4",
+ "jquery": "^3.3.1",
+ "moment": "^2.24.0",
"rxjs": "~6.3.3",
"zone.js": "~0.8.26"
},
diff --git a/src/app/app.component.html b/src/app/app.component.html
index 1094e7e..580133e 100644
--- a/src/app/app.component.html
+++ b/src/app/app.component.html
@@ -1,21 +1,8 @@
-
-
-
- Welcome to {{ title }}!
-
-

-
-Here are some links to help you start:
-
-
-
+
+
+
+
+
+
+
diff --git a/src/app/app.component.scss b/src/app/app.component.scss
index e69de29..4f391d9 100644
--- a/src/app/app.component.scss
+++ b/src/app/app.component.scss
@@ -0,0 +1,3 @@
+.container {
+ padding: 90px 15px 0;
+}
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 2c3ba29..de695a5 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -1,18 +1,18 @@
import { BrowserModule } from '@angular/platform-browser';
+import { HttpClientModule } from '@angular/common/http';
import { NgModule } from '@angular/core';
import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
+import { CurrentWeekComponent } from './shared/current-week/current-week.component';
+import { HomeComponent } from './home/home.component';
+import { NavbarComponent } from './shared/navbar/navbar.component';
+import { FooterComponent } from './shared/footer/footer.component';
@NgModule({
- declarations: [
- AppComponent
- ],
- imports: [
- BrowserModule,
- AppRoutingModule
- ],
- providers: [],
- bootstrap: [AppComponent]
+ declarations: [AppComponent, CurrentWeekComponent, HomeComponent, NavbarComponent, FooterComponent],
+ imports: [BrowserModule, AppRoutingModule, HttpClientModule],
+ providers: [],
+ bootstrap: [AppComponent]
})
-export class AppModule { }
+export class AppModule {}
diff --git a/src/app/home/home.component.html b/src/app/home/home.component.html
new file mode 100644
index 0000000..b440e7f
--- /dev/null
+++ b/src/app/home/home.component.html
@@ -0,0 +1,3 @@
+
diff --git a/src/app/home/home.component.scss b/src/app/home/home.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/home/home.component.spec.ts b/src/app/home/home.component.spec.ts
new file mode 100644
index 0000000..490e81b
--- /dev/null
+++ b/src/app/home/home.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { HomeComponent } from './home.component';
+
+describe('HomeComponent', () => {
+ let component: HomeComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ HomeComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(HomeComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts
new file mode 100644
index 0000000..f56c8c1
--- /dev/null
+++ b/src/app/home/home.component.ts
@@ -0,0 +1,15 @@
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-home',
+ templateUrl: './home.component.html',
+ styleUrls: ['./home.component.scss']
+})
+export class HomeComponent implements OnInit {
+
+ constructor() { }
+
+ ngOnInit() {
+ }
+
+}
diff --git a/src/app/models/calendar.model.ts b/src/app/models/calendar.model.ts
new file mode 100644
index 0000000..ae7a426
--- /dev/null
+++ b/src/app/models/calendar.model.ts
@@ -0,0 +1,7 @@
+export interface CalendarModel {
+ id: string;
+ subjects: string[];
+ weekCommencing: Date;
+ notes: string;
+ days: any[];
+}
diff --git a/src/app/shared/current-week/current-week.component.html b/src/app/shared/current-week/current-week.component.html
new file mode 100644
index 0000000..51292c9
--- /dev/null
+++ b/src/app/shared/current-week/current-week.component.html
@@ -0,0 +1,9 @@
+
+
+
+
+ {{this.errorText}}
+
diff --git a/src/app/shared/current-week/current-week.component.scss b/src/app/shared/current-week/current-week.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/shared/current-week/current-week.component.spec.ts b/src/app/shared/current-week/current-week.component.spec.ts
new file mode 100644
index 0000000..1ab0b88
--- /dev/null
+++ b/src/app/shared/current-week/current-week.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { CurrentWeekComponent } from './current-week.component';
+
+describe('CurrentWeekComponent', () => {
+ let component: CurrentWeekComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ CurrentWeekComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(CurrentWeekComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/shared/current-week/current-week.component.ts b/src/app/shared/current-week/current-week.component.ts
new file mode 100644
index 0000000..dd524d6
--- /dev/null
+++ b/src/app/shared/current-week/current-week.component.ts
@@ -0,0 +1,34 @@
+import { Component, OnInit } from '@angular/core';
+import { HttpClient, HttpErrorResponse } from '@angular/common/http';
+import { environment } from 'src/environments/environment';
+import { Observable, EMPTY } from 'rxjs';
+import { catchError } from 'rxjs/operators';
+
+@Component({
+ selector: 'app-current-week',
+ templateUrl: './current-week.component.html',
+ styleUrls: ['./current-week.component.scss']
+})
+export class CurrentWeekComponent implements OnInit {
+ data$: Observable;
+ errorText: string = '';
+
+ constructor(private httpClient: HttpClient) {}
+
+ ngOnInit() {
+ this.data$ = this.httpClient
+ .get(`${environment.apiHost}/gethomework`, {
+ responseType: 'text'
+ })
+ .pipe(
+ catchError((err: HttpErrorResponse) => {
+ if (err.status === 404) {
+ this.errorText = 'No homework found!!!!';
+ } else {
+ this.errorText = err.statusText;
+ }
+ return EMPTY;
+ })
+ );
+ }
+}
diff --git a/src/app/shared/footer/footer.component.html b/src/app/shared/footer/footer.component.html
new file mode 100644
index 0000000..871dbfd
--- /dev/null
+++ b/src/app/shared/footer/footer.component.html
@@ -0,0 +1,9 @@
+
diff --git a/src/app/shared/footer/footer.component.scss b/src/app/shared/footer/footer.component.scss
new file mode 100644
index 0000000..8b5be68
--- /dev/null
+++ b/src/app/shared/footer/footer.component.scss
@@ -0,0 +1,90 @@
+.footer {
+ position: fixed;
+ bottom: 0;
+ width: 100%;
+ height: 60px;
+ line-height: 60px;
+ background-color: #f5f5f5;
+}
+
+.text-pulse {
+ color: #e74c3c !important;
+}
+
+.fa-pulse {
+ display: inline-block;
+ -moz-animation: pulse 2s infinite linear;
+ -o-animation: pulse 2s infinite linear;
+ -webkit-animation: pulse 2s infinite linear;
+ animation: pulse 2s infinite linear;
+}
+
+@-webkit-keyframes pulse {
+ 0% {
+ opacity: 1;
+ }
+
+ 50% {
+ opacity: 0;
+ }
+
+ 100% {
+ opacity: 1;
+ }
+}
+
+@-moz-keyframes pulse {
+ 0% {
+ opacity: 1;
+ }
+
+ 50% {
+ opacity: 0;
+ }
+
+ 100% {
+ opacity: 1;
+ }
+}
+
+@-o-keyframes pulse {
+ 0% {
+ opacity: 1;
+ }
+
+ 50% {
+ opacity: 0;
+ }
+
+ 100% {
+ opacity: 1;
+ }
+}
+
+@-ms-keyframes pulse {
+ 0% {
+ opacity: 1;
+ }
+
+ 50% {
+ opacity: 0;
+ }
+
+ 100% {
+ opacity: 1;
+ }
+}
+
+@keyframes pulse {
+ 0% {
+ opacity: 1;
+ }
+
+ 50% {
+ opacity: 0.3;
+ }
+
+ 100% {
+ opacity: 1;
+ }
+}
diff --git a/src/app/shared/footer/footer.component.spec.ts b/src/app/shared/footer/footer.component.spec.ts
new file mode 100644
index 0000000..2ca6c45
--- /dev/null
+++ b/src/app/shared/footer/footer.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { FooterComponent } from './footer.component';
+
+describe('FooterComponent', () => {
+ let component: FooterComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ FooterComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(FooterComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/shared/footer/footer.component.ts b/src/app/shared/footer/footer.component.ts
new file mode 100644
index 0000000..da17d82
--- /dev/null
+++ b/src/app/shared/footer/footer.component.ts
@@ -0,0 +1,15 @@
+import { Component, OnInit } from '@angular/core';
+
+@Component({
+ selector: 'app-footer',
+ templateUrl: './footer.component.html',
+ styleUrls: ['./footer.component.scss']
+})
+export class FooterComponent implements OnInit {
+
+ constructor() { }
+
+ ngOnInit() {
+ }
+
+}
diff --git a/src/app/shared/navbar/navbar.component.html b/src/app/shared/navbar/navbar.component.html
new file mode 100644
index 0000000..a5336fa
--- /dev/null
+++ b/src/app/shared/navbar/navbar.component.html
@@ -0,0 +1,14 @@
+
diff --git a/src/app/shared/navbar/navbar.component.scss b/src/app/shared/navbar/navbar.component.scss
new file mode 100644
index 0000000..e69de29
diff --git a/src/app/shared/navbar/navbar.component.spec.ts b/src/app/shared/navbar/navbar.component.spec.ts
new file mode 100644
index 0000000..9032ad2
--- /dev/null
+++ b/src/app/shared/navbar/navbar.component.spec.ts
@@ -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;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ NavbarComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(NavbarComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+});
diff --git a/src/app/shared/navbar/navbar.component.ts b/src/app/shared/navbar/navbar.component.ts
new file mode 100644
index 0000000..e0ac8c0
--- /dev/null
+++ b/src/app/shared/navbar/navbar.component.ts
@@ -0,0 +1,66 @@
+import { Component, OnInit } from '@angular/core';
+import { HttpClient } from '@angular/common/http';
+import { environment } from 'src/environments/environment';
+import { CalendarModel } from 'src/app/models/calendar.model';
+import * as moment from 'moment';
+
+@Component({
+ selector: 'app-navbar',
+ templateUrl: './navbar.component.html',
+ styleUrls: ['./navbar.component.scss']
+})
+export class NavbarComponent implements OnInit {
+ constructor(private httpClient: HttpClient) {}
+ days = ['Monday', 'Tuesday', 'Wednesday', 'Thursday'];
+
+ ngOnInit() {}
+ addToCalendar() {
+ if (
+ confirm(
+ 'This will open 4 new tabs with pre-filled gmail calendar events for each day!'
+ )
+ ) {
+ this._addCalendarEvents();
+ }
+ }
+ _addCalendarEvents() {
+ this.httpClient
+ .get(`${environment.apiHost}/calendar`)
+ .subscribe((r) => {
+ for (const [i, d] of this.days.entries()) {
+ const day = r.days[d];
+ const description = Object.keys(day)
+ .map((k) => `${k}: ${day[k]}`)
+ .join('\n');
+ console.log('navbar.component', 'Description', description);
+ const scheduledDate = new Date(
+ new Date(r.weekCommencing).getTime() +
+ i * (1000 * 60 * 60 * 24)
+ );
+ scheduledDate.setHours(16);
+ scheduledDate.setMinutes(0);
+ scheduledDate.setSeconds(0);
+ const scheduledEndDate = new Date(scheduledDate);
+ scheduledEndDate.setMinutes(30);
+ const s = moment(scheduledDate).format('YYYYMMDDTHHmm00');
+ const e = moment(scheduledEndDate).format('YYYYMMDDTHHmm00');
+ const url =
+ `https://calendar.google.com/calendar/r/eventedit` +
+ `?text=${d}'s Homework` +
+ `&dates=${s}/${e}` +
+ `&details=${encodeURIComponent(description)}` +
+ `&sprop=website:&sf=true`;
+ console.log('navbar.component', 'URL:', url);
+ window.open(url, '_blank');
+ }
+ // console.log('navbar.component', 'Monday', r.days['Monday']);
+ // console.log('navbar.component', 'Tuesday', r.days['Tuesday']);
+ // console.log(
+ // 'navbar.component',
+ // 'Wednesday',
+ // r.days['Wednesday']
+ // );
+ // console.log('navbar.component', 'Thursday', r.days['Thursday']);
+ });
+ }
+}
diff --git a/src/environments/environment.ts b/src/environments/environment.ts
index 7b4f817..5ae7853 100644
--- a/src/environments/environment.ts
+++ b/src/environments/environment.ts
@@ -3,7 +3,8 @@
// The list of file replacements can be found in `angular.json`.
export const environment = {
- production: false
+ production: false,
+ apiHost: 'http://localhost:5000/api'
};
/*
diff --git a/src/index.html b/src/index.html
index 415f107..7eb75ab 100644
--- a/src/index.html
+++ b/src/index.html
@@ -1,14 +1,20 @@
-
-
- RetnsFrontend
-
-
-
-
-
-
-
+
+
+ RetnsFrontend
+
+
+
+
+
+
+
+
+
+
diff --git a/src/styles.scss b/src/styles.scss
index 90d4ee0..dca3990 100644
--- a/src/styles.scss
+++ b/src/styles.scss
@@ -1 +1,16 @@
-/* You can add global styles to this file, and also import other style files */
+$fa-font-path: '~@fortawesome/fontawesome-free-webfonts/webfonts';
+@import '~bootstrap/dist/css/bootstrap.min.css';
+@import '~@fortawesome/fontawesome-free-webfonts/scss/fa-regular';
+@import '~@fortawesome/fontawesome-free-webfonts/scss/fa-solid';
+@import '~@fortawesome/fontawesome-free-webfonts/scss/fa-brands';
+@import '~@fortawesome/fontawesome-free-webfonts/scss/fontawesome';
+
+html {
+ position: relative;
+ min-height: 100%;
+}
+
+body {
+ /* Margin bottom by footer height */
+ margin-bottom: 60px;
+}
diff --git a/src/tsconfig.app.json b/src/tsconfig.app.json
index 190fd30..ed0c0df 100644
--- a/src/tsconfig.app.json
+++ b/src/tsconfig.app.json
@@ -1,11 +1,11 @@
{
- "extends": "../tsconfig.json",
- "compilerOptions": {
- "outDir": "../out-tsc/app",
- "types": []
- },
- "exclude": [
- "test.ts",
- "**/*.spec.ts"
- ]
+ "extends": "../tsconfig.json",
+ "compilerOptions": {
+ "outDir": "../out-tsc/app",
+ "types": []
+ },
+ "exclude": [
+ "test.ts",
+ "**/*.spec.ts"
+ ]
}
diff --git a/tsconfig.json b/tsconfig.json
index 46aeded..2cf3fd7 100644
--- a/tsconfig.json
+++ b/tsconfig.json
@@ -1,21 +1,22 @@
{
- "compileOnSave": false,
- "compilerOptions": {
- "baseUrl": "./",
- "outDir": "./dist/out-tsc",
- "sourceMap": true,
- "declaration": false,
- "module": "es2015",
- "moduleResolution": "node",
- "emitDecoratorMetadata": true,
- "experimentalDecorators": true,
- "target": "es5",
- "typeRoots": [
- "node_modules/@types"
- ],
- "lib": [
- "es2018",
- "dom"
- ]
- }
+ "compileOnSave": false,
+ "compilerOptions": {
+ "baseUrl": "./",
+ "outDir": "./dist/out-tsc",
+ "sourceMap": true,
+ "declaration": false,
+ "module": "es2015",
+ "moduleResolution": "node",
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "target": "es5",
+ "downlevelIteration": true,
+ "typeRoots": [
+ "node_modules/@types"
+ ],
+ "lib": [
+ "es2018",
+ "dom"
+ ]
+ }
}
diff --git a/tslint.json b/tslint.json
index 6ddb6b2..3366352 100644
--- a/tslint.json
+++ b/tslint.json
@@ -1,131 +1,131 @@
{
- "rulesDirectory": [
- "node_modules/codelyzer"
- ],
- "rules": {
- "arrow-return-shorthand": true,
- "callable-types": true,
- "class-name": true,
- "comment-format": [
- true,
- "check-space"
+ "rulesDirectory": [
+ "node_modules/codelyzer"
],
- "curly": true,
- "deprecation": {
- "severity": "warn"
- },
- "eofline": true,
- "forin": true,
- "import-blacklist": [
- true,
- "rxjs/Rx"
- ],
- "import-spacing": true,
- "indent": [
- true,
- "spaces"
- ],
- "interface-over-type-literal": true,
- "label-position": true,
- "max-line-length": [
- true,
- 140
- ],
- "member-access": false,
- "member-ordering": [
- true,
- {
- "order": [
- "static-field",
- "instance-field",
- "static-method",
- "instance-method"
- ]
- }
- ],
- "no-arg": true,
- "no-bitwise": true,
- "no-console": [
- true,
- "debug",
- "info",
- "time",
- "timeEnd",
- "trace"
- ],
- "no-construct": true,
- "no-debugger": true,
- "no-duplicate-super": true,
- "no-empty": false,
- "no-empty-interface": true,
- "no-eval": true,
- "no-inferrable-types": [
- true,
- "ignore-params"
- ],
- "no-misused-new": true,
- "no-non-null-assertion": true,
- "no-redundant-jsdoc": true,
- "no-shadowed-variable": true,
- "no-string-literal": false,
- "no-string-throw": true,
- "no-switch-case-fall-through": true,
- "no-trailing-whitespace": true,
- "no-unnecessary-initializer": true,
- "no-unused-expression": true,
- "no-use-before-declare": true,
- "no-var-keyword": true,
- "object-literal-sort-keys": false,
- "one-line": [
- true,
- "check-open-brace",
- "check-catch",
- "check-else",
- "check-whitespace"
- ],
- "prefer-const": true,
- "quotemark": [
- true,
- "single"
- ],
- "radix": true,
- "semicolon": [
- true,
- "always"
- ],
- "triple-equals": [
- true,
- "allow-null-check"
- ],
- "typedef-whitespace": [
- true,
- {
- "call-signature": "nospace",
- "index-signature": "nospace",
- "parameter": "nospace",
- "property-declaration": "nospace",
- "variable-declaration": "nospace"
- }
- ],
- "unified-signatures": true,
- "variable-name": false,
- "whitespace": [
- true,
- "check-branch",
- "check-decl",
- "check-operator",
- "check-separator",
- "check-type"
- ],
- "no-output-on-prefix": true,
- "use-input-property-decorator": true,
- "use-output-property-decorator": true,
- "use-host-property-decorator": true,
- "no-input-rename": true,
- "no-output-rename": true,
- "use-life-cycle-interface": true,
- "use-pipe-transform-interface": true,
- "component-class-suffix": true,
- "directive-class-suffix": true
- }
+ "rules": {
+ "arrow-return-shorthand": true,
+ "callable-types": true,
+ "class-name": true,
+ "comment-format": [
+ true,
+ "check-space"
+ ],
+ "curly": true,
+ "deprecation": {
+ "severity": "warn"
+ },
+ "eofline": true,
+ "forin": true,
+ "import-blacklist": [
+ true,
+ "rxjs/Rx"
+ ],
+ "import-spacing": true,
+ "indent": [
+ true,
+ "spaces"
+ ],
+ "interface-over-type-literal": true,
+ "label-position": true,
+ "max-line-length": [
+ true,
+ 140
+ ],
+ "member-access": false,
+ "member-ordering": [
+ true,
+ {
+ "order": [
+ "static-field",
+ "instance-field",
+ "static-method",
+ "instance-method"
+ ]
+ }
+ ],
+ "no-arg": true,
+ "no-bitwise": true,
+ "no-console": [
+ true,
+ "debug",
+ "info",
+ "time",
+ "timeEnd",
+ "trace"
+ ],
+ "no-construct": true,
+ "no-debugger": true,
+ "no-duplicate-super": true,
+ "no-empty": false,
+ "no-empty-interface": true,
+ "no-eval": true,
+ "no-inferrable-types": [
+ false,
+ "ignore-params"
+ ],
+ "no-misused-new": true,
+ "no-non-null-assertion": true,
+ "no-redundant-jsdoc": true,
+ "no-shadowed-variable": true,
+ "no-string-literal": false,
+ "no-string-throw": true,
+ "no-switch-case-fall-through": true,
+ "no-trailing-whitespace": true,
+ "no-unnecessary-initializer": true,
+ "no-unused-expression": true,
+ "no-use-before-declare": true,
+ "no-var-keyword": true,
+ "object-literal-sort-keys": false,
+ "one-line": [
+ true,
+ "check-open-brace",
+ "check-catch",
+ "check-else",
+ "check-whitespace"
+ ],
+ "prefer-const": true,
+ "quotemark": [
+ true,
+ "single"
+ ],
+ "radix": true,
+ "semicolon": [
+ true,
+ "always"
+ ],
+ "triple-equals": [
+ true,
+ "allow-null-check"
+ ],
+ "typedef-whitespace": [
+ true,
+ {
+ "call-signature": "nospace",
+ "index-signature": "nospace",
+ "parameter": "nospace",
+ "property-declaration": "nospace",
+ "variable-declaration": "nospace"
+ }
+ ],
+ "unified-signatures": true,
+ "variable-name": false,
+ "whitespace": [
+ true,
+ "check-branch",
+ "check-decl",
+ "check-operator",
+ "check-separator",
+ "check-type"
+ ],
+ "no-output-on-prefix": true,
+ "use-input-property-decorator": true,
+ "use-output-property-decorator": true,
+ "use-host-property-decorator": true,
+ "no-input-rename": true,
+ "no-output-rename": true,
+ "use-life-cycle-interface": true,
+ "use-pipe-transform-interface": true,
+ "component-class-suffix": true,
+ "directive-class-suffix": true
+ }
}