From 29e600a9222e71dbb69e8c8fb7a6fc843a49b5bb Mon Sep 17 00:00:00 2001 From: Limbo2332 Date: Fri, 29 Sep 2023 17:07:16 +0300 Subject: [PATCH 1/6] fixed main adaptive design --- .../app/modules/main/main-page/main-page.component.html | 2 +- .../app/modules/main/main-page/main-page.component.sass | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/modules/main/main-page/main-page.component.html b/frontend/src/app/modules/main/main-page/main-page.component.html index 1bba8d689..51144223c 100644 --- a/frontend/src/app/modules/main/main-page/main-page.component.html +++ b/frontend/src/app/modules/main/main-page/main-page.component.html @@ -1,6 +1,6 @@
-
+
diff --git a/frontend/src/app/modules/main/main-page/main-page.component.sass b/frontend/src/app/modules/main/main-page/main-page.component.sass index 5bd16ca54..2be8dc8f3 100644 --- a/frontend/src/app/modules/main/main-page/main-page.component.sass +++ b/frontend/src/app/modules/main/main-page/main-page.component.sass @@ -1,4 +1,5 @@ @import "color-variables" +@import "screen-sizes-variables" .main-content-wrp padding: 20px 20px 30px @@ -21,5 +22,11 @@ background-color: $green &:hover background-color: $dark-green + @media (max-width: $mobile) + flex-direction: column !important + gap: 24px + & button + margin-right: 0 + .generate-challenge - margin-right: 10px \ No newline at end of file + margin-right: 10px From cc3de03528b474c926dc611d1a2eb82966ca6c67 Mon Sep 17 00:00:00 2001 From: Bohdan Date: Fri, 29 Sep 2023 18:37:33 +0300 Subject: [PATCH 2/6] Changed styles for markdown and tooltip --- .../challenge-creation.component.sass | 20 ++++++++++++++++++- .../challenges-test-page.component.html | 4 ++-- .../editor-question.component.html | 2 +- .../editor-question.component.sass | 2 +- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/modules/challenges/challenge-creation/challenge-creation.component.sass b/frontend/src/app/modules/challenges/challenge-creation/challenge-creation.component.sass index f5d2caece..8f69c96dc 100644 --- a/frontend/src/app/modules/challenges/challenge-creation/challenge-creation.component.sass +++ b/frontend/src/app/modules/challenges/challenge-creation/challenge-creation.component.sass @@ -5,7 +5,7 @@ margin: 40px 130px background-color: $deep-dark-grey border-radius: 32px - min-height: 100% + height: 100% .buttons justify-content: flex-end @@ -104,3 +104,21 @@ width: 100% & app-challenges-dropdown-select width: 80% + +.step-container + height: 85% + +:host ::ng-deep app-editor-question + height: 100% + +:host ::ng-deep .content-wrapper + height: 100% + + .markdown-wrapper + height: 60% + + .md-editor + height: 100% + + #markdown-editor + height: 100% \ No newline at end of file diff --git a/frontend/src/app/modules/challenges/challenges-test-page/challenges-test-page.component.html b/frontend/src/app/modules/challenges/challenges-test-page/challenges-test-page.component.html index 24f89e60e..cd0e31227 100644 --- a/frontend/src/app/modules/challenges/challenges-test-page/challenges-test-page.component.html +++ b/frontend/src/app/modules/challenges/challenges-test-page/challenges-test-page.component.html @@ -11,8 +11,8 @@ [customClass]="getTabClass(tab)"> -
- +
+
Help
diff --git a/frontend/src/app/modules/challenges/editor-question/editor-question.component.html b/frontend/src/app/modules/challenges/editor-question/editor-question.component.html index 4b9cfaa9e..f708d2f3e 100644 --- a/frontend/src/app/modules/challenges/editor-question/editor-question.component.html +++ b/frontend/src/app/modules/challenges/editor-question/editor-question.component.html @@ -113,7 +113,7 @@

Name and describe your question

