forked from Qortal/qortal-ui
save by address
This commit is contained in:
parent
3f4d7bbb29
commit
de7ae88ba4
@ -80,8 +80,10 @@ class SyncIndicator extends connect(store)(LitElement) {
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
async firstUpdated() {
|
async firstUpdated() {
|
||||||
|
this.address = store.getState().app.selectedAddress.address
|
||||||
|
|
||||||
const seenWelcomeSync = JSON.parse(
|
const seenWelcomeSync = JSON.parse(
|
||||||
localStorage.getItem('welcome-sync') || 'false'
|
localStorage.getItem(`welcome-sync-${this.address}`) || 'false'
|
||||||
);
|
);
|
||||||
this.seenWelcomeSync = seenWelcomeSync;
|
this.seenWelcomeSync = seenWelcomeSync;
|
||||||
}
|
}
|
||||||
@ -152,7 +154,6 @@ class SyncIndicator extends connect(store)(LitElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stateChanged(state) {
|
stateChanged(state) {
|
||||||
console.log({state})
|
|
||||||
if (
|
if (
|
||||||
state.app.nodeStatus &&
|
state.app.nodeStatus &&
|
||||||
Object.keys(state.app.nodeStatus).length === 0
|
Object.keys(state.app.nodeStatus).length === 0
|
||||||
|
@ -191,11 +191,11 @@ class TourComponent extends connect(store)(LitElement) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
async firstUpdated() {
|
async firstUpdated() {
|
||||||
|
this.address = store.getState().app.selectedAddress.address
|
||||||
const hasViewedTour = JSON.parse(
|
const hasViewedTour = JSON.parse(
|
||||||
localStorage.getItem('hasViewedTour') || 'false'
|
localStorage.getItem(`hasViewedTour-${this.address}`) || 'false'
|
||||||
);
|
);
|
||||||
const selectedAddress = store.getState().app.selectedAddress || '';
|
const name = await this.getName(this.address);
|
||||||
const name = await this.getName(selectedAddress.address);
|
|
||||||
if (name) {
|
if (name) {
|
||||||
this.hasName = true;
|
this.hasName = true;
|
||||||
}
|
}
|
||||||
@ -205,7 +205,7 @@ class TourComponent extends connect(store)(LitElement) {
|
|||||||
if (name) {
|
if (name) {
|
||||||
this.hasViewedTour = true;
|
this.hasViewedTour = true;
|
||||||
this.hasName = true;
|
this.hasName = true;
|
||||||
localStorage.setItem("hasViewedTour", JSON.stringify(true))
|
localStorage.setItem(`hasViewedTour-${this.address}`, JSON.stringify(true))
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log({ error });
|
console.log({ error });
|
||||||
@ -309,7 +309,7 @@ class TourComponent extends connect(store)(LitElement) {
|
|||||||
steps: steps,
|
steps: steps,
|
||||||
allowClose: false,
|
allowClose: false,
|
||||||
onDestroyed: () => {
|
onDestroyed: () => {
|
||||||
localStorage.setItem("hasViewedTour", JSON.stringify(true))
|
localStorage.setItem(`hasViewedTour-${this.address}`, JSON.stringify(true))
|
||||||
this.hasViewedTour = true;
|
this.hasViewedTour = true;
|
||||||
this.openWelcomeModal();
|
this.openWelcomeModal();
|
||||||
}
|
}
|
||||||
@ -346,7 +346,7 @@ class TourComponent extends connect(store)(LitElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
onClose() {
|
onClose() {
|
||||||
localStorage.setItem("welcome-sync", JSON.stringify(true))
|
localStorage.setItem(`welcome-sync-${this.address}`, JSON.stringify(true))
|
||||||
this.dialogOpenedCongrats = false;
|
this.dialogOpenedCongrats = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -35,9 +35,7 @@ class BeginnerChecklist extends connect(store)(LitElement) {
|
|||||||
this.hasName = null;
|
this.hasName = null;
|
||||||
this.nodeUrl = this.getNodeUrl();
|
this.nodeUrl = this.getNodeUrl();
|
||||||
this.myNode = this.getMyNode();
|
this.myNode = this.getMyNode();
|
||||||
this.hasTourFinished = JSON.parse(
|
this.hasTourFinished = null;
|
||||||
localStorage.getItem('hasViewedTour') || 'false'
|
|
||||||
)
|
|
||||||
this._controlTourFinished = this._controlTourFinished.bind(this);
|
this._controlTourFinished = this._controlTourFinished.bind(this);
|
||||||
this.uid = new ShortUniqueId();
|
this.uid = new ShortUniqueId();
|
||||||
}
|
}
|
||||||
@ -46,6 +44,13 @@ class BeginnerChecklist extends connect(store)(LitElement) {
|
|||||||
this.hasTourFinished = true;
|
this.hasTourFinished = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
firstUpdated() {
|
||||||
|
this.address = store.getState().app.selectedAddress.address;
|
||||||
|
this.hasTourFinished = JSON.parse(
|
||||||
|
localStorage.getItem(`hasViewedTour-${this.address}`) || 'null'
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
connectedCallback() {
|
connectedCallback() {
|
||||||
super.connectedCallback();
|
super.connectedCallback();
|
||||||
window.addEventListener(
|
window.addEventListener(
|
||||||
@ -84,7 +89,7 @@ class BeginnerChecklist extends connect(store)(LitElement) {
|
|||||||
|
|
||||||
async getName(recipient) {
|
async getName(recipient) {
|
||||||
try {
|
try {
|
||||||
if(!recipient) return ''
|
if (!recipient) return '';
|
||||||
const endpoint = `${this.nodeUrl}/names/address/${recipient}`;
|
const endpoint = `${this.nodeUrl}/names/address/${recipient}`;
|
||||||
const res = await fetch(endpoint);
|
const res = await fetch(endpoint);
|
||||||
const getNames = await res.json();
|
const getNames = await res.json();
|
||||||
@ -107,7 +112,8 @@ class BeginnerChecklist extends connect(store)(LitElement) {
|
|||||||
this.syncPercentage = state.app.nodeStatus.syncPercent;
|
this.syncPercentage = state.app.nodeStatus.syncPercent;
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!this.hasAttempted && state.app.selectedAddress &&
|
!this.hasAttempted &&
|
||||||
|
state.app.selectedAddress &&
|
||||||
state.app.nodeStatus.syncPercent === 100
|
state.app.nodeStatus.syncPercent === 100
|
||||||
) {
|
) {
|
||||||
this.hasAttempted = true;
|
this.hasAttempted = true;
|
||||||
@ -126,7 +132,7 @@ class BeginnerChecklist extends connect(store)(LitElement) {
|
|||||||
state.app.accountInfo.names.length > 0
|
state.app.accountInfo.names.length > 0
|
||||||
) {
|
) {
|
||||||
this.hasName = true;
|
this.hasName = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
handleBlur() {
|
handleBlur() {
|
||||||
@ -137,10 +143,8 @@ class BeginnerChecklist extends connect(store)(LitElement) {
|
|||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return this.hasName === false || !this.hasTourFinished
|
return this.hasName === false || this.hasTourFinished === false
|
||||||
? html`
|
? html`
|
||||||
<div class="layout">
|
<div class="layout">
|
||||||
<popover-component
|
<popover-component
|
||||||
@ -153,7 +157,9 @@ class BeginnerChecklist extends connect(store)(LitElement) {
|
|||||||
>
|
>
|
||||||
<mwc-icon
|
<mwc-icon
|
||||||
id="checklist-general-icon"
|
id="checklist-general-icon"
|
||||||
style=${`color: ${!this.hasName ? 'red' : 'var(--black)'}; cursor:pointer;user-select:none`}
|
style=${`color: ${
|
||||||
|
!this.hasName ? 'red' : 'var(--black)'
|
||||||
|
}; cursor:pointer;user-select:none`}
|
||||||
>checklist</mwc-icon
|
>checklist</mwc-icon
|
||||||
>
|
>
|
||||||
<vaadin-tooltip
|
<vaadin-tooltip
|
||||||
@ -165,7 +171,6 @@ class BeginnerChecklist extends connect(store)(LitElement) {
|
|||||||
>
|
>
|
||||||
</vaadin-tooltip>
|
</vaadin-tooltip>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div
|
<div
|
||||||
id="checklist-panel"
|
id="checklist-panel"
|
||||||
@ -196,8 +201,11 @@ class BeginnerChecklist extends connect(store)(LitElement) {
|
|||||||
`}
|
`}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="task-list-item" style="cursor:pointer" @click=${()=> {
|
<div
|
||||||
store.dispatch(
|
class="task-list-item"
|
||||||
|
style="cursor:pointer"
|
||||||
|
@click=${() => {
|
||||||
|
store.dispatch(
|
||||||
setNewTab({
|
setNewTab({
|
||||||
url: `group-management`,
|
url: `group-management`,
|
||||||
id: this.uid.rnd(),
|
id: this.uid.rnd(),
|
||||||
@ -216,8 +224,9 @@ class BeginnerChecklist extends connect(store)(LitElement) {
|
|||||||
openExisting: true,
|
openExisting: true,
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
this.handleBlur()
|
this.handleBlur();
|
||||||
}}>
|
}}
|
||||||
|
>
|
||||||
<p>Do you have a name registered?</p>
|
<p>Do you have a name registered?</p>
|
||||||
${this.hasName
|
${this.hasName
|
||||||
? html`
|
? html`
|
||||||
|
@ -207,7 +207,6 @@ const initNodeStatusSocket = () => {
|
|||||||
const activeNodeStatusSocket = new WebSocket(activeNodeStatusSocketLink)
|
const activeNodeStatusSocket = new WebSocket(activeNodeStatusSocketLink)
|
||||||
// Open Connection
|
// Open Connection
|
||||||
activeNodeStatusSocket.onopen = (e) => {
|
activeNodeStatusSocket.onopen = (e) => {
|
||||||
console.log('onopen')
|
|
||||||
nodeStatusSocketReconnectInterval = MIN_RECONNECT_INTERVAL;
|
nodeStatusSocketReconnectInterval = MIN_RECONNECT_INTERVAL;
|
||||||
|
|
||||||
nodeStatusSocketcloseGracefully = false
|
nodeStatusSocketcloseGracefully = false
|
||||||
@ -215,18 +214,15 @@ const initNodeStatusSocket = () => {
|
|||||||
}
|
}
|
||||||
// Message Event
|
// Message Event
|
||||||
activeNodeStatusSocket.onmessage = (e) => {
|
activeNodeStatusSocket.onmessage = (e) => {
|
||||||
console.log('onmessage')
|
|
||||||
doNodeStatus(JSON.parse(e.data))
|
doNodeStatus(JSON.parse(e.data))
|
||||||
}
|
}
|
||||||
// Closed Event
|
// Closed Event
|
||||||
activeNodeStatusSocket.onclose = () => {
|
activeNodeStatusSocket.onclose = () => {
|
||||||
console.log('onclose')
|
|
||||||
doNodeStatus({});
|
doNodeStatus({});
|
||||||
attemptReconnectNodeStatusSocket();
|
attemptReconnectNodeStatusSocket();
|
||||||
};
|
};
|
||||||
// Error Event
|
// Error Event
|
||||||
activeNodeStatusSocket.onerror = (e) => {
|
activeNodeStatusSocket.onerror = (e) => {
|
||||||
console.log('onerror')
|
|
||||||
doNodeStatus({})
|
doNodeStatus({})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user