Skip to content

Commit 008cac7

Browse files
committed
Perf: Optimize prompt message style
1 parent 65b8431 commit 008cac7

9 files changed

Lines changed: 67 additions & 25 deletions

File tree

src/app/elements/asset-tree/asset-tree.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -582,13 +582,13 @@ export class ElementAssetTreeComponent implements OnInit {
582582
const i = this.favoriteAssets.indexOf(assetId);
583583
this.favoriteAssets.splice(i, 1);
584584
const msg = this._i18n.instant('Disfavor') + ' ' + this._i18n.instant('success');
585-
this._toastr.success(msg, '');
585+
this._toastr.success(msg, '', { nzClass: 'custom-success-notification' });
586586
});
587587
} else {
588588
this._http.favoriteAsset(assetId, true).subscribe(() => {
589589
this.favoriteAssets.push(assetId);
590590
const msg = this._i18n.instant('Favorite') + ' ' + this._i18n.instant('success');
591-
this._toastr.success(msg, '');
591+
this._toastr.success(msg, '', { nzClass: 'custom-success-notification' });
592592
});
593593
}
594594
}
Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,16 @@
1-
<div class="content">
2-
<p>
3-
{{ "DownloadClientMsg" | translate }}
4-
</p>
5-
<label nz-checkbox name="auto-login" [(ngModel)]="ignoreRemind">
6-
{{ "Don't prompt again" | translate }}
7-
</label>
1+
<div class="download-dialog-content">
2+
<div class="message-section">
3+
<div class="icon-container">
4+
<i nz-icon nzType="download" nzTheme="outline"></i>
5+
</div>
6+
<div class="message-text">
7+
{{ "DownloadClientMsg" | translate }}
8+
</div>
9+
</div>
10+
11+
<div class="options-section">
12+
<label nz-checkbox name="auto-login" [(ngModel)]="ignoreRemind" class="reminder-checkbox">
13+
{{ "Don't prompt again" | translate }}
14+
</label>
15+
</div>
816
</div>
Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
11

