From b1db97af877ef646f0b340c84bb4b0cd438f27d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20M=C3=BCller?= Date: Fri, 18 Jun 2021 10:28:25 +0200 Subject: [PATCH] Some fancy changes --- .../about-us/about-us.component.html | 2 +- .../components/about-us/about-us.component.ts | 15 ++-- .../registration/registration.component.ts | 65 +++++++++--------- .../resetpasswort/resetpasswort.component.ts | 15 ++-- .../bottom-bar/bottom-bar.component.ts | 15 ++-- .../copyright/copyright.component.ts | 15 ++-- .../app/components/footer/footer.component.ts | 27 ++++---- .../greeting-info-slider.component.ts | 15 ++-- .../hot-deals-widget.component.ts | 12 ++-- .../app/components/kunden/kunden.component.ts | 6 +- .../product-details.component.ts | 8 +-- .../components/profile/profile.component.css | 5 ++ .../components/profile/profile.component.html | 2 +- .../components/profile/profile.component.ts | 43 +++++++----- .../slider-for-products.component.ts | 15 ++-- .../components/top-bar/top-bar.component.ts | 17 +++-- Frontend/src/assets/images/pencil.png | Bin 0 -> 1422 bytes 17 files changed, 150 insertions(+), 127 deletions(-) create mode 100644 Frontend/src/assets/images/pencil.png diff --git a/Frontend/src/app/components/about-us/about-us.component.html b/Frontend/src/app/components/about-us/about-us.component.html index 02cbb14..55befbc 100644 --- a/Frontend/src/app/components/about-us/about-us.component.html +++ b/Frontend/src/app/components/about-us/about-us.component.html @@ -11,7 +11,7 @@

You follow the same passion as we do and you want to find alternatives to the de-facto monopolist Amazon?

-

In this case, welcome aboard! We’re happy that you share our passion and hope that we can help you achieving this goal with the website

+

In this case, welcome aboard! We’re happy that you share our passion and hope that we can help you achieving this goal with the website.

