From ea16a1d533e5623fa8e1f76957f793cc425424b6 Mon Sep 17 00:00:00 2001 From: McNaBry Date: Thu, 14 Nov 2024 00:33:25 +0800 Subject: [PATCH 01/10] Update history page styles * Move history out of account as parent div being flex/grid affects table style * Adjust width of side panel to be maximum 90% of screen width * Update styles of readonly editor --- frontend/src/_services/history.service.ts | 2 +- frontend/src/app/account/account.component.ts | 2 - frontend/src/app/account/account.module.ts | 2 - .../account/history/history.component.html | 84 ------------------- frontend/src/app/app.routes.ts | 6 ++ .../history/history.component.css | 10 +++ .../src/app/history/history.component.html | 83 ++++++++++++++++++ .../history/history.component.ts | 28 ++++++- .../{account => }/history/history.model.ts | 2 +- .../navigation-bar.component.ts | 2 +- 10 files changed, 126 insertions(+), 95 deletions(-) delete mode 100644 frontend/src/app/account/history/history.component.html rename frontend/src/app/{account => }/history/history.component.css (82%) create mode 100644 frontend/src/app/history/history.component.html rename frontend/src/app/{account => }/history/history.component.ts (80%) rename frontend/src/app/{account => }/history/history.model.ts (94%) diff --git a/frontend/src/_services/history.service.ts b/frontend/src/_services/history.service.ts index 3ee0240ca3..e9835c9669 100644 --- a/frontend/src/_services/history.service.ts +++ b/frontend/src/_services/history.service.ts @@ -2,7 +2,7 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; import { map } from 'rxjs/operators'; -import { historyResponse, MatchingHistory } from '../app/account/history/history.model'; +import { historyResponse, MatchingHistory } from '../app/history/history.model'; import { ApiService } from './api.service'; @Injectable({ diff --git a/frontend/src/app/account/account.component.ts b/frontend/src/app/account/account.component.ts index aa1bc14b19..a2f6e4c0f1 100644 --- a/frontend/src/app/account/account.component.ts +++ b/frontend/src/app/account/account.component.ts @@ -5,7 +5,6 @@ import { LoginComponent } from './login/login.component'; import { RegisterComponent } from './register/register.component'; import { LayoutComponent } from './layout.component'; import { ProfileComponent } from './profile/profile.component'; -import { HistoryComponent } from './history/history.component'; const routes: Routes = [ { @@ -16,7 +15,6 @@ const routes: Routes = [ { path: 'login', component: LoginComponent }, { path: 'register', component: RegisterComponent }, { path: 'profile', component: ProfileComponent }, - { path: 'history', component: HistoryComponent }, ], }, ]; diff --git a/frontend/src/app/account/account.module.ts b/frontend/src/app/account/account.module.ts index 10b87cfb34..33e7cb9efa 100644 --- a/frontend/src/app/account/account.module.ts +++ b/frontend/src/app/account/account.module.ts @@ -7,7 +7,6 @@ import { RegisterComponent } from './register/register.component'; import { LayoutComponent } from './layout.component'; import { AccountRoutingModule } from './account.component'; import { ProfileComponent } from './profile/profile.component'; -import { HistoryComponent } from './history/history.component'; @NgModule({ imports: [ @@ -18,7 +17,6 @@ import { HistoryComponent } from './history/history.component'; LoginComponent, RegisterComponent, ProfileComponent, - HistoryComponent, ], }) export class AccountModule {} diff --git a/frontend/src/app/account/history/history.component.html b/frontend/src/app/account/history/history.component.html deleted file mode 100644 index ed1d597ccf..0000000000 --- a/frontend/src/app/account/history/history.component.html +++ /dev/null @@ -1,84 +0,0 @@ -
- - -
-

Matching History

-
-
- -
- - - - - - -
-
- - - - Question - - - Difficulty - - Topics - - Collaborator - - Status - Time - - - - - {{ history.question.title }} - {{ history.difficulty }} - {{ history.topics.join(', ') }} - {{ history.collaborator }} - - @if (history.status === 'COMPLETED') { - - } @else if (history.status === 'FORFEITED') { - - } @else if (history.status === 'IN_PROGRESS') { - - } - - {{ history.time }} - - -
-
-
-
-

{{ panelHistory?.question?.title }}

- -
-
-

{{ panelHistory?.question?.description }}

-
-
-
- diff --git a/frontend/src/app/app.routes.ts b/frontend/src/app/app.routes.ts index 59b77f39aa..2ce0db61b0 100644 --- a/frontend/src/app/app.routes.ts +++ b/frontend/src/app/app.routes.ts @@ -5,6 +5,7 @@ import { MatchingComponent } from './matching/matching.component'; import { HomeComponent } from './home/home.component'; import { AuthGuardService } from '../_services/auth.guard.service'; import { CollabGuardService } from '../_services/collab.guard.service'; +import { HistoryComponent } from './history/history.component'; const accountModule = () => import('./account/account.module').then(x => x.AccountModule); @@ -33,6 +34,11 @@ export const routes: Routes = [ component: HomeComponent, canActivate: [AuthGuardService], }, + { + path: 'history', + component: HistoryComponent, + canActivate: [AuthGuardService], + }, { path: '**', redirectTo: '/home', diff --git a/frontend/src/app/account/history/history.component.css b/frontend/src/app/history/history.component.css similarity index 82% rename from frontend/src/app/account/history/history.component.css rename to frontend/src/app/history/history.component.css index 2053d5c2d0..155f32abb6 100644 --- a/frontend/src/app/account/history/history.component.css +++ b/frontend/src/app/history/history.component.css @@ -1,3 +1,12 @@ +.container { + min-height: calc(100dvh - 160px); + width: 100%; + justify-content: center; + align-items: center; + padding: 1rem; + margin-top: auto; +} + .sliding-panel { position: fixed; top: 0; @@ -9,6 +18,7 @@ box-shadow: -2px 0 5px rgba(0,0,0,0.5); transition: right 0.3s ease; z-index: 1000; + max-width: 90%; } .sliding-panel.open { diff --git a/frontend/src/app/history/history.component.html b/frontend/src/app/history/history.component.html new file mode 100644 index 0000000000..095057bb46 --- /dev/null +++ b/frontend/src/app/history/history.component.html @@ -0,0 +1,83 @@ +
+
+ + +
+

Matching History

+ + + + + + +
+
+ + + + Question + + + Difficulty + + Topics + + Collaborator + + Status + Time + + + + + {{ history.question.title }} + {{ history.difficulty }} + {{ history.topics.join(', ') }} + {{ history.collaborator }} + + @if (history.status === 'COMPLETED') { + + } @else if (history.status === 'FORFEITED') { + + } @else if (history.status === 'IN_PROGRESS') { + + } + + {{ history.time }} + + +
+
+
+
+

{{ panelHistory?.question?.title }}

+ +
+
+

{{ panelHistory?.question?.description }}

+

Submitted Solution

+
+
+
+ +
diff --git a/frontend/src/app/account/history/history.component.ts b/frontend/src/app/history/history.component.ts similarity index 80% rename from frontend/src/app/account/history/history.component.ts rename to frontend/src/app/history/history.component.ts index 728a0b8782..50b36e54f6 100644 --- a/frontend/src/app/account/history/history.component.ts +++ b/frontend/src/app/history/history.component.ts @@ -2,16 +2,16 @@ import { Component, OnInit, ViewChild, ElementRef } from '@angular/core'; import { TableModule } from 'primeng/table'; import { CommonModule, DatePipe } from '@angular/common'; import { HistoryStatus, MatchingHistory } from './history.model'; -import { HistoryService } from '../../../_services/history.service'; +import { HistoryService } from '../../_services/history.service'; import { MessageService } from 'primeng/api'; import { InputTextModule } from 'primeng/inputtext'; import { ButtonModule } from 'primeng/button'; import { IconFieldModule } from 'primeng/iconfield'; import { InputIconModule } from 'primeng/inputicon'; import { oneDark } from '@codemirror/theme-one-dark'; -import { EditorState } from '@codemirror/state'; +import { EditorState, Extension } from '@codemirror/state'; import { EditorView, basicSetup } from 'codemirror'; -import { languageMap } from '../../collaboration/editor/languages'; +import { languageMap } from '../collaboration/editor/languages'; import { ToastModule } from 'primeng/toast'; import { Router } from '@angular/router'; @@ -30,6 +30,7 @@ export class HistoryComponent implements OnInit { isPanelVisible = false; panelHistory: MatchingHistory | null = null; editorView: EditorView | null = null; + customTheme!: Extension; constructor( private historyService: HistoryService, @@ -80,10 +81,29 @@ export class HistoryComponent implements OnInit { this.editorView.destroy(); } + const customTheme = EditorView.theme( + { + '&': { + backgroundColor: 'var(--surface-section)', + }, + '.cm-gutters': { + backgroundColor: 'var(--surface-section)', + }, + }, + { dark: true }, + ); + const languageExtension = languageMap[language] || languageMap['java']; const state = EditorState.create({ doc: code, - extensions: [basicSetup, languageExtension, oneDark, EditorView.editable.of(false)], + extensions: [ + basicSetup, + languageExtension, + customTheme, + oneDark, + EditorView.lineWrapping, + EditorView.editable.of(false), + ], }); this.editorView = new EditorView({ diff --git a/frontend/src/app/account/history/history.model.ts b/frontend/src/app/history/history.model.ts similarity index 94% rename from frontend/src/app/account/history/history.model.ts rename to frontend/src/app/history/history.model.ts index e0972b1411..d9cf1d1c85 100644 --- a/frontend/src/app/account/history/history.model.ts +++ b/frontend/src/app/history/history.model.ts @@ -1,4 +1,4 @@ -import { DifficultyLevels } from '../../questions/difficulty-levels.enum'; +import { DifficultyLevels } from '../questions/difficulty-levels.enum'; export enum HistoryStatus { COMPLETED = 'COMPLETED', diff --git a/frontend/src/app/navigation-bar/navigation-bar.component.ts b/frontend/src/app/navigation-bar/navigation-bar.component.ts index 1bf5fb0bce..774cfd5aab 100644 --- a/frontend/src/app/navigation-bar/navigation-bar.component.ts +++ b/frontend/src/app/navigation-bar/navigation-bar.component.ts @@ -71,7 +71,7 @@ export class NavigationBarComponent implements OnInit { { label: 'Match History', icon: 'pi pi-trophy', - routerLink: '/account/history', + routerLink: '/history', class: 'p-submenu-list', }, { From cf3db25f331c158fe7ff10d2266d37acec8f8b78 Mon Sep 17 00:00:00 2001 From: Samuel Lim Date: Thu, 14 Nov 2024 00:59:12 +0800 Subject: [PATCH 02/10] Fix compose.dev.yml --- compose.dev.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compose.dev.yml b/compose.dev.yml index cb9433736b..ceb93c8369 100644 --- a/compose.dev.yml +++ b/compose.dev.yml @@ -48,6 +48,10 @@ services: - /app/node_modules - ./services/collaboration:/app + collaboration-db: + ports: + - 27020:27017 + history: command: npm run dev ports: From c734a8031929d02eaec44a29f589b253b78d2ba5 Mon Sep 17 00:00:00 2001 From: McNaBry Date: Thu, 14 Nov 2024 01:01:10 +0800 Subject: [PATCH 03/10] Fix panel description styling Co-authored-by: samuelim01 <61283948+samuelim01@users.noreply.github.com> --- frontend/src/app/history/history.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/history/history.component.html b/frontend/src/app/history/history.component.html index 095057bb46..9087e6a91a 100644 --- a/frontend/src/app/history/history.component.html +++ b/frontend/src/app/history/history.component.html @@ -74,7 +74,7 @@

{{ panelHistory?.question?.title }}

class="p-button-text" />
-

{{ panelHistory?.question?.description }}

+

{{ panelHistory?.question?.description }}

Submitted Solution

From dd511fde2212201cff2f223dd1e38cc5ef4aa58c Mon Sep 17 00:00:00 2001 From: McNaBry Date: Thu, 14 Nov 2024 01:50:07 +0800 Subject: [PATCH 04/10] Conver history panel to primeNG sidebar --- .../src/app/history/history.component.html | 20 +++++++++---------- frontend/src/app/history/history.component.ts | 12 ++++++++++- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/frontend/src/app/history/history.component.html b/frontend/src/app/history/history.component.html index 9087e6a91a..b445bc2e8d 100644 --- a/frontend/src/app/history/history.component.html +++ b/frontend/src/app/history/history.component.html @@ -63,21 +63,21 @@

Matching History

-
-
+ +

{{ panelHistory?.question?.title }}

- -
+

{{ panelHistory?.question?.description }}

Submitted Solution

-
+ diff --git a/frontend/src/app/history/history.component.ts b/frontend/src/app/history/history.component.ts index 50b36e54f6..7913127320 100644 --- a/frontend/src/app/history/history.component.ts +++ b/frontend/src/app/history/history.component.ts @@ -13,11 +13,21 @@ import { EditorState, Extension } from '@codemirror/state'; import { EditorView, basicSetup } from 'codemirror'; import { languageMap } from '../collaboration/editor/languages'; import { ToastModule } from 'primeng/toast'; +import { SidebarModule } from 'primeng/sidebar'; import { Router } from '@angular/router'; @Component({ standalone: true, - imports: [TableModule, CommonModule, InputTextModule, ButtonModule, IconFieldModule, InputIconModule, ToastModule], + imports: [ + SidebarModule, + TableModule, + CommonModule, + InputTextModule, + ButtonModule, + IconFieldModule, + InputIconModule, + ToastModule, + ], providers: [MessageService, DatePipe], templateUrl: './history.component.html', styleUrl: './history.component.css', From 00b16aa31b6fe642d146dce4aad7014b8030ed20 Mon Sep 17 00:00:00 2001 From: McNaBry Date: Thu, 14 Nov 2024 02:43:36 +0800 Subject: [PATCH 05/10] Fix sorting for history table --- .../src/app/history/history.component.html | 8 ++- frontend/src/app/history/history.component.ts | 57 ++++++++++++++++--- 2 files changed, 55 insertions(+), 10 deletions(-) diff --git a/frontend/src/app/history/history.component.html b/frontend/src/app/history/history.component.html index b445bc2e8d..00cc1c87b9 100644 --- a/frontend/src/app/history/history.component.html +++ b/frontend/src/app/history/history.component.html @@ -11,7 +11,9 @@ [rows]="10" [rowsPerPageOptions]="[10, 25, 50]" [globalFilterFields]="['question', 'difficulty', 'topics', 'collaborator', 'status', 'time']" - styleClass="p-datatable-gridlines-striped"> + styleClass="p-datatable-gridlines-striped" + (sortFunction)="customSort($event)" + [customSort]="true">

Matching History

@@ -58,7 +60,7 @@

Matching History

} - {{ history.time }} + {{ history.time | date: 'dd/MM/yyyy HH:mm a' }} @@ -67,7 +69,7 @@

Matching History

[(visible)]="isPanelVisible" position="right" [blockScroll]="true" - styleClass="w-10 md:w-4" + styleClass="w-10 md:w-8 lg:w-6" transitionOptions="200ms cubic-bezier(0, 0, 0.2, 1)" (onHide)="closePanel()"> diff --git a/frontend/src/app/history/history.component.ts b/frontend/src/app/history/history.component.ts index 7913127320..b2b50f5b94 100644 --- a/frontend/src/app/history/history.component.ts +++ b/frontend/src/app/history/history.component.ts @@ -1,9 +1,9 @@ import { Component, OnInit, ViewChild, ElementRef } from '@angular/core'; -import { TableModule } from 'primeng/table'; +import { Table, TableModule } from 'primeng/table'; import { CommonModule, DatePipe } from '@angular/common'; import { HistoryStatus, MatchingHistory } from './history.model'; import { HistoryService } from '../../_services/history.service'; -import { MessageService } from 'primeng/api'; +import { MessageService, SortEvent } from 'primeng/api'; import { InputTextModule } from 'primeng/inputtext'; import { ButtonModule } from 'primeng/button'; import { IconFieldModule } from 'primeng/iconfield'; @@ -34,28 +34,28 @@ import { Router } from '@angular/router'; }) export class HistoryComponent implements OnInit { @ViewChild('editor') editor!: ElementRef; + @ViewChild('dt') dt!: Table; histories: MatchingHistory[] = []; + initialValue: MatchingHistory[] = []; loading = true; isPanelVisible = false; panelHistory: MatchingHistory | null = null; editorView: EditorView | null = null; customTheme!: Extension; + isSorted: null | undefined | boolean; constructor( private historyService: HistoryService, private messageService: MessageService, - private datePipe: DatePipe, private router: Router, ) {} ngOnInit() { this.historyService.getHistories().subscribe({ next: data => { - this.histories = data.map(history => ({ - ...history, - time: this.datePipe.transform(history.time, 'short'), // Pipe to format date for searching - })); + this.histories = data; + this.initialValue = [...data]; this.loading = false; }, error: () => { @@ -71,6 +71,49 @@ export class HistoryComponent implements OnInit { }); } + customSort(event: SortEvent) { + if (this.isSorted == null || this.isSorted === undefined) { + this.isSorted = true; + this.sortTableData(event); + } else if (this.isSorted == true) { + this.isSorted = false; + this.sortTableData(event); + } else if (this.isSorted == false) { + this.isSorted = null; + this.histories = [...this.initialValue]; + this.dt.reset(); + } + } + + sortTableData(event: SortEvent) { + event.data?.sort((data1, data2) => { + console.log(event.field); + const value1 = data1[event.field ?? ''] ?? null; + const value2 = data2[event.field ?? ''] ?? null; + let result = 0; + + // Null checks + if (value1 === null && value2 !== null) { + result = -1; + } else if (value1 !== null && value2 === null) { + result = 1; + } else if (value1 === null && value2 === null) { + result = 0; + } else if (event.field == 'time') { + console.log(new Date(value1)); + result = new Date(value1) >= new Date(value2) ? 1 : -1; + } else if (typeof value1 === 'string' && typeof value2 === 'string') { + // String comparison + result = value1.localeCompare(value2); + } else { + // Generic comparison for numbers and other types + result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0; + } + + return (event.order ?? 1) * result; + }); + } + onRowSelect(history: MatchingHistory) { this.panelHistory = history; if (history.status != HistoryStatus.IN_PROGRESS) { From 82102c3137c6b987b30cdaa8a832daaa41d96c49 Mon Sep 17 00:00:00 2001 From: McNaBry Date: Thu, 14 Nov 2024 02:48:12 +0800 Subject: [PATCH 06/10] Remove console log statements in history component --- frontend/src/app/history/history.component.ts | 2 -- 1 file changed, 2 deletions(-) diff --git a/frontend/src/app/history/history.component.ts b/frontend/src/app/history/history.component.ts index b2b50f5b94..ccc304e3bc 100644 --- a/frontend/src/app/history/history.component.ts +++ b/frontend/src/app/history/history.component.ts @@ -87,7 +87,6 @@ export class HistoryComponent implements OnInit { sortTableData(event: SortEvent) { event.data?.sort((data1, data2) => { - console.log(event.field); const value1 = data1[event.field ?? ''] ?? null; const value2 = data2[event.field ?? ''] ?? null; let result = 0; @@ -100,7 +99,6 @@ export class HistoryComponent implements OnInit { } else if (value1 === null && value2 === null) { result = 0; } else if (event.field == 'time') { - console.log(new Date(value1)); result = new Date(value1) >= new Date(value2) ? 1 : -1; } else if (typeof value1 === 'string' && typeof value2 === 'string') { // String comparison From 5eed05486871b9489e5c6ccf4d2e13d52c2d5803 Mon Sep 17 00:00:00 2001 From: McNaBry Date: Thu, 14 Nov 2024 02:52:06 +0800 Subject: [PATCH 07/10] Add fix to history * Make SortEvent required * Adjust undefined handling for dt * Adjust time format --- frontend/src/app/history/history.component.html | 2 +- frontend/src/app/history/history.component.ts | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frontend/src/app/history/history.component.html b/frontend/src/app/history/history.component.html index 00cc1c87b9..7cf0eabf9a 100644 --- a/frontend/src/app/history/history.component.html +++ b/frontend/src/app/history/history.component.html @@ -60,7 +60,7 @@

Matching History

} - {{ history.time | date: 'dd/MM/yyyy HH:mm a' }} + {{ history.time | date: 'dd/MM/yyyy hh:mm a' }}
diff --git a/frontend/src/app/history/history.component.ts b/frontend/src/app/history/history.component.ts index ccc304e3bc..b0dc578743 100644 --- a/frontend/src/app/history/history.component.ts +++ b/frontend/src/app/history/history.component.ts @@ -71,7 +71,7 @@ export class HistoryComponent implements OnInit { }); } - customSort(event: SortEvent) { + customSort(event: Required) { if (this.isSorted == null || this.isSorted === undefined) { this.isSorted = true; this.sortTableData(event); @@ -81,11 +81,11 @@ export class HistoryComponent implements OnInit { } else if (this.isSorted == false) { this.isSorted = null; this.histories = [...this.initialValue]; - this.dt.reset(); + this.dt?.reset(); } } - sortTableData(event: SortEvent) { + sortTableData(event: Required) { event.data?.sort((data1, data2) => { const value1 = data1[event.field ?? ''] ?? null; const value2 = data2[event.field ?? ''] ?? null; From d028e81c1cf25563116f6c2aa7662d460d87da4c Mon Sep 17 00:00:00 2001 From: Samuel Lim Date: Thu, 14 Nov 2024 02:54:28 +0800 Subject: [PATCH 08/10] Remove removable sort --- frontend/src/app/history/history.component.ts | 20 +++---------------- 1 file changed, 3 insertions(+), 17 deletions(-) diff --git a/frontend/src/app/history/history.component.ts b/frontend/src/app/history/history.component.ts index b0dc578743..f6d10f75aa 100644 --- a/frontend/src/app/history/history.component.ts +++ b/frontend/src/app/history/history.component.ts @@ -72,23 +72,9 @@ export class HistoryComponent implements OnInit { } customSort(event: Required) { - if (this.isSorted == null || this.isSorted === undefined) { - this.isSorted = true; - this.sortTableData(event); - } else if (this.isSorted == true) { - this.isSorted = false; - this.sortTableData(event); - } else if (this.isSorted == false) { - this.isSorted = null; - this.histories = [...this.initialValue]; - this.dt?.reset(); - } - } - - sortTableData(event: Required) { event.data?.sort((data1, data2) => { - const value1 = data1[event.field ?? ''] ?? null; - const value2 = data2[event.field ?? ''] ?? null; + const value1 = data1[event.field]; + const value2 = data2[event.field]; let result = 0; // Null checks @@ -108,7 +94,7 @@ export class HistoryComponent implements OnInit { result = value1 < value2 ? -1 : value1 > value2 ? 1 : 0; } - return (event.order ?? 1) * result; + return event.order * result; }); } From f2bd2a3cfe1cdffedbfa7403f46164028d3078cf Mon Sep 17 00:00:00 2001 From: Samuel Lim Date: Thu, 14 Nov 2024 03:06:41 +0800 Subject: [PATCH 09/10] Fix question sort --- frontend/src/_services/history.service.ts | 3 ++- frontend/src/app/history/history.component.html | 10 ++++------ frontend/src/app/history/history.model.ts | 3 ++- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/src/_services/history.service.ts b/frontend/src/_services/history.service.ts index e9835c9669..41b5a71930 100644 --- a/frontend/src/_services/history.service.ts +++ b/frontend/src/_services/history.service.ts @@ -22,7 +22,8 @@ export class HistoryService extends ApiService { id: item._id, roomId: item.roomId, collaborator: item.collaborator.username, - question: item.question, + title: item.question.title, + description: item.question.description, topics: item.question.topics, difficulty: item.question.difficulty, status: item.status, diff --git a/frontend/src/app/history/history.component.html b/frontend/src/app/history/history.component.html index 7cf0eabf9a..76c5638c47 100644 --- a/frontend/src/app/history/history.component.html +++ b/frontend/src/app/history/history.component.html @@ -31,9 +31,7 @@

Matching History

- - Question - + Question Difficulty @@ -47,7 +45,7 @@

Matching History

- {{ history.question.title }} + {{ history.title }} {{ history.difficulty }} {{ history.topics.join(', ') }} {{ history.collaborator }} @@ -73,10 +71,10 @@

Matching History

transitionOptions="200ms cubic-bezier(0, 0, 0.2, 1)" (onHide)="closePanel()"> -

{{ panelHistory?.question?.title }}

+

{{ panelHistory?.title }}

-

{{ panelHistory?.question?.description }}

+

{{ panelHistory?.description }}

Submitted Solution

diff --git a/frontend/src/app/history/history.model.ts b/frontend/src/app/history/history.model.ts index d9cf1d1c85..a10893323e 100644 --- a/frontend/src/app/history/history.model.ts +++ b/frontend/src/app/history/history.model.ts @@ -10,7 +10,8 @@ export interface MatchingHistory { id: string; roomId: string; collaborator: string; // collaborator username - question: Question; // question + title: string; + description: string; difficulty: DifficultyLevels; // question difficulty topics: string[]; // question topics status: HistoryStatus; // status of the session From ee3ad0b056a5fcf6affc7d345db4e56d045ad656 Mon Sep 17 00:00:00 2001 From: Samuel Lim Date: Thu, 14 Nov 2024 03:07:13 +0800 Subject: [PATCH 10/10] Fix filter --- frontend/src/app/history/history.component.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/app/history/history.component.html b/frontend/src/app/history/history.component.html index 76c5638c47..050c8801c4 100644 --- a/frontend/src/app/history/history.component.html +++ b/frontend/src/app/history/history.component.html @@ -10,7 +10,7 @@ [paginator]="true" [rows]="10" [rowsPerPageOptions]="[10, 25, 50]" - [globalFilterFields]="['question', 'difficulty', 'topics', 'collaborator', 'status', 'time']" + [globalFilterFields]="['title', 'difficulty', 'topics', 'collaborator', 'status', 'time']" styleClass="p-datatable-gridlines-striped" (sortFunction)="customSort($event)" [customSort]="true">