*ngIf="inputForm.controls.description.touched && inputForm.controls.description.invalid"> {{ getErrorMessage('description') }}
-
+
Date: Fri, 29 Sep 2023 18:51:44 +0300 Subject: [PATCH 3/6] fixed modals for codefight winner and loser --- .../Services/NotificationConsumerService.cs | 3 +++ .../src/app/core/guards/codefight.guard.ts | 4 ---- .../core/hubs/notifications-hub.service.ts | 8 +++---- .../services/toastr-notifications.service.ts | 21 ++++++++++++------- .../online-editor-page.component.html | 9 -------- .../online-editor-page.component.ts | 20 +++++++++++------- .../custom-toastr-notification.component.html | 2 +- .../pie-chart/pie-chart.component.html | 2 +- .../utils/toastr/toastr-code-fight-options.ts | 6 ++++++ frontend/src/styles/global.sass | 14 +++++++++++-- 10 files changed, 53 insertions(+), 36 deletions(-) create mode 100644 frontend/src/app/shared/utils/toastr/toastr-code-fight-options.ts diff --git a/backend/LeetWars.Notifier/LeetWars.Notifier.WebAPI/Services/NotificationConsumerService.cs b/backend/LeetWars.Notifier/LeetWars.Notifier.WebAPI/Services/NotificationConsumerService.cs index 6f9675f46..14f6ccd9d 100644 --- a/backend/LeetWars.Notifier/LeetWars.Notifier.WebAPI/Services/NotificationConsumerService.cs +++ b/backend/LeetWars.Notifier/LeetWars.Notifier.WebAPI/Services/NotificationConsumerService.cs @@ -146,7 +146,10 @@ private async Task SendCodeFightResultsAsync(NotificationDto notificationDto) if (!string.IsNullOrEmpty(notificationDto.ReceiverId) && notificationDto.Sender is not null) { + notificationDto.Message = "You have won the code fight!"; await _hubContext.Clients.Groups(notificationDto.Sender.Id.ToString()).WinCodeFightAsync(notificationDto); + + notificationDto.Message = "You have lost the code fight!"; await _hubContext.Clients.Groups(notificationDto.ReceiverId).LoseCodeFightAsync(notificationDto); } } diff --git a/frontend/src/app/core/guards/codefight.guard.ts b/frontend/src/app/core/guards/codefight.guard.ts index ea499aa50..9e17d4400 100644 --- a/frontend/src/app/core/guards/codefight.guard.ts +++ b/frontend/src/app/core/guards/codefight.guard.ts @@ -48,10 +48,6 @@ export class CodefightGuard implements CanDeactivate class: 'confirm', handler: () => { this.endCodeFight(); - - this.modalRef.closed.subscribe(() => { - this.router.navigate(['/']); - }); }, }, { diff --git a/frontend/src/app/core/hubs/notifications-hub.service.ts b/frontend/src/app/core/hubs/notifications-hub.service.ts index 45bed220e..caba7b15f 100644 --- a/frontend/src/app/core/hubs/notifications-hub.service.ts +++ b/frontend/src/app/core/hubs/notifications-hub.service.ts @@ -108,13 +108,13 @@ export class NotificationHubService { this.updateUsersAfterRequestEnded(codeFight.notification); }); - this.hubConnection.on('WinCodeFightAsync', () => { - this.toastrService.showSuccess('You have won the code fight!'); + this.hubConnection.on('WinCodeFightAsync', (notification: INotificationModel) => { + this.toastrService.showCodeFightNotification(notification, 'success'); this.router.navigateByUrl('/leader/board', { state: { canLeave: true } }); }); - this.hubConnection.on('LoseCodeFightAsync', () => { - this.toastrService.showInfo('You have lost the code fight!'); + this.hubConnection.on('LoseCodeFightAsync', (notification: INotificationModel) => { + this.toastrService.showCodeFightNotification(notification, 'error'); this.router.navigateByUrl('/leader/board', { state: { canLeave: true } }); }); diff --git a/frontend/src/app/core/services/toastr-notifications.service.ts b/frontend/src/app/core/services/toastr-notifications.service.ts index f8a16d488..165b98160 100644 --- a/frontend/src/app/core/services/toastr-notifications.service.ts +++ b/frontend/src/app/core/services/toastr-notifications.service.ts @@ -1,5 +1,6 @@ import { Injectable } from '@angular/core'; import { INotificationModel } from '@shared/models/notifications/notifications'; +import { toastrCodeFightOptions } from '@shared/utils/toastr/toastr-code-fight-options'; import { ToastrService } from 'ngx-toastr'; @Injectable({ @@ -8,6 +9,12 @@ import { ToastrService } from 'ngx-toastr'; export class ToastrNotificationsService extends ToastrService { codeFightNotification: INotificationModel; + codeFightType?: 'success' | 'error'; + + private codeFightTitle = 'CodeFight'; + + private codeFightDefaultTimeOut = 10000; + showSuccess(message: string) { super.success(message, 'Success'); } @@ -24,14 +31,14 @@ export class ToastrNotificationsService extends ToastrService { super.error(message, 'Error'); } - showCodeFightNotification(notification: INotificationModel) { + showCodeFightNotification(notification: INotificationModel, codeFightType?: 'success' | 'error') { this.codeFightNotification = notification; + this.codeFightType = codeFightType; - super.show(notification.message, 'CodeFight', { - toastClass: 'custom-toast', - positionClass: 'toast-bottom-right', - progressBar: true, - timeOut: notification.showFor, - }); + super.show(notification.message, this.codeFightTitle, { + ...toastrCodeFightOptions, + toastClass: `custom-toast${codeFightType || ''}`, + timeOut: notification.showFor ?? this.codeFightDefaultTimeOut, + }, codeFightType); } } diff --git a/frontend/src/app/modules/challenges/online-editor-page/online-editor-page.component.html b/frontend/src/app/modules/challenges/online-editor-page/online-editor-page.component.html index d7ea760bf..eb4e51786 100644 --- a/frontend/src/app/modules/challenges/online-editor-page/online-editor-page.component.html +++ b/frontend/src/app/modules/challenges/online-editor-page/online-editor-page.component.html @@ -16,15 +16,6 @@ -
  • - - Submissions here -
  • - -
  • - - Output here -
  • diff --git a/frontend/src/app/modules/challenges/online-editor-page/online-editor-page.component.ts b/frontend/src/app/modules/challenges/online-editor-page/online-editor-page.component.ts index 48a56d0a8..066758672 100644 --- a/frontend/src/app/modules/challenges/online-editor-page/online-editor-page.component.ts +++ b/frontend/src/app/modules/challenges/online-editor-page/online-editor-page.component.ts @@ -18,7 +18,7 @@ import { ICodeSubmitResult } from '@shared/models/code-run/code-submit-result'; import { ICodeFightEnd } from '@shared/models/codefight/code-fight-end'; import { ITestsOutput } from '@shared/models/tests-output/tests-output'; import { IUser } from '@shared/models/user/user'; -import { take, takeUntil } from 'rxjs'; +import { switchMap, take, takeUntil } from 'rxjs'; import { editorOptions, mapLanguageName } from '../challenge-creation/challenge-creation.utils'; @@ -153,13 +153,17 @@ export class OnlineEditorPageComponent extends BaseComponent implements OnDestro } giveUpCodeFight() { - this.codeFightGuard.openModal().closed.subscribe(() => { - const codeFightEnd: ICodeFightEnd = { - isWinner: false, - senderId: this.user.id, - }; - - this.codeFightService.sendCodeFightEnd(codeFightEnd).subscribe(); + this.codeFightGuard.openModal().closed.pipe( + switchMap(() => { + const codeFightEnd: ICodeFightEnd = { + isWinner: false, + senderId: this.user.id, + }; + + return this.codeFightService.sendCodeFightEnd(codeFightEnd); + }), + ).subscribe(() => { + this.router.navigate(['/']); }); } diff --git a/frontend/src/app/shared/components/custom-toastr-notification/custom-toastr-notification.component.html b/frontend/src/app/shared/components/custom-toastr-notification/custom-toastr-notification.component.html index 037aeb9e5..fba13fc68 100644 --- a/frontend/src/app/shared/components/custom-toastr-notification/custom-toastr-notification.component.html +++ b/frontend/src/app/shared/components/custom-toastr-notification/custom-toastr-notification.component.html @@ -32,7 +32,7 @@ logo

    {{ message }}

    -
    +
    diff --git a/frontend/src/app/shared/components/pie-chart/pie-chart.component.html b/frontend/src/app/shared/components/pie-chart/pie-chart.component.html index 2de2c7c79..0ca5f4454 100644 --- a/frontend/src/app/shared/components/pie-chart/pie-chart.component.html +++ b/frontend/src/app/shared/components/pie-chart/pie-chart.component.html @@ -9,6 +9,6 @@
    {{ currentNumber }}
    -

    {{ centerText }}

    +

    {{ centerText }}

    diff --git a/frontend/src/app/shared/utils/toastr/toastr-code-fight-options.ts b/frontend/src/app/shared/utils/toastr/toastr-code-fight-options.ts new file mode 100644 index 000000000..a2d4c7831 --- /dev/null +++ b/frontend/src/app/shared/utils/toastr/toastr-code-fight-options.ts @@ -0,0 +1,6 @@ +import { IndividualConfig } from 'ngx-toastr'; + +export const toastrCodeFightOptions: Partial = { + positionClass: 'toast-bottom-right', + progressBar: true, +}; diff --git a/frontend/src/styles/global.sass b/frontend/src/styles/global.sass index 4d333a7a0..8e6e2fc21 100644 --- a/frontend/src/styles/global.sass +++ b/frontend/src/styles/global.sass @@ -36,12 +36,22 @@ ul, p .toast-container position: fixed -.custom-toast +.custom-toast, +.custom-toastsuccess, +.custom-toasterror background-color: $charcoal-grey width: 400px !important - border: 2px solid $green cursor: default +.custom-toast + border: 2px solid $green + +.custom-toastsuccess + box-shadow: $fresh-green 0 0 4px 4px + +.custom-toasterror + box-shadow: $light-red 0 0 4px 4px + :disabled cursor: default From 45235887fc914caa91c3eb5517cea97359c556f4 Mon Sep 17 00:00:00 2001 From: Limbo2332 Date: Fri, 29 Sep 2023 19:10:53 +0300 Subject: [PATCH 4/6] fixed username cyrrylic --- .../LeetWars.Core/LeetWars.Core.BLL/Services/UserService.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/backend/LeetWars.Core/LeetWars.Core.BLL/Services/UserService.cs b/backend/LeetWars.Core/LeetWars.Core.BLL/Services/UserService.cs index fb1e90393..d21834d3b 100644 --- a/backend/LeetWars.Core/LeetWars.Core.BLL/Services/UserService.cs +++ b/backend/LeetWars.Core/LeetWars.Core.BLL/Services/UserService.cs @@ -20,6 +20,7 @@ using Microsoft.EntityFrameworkCore; using System.Linq.Expressions; using LeetWars.Core.Common.DTO.UserPrefferences; +using System.Net; namespace LeetWars.Core.BLL.Services; @@ -200,7 +201,9 @@ public async Task> GetLeaderBoardAsync(LeaderBoardPageSettingsDto if(page.UserName is not null) { - query = query.Where(u => u.UserName.ToLower().Contains(page.UserName.ToLower())); + string userName = WebUtility.UrlDecode(page.UserName); + + query = query.Where(u => u.UserName.ToLower().Contains(userName.ToLower())); } if (page.HasFriends) From 49f891410f7e8da510eb000219d0785a87da153b Mon Sep 17 00:00:00 2001 From: Bohdan Date: Fri, 29 Sep 2023 19:47:32 +0300 Subject: [PATCH 5/6] Removed help tabs --- .../challenges-test-page.component.html | 4 ---- .../challenges-test-page.component.sass | 18 ----------------- .../editor-question.component.html | 6 +----- .../editor-question.component.sass | 3 +-- .../editor-question.component.ts | 4 ---- .../solution-page.component.html | 4 ---- .../solution-page.component.sass | 20 ------------------- frontend/src/app/shared/enums/tab-type.ts | 1 - 8 files changed, 2 insertions(+), 58 deletions(-) diff --git a/frontend/src/app/modules/challenges/challenges-test-page/challenges-test-page.component.html b/frontend/src/app/modules/challenges/challenges-test-page/challenges-test-page.component.html index cd0e31227..38a9ce607 100644 --- a/frontend/src/app/modules/challenges/challenges-test-page/challenges-test-page.component.html +++ b/frontend/src/app/modules/challenges/challenges-test-page/challenges-test-page.component.html @@ -11,10 +11,6 @@ [customClass]="getTabClass(tab)"> -
    - -
    Help
    -