diff --git a/Frontend/src/app/components/about-us/about-us.component.ts b/Frontend/src/app/components/about-us/about-us.component.ts index d287527..74b308e 100644 --- a/Frontend/src/app/components/about-us/about-us.component.ts +++ b/Frontend/src/app/components/about-us/about-us.component.ts @@ -1,15 +1,16 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; @Component({ - selector: 'app-about-us', - templateUrl: './about-us.component.html', - styleUrls: ['./about-us.component.css'] + selector: 'app-about-us', + templateUrl: './about-us.component.html', + styleUrls: ['./about-us.component.css'] }) export class AboutUsComponent implements OnInit { - constructor() { } + constructor() { + } - ngOnInit(): void { - } + ngOnInit(): void { + } } diff --git a/Frontend/src/app/components/auth/registration/registration.component.ts b/Frontend/src/app/components/auth/registration/registration.component.ts index 5324f72..1528be0 100644 --- a/Frontend/src/app/components/auth/registration/registration.component.ts +++ b/Frontend/src/app/components/auth/registration/registration.component.ts @@ -1,44 +1,47 @@ -import { Component, OnInit } from '@angular/core'; -import { FormBuilder, FormGroup, Validators } from '@angular/forms'; -import {ApiService} from "../../../services/api.service"; -import {Router} from "@angular/router"; +import {Component, OnInit} from '@angular/core'; +import {FormBuilder, FormGroup, Validators} from '@angular/forms'; +import {ApiService} from '../../../services/api.service'; +import {Router} from '@angular/router'; @Component({ - selector: 'app-registration', - templateUrl: './registration.component.html', - styleUrls: ['./registration.component.css'] + selector: 'app-registration', + templateUrl: './registration.component.html', + styleUrls: ['./registration.component.css'] }) export class RegistrationComponent implements OnInit { form: any; loading = false; submitted = false; - constructor( - private formBuilder: FormBuilder, - private api : ApiService, - private router: Router - ) { } + constructor( + private formBuilder: FormBuilder, + private api: ApiService, + private router: Router + ) { + } - ngOnInit(): void { - this.form = this.formBuilder.group({ - username: ['', Validators.required], - email: ['', Validators.required], - password: ['', [ - Validators.required, - Validators.minLength(8)] - ], - }); - } + ngOnInit(): void { + this.form = this.formBuilder.group({ + username: ['', Validators.required], + email: ['', Validators.required], + password: ['', [ + Validators.required, + Validators.minLength(8)] + ], + }); + } - get me() { return this.form.controls; } + get me() { + return this.form.controls; + } - onSubmit() { - this.api.registerUser(this.form.value.username, this.form.value.password, this.form.value.email).subscribe( - res=> { - this.api.saveSessionInfoToLocalStorage(res); - this.router.navigate(['/']); - } - ); - } + onSubmit(): void { + this.api.registerUser(this.form.value.username, this.form.value.password, this.form.value.email).subscribe( + res => { + this.api.saveSessionInfoToLocalStorage(res); + this.router.navigate(['/']); + } + ); + } } diff --git a/Frontend/src/app/components/auth/resetpasswort/resetpasswort.component.ts b/Frontend/src/app/components/auth/resetpasswort/resetpasswort.component.ts index 4126525..a51b175 100644 --- a/Frontend/src/app/components/auth/resetpasswort/resetpasswort.component.ts +++ b/Frontend/src/app/components/auth/resetpasswort/resetpasswort.component.ts @@ -1,15 +1,16 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; @Component({ - selector: 'app-resetpasswort', - templateUrl: './resetpasswort.component.html', - styleUrls: ['./resetpasswort.component.css'] + selector: 'app-resetpasswort', + templateUrl: './resetpasswort.component.html', + styleUrls: ['./resetpasswort.component.css'] }) export class ResetpasswortComponent implements OnInit { - constructor() { } + constructor() { + } - ngOnInit(): void { - } + ngOnInit(): void { + } } diff --git a/Frontend/src/app/components/bottom-bar/bottom-bar.component.ts b/Frontend/src/app/components/bottom-bar/bottom-bar.component.ts index 603ea87..e2b42e2 100644 --- a/Frontend/src/app/components/bottom-bar/bottom-bar.component.ts +++ b/Frontend/src/app/components/bottom-bar/bottom-bar.component.ts @@ -1,15 +1,16 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; @Component({ - selector: 'app-bottom-bar', - templateUrl: "./bottom-bar.component.html", - styleUrls: ["./bottom-bar.component.css"] + selector: 'app-bottom-bar', + templateUrl: './bottom-bar.component.html', + styleUrls: ['./bottom-bar.component.css'] }) export class BottomBarComponent implements OnInit { - constructor() { } + constructor() { + } - ngOnInit(): void { - } + ngOnInit(): void { + } } diff --git a/Frontend/src/app/components/copyright/copyright.component.ts b/Frontend/src/app/components/copyright/copyright.component.ts index 4db696c..b7bd67d 100644 --- a/Frontend/src/app/components/copyright/copyright.component.ts +++ b/Frontend/src/app/components/copyright/copyright.component.ts @@ -1,15 +1,16 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; @Component({ - selector: 'app-copyright', - templateUrl: './copyright.component.html', - styleUrls: ['./copyright.component.css'] + selector: 'app-copyright', + templateUrl: './copyright.component.html', + styleUrls: ['./copyright.component.css'] }) export class CopyrightComponent implements OnInit { - constructor() { } + constructor() { + } - ngOnInit(): void { - } + ngOnInit(): void { + } } diff --git a/Frontend/src/app/components/footer/footer.component.ts b/Frontend/src/app/components/footer/footer.component.ts index f587c32..d9263bd 100644 --- a/Frontend/src/app/components/footer/footer.component.ts +++ b/Frontend/src/app/components/footer/footer.component.ts @@ -1,23 +1,24 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; import {ActivatedRoute, Router} from '@angular/router'; @Component({ - selector: 'app-footer', - templateUrl: './footer.component.html', - styleUrls: ['./footer.component.css'] + selector: 'app-footer', + templateUrl: './footer.component.html', + styleUrls: ['./footer.component.css'] }) export class FooterComponent implements OnInit { - constructor( - private router: Router, - private route: ActivatedRoute - ) {} + constructor( + private router: Router, + private route: ActivatedRoute + ) { + } - ngOnInit(): void { - } + ngOnInit(): void { + } - navigateImprint(): void { - this.router.navigate([('/impressum')]); - } + navigateImprint(): void { + this.router.navigate([('/impressum')]); + } } diff --git a/Frontend/src/app/components/greeting-info-slider/greeting-info-slider.component.ts b/Frontend/src/app/components/greeting-info-slider/greeting-info-slider.component.ts index 9172ea0..4b2eca5 100644 --- a/Frontend/src/app/components/greeting-info-slider/greeting-info-slider.component.ts +++ b/Frontend/src/app/components/greeting-info-slider/greeting-info-slider.component.ts @@ -1,15 +1,16 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; @Component({ - selector: 'app-greeting-info-slider', - templateUrl: './greeting-info-slider.component.html', - styleUrls: ['./greeting-info-slider.component.css'] + selector: 'app-greeting-info-slider', + templateUrl: './greeting-info-slider.component.html', + styleUrls: ['./greeting-info-slider.component.css'] }) export class GreetingInfoSliderComponent implements OnInit { - constructor() { } + constructor() { + } - ngOnInit(): void { - } + ngOnInit(): void { + } } diff --git a/Frontend/src/app/components/hot-deals-widget/hot-deals-widget.component.ts b/Frontend/src/app/components/hot-deals-widget/hot-deals-widget.component.ts index d9a09e7..98c5a14 100644 --- a/Frontend/src/app/components/hot-deals-widget/hot-deals-widget.component.ts +++ b/Frontend/src/app/components/hot-deals-widget/hot-deals-widget.component.ts @@ -4,9 +4,9 @@ import {Product} from '../../models/product'; import {ActivatedRoute, Router} from '@angular/router'; @Component({ - selector: 'app-hot-deals-widget', - templateUrl: './hot-deals-widget.component.html', - styleUrls: ['./hot-deals-widget.component.css'] + selector: 'app-hot-deals-widget', + templateUrl: './hot-deals-widget.component.html', + styleUrls: ['./hot-deals-widget.component.css'] }) export class HotDealsWidgetComponent implements OnInit { @@ -52,7 +52,7 @@ export class HotDealsWidgetComponent implements OnInit { default: { this.getProductsByIds(); this.getAmazonPricesForBestDeals(); - this.getVendors() + this.getVendors(); break; } } @@ -73,7 +73,7 @@ export class HotDealsWidgetComponent implements OnInit { deals => { deals.forEach(deal => { this.bestDealsProductIds.push(deal.product_id); - this.productsPricesMap [deal.product_id] = {lowestPrice: deal} + this.productsPricesMap [deal.product_id] = {lowestPrice: deal}; }); this.loadParams(); } @@ -92,7 +92,7 @@ export class HotDealsWidgetComponent implements OnInit { } - getAmazonPricesForBestDeals(): void{ + getAmazonPricesForBestDeals(): void { this.bestDealsProductIds.forEach(id => { this.apiService.getAmazonPrice(id).subscribe( price => { diff --git a/Frontend/src/app/components/kunden/kunden.component.ts b/Frontend/src/app/components/kunden/kunden.component.ts index 416be2e..6c5e93a 100644 --- a/Frontend/src/app/components/kunden/kunden.component.ts +++ b/Frontend/src/app/components/kunden/kunden.component.ts @@ -4,9 +4,9 @@ import {Product} from '../../models/product'; import {ActivatedRoute, Router} from '@angular/router'; @Component({ - selector: 'app-kunden', - templateUrl: './kunden.component.html', - styleUrls: ['./kunden.component.css'] + selector: 'app-kunden', + templateUrl: './kunden.component.html', + styleUrls: ['./kunden.component.css'] }) export class KundenComponent implements OnInit { products: Product[] = []; diff --git a/Frontend/src/app/components/product-details/product-details.component.ts b/Frontend/src/app/components/product-details/product-details.component.ts index e7588c2..5d5ee49 100644 --- a/Frontend/src/app/components/product-details/product-details.component.ts +++ b/Frontend/src/app/components/product-details/product-details.component.ts @@ -46,7 +46,7 @@ export class ProductDetailsComponent implements OnInit { this.getProduct(); this.getVendors(); this.getPrices(); - if (this.apiService.getSessionInfoFromLocalStorage().session_id != "") { + if (this.apiService.getSessionInfoFromLocalStorage().session_id != '') { this.isLoggedIn = true; } } @@ -123,10 +123,10 @@ export class ProductDetailsComponent implements OnInit { return Math.round(percentage); } - setPriceAlarm() { - this.apiService.createPriceAlarms(this.productId, this.price*100).subscribe( + setPriceAlarm(): void { + this.apiService.createPriceAlarms(this.productId, this.price * 100).subscribe( alarms => console.log(alarms) - ) + ); } diff --git a/Frontend/src/app/components/profile/profile.component.css b/Frontend/src/app/components/profile/profile.component.css index 42605dc..f82c74e 100644 --- a/Frontend/src/app/components/profile/profile.component.css +++ b/Frontend/src/app/components/profile/profile.component.css @@ -19,3 +19,8 @@ table, th, td { cursor: pointer; color: #0d5a4b; } + +.edit { + width: 5%; + height: 5%; +} diff --git a/Frontend/src/app/components/profile/profile.component.html b/Frontend/src/app/components/profile/profile.component.html index 669e11f..24dfdc4 100644 --- a/Frontend/src/app/components/profile/profile.component.html +++ b/Frontend/src/app/components/profile/profile.component.html @@ -89,7 +89,7 @@ {{alarm.defined_price/100}}€ - + diff --git a/Frontend/src/app/components/profile/profile.component.ts b/Frontend/src/app/components/profile/profile.component.ts index 4e9402a..69ab24c 100644 --- a/Frontend/src/app/components/profile/profile.component.ts +++ b/Frontend/src/app/components/profile/profile.component.ts @@ -1,25 +1,26 @@ -import { Component, OnInit } from '@angular/core'; -import {ApiService} from "../../services/api.service"; +import {Component, OnInit} from '@angular/core'; +import {ApiService} from '../../services/api.service'; @Component({ - selector: 'app-profile', - templateUrl: './profile.component.html', - styleUrls: ['./profile.component.css'] + selector: 'app-profile', + templateUrl: './profile.component.html', + styleUrls: ['./profile.component.css'] }) export class ProfileComponent implements OnInit { currentUser: any; - obj:any; + obj: any; alarms: any []; productsMap: any = {}; - constructor(private api: ApiService ) { } + constructor(private api: ApiService) { + } ngOnInit(): void { this.api.getUserInfo().subscribe( - user=> { - this.currentUser = user + user => { + this.currentUser = user; console.log(this.currentUser); }, ); @@ -30,29 +31,33 @@ export class ProfileComponent implements OnInit { getPriceAlarms(): void { this.api.getPriceAlarms().subscribe( alarms => { - this.alarms = alarms - this.getProductsByIds() + this.alarms = alarms; + this.getProductsByIds(); } - ) + ); } getProductsByIds(): void { - let productIds: number [] = []; + const productIds: number [] = []; this.alarms.forEach( - alarm => {productIds.push(alarm.product_id)} + alarm => { + productIds.push(alarm.product_id); + } ); this.api.getProductsByIds(productIds).subscribe( products => { products.forEach( - product => {this.productsMap[product.product_id] = product} - ) + product => { + this.productsMap[product.product_id] = product; + } + ); } - ) + ); } - delete(id:number): void { + delete(id: number): void { this.api.deletePriceAlarm(id).subscribe( res => window.location.reload() - ) + ); } } diff --git a/Frontend/src/app/components/slider-for-products/slider-for-products.component.ts b/Frontend/src/app/components/slider-for-products/slider-for-products.component.ts index 373a624..83458cb 100644 --- a/Frontend/src/app/components/slider-for-products/slider-for-products.component.ts +++ b/Frontend/src/app/components/slider-for-products/slider-for-products.component.ts @@ -1,15 +1,16 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, OnInit} from '@angular/core'; @Component({ - selector: 'app-slider-for-products', - templateUrl: './slider-for-products.component.html', - styleUrls: ['./slider-for-products.component.css'] + selector: 'app-slider-for-products', + templateUrl: './slider-for-products.component.html', + styleUrls: ['./slider-for-products.component.css'] }) export class SliderForProductsComponent implements OnInit { - constructor() { } + constructor() { + } - ngOnInit(): void { - } + ngOnInit(): void { + } } diff --git a/Frontend/src/app/components/top-bar/top-bar.component.ts b/Frontend/src/app/components/top-bar/top-bar.component.ts index 0e0c037..9eb76a3 100644 --- a/Frontend/src/app/components/top-bar/top-bar.component.ts +++ b/Frontend/src/app/components/top-bar/top-bar.component.ts @@ -1,6 +1,6 @@ import {Component, Input, OnInit} from '@angular/core'; -import {ApiService} from "../../services/api.service"; -import {Router} from "@angular/router"; +import {ApiService} from '../../services/api.service'; +import {NavigationEnd, Router} from '@angular/router'; @Component({ @@ -20,13 +20,12 @@ export class TopBarComponent implements OnInit { ) { } - ngOnInit() { - + ngOnInit(): void { this.api.getUserInfo().subscribe(data => { - console.log(data) + console.log(data); }); - if (this.api.getSessionInfoFromLocalStorage().session_id != "") { + if (this.api.getSessionInfoFromLocalStorage().session_id !== '') { this.isLoggedIn = true; } } @@ -34,7 +33,11 @@ export class TopBarComponent implements OnInit { logout(): void { localStorage.setItem('session_id', ''); localStorage.setItem('session_key', ''); - this.router.navigate(['/']); + if (this.router.url === '/profile') { + this.router.navigate(['/']); + } else { + window.location.reload(); + } } getSearchedProducts(): void { diff --git a/Frontend/src/assets/images/pencil.png b/Frontend/src/assets/images/pencil.png new file mode 100644 index 0000000000000000000000000000000000000000..cb8cbdfe53596da301889d6d4c7a44b5d3f41112 GIT binary patch literal 1422 zcmX|A2~bm46it3YR>GQu2!RkFAzKmXkK1kMx#-oP&hj~dwYAcSS*4d=ybZ7nHd5c zU0htu&CU6IK0pqK16fN;OWbN|YQlBI3&tlZhiPf<~oM0m4Rnd^`{+SX*0T zkByBrrL3&1pwHv+1Ofrn+}+)MeSH@#TBOx#VHLGNb9HrfaB#qNnM?*{;P4DSQXmM0 z!tCs9REIZ-M1qdMw70iM6_kdV>FH@?0iqTxNu^R427(w(VGb4+79k-aK+ryDkOhK^ zSWv(bQc9%~wZvjE9NO5}AjX`5o3dbHZn%XMa5$06<)%(y737+l8nlU2Qc{w?zdvXw z2XQDkIy#~$Si%AUqku8s2u#y9nE`*ngrQuMTS5q33))jYGWts3d~hW6Kvh=Snm z-~p^N&py1Go9m5T{;Q*NG7mS4-rV(ToxOMW&#bRVY>py*>_C5mus@+n=JvUmH-GA& zHtEnrMpcGaV(Es05y6u61sV4PdiALyHkYB0q}1HG^yGQ%0CS{Uyjb(SL;K`KM}y~= zJwL7;9XYr^P#==tQD)G`eNuFNmA?C%@if2t%F6r+>5lM1H91Wk!HcU_YxkBM7d*&<6%pV~dG*cLUKbhT^iCASrSZ+*E@^C)(vL^#Mc^v=XcJ0p3kV@?_R$J;g= z*3kCmpE%NWwXH>C`64XQ(S