mirror of
https://github.com/Qortal/qortal-ui.git
synced 2025-03-27 15:55:55 +00:00
fix spinner for saving
This commit is contained in:
parent
a56266b61f
commit
55b9e8d343
@ -816,10 +816,7 @@ class ProfileQdn extends connect(store)(LitElement) {
|
|||||||
? html`
|
? html`
|
||||||
<mwc-icon
|
<mwc-icon
|
||||||
id="profile-icon"
|
id="profile-icon"
|
||||||
class=${Object.values(this.valuesToBeSavedOnQdn)
|
class=${'notActive'}
|
||||||
.length > 0 || this.resourceExists === false
|
|
||||||
? 'active'
|
|
||||||
: 'notActive'}
|
|
||||||
@click=${() => {
|
@click=${() => {
|
||||||
const target = this.shadowRoot.getElementById(
|
const target = this.shadowRoot.getElementById(
|
||||||
'popover-notification'
|
'popover-notification'
|
||||||
|
@ -7,6 +7,8 @@ import WebWorker from '../WebWorkerFile.js';
|
|||||||
import '@polymer/paper-spinner/paper-spinner-lite.js';
|
import '@polymer/paper-spinner/paper-spinner-lite.js';
|
||||||
import '@vaadin/tooltip';
|
import '@vaadin/tooltip';
|
||||||
import { get, translate } from 'lit-translate';
|
import { get, translate } from 'lit-translate';
|
||||||
|
import ShortUniqueId from 'short-unique-id';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
decryptGroupData,
|
decryptGroupData,
|
||||||
|
|
||||||
@ -18,6 +20,7 @@ import {
|
|||||||
import { publishData } from '../../../../plugins/plugins/utils/publish-image.js';
|
import { publishData } from '../../../../plugins/plugins/utils/publish-image.js';
|
||||||
import { parentEpml } from '../show-plugin.js';
|
import { parentEpml } from '../show-plugin.js';
|
||||||
import '../notification-view/popover.js';
|
import '../notification-view/popover.js';
|
||||||
|
import { setNewTab } from '../../redux/app/app-actions.js';
|
||||||
|
|
||||||
class SaveSettingsQdn extends connect(store)(LitElement) {
|
class SaveSettingsQdn extends connect(store)(LitElement) {
|
||||||
static get properties() {
|
static get properties() {
|
||||||
@ -29,6 +32,9 @@ class SaveSettingsQdn extends connect(store)(LitElement) {
|
|||||||
resourceExists: { type: Boolean },
|
resourceExists: { type: Boolean },
|
||||||
isSaving: { type: Boolean },
|
isSaving: { type: Boolean },
|
||||||
fee: { type: Object },
|
fee: { type: Object },
|
||||||
|
hasName: {type: Boolean},
|
||||||
|
error: {type: String},
|
||||||
|
name: {type: String}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -49,6 +55,11 @@ class SaveSettingsQdn extends connect(store)(LitElement) {
|
|||||||
this.valuesToBeSavedOnQdn = {};
|
this.valuesToBeSavedOnQdn = {};
|
||||||
this.isSaving = false;
|
this.isSaving = false;
|
||||||
this.fee = null;
|
this.fee = null;
|
||||||
|
this.hasName = false;
|
||||||
|
this.error = "";
|
||||||
|
this.uid = new ShortUniqueId();
|
||||||
|
this.name = undefined;
|
||||||
|
|
||||||
}
|
}
|
||||||
static styles = css`
|
static styles = css`
|
||||||
:host {
|
:host {
|
||||||
@ -311,13 +322,26 @@ class SaveSettingsQdn extends connect(store)(LitElement) {
|
|||||||
|
|
||||||
async getGeneralSettingsQdn() {
|
async getGeneralSettingsQdn() {
|
||||||
try {
|
try {
|
||||||
|
this.error = ""
|
||||||
const arbFee = await this.getArbitraryFee();
|
const arbFee = await this.getArbitraryFee();
|
||||||
this.fee = arbFee;
|
this.fee = arbFee;
|
||||||
this.hasAttemptedToFetchResource = true;
|
this.hasAttemptedToFetchResource = true;
|
||||||
let resource;
|
let resource;
|
||||||
const nameObject = store.getState().app.accountInfo.names[0];
|
let nameObject
|
||||||
if (!nameObject) throw new Error('no name');
|
try {
|
||||||
|
nameObject = store.getState().app.accountInfo.names[0];
|
||||||
|
|
||||||
|
} catch (error) {
|
||||||
|
|
||||||
|
}
|
||||||
|
if (!nameObject) {
|
||||||
|
this.name = null;
|
||||||
|
this.error = 'no name'
|
||||||
|
throw new Error('no name');
|
||||||
|
}
|
||||||
const name = nameObject.name;
|
const name = nameObject.name;
|
||||||
|
this.name = name;
|
||||||
|
this.hasName = true
|
||||||
this.error = '';
|
this.error = '';
|
||||||
const url = `${this.nodeUrl}/arbitrary/resources/search?service=DOCUMENT_PRIVATE&identifier=qortal_general_settings&name=${name}&prefix=true&exactmatchnames=true&excludeblocked=true&limit=20`;
|
const url = `${this.nodeUrl}/arbitrary/resources/search?service=DOCUMENT_PRIVATE&identifier=qortal_general_settings&name=${name}&prefix=true&exactmatchnames=true&excludeblocked=true&limit=20`;
|
||||||
const res = await fetch(url);
|
const res = await fetch(url);
|
||||||
@ -365,8 +389,6 @@ class SaveSettingsQdn extends connect(store)(LitElement) {
|
|||||||
|
|
||||||
stateChanged(state) {
|
stateChanged(state) {
|
||||||
if (
|
if (
|
||||||
state.app.accountInfo &&
|
|
||||||
state.app.accountInfo.names.length &&
|
|
||||||
state.app.nodeStatus &&
|
state.app.nodeStatus &&
|
||||||
state.app.nodeStatus.syncPercent !== this.syncPercentage
|
state.app.nodeStatus.syncPercent !== this.syncPercentage
|
||||||
) {
|
) {
|
||||||
@ -379,6 +401,15 @@ class SaveSettingsQdn extends connect(store)(LitElement) {
|
|||||||
this.getGeneralSettingsQdn();
|
this.getGeneralSettingsQdn();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (
|
||||||
|
state.app.accountInfo &&
|
||||||
|
state.app.accountInfo.names.length &&
|
||||||
|
state.app.nodeStatus &&
|
||||||
|
state.app.nodeStatus.syncPercent === 100 && this.hasName === false && this.hasAttemptedToFetchResource && state.app.accountInfo && state.app.accountInfo.names && state.app.accountInfo.names.length > 0
|
||||||
|
) {
|
||||||
|
this.getGeneralSettingsQdn();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async getArbitraryFee() {
|
async getArbitraryFee() {
|
||||||
@ -531,7 +562,78 @@ class SaveSettingsQdn extends connect(store)(LitElement) {
|
|||||||
style="display: block; margin: 0 auto;"
|
style="display: block; margin: 0 auto;"
|
||||||
></paper-spinner-lite>
|
></paper-spinner-lite>
|
||||||
`
|
`
|
||||||
: html`
|
: !this.name ? html`
|
||||||
|
<mwc-icon
|
||||||
|
id="profile-icon"
|
||||||
|
class=${'notActive'}
|
||||||
|
@click=${() => {
|
||||||
|
const target = this.shadowRoot.getElementById(
|
||||||
|
'popover-notification'
|
||||||
|
);
|
||||||
|
const popover =
|
||||||
|
this.shadowRoot.querySelector(
|
||||||
|
'popover-component'
|
||||||
|
);
|
||||||
|
if (popover) {
|
||||||
|
popover.openPopover(target);
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
style="user-select:none;cursor:pointer"
|
||||||
|
>save</mwc-icon
|
||||||
|
>
|
||||||
|
<vaadin-tooltip
|
||||||
|
for="profile-icon"
|
||||||
|
position="bottom"
|
||||||
|
hover-delay=${300}
|
||||||
|
hide-delay=${1}
|
||||||
|
text=${translate('profile.profile20')}
|
||||||
|
>
|
||||||
|
</vaadin-tooltip>
|
||||||
|
<popover-component for="profile-icon" message="">
|
||||||
|
<div style="margin-bottom:20px">
|
||||||
|
<p style="margin:10px 0px; font-size:16px">
|
||||||
|
${translate('profile.profile1')}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div
|
||||||
|
style="display:flex;justify-content:center;gap:10px"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
class="accept-button"
|
||||||
|
@click="${() => {
|
||||||
|
store.dispatch(
|
||||||
|
setNewTab({
|
||||||
|
url: `group-management`,
|
||||||
|
id: this.uid.rnd(),
|
||||||
|
myPlugObj: {
|
||||||
|
url: 'name-registration',
|
||||||
|
domain: 'core',
|
||||||
|
page: 'name-registration/index.html',
|
||||||
|
title: 'Name Registration',
|
||||||
|
icon: 'vaadin:user-check',
|
||||||
|
mwcicon: 'manage_accounts',
|
||||||
|
pluginNumber:
|
||||||
|
'plugin-qCmtXAQmtu',
|
||||||
|
menus: [],
|
||||||
|
parent: false,
|
||||||
|
},
|
||||||
|
openExisting: true,
|
||||||
|
})
|
||||||
|
);
|
||||||
|
const popover =
|
||||||
|
this.shadowRoot.querySelector(
|
||||||
|
'popover-component'
|
||||||
|
);
|
||||||
|
if (popover) {
|
||||||
|
popover.closePopover();
|
||||||
|
}
|
||||||
|
}}"
|
||||||
|
>
|
||||||
|
${translate('profile.profile2')}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</popover-component>
|
||||||
|
` : html`
|
||||||
<mwc-icon
|
<mwc-icon
|
||||||
id="save-icon"
|
id="save-icon"
|
||||||
class=${Object.values(this.valuesToBeSavedOnQdn)
|
class=${Object.values(this.valuesToBeSavedOnQdn)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user