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:
Aditya
2026-05-12 14:24:47 +05:30
co-authored by Claude Opus 4.7
parent 09fab88451
commit 1631cd3383
7 changed files with 261 additions and 28 deletions
@@ -0,0 +1,23 @@
<!--
Copyright since 2025 Mifos Initiative
This Source Code Form is subject to the terms of the Mozilla Public
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/.
-->
<mat-dialog-content class="sd-content">
<div class="sd-icon">
<fa-icon icon="check-circle"></fa-icon>
</div>
<h2 class="sd-title">{{ data.title || 'Success' }}</h2>
@if (data.message) {
<p class="sd-message">{{ data.message }}</p>
}
</mat-dialog-content>
<mat-dialog-actions align="center" class="sd-actions">
<button mat-flat-button color="primary" mat-dialog-close>
{{ data.buttonLabel || 'OK' }}
</button>
</mat-dialog-actions>
@@ -0,0 +1,76 @@
/**
* Copyright since 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* 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: 460px;
font-family: inherit;
color: #0f172a;
}
.sd-content {
display: flex !important;
flex-direction: column;
align-items: center;
text-align: center;
gap: 14px;
padding: 32px 28px 8px !important;
background: linear-gradient(180deg, #f0fdf4 0%, #fff 70%);
}
.sd-icon {
width: 76px;
height: 76px;
border-radius: 50%;
background: #dcfce7;
color: #16a34a;
display: inline-flex;
align-items: center;
justify-content: center;
font-size: 38px;
box-shadow: 0 0 0 6px rgb(22 163 74 / 10%);
animation: sd-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}
@keyframes sd-pop {
0% {
transform: scale(0.6);
opacity: 0;
}
100% {
transform: scale(1);
opacity: 1;
}
}
.sd-title {
margin: 4px 0 0;
font-size: 20px;
font-weight: 700;
color: #0f172a;
}
.sd-message {
margin: 0;
color: #475569;
font-size: 14px;
line-height: 1.5;
max-width: 360px;
}
.sd-actions {
padding: 16px 24px 22px !important;
background: #fff;
justify-content: center !important;
button {
min-width: 120px;
}
}
@@ -0,0 +1,41 @@
/**
* Copyright since 2025 Mifos Initiative
*
* This Source Code Form is subject to the terms of the Mozilla Public
* 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/.
*/
import { Component, inject } from '@angular/core';
import {
MatDialogRef,
MAT_DIALOG_DATA,
MatDialogContent,
MatDialogActions,
MatDialogClose
} from '@angular/material/dialog';
import { MatButton } from '@angular/material/button';
import { FaIconComponent } from '@fortawesome/angular-fontawesome';
export interface SuccessDialogData {
title?: string;
message?: string;
buttonLabel?: string;
}
@Component({
selector: 'mifosx-success-dialog',
templateUrl: './success-dialog.component.html',
styleUrls: ['./success-dialog.component.scss'],
imports: [
MatDialogContent,
MatDialogActions,
MatDialogClose,
MatButton,
FaIconComponent
]
})
export class SuccessDialogComponent {
dialogRef = inject<MatDialogRef<SuccessDialogComponent>>(MatDialogRef);
data = inject<SuccessDialogData>(MAT_DIALOG_DATA);
}