minor UI fix
This commit is contained in:
parent
f210f51fc3
commit
1c3dabed86
@ -1001,11 +1001,11 @@ smNotifications.innerHTML = `
|
|||||||
}
|
}
|
||||||
.icon--success {
|
.icon--success {
|
||||||
fill: var(--green);
|
fill: var(--green);
|
||||||
}
|
}
|
||||||
.icon--failure,
|
.icon--failure,
|
||||||
.icon--error {
|
.icon--error {
|
||||||
fill: var(--danger-color);
|
fill: var(--danger-color);
|
||||||
}
|
}
|
||||||
.close{
|
.close{
|
||||||
height: 2rem;
|
height: 2rem;
|
||||||
width: 2rem;
|
width: 2rem;
|
||||||
@ -1117,13 +1117,13 @@ customElements.define('sm-notifications', class extends HTMLElement {
|
|||||||
|
|
||||||
createNotification(message, options = {}) {
|
createNotification(message, options = {}) {
|
||||||
const { pinned = false, icon = '', action } = options;
|
const { pinned = false, icon = '', action } = options;
|
||||||
const notification = document.createElement('output')
|
const notification = document.createElement('div')
|
||||||
notification.id = this.randString(8)
|
notification.id = this.randString(8)
|
||||||
notification.classList.add('notification');
|
notification.classList.add('notification');
|
||||||
let composition = ``;
|
let composition = ``;
|
||||||
composition += `
|
composition += `
|
||||||
<div class="icon-container">${icon}</div>
|
<div class="icon-container">${icon}</div>
|
||||||
<p>${message}</p>
|
<output>${message}</output>
|
||||||
`;
|
`;
|
||||||
if (action) {
|
if (action) {
|
||||||
composition += `
|
composition += `
|
||||||
@ -1177,6 +1177,7 @@ customElements.define('sm-notifications', class extends HTMLElement {
|
|||||||
}
|
}
|
||||||
|
|
||||||
removeNotification(notification, direction = 'left') {
|
removeNotification(notification, direction = 'left') {
|
||||||
|
if (!notification) return;
|
||||||
const sign = direction === 'left' ? '-' : '+';
|
const sign = direction === 'left' ? '-' : '+';
|
||||||
notification.animate([
|
notification.animate([
|
||||||
{
|
{
|
||||||
@ -1218,8 +1219,10 @@ customElements.define('sm-notifications', class extends HTMLElement {
|
|||||||
|
|
||||||
this.mediaQuery.addEventListener('change', this.handleOrientationChange);
|
this.mediaQuery.addEventListener('change', this.handleOrientationChange);
|
||||||
this.notificationPanel.addEventListener('pointerdown', e => {
|
this.notificationPanel.addEventListener('pointerdown', e => {
|
||||||
if (e.target.closest('.notification')) {
|
if (e.target.closest('.close')) {
|
||||||
this.swipeThreshold = this.clientWidth / 2;
|
this.removeNotification(e.target.closest('.notification'));
|
||||||
|
} else if (e.target.closest('.notification')) {
|
||||||
|
this.swipeThreshold = e.target.closest('.notification').getBoundingClientRect().width / 2;
|
||||||
this.currentTarget = e.target.closest('.notification');
|
this.currentTarget = e.target.closest('.notification');
|
||||||
this.currentTarget.setPointerCapture(e.pointerId);
|
this.currentTarget.setPointerCapture(e.pointerId);
|
||||||
this.startTime = Date.now();
|
this.startTime = Date.now();
|
||||||
@ -1262,12 +1265,6 @@ customElements.define('sm-notifications', class extends HTMLElement {
|
|||||||
this.notificationPanel.releasePointerCapture(e.pointerId);
|
this.notificationPanel.releasePointerCapture(e.pointerId);
|
||||||
this.currentX = 0;
|
this.currentX = 0;
|
||||||
});
|
});
|
||||||
this.notificationPanel.addEventListener('click', e => {
|
|
||||||
if (e.target.closest('.close')) {
|
|
||||||
this.removeNotification(e.target.closest('.notification'));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
const observer = new MutationObserver(mutationList => {
|
const observer = new MutationObserver(mutationList => {
|
||||||
mutationList.forEach(mutation => {
|
mutationList.forEach(mutation => {
|
||||||
if (mutation.type === 'childList') {
|
if (mutation.type === 'childList') {
|
||||||
|
|||||||
@ -1515,16 +1515,15 @@
|
|||||||
console.error(e)
|
console.error(e)
|
||||||
})
|
})
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
|
console.error(error)
|
||||||
notify(`Error sending transaction \n ${error}`, 'error');
|
notify(`Error sending transaction \n ${error}`, 'error');
|
||||||
}).finally(_ => {
|
}).finally(_ => {
|
||||||
buttonLoader('send_transaction', false)
|
buttonLoader('send_transaction', false)
|
||||||
})
|
})
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
notify(err, 'error')
|
notify(err, 'error')
|
||||||
}).finally(() => {
|
|
||||||
buttonLoader('send_transaction', false)
|
buttonLoader('send_transaction', false)
|
||||||
})
|
})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// detect if given string is a bitcoin transaction id
|
// detect if given string is a bitcoin transaction id
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user