Changeset 806f4ee
- Timestamp:
- 10/28/21 18:07:52 (3 years ago)
- Branches:
- dev
- Children:
- 1e0d869, 728eb31, ad0fcd3
- Parents:
- 2025810 (diff), 77cfe5b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/Clients/Angular/finki-chattery/src/app
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Clients/Angular/finki-chattery/src/app/core/state/question-facade.service.ts
r2025810 r806f4ee 2 2 import { Injectable } from '@angular/core'; 3 3 import { Action, Store } from '@ngrx/store'; 4 import { Observable, throwError } from 'rxjs';4 import { Observable, Subject, throwError } from 'rxjs'; 5 5 import { catchError, filter, map } from 'rxjs/operators'; 6 6 … … 25 25 }) 26 26 export class QuestionFacadeService { 27 private questionSearchedSubject = new Subject<any>(); 28 27 29 effectWorking$: Observable<boolean | HttpErrorResponse>; 28 30 … … 41 43 }) 42 44 ); 45 } 46 47 public questionSearched(): Observable<void> { 48 return this.questionSearchedSubject.asObservable(); 43 49 } 44 50 … … 81 87 public searchQuestions(searchText: string, categories: string[]): void { 82 88 this.dispatchEffect(new GetSearchQuestions(searchText, categories)); 89 this.questionSearchedSubject.next(Math.random()); 83 90 } 84 91 -
src/Clients/Angular/finki-chattery/src/app/modules/questioning/components/questions-preview-general/questions-preview-general.component.html
r2025810 r806f4ee 1 <app-search-question (searched)="routeToSearch()"></app-search-question>2 1 <div class="margin-x-lg"> 3 2 <h1 class="mat-headline">{{ 'questions-preview' | translate }}</h1> -
src/Clients/Angular/finki-chattery/src/app/modules/questioning/components/questions-preview-general/questions-preview-general.component.ts
r2025810 r806f4ee 2 2 import { FormControl } from '@angular/forms'; 3 3 import { Router } from '@angular/router'; 4 import { CategoryFacadeService } from 'src/app/core/state/category-facade.service';5 4 import { QuestionFacadeService } from 'src/app/core/state/question-facade.service'; 6 5 import { CategoryStateViewModel, PreviewQuestionsOrderEnum } from 'src/app/shared-app/models'; … … 30 29 } 31 30 }); 31 32 this.questionFacade.questionSearched().subscribe(() => { 33 this.router.navigateByUrl('questioning/search'); 34 }); 32 35 } 33 36 … … 35 38 this.router.navigateByUrl(`questioning/${uid}`); 36 39 } 37 38 routeToSearch(): void {39 this.router.navigateByUrl(`questioning/search`);40 }41 40 } -
src/Clients/Angular/finki-chattery/src/app/modules/questioning/components/questions-search/questions-search.component.html
r2025810 r806f4ee 1 <app-search-question></app-search-question>2 1 <div class="margin-x-lg"> 3 2 <h1 class="mat-headline">{{ 'questions-search-title' | translate: { searchQuery: (searchQuestionsQuery$ | async)?.text } }}</h1> -
src/Clients/Angular/finki-chattery/src/app/shared-app/components/generic/header/header.component.html
r2025810 r806f4ee 1 1 <mat-toolbar> 2 <span>FinkiChattery</span> 3 <span class="right"></span> 4 <app-button class="margin-y-xs" *ngIf="auth.isStudent()" (action)="askQuestion()" [buttonType]="ButtonType.CallToAction">{{ 5 'header-ask-question' | translate 6 }}</app-button> 7 <app-button class="margin-y-xs" *ngIf="auth.isLoggedIn()" (action)="logout()" [buttonType]="ButtonType.Basic">{{ 8 'header-logout' | translate 9 }}</app-button> 2 <mat-toolbar-row> 3 <span class="cursor" (click)="navigateFromLogo()">FinkiChattery</span> 4 <span class="right"></span> 5 6 <app-button class="margin-y-xs" *ngIf="auth.isStudent()" (action)="askQuestion()" [buttonType]="ButtonType.CallToAction">{{ 7 'header-ask-question' | translate 8 }}</app-button> 9 <app-button class="margin-y-xs" *ngIf="auth.isLoggedIn()" (action)="logout()" [buttonType]="ButtonType.Basic">{{ 10 'header-logout' | translate 11 }}</app-button> 12 </mat-toolbar-row> 13 <mat-toolbar-row *ngIf="auth.isStudent()"> 14 <app-search-question class="search-questions"></app-search-question> 15 </mat-toolbar-row> 10 16 </mat-toolbar> -
src/Clients/Angular/finki-chattery/src/app/shared-app/components/generic/header/header.component.scss
r2025810 r806f4ee 2 2 flex: 1 1 auto; 3 3 } 4 5 .search-questions { 6 width: 60%; 7 margin: auto; 8 } 9 10 @media only screen and (max-width: 600px) { 11 .search-questions { 12 width: 100%; 13 margin: 0; 14 } 15 } -
src/Clients/Angular/finki-chattery/src/app/shared-app/components/generic/header/header.component.ts
r2025810 r806f4ee 23 23 this.router.navigateByUrl('questioning/ask'); 24 24 } 25 26 navigateFromLogo(): void { 27 if (this.auth.isStudent()) { 28 this.router.navigateByUrl('questioning/preview'); 29 } 30 } 25 31 } -
src/Clients/Angular/finki-chattery/src/app/shared-app/components/question/search-question/search-question.component.html
r2025810 r806f4ee 1 <mat- card>2 <mat- card-content>3 <mat-form-field class="full-width" appearance=" fill" appHandleInputFormErrors>1 <mat-expansion-panel [(expanded)]="isExpanded"> 2 <mat-expansion-panel-header> 3 <mat-form-field class="full-width" appearance="standard"> 4 4 <input 5 5 [placeholder]="'questions-preview-find-question' | translate" … … 7 7 autocomplete="off" 8 8 [formControl]="questionSearchFormContor" 9 (keydown )="searchQuestionsKeyboard($event)"9 (keydown.Space)="$event.stopPropagation()" 10 10 /> 11 <mat-icon matSuffix>search</mat-icon>12 11 </mat-form-field> 13 <mat-form-field class="full-width" appearance="fill"> 14 <mat-select 15 [formControl]="questionCategoriesFormContor" 16 multiple 17 [placeholder]="'questions-preview-find-question-categories' | translate" 18 > 19 <mat-option *ngFor="let category of categories$ | async" [value]="category.uid">{{ category.translatedName }}</mat-option> 20 </mat-select> 21 </mat-form-field> 22 </mat-card-content> 23 <mat-card-actions> 24 <app-button [buttonType]="ButtonType.CallToAction" [disabled]="questionSearchFormContor.invalid" (action)="searchQuestions()">{{ 25 'questions-search' | translate 26 }}</app-button> 27 </mat-card-actions> 28 </mat-card> 12 </mat-expansion-panel-header> 13 <mat-form-field appearance="standard" class="margin-right-md"> 14 <mat-select 15 [formControl]="questionCategoriesFormContor" 16 multiple 17 [placeholder]="'questions-preview-find-question-categories' | translate" 18 > 19 <mat-option *ngFor="let category of categories$ | async" [value]="category.uid">{{ category.translatedName }}</mat-option> 20 </mat-select> 21 </mat-form-field> 22 <app-button [buttonType]="ButtonType.CallToAction" [disabled]="questionSearchFormContor.invalid" (action)="searchQuestions()">{{ 23 'questions-search' | translate 24 }}</app-button> 25 </mat-expansion-panel> -
src/Clients/Angular/finki-chattery/src/app/shared-app/components/question/search-question/search-question.component.scss
r2025810 r806f4ee 1 mat-form-field { 2 font-size: initial !important; 3 } 4 5 mat-expansion-panel { 6 z-index: 1; 7 } -
src/Clients/Angular/finki-chattery/src/app/shared-app/components/question/search-question/search-question.component.ts
r2025810 r806f4ee 1 import { Component, EventEmitter, OnInit, Output } from '@angular/core';1 import { Component, OnInit } from '@angular/core'; 2 2 import { FormControl, Validators } from '@angular/forms'; 3 3 … … 12 12 }) 13 13 export class SearchQuestionComponent implements OnInit { 14 @Output() searched = new EventEmitter();15 16 14 ButtonType = ButtonType; 17 15 questionSearchFormContor = new FormControl('', [Validators.required, Validators.maxLength(250)]); 18 16 questionCategoriesFormContor = new FormControl(); 19 17 categories$ = this.categoriesFacade.getCategories(); 18 isExpanded = false; 20 19 21 20 constructor(private categoriesFacade: CategoryFacadeService, private questionsFacade: QuestionFacadeService) {} … … 23 22 ngOnInit(): void {} 24 23 25 public searchQuestionsKeyboard(event: KeyboardEvent): void {26 if (event.code === 'enter') {27 this.searchQuestions();28 }29 }30 31 24 public searchQuestions(): void { 25 this.isExpanded = false; 32 26 this.questionsFacade.searchQuestions(this.questionSearchFormContor.value, this.questionCategoriesFormContor.value); 33 this.searched.emit(); 27 this.questionSearchFormContor.reset(); 28 this.questionCategoriesFormContor.reset(); 34 29 } 35 30 } -
src/Clients/Angular/finki-chattery/src/app/shared-material/shared-material.module.ts
r2025810 r806f4ee 25 25 import { MatBadgeModule } from '@angular/material/badge'; 26 26 import { MatStepperModule } from '@angular/material/stepper'; 27 import { MatExpansionModule } from '@angular/material/expansion'; 27 28 28 29 @NgModule({ … … 51 52 MatButtonToggleModule, 52 53 MatBadgeModule, 53 MatStepperModule 54 MatStepperModule, 55 MatExpansionModule 54 56 ], 55 57 exports: [ … … 76 78 MatButtonToggleModule, 77 79 MatBadgeModule, 78 MatStepperModule 80 MatStepperModule, 81 MatExpansionModule 79 82 ] 80 83 })
Note:
See TracChangeset
for help on using the changeset viewer.