Changeset dab7a9b for src/Clients


Ignore:
Timestamp:
10/16/21 20:00:21 (3 years ago)
Author:
Стојков Марко <mst@…>
Branches:
dev
Children:
9885bee
Parents:
f9983f5
Message:

Preview question component

Location:
src/Clients/Angular/finki-chattery/src
Files:
22 added
1 deleted
16 edited

Legend:

Unmodified
Added
Removed
  • src/Clients/Angular/finki-chattery/src/app/app-routing.module.ts

    rf9983f5 rdab7a9b  
    11import { NgModule } from '@angular/core';
    22import { Routes, RouterModule } from '@angular/router';
     3import { AuthorizedGuard } from './core/guards/authorized.guard';
    34
    45const routes: Routes = [
     6  {
     7    path: 'questioning',
     8    canActivate: [AuthorizedGuard],
     9    loadChildren: () => import('./modules/questioning/questioning.module').then((x) => x.QuestioningModule)
     10  },
    511  {
    612    path: '**',
  • src/Clients/Angular/finki-chattery/src/app/app.component.html

    rf9983f5 rdab7a9b  
    22  <mat-progress-bar class="global-loader" [class.hidden]="!(loader.isLoading | async)" mode="indeterminate"></mat-progress-bar>
    33  <router-outlet></router-outlet>
    4   <button (click)="login()">LOGIN</button>
    54</main>
  • src/Clients/Angular/finki-chattery/src/app/app.component.ts

    rf9983f5 rdab7a9b  
    88})
    99export class AppComponent implements OnInit {
    10   constructor(public loader: LoaderService, private redirect: RedirectService, private auth: AuthService) {}
     10  constructor(public loader: LoaderService, private redirect: RedirectService) {}
    1111
    1212  ngOnInit(): void {
    1313    this.redirect.redirectLoggedInUser();
    1414  }
    15 
    16   public login(): void {
    17     this.auth.login();
    18   }
    1915}
  • src/Clients/Angular/finki-chattery/src/app/core/services/auth.service.ts

    rf9983f5 rdab7a9b  
    3535      map((user) => {
    3636        if (user) {
     37          if (user.expired) {
     38            return false;
     39          }
     40
    3741          return true;
    3842        }
  • src/Clients/Angular/finki-chattery/src/app/core/services/notification.service.ts

    rf9983f5 rdab7a9b  
    2222
    2323  public successNotification(title: string, description?: string): void {
    24     this.toastr.success(this.translate.instant(description), this.translate.instant(title));
     24    if (description) {
     25      this.toastr.success(this.translate.instant(description), this.translate.instant(title));
     26    }
     27    this.toastr.success(this.translate.instant(title));
    2528  }
    2629}
  • src/Clients/Angular/finki-chattery/src/app/core/state/question-facade.service.ts

    rf9983f5 rdab7a9b  
    1515export class QuestionFacadeService {
    1616  effectWorking$: Observable<boolean | HttpErrorResponse>;
    17   question$: Observable<QuestionStateViewModel>;
    1817
    1918  constructor(private store: Store<QuestionState>) {
    20     this.question$ = this.store
    21       .select(questionStateQuery.getQuestion)
    22       .pipe(filter((x: QuestionStateViewModel | null): x is QuestionStateViewModel => x !== null));
    2319    this.effectWorking$ = this.store.select(questionStateQuery.effectWorking).pipe(
    2420      filter((effect) => effect !== null),
     
    3632  }
    3733
     34  public getQuestion(): Observable<QuestionStateViewModel> {
     35    return this.store
     36      .select(questionStateQuery.getQuestion)
     37      .pipe(filter((x: QuestionStateViewModel | null): x is QuestionStateViewModel => x !== null));
     38  }
     39
    3840  public fetchQuestion(questionUid: string): void {
    3941    this.dispatchEffect(new GetQuestionState(questionUid));
  • src/Clients/Angular/finki-chattery/src/app/core/state/question-state/question-state.models.ts

    rf9983f5 rdab7a9b  
    1616  public index!: string;
    1717  public imageUrl!: string;
     18  public reputation!: number;
    1819}
    1920
     
    4243  public index!: string;
    4344  public imageUrl!: string;
     45  public reputation!: number;
    4446}
    4547
     
    5557  public index!: string;
    5658  public imageUrl!: string;
     59  public reputation!: number;
    5760}
  • src/Clients/Angular/finki-chattery/src/app/core/state/question-state/question.mapper.ts

    rf9983f5 rdab7a9b  
    2525              y.studentResponse.uid,
    2626              y.studentResponse.index,
    27               y.studentResponse.imageUrl
     27              y.studentResponse.imageUrl,
     28              y.studentResponse.reputation
    2829            );
    2930
     
    3536          x.studentResponse.uid,
    3637          x.studentResponse.index,
    37           x.studentResponse.imageUrl
     38          x.studentResponse.imageUrl,
     39          x.studentResponse.reputation
    3840        );
    3941
     
    6567      questionStateResponse.studentResponse.uid,
    6668      questionStateResponse.studentResponse.index,
    67       questionStateResponse.studentResponse.imageUrl
     69      questionStateResponse.studentResponse.imageUrl,
     70      questionStateResponse.studentResponse.reputation
    6871    );
    6972
  • src/Clients/Angular/finki-chattery/src/app/shared-app/directives/directives.ts

    rf9983f5 rdab7a9b  
    1 import { HandleInputFormErrorsDirective, HoverElevationDirective, LoaderDirective, HandleSelectFormErrorsDirective } from '.';
     1import { HandleInputFormErrorsDirective, HoverElevationDirective, LoaderDirective, HandleSelectFormErrorsDirective, ShareLinkDirective } from '.';
    22
    3 export const DIRECTIVES: any[] = [
    4   HandleInputFormErrorsDirective,
    5   LoaderDirective,
    6   HoverElevationDirective,
    7   HandleSelectFormErrorsDirective
    8 ];
     3export const DIRECTIVES: any[] = [HandleInputFormErrorsDirective, LoaderDirective, HoverElevationDirective, HandleSelectFormErrorsDirective, ShareLinkDirective];
  • src/Clients/Angular/finki-chattery/src/app/shared-app/directives/index.ts

    rf9983f5 rdab7a9b  
    33export * from './hover-elevation.directive';
    44export * from './handle-select-form-errors.directive';
     5export * from './share-link.directive';
  • src/Clients/Angular/finki-chattery/src/app/shared-app/models/question-state-view-models.models.ts

    rf9983f5 rdab7a9b  
    1515
    1616export class StudentQuestionStateViewModel {
    17   constructor(public uid: string, public index: string, public imageUrl: string) {}
     17  constructor(public uid: string, public index: string, public imageUrl: string, public reputation: number) {}
    1818}
    1919
     
    3939
    4040export class AnswerStudentQuestionStateViewModel {
    41   constructor(public uid: string, public index: string, public imageUrl: string) {}
     41  constructor(public uid: string, public index: string, public imageUrl: string, public reputation: number) {}
    4242}
    4343
     
    5252
    5353export class AnswerResponseStudentQuestionStateViewModel {
    54   constructor(public uid: string, public index: string, public imageUrl: string) {}
     54  constructor(public uid: string, public index: string, public imageUrl: string, public reputation: number) {}
    5555}
  • src/Clients/Angular/finki-chattery/src/app/shared-app/services/translate-from-json.service.ts

    rf9983f5 rdab7a9b  
    4343  }
    4444
    45   public instant(key?: string): string | undefined {
    46     if (key) {
    47       return this.translateService.instant(key);
    48     }
    49     return undefined;
     45  public instant(key: string): string {
     46    return this.translateService.instant(key);
    5047  }
    5148}
  • src/Clients/Angular/finki-chattery/src/app/shared-app/shared-app.module.ts

    rf9983f5 rdab7a9b  
    88import { FileUploadModule } from 'ng2-file-upload';
    99
    10 import { COMPONENTS } from './components/generic/components';
     10import { COMPONENTS } from './components/components';
    1111import { SharedMaterialModule } from '../shared-material/shared-material.module';
    1212import { DIRECTIVES } from './directives/directives';
    1313import { SERVICES } from './services/services';
    1414import { PIPES } from './pipes/pipes';
    15 import { FileUploadComponent } from './components/generic/file-upload/file-upload.component';
    16 import { HandleSelectFormErrorsDirective } from './directives/handle-select-form-errors.directive';
    1715
    1816@NgModule({
    19   declarations: [COMPONENTS, DIRECTIVES, PIPES, FileUploadComponent, HandleSelectFormErrorsDirective],
     17  declarations: [COMPONENTS, DIRECTIVES, PIPES],
    2018  providers: [SERVICES],
    2119  imports: [
     
    3937    COMPONENTS,
    4038    DIRECTIVES,
    41     PIPES
     39    PIPES,
     40    SharedMaterialModule
    4241  ]
    4342})
  • src/Clients/Angular/finki-chattery/src/app/shared-material/shared-material.module.ts

    rf9983f5 rdab7a9b  
    2020import { MatDatepickerModule } from '@angular/material/datepicker';
    2121import { MatNativeDateModule } from '@angular/material/core';
     22import { MatChipsModule } from '@angular/material/chips';
     23import { MatTooltipModule } from '@angular/material/tooltip';
     24import { MatButtonToggleModule } from '@angular/material/button-toggle';
     25
    2226@NgModule({
    2327  imports: [
     
    4044    MatTableModule,
    4145    MatDatepickerModule,
    42     MatNativeDateModule
     46    MatNativeDateModule,
     47    MatChipsModule,
     48    MatTooltipModule,
     49    MatButtonToggleModule
    4350  ],
    4451  exports: [
     
    6067    MatTableModule,
    6168    MatDatepickerModule,
    62     MatNativeDateModule
     69    MatNativeDateModule,
     70    MatChipsModule,
     71    MatTooltipModule,
     72    MatButtonToggleModule
    6373  ]
    6474})
  • src/Clients/Angular/finki-chattery/src/assets/translations/en.json

    rf9983f5 rdab7a9b  
    1414  "password-not-match": "Passwords don't match",
    1515  "code-date-passed": "The code date has passed",
    16   "not-found": "Not found"
     16  "not-found": "Not found",
     17  "question-preview-subtitle": "Asked <b>{{createdOn}}</b>, Last active <b>{{lastActive}}</b>, Viewed <b>{{views}}</b> times",
     18  "share-link": "Share",
     19  "share-link-success": "Successfully copied link for sharing",
     20  "question-asked-by-subtitle": "Asked on: {{date}}",
     21  "question-answers": "{{answerCount}} Answers",
     22  "question-answered-by-subtitle": "Answered on: {{date}}",
     23  "student-reputation": "{{reputation}} reputation",
     24  "vote-correct-answer": "This has been accepted as the correct answer by the owner of the question",
     25  "answer-sort-oldest": "Oldest",
     26  "answer-sort-votes": "Votes"
    1727}
  • src/Clients/Angular/finki-chattery/src/styles.scss

    rf9983f5 rdab7a9b  
    264264
    265265.avatar-image {
    266   width: 100px;
    267   height: 100px;
     266  width: 80px;
     267  height: 80px;
    268268  display: block;
    269269  border-radius: 50%;
Note: See TracChangeset for help on using the changeset viewer.