feat(dialogs): polished success + error modals replace bare snackbar/dialog
Add reusable SuccessDialogComponent (green check, gradient hero, pop-in animation) and redesign ErrorDialogComponent to match (red exclamation, clear title, centered OK). Wire edit-user submit flow to the new dialogs: success defers navigation until the user confirms, errors surface the backend message in the styled modal instead of a grey snackbar. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
09fab88451
commit
1631cd3383
@@ -6,17 +6,19 @@
|
||||
file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
-->
|
||||
|
||||
<h1 mat-dialog-title>{{ 'Error Log' | translate }}</h1>
|
||||
|
||||
<div mat-dialog-content>
|
||||
<mat-dialog-content class="ed-content">
|
||||
<div class="ed-icon">
|
||||
<fa-icon icon="exclamation-circle"></fa-icon>
|
||||
</div>
|
||||
<h2 class="ed-title">We encountered an issue. Please try again.</h2>
|
||||
@if (!showAsCode) {
|
||||
<p>{{ displayData }}</p>
|
||||
<p class="ed-message">{{ displayData }}</p>
|
||||
}
|
||||
@if (showAsCode) {
|
||||
<span [innerHTML]="sanitizedData"></span>
|
||||
<div class="ed-code" [innerHTML]="sanitizedData"></div>
|
||||
}
|
||||
</div>
|
||||
</mat-dialog-content>
|
||||
|
||||
<mat-dialog-actions align="left">
|
||||
<button mat-raised-button mat-dialog-close>{{ 'Cancel' | translate }}</button>
|
||||
<mat-dialog-actions align="center" class="ed-actions">
|
||||
<button mat-flat-button color="warn" mat-dialog-close>OK</button>
|
||||
</mat-dialog-actions>
|
||||
|
||||
@@ -5,3 +5,87 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
:host {
|
||||
display: block;
|
||||
min-width: 380px;
|
||||
max-width: 480px;
|
||||
font-family: inherit;
|
||||
color: #0f172a;
|
||||
}
|
||||
|
||||
.ed-content {
|
||||
display: flex !important;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
gap: 14px;
|
||||
padding: 32px 28px 8px !important;
|
||||
background: linear-gradient(180deg, #fef2f2 0%, #fff 70%);
|
||||
}
|
||||
|
||||
.ed-icon {
|
||||
width: 76px;
|
||||
height: 76px;
|
||||
border-radius: 50%;
|
||||
background: #fee2e2;
|
||||
color: #dc2626;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 38px;
|
||||
box-shadow: 0 0 0 6px rgb(220 38 38 / 10%);
|
||||
animation: ed-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
|
||||
}
|
||||
|
||||
@keyframes ed-pop {
|
||||
0% {
|
||||
transform: scale(0.6);
|
||||
opacity: 0;
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: scale(1);
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.ed-title {
|
||||
margin: 4px 0 0;
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
color: #0f172a;
|
||||
}
|
||||
|
||||
.ed-message {
|
||||
margin: 0;
|
||||
color: #475569;
|
||||
font-size: 14px;
|
||||
line-height: 1.55;
|
||||
max-width: 380px;
|
||||
word-break: break-word;
|
||||
}
|
||||
|
||||
.ed-code {
|
||||
width: 100%;
|
||||
max-height: 320px;
|
||||
overflow: auto;
|
||||
text-align: left;
|
||||
background: #0f172a;
|
||||
color: #e2e8f0;
|
||||
border-radius: 8px;
|
||||
padding: 12px 14px;
|
||||
font-family: 'SF Mono', Menlo, Consolas, monospace;
|
||||
font-size: 12.5px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.ed-actions {
|
||||
padding: 16px 24px 22px !important;
|
||||
background: #fff;
|
||||
justify-content: center !important;
|
||||
|
||||
button {
|
||||
min-width: 120px;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@ import { Component, OnInit, SecurityContext, inject } from '@angular/core';
|
||||
import {
|
||||
MatDialogRef,
|
||||
MAT_DIALOG_DATA,
|
||||
MatDialogTitle,
|
||||
MatDialogContent,
|
||||
MatDialogActions,
|
||||
MatDialogClose
|
||||
} from '@angular/material/dialog';
|
||||
import { CdkScrollable } from '@angular/cdk/scrolling';
|
||||
import { DomSanitizer, SafeHtml } from '@angular/platform-browser';
|
||||
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
|
||||
import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
|
||||
@Component({
|
||||
@@ -26,11 +26,11 @@ import { STANDALONE_SHARED_IMPORTS } from 'app/standalone-shared.module';
|
||||
styleUrls: ['./error-dialog.component.scss'],
|
||||
imports: [
|
||||
...STANDALONE_SHARED_IMPORTS,
|
||||
MatDialogTitle,
|
||||
CdkScrollable,
|
||||
MatDialogContent,
|
||||
MatDialogActions,
|
||||
MatDialogClose
|
||||
MatDialogClose,
|
||||
FaIconComponent
|
||||
]
|
||||
})
|
||||
export class ErrorDialogComponent {
|
||||
|
||||
Reference in New Issue
Block a user