Replace native confirms with Ladill custom dialogs.
Deploy Ladill Give / deploy (push) Successful in 39s
Deploy Ladill Give / deploy (push) Successful in 39s
This commit is contained in:
@@ -33,6 +33,10 @@ export function ladillNeedsTopup(balance, price) {
|
||||
return normalizedBalance <= 0 || normalizedBalance < normalizedPrice;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alpine store mirrors window.ladillConfirm (defined in partials/confirm-prompt).
|
||||
* Prefer window.ladillConfirm for new code — it works without Alpine and powers data-confirm forms.
|
||||
*/
|
||||
export function registerLadillConfirmStore(Alpine) {
|
||||
Alpine.store('ladillConfirm', {
|
||||
open: false,
|
||||
@@ -44,6 +48,11 @@ export function registerLadillConfirmStore(Alpine) {
|
||||
_resolve: null,
|
||||
|
||||
ask(options = {}) {
|
||||
// Delegate to the global custom dialog when available (no double UI).
|
||||
if (typeof window.ladillConfirm === 'function' && window.__ladillConfirmInstalled) {
|
||||
return window.ladillConfirm(options);
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
this.title = options.title || 'Are you sure?';
|
||||
this.message = options.message || '';
|
||||
@@ -65,7 +74,9 @@ export function registerLadillConfirmStore(Alpine) {
|
||||
},
|
||||
});
|
||||
|
||||
window.ladillConfirm = (options = {}) => Alpine.store('ladillConfirm').ask(options);
|
||||
if (typeof window.ladillConfirm !== 'function') {
|
||||
window.ladillConfirm = (options = {}) => Alpine.store('ladillConfirm').ask(options);
|
||||
}
|
||||
}
|
||||
|
||||
export function registerLadillModalHelpers() {
|
||||
|
||||
Reference in New Issue
Block a user