Changes in / [806f4ee:2025810]


Ignore:
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  
    22import { Injectable } from '@angular/core';
    33import { Action, Store } from '@ngrx/store';
    4 import { Observable, Subject, throwError } from 'rxjs';
     4import { Observable, throwError } from 'rxjs';
    55import { catchError, filter, map } from 'rxjs/operators';
    66
     
    2525})
    2626export class QuestionFacadeService {
    27   private questionSearchedSubject = new Subject<any>();
    28 
    2927  effectWorking$: Observable<boolean | HttpErrorResponse>;
    3028
     
    4341      })
    4442    );
    45   }
    46 
    47   public questionSearched(): Observable<void> {
    48     return this.questionSearchedSubject.asObservable();
    4943  }
    5044
     
    8781  public searchQuestions(searchText: string, categories: string[]): void {
    8882    this.dispatchEffect(new GetSearchQuestions(searchText, categories));
    89     this.questionSearchedSubject.next(Math.random());
    9083  }
    9184
  • 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>
    12<div class="margin-x-lg">
    23  <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  
    22import { FormControl } from '@angular/forms';
    33import { Router } from '@angular/router';
     4import { CategoryFacadeService } from 'src/app/core/state/category-facade.service';
    45import { QuestionFacadeService } from 'src/app/core/state/question-facade.service';
    56import { CategoryStateViewModel, PreviewQuestionsOrderEnum } from 'src/app/shared-app/models';
     
    2930      }
    3031    });
    31 
    32     this.questionFacade.questionSearched().subscribe(() => {
    33       this.router.navigateByUrl('questioning/search');
    34     });
    3532  }
    3633
     
    3835    this.router.navigateByUrl(`questioning/${uid}`);
    3936  }
     37
     38  routeToSearch(): void {
     39    this.router.navigateByUrl(`questioning/search`);
     40  }
    4041}
  • 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>
    12<div class="margin-x-lg">
    23  <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  
    11<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>
    1610</mat-toolbar>
  • src/Clients/Angular/finki-chattery/src/app/shared-app/components/generic/header/header.component.scss

    r806f4ee r2025810  
    22  flex: 1 1 auto;
    33}
    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  
    2323    this.router.navigateByUrl('questioning/ask');
    2424  }
    25 
    26   navigateFromLogo(): void {
    27     if (this.auth.isStudent()) {
    28       this.router.navigateByUrl('questioning/preview');
    29     }
    30   }
    3125}
  • 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>
    44      <input
    55        [placeholder]="'questions-preview-find-question' | translate"
     
    77        autocomplete="off"
    88        [formControl]="questionSearchFormContor"
    9         (keydown.Space)="$event.stopPropagation()"
     9        (keydown)="searchQuestionsKeyboard($event)"
    1010      />
     11      <mat-icon matSuffix>search</mat-icon>
    1112    </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';
     1import { Component, EventEmitter, OnInit, Output } from '@angular/core';
    22import { FormControl, Validators } from '@angular/forms';
    33
     
    1212})
    1313export class SearchQuestionComponent implements OnInit {
     14  @Output() searched = new EventEmitter();
     15
    1416  ButtonType = ButtonType;
    1517  questionSearchFormContor = new FormControl('', [Validators.required, Validators.maxLength(250)]);
    1618  questionCategoriesFormContor = new FormControl();
    1719  categories$ = this.categoriesFacade.getCategories();
    18   isExpanded = false;
    1920
    2021  constructor(private categoriesFacade: CategoryFacadeService, private questionsFacade: QuestionFacadeService) {}
     
    2223  ngOnInit(): void {}
    2324
     25  public searchQuestionsKeyboard(event: KeyboardEvent): void {
     26    if (event.code === 'enter') {
     27      this.searchQuestions();
     28    }
     29  }
     30
    2431  public searchQuestions(): void {
    25     this.isExpanded = false;
    2632    this.questionsFacade.searchQuestions(this.questionSearchFormContor.value, this.questionCategoriesFormContor.value);
    27     this.questionSearchFormContor.reset();
    28     this.questionCategoriesFormContor.reset();
     33    this.searched.emit();
    2934  }
    3035}
  • src/Clients/Angular/finki-chattery/src/app/shared-material/shared-material.module.ts

    r806f4ee r2025810  
    2525import { MatBadgeModule } from '@angular/material/badge';
    2626import { MatStepperModule } from '@angular/material/stepper';
    27 import { MatExpansionModule } from '@angular/material/expansion';
    2827
    2928@NgModule({
     
    5251    MatButtonToggleModule,
    5352    MatBadgeModule,
    54     MatStepperModule,
    55     MatExpansionModule
     53    MatStepperModule
    5654  ],
    5755  exports: [
     
    7876    MatButtonToggleModule,
    7977    MatBadgeModule,
    80     MatStepperModule,
    81     MatExpansionModule
     78    MatStepperModule
    8279  ]
    8380})
Note: See TracChangeset for help on using the changeset viewer.