From ac56be7b799ef6faf13e7c9fdf706b4496cab1bb Mon Sep 17 00:00:00 2001 From: Isahann Hanacleto Date: Mon, 26 Aug 2024 17:58:39 -0300 Subject: [PATCH] #66 feedback window --- .../about-window/about-window.component.html | 45 ++++++++++- .../about-window/about-window.component.sass | 76 +++++++++++++++--- .../about-window/about-window.component.ts | 34 +++++++- src/app/app.module.ts | 4 +- src/assets/icons/20x20/contact.png | Bin 0 -> 6949 bytes src/assets/icons/20x20/send.png | Bin 0 -> 6813 bytes 6 files changed, 143 insertions(+), 16 deletions(-) create mode 100644 src/assets/icons/20x20/contact.png create mode 100644 src/assets/icons/20x20/send.png diff --git a/src/app/about-window/about-window.component.html b/src/app/about-window/about-window.component.html index 793e125..921446f 100644 --- a/src/app/about-window/about-window.component.html +++ b/src/app/about-window/about-window.component.html @@ -6,7 +6,8 @@ + href="https://opentdb.com/">Open Trivia Database and QuizAPI @@ -14,7 +15,45 @@ href="https://www.deviantart.com/marchmountain/art/Windows-XP-High-Resolution-Icon-Pack-916042853">marchmountain at DeviantArt - +
+ + +
+ +
+ +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ + +
+ +
+ + +
+
+
+
+ diff --git a/src/app/about-window/about-window.component.sass b/src/app/about-window/about-window.component.sass index 7ebffdb..4546310 100644 --- a/src/app/about-window/about-window.component.sass +++ b/src/app/about-window/about-window.component.sass @@ -1,15 +1,69 @@ -.window-body - display: flex - flex-direction: column - align-items: center - justify-content: center +.window + margin: 10px - label - margin: 3px + &-body + display: flex + flex-direction: column + align-items: center + justify-content: center - &.main - margin-bottom: 10px + label + margin: 3px + + &.main + margin-bottom: 10px + font-style: italic + + &_buttons + display: flex + flex-direction: row + align-items: center + justify-content: center + margin: 5px + + app-icon-button + margin: 5px + + label.window-body_feedback-title font-style: italic + margin-bottom: 10px + + &_feedback-inputs + display: flex + flex-direction: column + align-items: center + justify-content: center + margin: 10px + width: 300px + + .field-row + width: 100% + + textarea + border: 1px solid #7f9db9 + + label + width: 25% + display: block + text-align: end + align-self: flex-start + + input, textarea + width: 75% + + &_feedback-inputs-error + color: red + display: flex + flex-direction: column + align-items: center + justify-content: center + + &_feedback-buttons + display: flex + flex-direction: row + align-items: center + justify-content: center + margin: 5px - app-icon-button - margin-top: 15px + app-icon-button + margin: 5px diff --git a/src/app/about-window/about-window.component.ts b/src/app/about-window/about-window.component.ts index 6d30565..f8c112b 100644 --- a/src/app/about-window/about-window.component.ts +++ b/src/app/about-window/about-window.component.ts @@ -1,6 +1,7 @@ import {Component} from '@angular/core'; import {Router} from "@angular/router"; import {PathsEnum} from "../../model/enums/PathsEnum"; +import {AbstractControl, FormBuilder, FormGroup, Validators} from "@angular/forms"; @Component({ selector: 'app-about-window', @@ -11,9 +12,40 @@ export class AboutWindowComponent { protected readonly PathsEnum = PathsEnum; + public showFeedbackWindow: boolean = false; + public feedbackForm: FormGroup = this.formBuilder.group({ + name: ['', Validators.required], + message: [undefined, Validators.required] + }); + constructor( - public readonly router: Router + public readonly router: Router, + public readonly formBuilder: FormBuilder ) { } + protected toggleFeedbackWindow(): void { + this.feedbackForm.reset(); + this.showFeedbackWindow = !this.showFeedbackWindow; + } + + public async onSubmit(): Promise { + const subject: string = `XPQuiz - Suggestions from ${this.feedbackForm.controls['name'].value}`; + const body: string = encodeURI(this.feedbackForm.controls['message'].value) + + window.location.href = `mailto:xpquiz.github.io@gmail.com?subject=${subject}&body=${body}`; + } + + public shouldDisableSendButton(): boolean { + return !this.feedbackForm.valid; + } + + public shouldShowErrorMessage(formControlName: string): boolean { + const formControl: AbstractControl = this.feedbackForm.controls[formControlName]; + + if (!this.feedbackForm.touched && !formControl.touched) + return false; + + return !formControl.valid; + } } diff --git a/src/app/app.module.ts b/src/app/app.module.ts index b46d839..11a3c98 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -17,6 +17,7 @@ import {CopyClipboardDirective} from "./directives/CopyClipboardDirective"; import { GameModeWindowComponent } from './game-mode-window/game-mode-window.component'; import { IconTextButtonComponent } from './common/icon-text-button/icon-text-button.component'; import { QuestionTrifectaWindowComponent } from './question-trifecta-window/question-trifecta-window.component'; +import {ReactiveFormsModule} from "@angular/forms"; @NgModule({ declarations: [ @@ -38,7 +39,8 @@ import { QuestionTrifectaWindowComponent } from './question-trifecta-window/ques BrowserModule, AppRoutingModule, HttpClientModule, - NgOptimizedImage + NgOptimizedImage, + ReactiveFormsModule ], providers: [], bootstrap: [AppComponent] diff --git a/src/assets/icons/20x20/contact.png b/src/assets/icons/20x20/contact.png new file mode 100644 index 0000000000000000000000000000000000000000..210166a8bb36b9d97aaba41c7580566859bb2a49 GIT binary patch literal 6949 zcmeHLd0Z3M77n!)ML}(;ZACCIZh%aZnXEICA`p~R0ud2W+NYDr1R_Z$CPRqeQkS-% zEux?xR*MyjqNP+zT_}oGDsI(^uV|@YK`ZX4RjeDmld!67_1EY7y*~_0lDX&H?=1J6 z@7_t8DtwHq%K#S^i{+{al}Cb4cjoHR9lU>(=IIJP_9aKf(2;l&+hnG+Iz7pzXP8Jf zY13(0EZa{8RgLQ&evf<2?w-55Un-Y|XNI22YiJ%AnkAR*-`CK0>ajcb_2)&SLY5v^ ztSnjX1j83h!jX5rAA0b6uh96jt0M|Vg~EO*>!AyaXQCe4&Np3Hw`6B<&eeGptYc%= zzP^_jJa3D9@S@RS+<_j}mT2Q=RX2Ox$i1qXqdR(Qn8$Xk^wx*uw>OtBM8m!^|I%A) z+{s!zJZ%Jyv{i~A``P+Z%mHX8YA8z`*gx$Lr zR}{`)w5766TSq5r;W+02<`i>~=ywaiHmESZXw4}W=h%&Fp3Not(M)myYKJTJN2n(^ML}<@Ha@nL&!YmWrEqtfHOaLZ zOrZ8yEdKzT2`3Urnyn_|bVeEHYUwTxTc?q6CW@4Nr74(<*M%mV$??hIQABbAfoeDb zZ@T!~FaTg6X`F2{=#3W4Cga#~G4P!k=5g3|6*@u2iBYQ9!IYU~3%Nor9}2PQtO(~# z7q-7yqs1cSqgx@sos1Jt(^_QJ_3LF+SQqq$LS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