2-
.content {
3-
padding: 24px;
4-
}
2+
.download-dialog-content {
3+
.message-section {
4+
display: flex;
5+
align-items: flex-start;
6+
gap: 12px;
7+
8+
.icon-container {
9+
cursor: pointer;
10+
}
511

12+
.message-text {
13+
flex: 1;
14+
font-size: 15px;
15+
color: #262626;
16+
}
17+
}
618

7-
.connect-type-group {
8-
border: solid #cbc9c9 1px;
9-
padding: 5px
19+
.options-section {
20+
display: flex;
21+
align-items: center;
22+
justify-content: flex-end;
23+
margin-top: 12px;
24+
}
1025
}
26+

src/app/elements/content/command-dialog/command-dialog.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ export class ElementCommandDialogComponent implements OnInit {
4343
this._http.addQuickCommand(data).subscribe(
4444
async () => {
4545
const msg = await this._i18n.t('Save success');
46-
this._toastr.success('' + msg, '', {nzDuration: 2000});
46+
this._toastr.success('' + msg, '', {nzDuration: 2000, nzClass: 'custom-success-notification'});
4747
this.dialogRef.close(this.command);
4848
},
4949
(error) => {
5050
const msg = 'name:' + error.error.name;
51-
this._toastr.error(msg, '');
51+
this._toastr.error(msg, '', { nzClass: 'custom-error-notification' });
5252
}
5353
);
5454
}

src/app/elements/content/content-window/guide/guide.component.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export class ElementConnectorGuideComponent implements OnInit {
5959
} else {
6060
msg = error.error.msg || error.error.is_reusable || error.message;
6161
}
62-
this._toastr.error(msg, '', { nzDuration: 2000 });
62+
this._toastr.error(msg, '', { nzDuration: 2000, nzClass: 'custom-error-notification' });
6363
}
6464
);
6565
}
@@ -82,7 +82,7 @@ export class ElementConnectorGuideComponent implements OnInit {
8282

8383
async onCopySuccess(evt) {
8484
const msg = await this._i18n.t('Copied');
85-
this._toastr.success(msg, '');
85+
this._toastr.success(msg, '', { nzClass: 'custom-success-notification' });
8686
}
8787

8888
onHoverClipRef(evt) {

src/app/pages/monitor/monitor.component.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ export class PagesMonitorComponent implements OnInit {
108108
const resumeTaskMsg = await this._i18n.t('Resume task has been send');
109109
const session_ids = res['ok'];
110110
const msg = this.isPaused ? resumeTaskMsg : pauseTaskMsg;
111-
this._toastr.success(msg, '');
111+
this._toastr.success(msg, '', { nzClass: 'custom-success-notification' });
112112
if (session_ids.indexOf(this.sessionID) !== -1) {
113113

114114
}

src/app/services/connect-token/acl-dialog/acl-dialog.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ <h3 nz-typography nzTitle>{{ content.title | translate }}</h3>
33

44
<div class="nz-modal-content">
55
<div [class.error-message]="content.isError">
6-
<nz-alert nzType="info" class="content-message" [nzDescription]="alertContent">
6+
<nz-alert [nzType]="content.isError ? 'error' : 'info'" class="content-message" [nzDescription]="alertContent">
77
<ng-template #alertContent>
88
<div>{{ content.message | translate }}</div>
99

src/app/services/connect-token/acl-dialog/acl-dialog.component.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ export class ElementACLDialogComponent implements OnInit {
8989

9090
async onCopySuccess(evt) {
9191
const msg = await this._i18n.t('Copied');
92-
this._toastr.success(msg, '');
92+
this._toastr.success(msg, '', { nzClass: 'custom-success-notification' });
9393
writeText(evt);
9494
}
9595

@@ -119,7 +119,7 @@ export class ElementACLDialogComponent implements OnInit {
119119
this.content = this.getDialogContent(this.code);
120120
} else {
121121
const msg = await this._i18n.t('Face verify success');
122-
this._toastr.success(msg, '');
122+
this._toastr.success(msg, '', { nzClass: 'custom-success-notification' });
123123
this.dialogRef.close(connToken);
124124
this.faceService.openFaceMonitor();
125125
}
@@ -174,7 +174,7 @@ export class ElementACLDialogComponent implements OnInit {
174174
this.content = this.getDialogContent(this.code);
175175
} else {
176176
const msg = await this._i18n.t('Face verify success');
177-
this._toastr.success(msg, '');
177+
this._toastr.success(msg, '', { nzClass: 'custom-success-notification' });
178178
this.dialogRef.close(connToken);
179179
}
180180
}
@@ -274,10 +274,12 @@ export class ElementACLDialogComponent implements OnInit {
274274
this.code = 'ticket_review_pending';
275275
return;
276276
}
277+
277278
const state = ticket.state.value;
279+
278280
if (state === 'approved') {
279281
const msg = await this._i18n.t('Login review approved');
280-
this._toastr.success(msg, '');
282+
this._toastr.success(msg, '', { nzClass: 'custom-success-notification' } );
281283
this.dialogRef.close(this.connectionToken);
282284
} else if (state === 'rejected') {
283285
this.code = 'ticket_review_rejected';

src/sass/ant.less

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -197,3 +197,19 @@
197197
.ant-splitter-bar-dragger-active::before {
198198
background: #5f5f5f;
199199
}
200+
201+
.ant-notification-notice {
202+
border-radius: 0.5rem;
203+
204+
&.custom-success-notification {
205+
background-color: #50a352;
206+
}
207+
208+
&.custom-error-notification {
209+
background-color: #f56c6c;
210+
}
211+
212+
.ant-notification-notice-content .ant-notification-notice-message {
213+
color: #fff;
214+
}
215+
}

0 commit comments

Comments
 (0)