Changes in / [806f4ee:2025810]
- 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
r806f4ee r2025810 2 2 import { Injectable } from '@angular/core'; 3 3 import { Action, Store } from '@ngrx/store'; 4 import { Observable, Subject,throwError } from 'rxjs';4 import { Observable, 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 29 27 effectWorking$: Observable<boolean | HttpErrorResponse>; 30 28 … … 43 41 }) 44 42 ); 45 }46 47 public questionSearched(): Observable<void> {48 return this.questionSearchedSubject.asObservable();49 43 } 50 44 … … 87 81 public searchQuestions(searchText: string, categories: string[]): void { 88 82 this.dispatchEffect(new GetSearchQuestions(searchText, categories)); 89 this.questionSearchedSubject.next(Math.random());90 83 } 91 84 -
src/Clients/Angular/finki-chattery/src/app/modules/questioning/components/questions-preview-general/questions-preview-general.component.html
r806f4ee r2025810 1 <app-search-question (searched)="routeToSearch()"></app-search-question> 1 2 <div class="margin-x-lg"> 2 3 <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
r806f4ee r2025810 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'; 4 5 import { QuestionFacadeService } from 'src/app/core/state/question-facade.service'; 5 6 import { CategoryStateViewModel, PreviewQuestionsOrderEnum } from 'src/app/shared-app/models'; … … 29 30 } 30 31 }); 31 32 this.questionFacade.questionSearched().subscribe(() => {33 this.router.navigateByUrl('questioning/search');34 });35 32 } 36 33 … … 38 35 this.router.navigateByUrl(`questioning/${uid}`); 39 36 } 37 38 routeToSearch(): void { 39 this.router.navigateByUrl(`questioning/search`); 40 } 40 41 } -
src/Clients/Angular/finki-chattery/src/app/modules/questioning/components/questions-search/questions-search.component.html
r806f4ee r2025810 1 <app-search-question></app-search-question> 1 2 <div class="margin-x-lg"> 2 3 <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
r806f4ee r2025810 1 1 <mat-toolbar> 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> 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> 16 10 </mat-toolbar> -
src/Clients/Angular/finki-chattery/src/app/shared-app/components/generic/header/header.component.scss
r806f4ee r2025810 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
r806f4ee r2025810 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 }31 25 } -
src/Clients/Angular/finki-chattery/src/app/shared-app/components/question/search-question/search-question.component.html
r806f4ee r2025810 1 <mat- expansion-panel [(expanded)]="isExpanded">2 <mat- expansion-panel-header>3 <mat-form-field class="full-width" appearance=" standard">1 <mat-card> 2 <mat-card-content> 3 <mat-form-field class="full-width" appearance="fill" appHandleInputFormErrors> 4 4 <input 5 5 [placeholder]="'questions-preview-find-question' | translate" … … 7 7 autocomplete="off" 8 8 [formControl]="questionSearchFormContor" 9 (keydown .Space)="$event.stopPropagation()"9 (keydown)="searchQuestionsKeyboard($event)" 10 10 /> 11 <mat-icon matSuffix>search</mat-icon> 11 12 </mat-form-field> 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> 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> -
src/Clients/Angular/finki-chattery/src/app/shared-app/components/question/search-question/search-question.component.scss
r806f4ee r2025810 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
r806f4ee r2025810 1 import { Component, OnInit } from '@angular/core';1 import { Component, EventEmitter, OnInit, Output } 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 14 16 ButtonType = ButtonType; 15 17 questionSearchFormContor = new FormControl('', [Validators.required, Validators.maxLength(250)]); 16 18 questionCategoriesFormContor = new FormControl(); 17 19 categories$ = this.categoriesFacade.getCategories(); 18 isExpanded = false;19 20 20 21 constructor(private categoriesFacade: CategoryFacadeService, private questionsFacade: QuestionFacadeService) {} … … 22 23 ngOnInit(): void {} 23 24 25 public searchQuestionsKeyboard(event: KeyboardEvent): void { 26 if (event.code === 'enter') { 27 this.searchQuestions(); 28 } 29 } 30 24 31 public searchQuestions(): void { 25 this.isExpanded = false;26 32 this.questionsFacade.searchQuestions(this.questionSearchFormContor.value, this.questionCategoriesFormContor.value); 27 this.questionSearchFormContor.reset(); 28 this.questionCategoriesFormContor.reset(); 33 this.searched.emit(); 29 34 } 30 35 } -
src/Clients/Angular/finki-chattery/src/app/shared-material/shared-material.module.ts
r806f4ee r2025810 25 25 import { MatBadgeModule } from '@angular/material/badge'; 26 26 import { MatStepperModule } from '@angular/material/stepper'; 27 import { MatExpansionModule } from '@angular/material/expansion';28 27 29 28 @NgModule({ … … 52 51 MatButtonToggleModule, 53 52 MatBadgeModule, 54 MatStepperModule, 55 MatExpansionModule 53 MatStepperModule 56 54 ], 57 55 exports: [ … … 78 76 MatButtonToggleModule, 79 77 MatBadgeModule, 80 MatStepperModule, 81 MatExpansionModule 78 MatStepperModule 82 79 ] 83 80 })
Note:
See TracChangeset
for help on using the changeset viewer.