Skip to content

Commit 8df92ef

Browse files
authored
Show spinner when confirming dialog action (hestiacp#3517)
* Show spinner when confirming action * Tidy * Bump dependencies
1 parent c135987 commit 8df92ef

File tree

15 files changed

+103
-113
lines changed

15 files changed

+103
-113
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"@prettier/plugin-php": "^0.19.4",
3030
"@typescript-eslint/eslint-plugin": "^5.59.1",
3131
"@typescript-eslint/parser": "^5.59.1",
32-
"cssnano": "^6.0.0",
32+
"cssnano": "^6.0.1",
3333
"esbuild": "^0.17.18",
3434
"eslint": "^8.39.0",
3535
"eslint-config-prettier": "^8.8.0",
@@ -50,7 +50,7 @@
5050
"stylelint": "^15.6.0",
5151
"stylelint-config-standard": "^33.0.0",
5252
"typescript": "^5.0.4",
53-
"vitepress": "1.0.0-alpha.74",
53+
"vitepress": "1.0.0-alpha.75",
5454
"vue": "^3.2.47"
5555
},
5656
"browserslist": [

web/css/src/themes/dark.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -735,7 +735,7 @@ strong {
735735
/* Spinner
736736
========================================================================== */
737737

738-
.fullscreen-loader {
738+
.spinner-overlay {
739739
background-color: rgb(0 0 0 / 50%);
740740
}
741741

web/css/src/themes/default.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2200,7 +2200,7 @@
22002200
/* Spinner
22012201
========================================================================== */
22022202

2203-
.fullscreen-loader {
2203+
.spinner-overlay {
22042204
position: fixed;
22052205
inset: 0;
22062206
display: flex;
@@ -2209,7 +2209,7 @@
22092209
padding: 50px;
22102210
background-color: rgb(0 0 0 / 10%);
22112211
font-size: 50px;
2212-
z-index: 9999;
2212+
z-index: 4;
22132213
visibility: hidden;
22142214
opacity: 0;
22152215
transition: opacity 0.2s ease, visibility 0s 0.2s;

web/css/themes/dark.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/css/themes/default.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/js/dist/main.min.js

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

web/js/dist/main.min.js.map

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { createConfirmationDialog } from './helpers';
22

3-
// Adds listeners to .js-confirm-action links and intercepts them with a confirmation dialog
4-
export default function handleConfirmationDialogs() {
3+
// Listen to .js-confirm-action links and intercept clicks with a confirmation dialog
4+
export default function handleConfirmAction() {
55
document.querySelectorAll('.js-confirm-action').forEach((triggerLink) => {
66
triggerLink.addEventListener('click', (evt) => {
77
evt.preventDefault();
@@ -10,7 +10,7 @@ export default function handleConfirmationDialogs() {
1010
const message = triggerLink.dataset.confirmMessage;
1111
const targetUrl = triggerLink.getAttribute('href');
1212

13-
createConfirmationDialog({ title, message, targetUrl });
13+
createConfirmationDialog({ title, message, targetUrl, spinner: true });
1414
});
1515
});
1616
}

web/js/src/discardAllMail.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// "Discard all mail" checkbox behavior
1+
// "Discard all mail" checkbox behavior on Add/Edit Mail Account pages
22
export default function handleDiscardAllMail() {
33
const discardAllMailCheckbox = document.querySelector('.js-discard-all-mail');
44

@@ -7,9 +7,8 @@ export default function handleDiscardAllMail() {
77
}
88

99
discardAllMailCheckbox.addEventListener('click', () => {
10-
// TODO: Use .js- class instead of #id
11-
const forwardToTextarea = document.querySelector('#v_fwd');
12-
const doNotStoreCheckbox = document.querySelector('#v_fwd_for');
10+
const forwardToTextarea = document.querySelector('.js-forward-to-textarea');
11+
const doNotStoreCheckbox = document.querySelector('.js-do-not-store-checkbox');
1312

1413
if (discardAllMailCheckbox.checked) {
1514
// Disable "Forward to" textarea

web/js/src/helpers.js

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,16 @@ export function getCssVariable(variableName) {
3434

3535
// Shows the loading spinner overlay
3636
export function showSpinner() {
37-
document.querySelector('.js-fullscreen-loader').classList.add('active');
37+
document.querySelector('.js-spinner').classList.add('active');
3838
}
3939

4040
// Creates a confirmation <dialog> on the fly
41-
export function createConfirmationDialog({ title, message = 'Are you sure?', targetUrl }) {
41+
export function createConfirmationDialog({
42+
title,
43+
message = 'Are you sure?',
44+
targetUrl,
45+
spinner = false,
46+
}) {
4247
// Create the dialog
4348
const dialog = document.createElement('dialog');
4449
dialog.classList.add('modal');
@@ -80,6 +85,9 @@ export function createConfirmationDialog({ title, message = 'Are you sure?', tar
8085
// Define named functions to handle the event listeners
8186
const handleConfirm = () => {
8287
if (targetUrl) {
88+
if (spinner) {
89+
showSpinner();
90+
}
8391
window.location.href = targetUrl;
8492
}
8593

0 commit comments

Comments
 (0)