From 2e3fa8f1d9f8d0e25ba94f2795c832c2bef7e131 Mon Sep 17 00:00:00 2001 From: Marcin Czachurski Date: Fri, 17 Nov 2023 18:23:32 +0100 Subject: [PATCH] Add new pages --- src/app/components/angular-material.module.ts | 13 ++- .../core/header/header.component.html | 81 +++++++++++++++-- .../core/header/header.component.scss | 6 ++ src/app/pages/categories/categories.page.html | 5 ++ src/app/pages/categories/categories.page.scss | 0 src/app/pages/categories/categories.page.ts | 13 +++ src/app/pages/editors/editors.page.html | 5 ++ src/app/pages/editors/editors.page.scss | 0 src/app/pages/editors/editors.page.ts | 13 +++ src/app/pages/pages-routing.module.ts | 8 ++ src/app/pages/pages.module.ts | 16 +++- .../pages/preferences/preferences.page.html | 89 +++++++++++++++++++ .../pages/preferences/preferences.page.scss | 29 ++++++ src/app/pages/preferences/preferences.page.ts | 55 ++++++++++++ src/app/pages/trending/trending.page.html | 5 ++ src/app/pages/trending/trending.page.scss | 0 src/app/pages/trending/trending.page.ts | 13 +++ 17 files changed, 339 insertions(+), 12 deletions(-) create mode 100644 src/app/pages/categories/categories.page.html create mode 100644 src/app/pages/categories/categories.page.scss create mode 100644 src/app/pages/categories/categories.page.ts create mode 100644 src/app/pages/editors/editors.page.html create mode 100644 src/app/pages/editors/editors.page.scss create mode 100644 src/app/pages/editors/editors.page.ts create mode 100644 src/app/pages/preferences/preferences.page.html create mode 100644 src/app/pages/preferences/preferences.page.scss create mode 100644 src/app/pages/preferences/preferences.page.ts create mode 100644 src/app/pages/trending/trending.page.html create mode 100644 src/app/pages/trending/trending.page.scss create mode 100644 src/app/pages/trending/trending.page.ts diff --git a/src/app/components/angular-material.module.ts b/src/app/components/angular-material.module.ts index 7c6039e..247937a 100644 --- a/src/app/components/angular-material.module.ts +++ b/src/app/components/angular-material.module.ts @@ -25,6 +25,9 @@ import { MatDatepickerModule } from '@angular/material/datepicker'; import { MatNativeDateModule } from '@angular/material/core'; import { MatCheckboxModule } from '@angular/material/checkbox'; import { MatButtonToggleModule } from '@angular/material/button-toggle'; +import { MatBadgeModule } from '@angular/material/badge'; +import { MatSlideToggleModule } from '@angular/material/slide-toggle'; +import { MatRadioModule } from '@angular/material/radio'; @NgModule({ imports: [ @@ -53,7 +56,10 @@ import { MatButtonToggleModule } from '@angular/material/button-toggle'; MatNativeDateModule, MatCheckboxModule, MatStepperModule, - MatButtonToggleModule + MatButtonToggleModule, + MatBadgeModule, + MatSlideToggleModule, + MatRadioModule ], exports: [ MatToolbarModule, @@ -81,7 +87,10 @@ import { MatButtonToggleModule } from '@angular/material/button-toggle'; MatNativeDateModule, MatCheckboxModule, MatStepperModule, - MatButtonToggleModule + MatButtonToggleModule, + MatBadgeModule, + MatSlideToggleModule, + MatRadioModule ] }) export class AngularMaterialModule { } diff --git a/src/app/components/core/header/header.component.html b/src/app/components/core/header/header.component.html index 38a7a69..0152d99 100644 --- a/src/app/components/core/header/header.component.html +++ b/src/app/components/core/header/header.component.html @@ -7,22 +7,83 @@ + + + + + + + + + + + + + + +
- + + + + - + + + + + + + + - + + + + + + +
@@ -52,6 +113,10 @@ account_circle Account + +
+ + + + + + + + diff --git a/src/app/pages/preferences/preferences.page.scss b/src/app/pages/preferences/preferences.page.scss new file mode 100644 index 0000000..4f84041 --- /dev/null +++ b/src/app/pages/preferences/preferences.page.scss @@ -0,0 +1,29 @@ +.preferences-container { + max-width: 640px; + + mat-form-field { + width: 100%; + } + + ::ng-deep .mat-mdc-form-field-subscript-wrapper { + height: 0; + } + + .actions { + margin-left: 8px; + margin-right: 8px; + margin-bottom: 10px; + } + + .rounded { + width: 32px; + height: 32px; + border-radius: 15%; + } + + .circle { + width: 32px; + height: 32px; + border-radius: 50%; + } +} diff --git a/src/app/pages/preferences/preferences.page.ts b/src/app/pages/preferences/preferences.page.ts new file mode 100644 index 0000000..35b85e4 --- /dev/null +++ b/src/app/pages/preferences/preferences.page.ts @@ -0,0 +1,55 @@ +import { Component } from '@angular/core'; +import { fadeInAnimation } from "../../animations/fade-in.animation"; +import { MessagesService } from 'src/app/services/common/messages.service'; +import { EventType } from 'src/app/models/event-type'; +import { LoadingService } from 'src/app/services/common/loading.service'; +import { Responsive } from 'src/app/common/responsive'; +import { BreakpointObserver } from '@angular/cdk/layout'; + +@Component({ + selector: 'app-preferences', + templateUrl: './preferences.page.html', + styleUrls: ['./preferences.page.scss'], + animations: fadeInAnimation +}) +export class PreferencesPage extends Responsive { + isReady = false; + preferences: string[] = []; + eventTypes = Object.values(EventType); + + theme = '1'; + avatar = '1'; + alwaysShowNSFW = false; + showAlternativeText = false; + showAvatars = false; + showFavourites = false; + showAltIcon = false; + + constructor( + private messageService: MessagesService, + private loadingService: LoadingService, + breakpointObserver: BreakpointObserver) { + super(breakpointObserver); + } + + override async ngOnInit(): Promise { + super.ngOnInit(); + + this.loadingService.showLoader(); + // this.settings = await this.settingsService.get(); + this.isReady = true; + this.loadingService.hideLoader(); + } + + async onSubmit(): Promise { + try { + if (this.preferences) { + // await this.settingsService.put(this.settings); + this.messageService.showSuccess('Settings was saved.'); + } + } catch (error) { + console.error(error); + this.messageService.showServerError(error); + } + } +} diff --git a/src/app/pages/trending/trending.page.html b/src/app/pages/trending/trending.page.html new file mode 100644 index 0000000..2cfa4dc --- /dev/null +++ b/src/app/pages/trending/trending.page.html @@ -0,0 +1,5 @@ +
+
+

Trending

+
+
\ No newline at end of file diff --git a/src/app/pages/trending/trending.page.scss b/src/app/pages/trending/trending.page.scss new file mode 100644 index 0000000..e69de29 diff --git a/src/app/pages/trending/trending.page.ts b/src/app/pages/trending/trending.page.ts new file mode 100644 index 0000000..5b37899 --- /dev/null +++ b/src/app/pages/trending/trending.page.ts @@ -0,0 +1,13 @@ +import { Component } from "@angular/core"; +import { fadeInAnimation } from "src/app/animations/fade-in.animation"; +import { Responsive } from "src/app/common/responsive"; + +@Component({ + selector: 'app-trending', + templateUrl: './trending.page.html', + styleUrls: ['./trending.page.scss'], + animations: fadeInAnimation +}) +export class TrendingPage extends Responsive { + isReady = true; +}