Changeset 6738cc0 for src/Clients
- Timestamp:
- 01/19/22 19:14:27 (3 years ago)
- Branches:
- dev
- Parents:
- f3c4950
- Location:
- src/Clients/Angular/finki-chattery
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Clients/Angular/finki-chattery/package-lock.json
rf3c4950 r6738cc0 7801 7801 } 7802 7802 }, 7803 "ngx-pipes": { 7804 "version": "2.7.6", 7805 "resolved": "https://registry.npmjs.org/ngx-pipes/-/ngx-pipes-2.7.6.tgz", 7806 "integrity": "sha512-FAeMd1mI8jCnnrhUuNLXs+PaVT1ujhA0QD3KRBDuzGFcbnP7NMXR2EJ5KYbV39LDNuRCluhpfwZudQu/NvrVuA==", 7807 "requires": { 7808 "tslib": "^2.0.0" 7809 } 7810 }, 7803 7811 "ngx-toastr": { 7804 7812 "version": "13.2.1", -
src/Clients/Angular/finki-chattery/package.json
rf3c4950 r6738cc0 33 33 "ng2-file-upload": "^1.4.0", 34 34 "ngx-material-timepicker": "^5.5.3", 35 "ngx-pipes": "^2.7.6", 35 36 "ngx-toastr": "^13.2.1", 36 37 "oidc-client": "^1.11.5", -
src/Clients/Angular/finki-chattery/src/app/core/services/auth.service.ts
rf3c4950 r6738cc0 107 107 }); 108 108 } 109 110 public studentCheckedNotifications(): Observable<void> { 111 return this.baseApi.post('v1/students/checked-notifications'); 112 } 109 113 } -
src/Clients/Angular/finki-chattery/src/app/shared-app/components/generic/header/header.component.html
rf3c4950 r6738cc0 19 19 'header-student-questions' | translate 20 20 }}</app-button> 21 <app-button 22 matBadge="{{ auth.selfUser?.student?.notifications?.length }}" 23 matBadgeHidden="{{ studentCheckedNotifications || auth.selfUser?.student?.notifications?.length === 0 }}" 24 [matMenuTriggerFor]="notificationMenu" 25 class="margin-y-xs" 26 *ngIf="auth.isStudent()" 27 (click)="studentCheckedNotificationsClick()" 28 [buttonType]="ButtonType.Basic" 29 > 30 <mat-icon>notifications</mat-icon> 31 </app-button> 21 32 <app-button class="margin-y-xs" *ngIf="auth.isLoggedIn()" (action)="logout()" [buttonType]="ButtonType.Basic">{{ 22 33 'header-logout' | translate … … 34 45 </button> 35 46 </mat-menu> 47 48 <mat-menu #notificationMenu="matMenu"> 49 <div (click)="goToQuestion(q.questionUid)" mat-menu-item *ngFor="let q of auth.selfUser?.student?.notifications"> 50 {{ q?.text }} <span class="time-ago">{{ q?.createdOn | timeAgo }}</span> 51 </div> 52 </mat-menu> -
src/Clients/Angular/finki-chattery/src/app/shared-app/components/generic/header/header.component.scss
rf3c4950 r6738cc0 14 14 } 15 15 } 16 17 ::ng-deep.mat-menu-panel { 18 max-width: none !important; 19 } -
src/Clients/Angular/finki-chattery/src/app/shared-app/components/generic/header/header.component.ts
rf3c4950 r6738cc0 11 11 export class HeaderComponent implements OnInit { 12 12 ButtonType = ButtonType; 13 14 public studentCheckedNotifications = false; 13 15 14 16 constructor(public auth: AuthService, private router: Router) {} … … 36 38 this.router.navigateByUrl(`questioning/${questionUid}`); 37 39 } 40 41 studentCheckedNotificationsClick(): void { 42 if (!this.studentCheckedNotifications) { 43 this.auth.studentCheckedNotifications().subscribe(); 44 } 45 this.studentCheckedNotifications = true; 46 } 38 47 } -
src/Clients/Angular/finki-chattery/src/app/shared-app/models/user.models.ts
rf3c4950 r6738cc0 1 import * as moment from 'moment'; 2 1 3 export class ApplicationUser { 2 4 constructor( … … 30 32 public questions!: StudentQuestionResponse[]; 31 33 public teams!: StudentTeamResponse[]; 34 public notifications!: StudentNotificationResponse[]; 35 } 36 37 export class StudentNotificationResponse { 38 public uid!: string; 39 public createdOn!: moment.Moment; 40 public questionUid!: string; 41 public text!: string; 42 43 constructor(uid: string, createdOn: moment.Moment, questionUid: string, text: string) { 44 this.uid = uid; 45 this.createdOn = createdOn; 46 this.questionUid = questionUid; 47 this.text = text; 48 } 32 49 } 33 50 -
src/Clients/Angular/finki-chattery/src/app/shared-app/services/base-api.service.ts
rf3c4950 r6738cc0 4 4 5 5 import { environment } from '@env/environment'; 6 import { SelfUserResponse } from '../models'; 6 import { SelfUserResponse, StudentNotificationResponse } from '../models'; 7 import { map } from 'rxjs/operators'; 8 import * as moment from 'moment'; 7 9 8 10 @Injectable({ … … 19 21 20 22 public getSelfUser(): Observable<SelfUserResponse> { 21 return this.get<SelfUserResponse>('v1/self'); 23 return this.get<SelfUserResponse>('v1/self').pipe( 24 map((x) => { 25 if (x.student) { 26 x.student.notifications = x.student.notifications.map( 27 (y) => new StudentNotificationResponse(y.uid, moment(y.createdOn), y.questionUid, y.text) 28 ); 29 } 30 31 return x; 32 }) 33 ); 22 34 } 23 35 -
src/Clients/Angular/finki-chattery/src/app/shared-app/shared-app.module.ts
rf3c4950 r6738cc0 14 14 import { SERVICES } from './services/services'; 15 15 import { PIPES } from './pipes/pipes'; 16 import { NgPipesModule } from 'ngx-pipes'; 16 17 17 18 @NgModule({ … … 27 28 FileUploadModule, 28 29 NgxMaterialTimepickerModule, 29 EditorModule 30 EditorModule, 31 NgPipesModule 30 32 ], 31 33 exports: [ … … 41 43 PIPES, 42 44 SharedMaterialModule, 43 EditorModule 45 EditorModule, 46 NgPipesModule 44 47 ] 45 48 })
Note:
See TracChangeset
for help on using the changeset viewer.