4
1
mirror of https://github.com/Qortal/qortal-ui.git synced 2025-02-11 17:55:51 +00:00

Translate Add Api key and make it dark, fix snackbar

This commit is contained in:
AlphaX-Projects 2022-04-15 05:12:42 +02:00
parent 6fbce64e5c
commit 56907922dc
8 changed files with 92 additions and 20 deletions

View File

@ -544,5 +544,14 @@
"tchange3": "Confirm",
"tchange4": "To",
"tchange5": "Amount"
},
"apipage": {
"achange1": "Add API key",
"achange2": "API key",
"achange3": "Please enter the API key for this node. It can be found in a file called “apikey.txt“ in the directory where the core is installed. Alternatively, click Cancel to use the core with reduced functionality.",
"achange4": "Cancel",
"achange5": "Add",
"achange6": "Successfully added API Key",
"achange7": "API key wrong, no API key added"
}
}

View File

@ -544,5 +544,14 @@
"tchange3": "Bestätigen",
"tchange4": "Zu",
"tchange5": "Menge"
},
"apipage": {
"achange1": "Füge API-Schlüssel hinzu",
"achange2": "API-Schlüssel",
"achange3": "Bitte geben Sie den API-Schlüssel für diesen Knoten ein. Es kann in einer Datei namens “apikey.txt“ in dem Verzeichnis gefunden werden, in dem der Kern installiert ist. Klicken Sie alternativ auf Abbrechen, um den Kern mit eingeschränkter Funktionalität zu verwenden.",
"achange4": "Abbrechen",
"achange5": "Hinzufügen",
"achange6": "API-Schlüssel erfolgreich hinzugefügt",
"achange7": "API-Schlüssel falsch, kein API-Schlüssel hinzugefügt"
}
}

View File

@ -544,5 +544,14 @@
"tchange3": "Confirm",
"tchange4": "To",
"tchange5": "Amount"
},
"apipage": {
"achange1": "Add API key",
"achange2": "API key",
"achange3": "Please enter the API key for this node. It can be found in a file called “apikey.txt“ in the directory where the core is installed. Alternatively, click Cancel to use the core with reduced functionality.",
"achange4": "Cancel",
"achange5": "Add",
"achange6": "Successfully added API Key",
"achange7": "API key wrong, no API key added"
}
}

View File

@ -544,5 +544,14 @@
"tchange3": "Confirm",
"tchange4": "To",
"tchange5": "Amount"
},
"apipage": {
"achange1": "Add API key",
"achange2": "API key",
"achange3": "Please enter the API key for this node. It can be found in a file called “apikey.txt“ in the directory where the core is installed. Alternatively, click Cancel to use the core with reduced functionality.",
"achange4": "Cancel",
"achange5": "Add",
"achange6": "Successfully added API Key",
"achange7": "API key wrong, no API key added"
}
}

View File

@ -544,5 +544,14 @@
"tchange3": "Confirm",
"tchange4": "To",
"tchange5": "Amount"
},
"apipage": {
"achange1": "Add API key",
"achange2": "API key",
"achange3": "Please enter the API key for this node. It can be found in a file called “apikey.txt“ in the directory where the core is installed. Alternatively, click Cancel to use the core with reduced functionality.",
"achange4": "Cancel",
"achange5": "Add",
"achange6": "Successfully added API Key",
"achange7": "API key wrong, no API key added"
}
}

View File

@ -544,5 +544,14 @@
"tchange3": "Confirm",
"tchange4": "To",
"tchange5": "Amount"
},
"apipage": {
"achange1": "Add API key",
"achange2": "API key",
"achange3": "Please enter the API key for this node. It can be found in a file called “apikey.txt“ in the directory where the core is installed. Alternatively, click Cancel to use the core with reduced functionality.",
"achange4": "Cancel",
"achange5": "Add",
"achange6": "Successfully added API Key",
"achange7": "API key wrong, no API key added"
}
}

View File

@ -2,6 +2,7 @@ import { LitElement, html, css } from 'lit'
import { connect } from 'pwa-helpers'
import { store } from '../store.js'
import { testApiKey } from '../apiKeyUtils.js'
import { get, translate, translateUnsafeHTML } from 'lit-translate'
import '@material/mwc-dialog'
import '@material/mwc-button'
@ -23,6 +24,23 @@ class MykeyPage extends connect(store)(LitElement) {
static get styles() {
return css`
* {
--mdc-theme-primary: rgb(3, 169, 244);
--mdc-theme-secondary: var(--mdc-theme-primary);
--paper-input-container-focus-color: var(--mdc-theme-primary);
--mdc-theme-surface: var(--white);
--mdc-dialog-heading-ink-color: var(--black);
--mdc-dialog-content-ink-color: var(--black);
--lumo-primary-text-color: rgb(0, 167, 245);
--lumo-primary-color-50pct: rgba(0, 167, 245, 0.5);
--lumo-primary-color-10pct: rgba(0, 167, 245, 0.1);
--lumo-primary-color: hsl(199, 100%, 48%);
--lumo-base-color: var(--white);
--lumo-body-text-color: var(--black);
--_lumo-grid-border-color: var(--border);
--_lumo-grid-secondary-border-color: var(--border2);
}
.red {
--mdc-theme-primary: red;
}
@ -37,23 +55,23 @@ class MykeyPage extends connect(store)(LitElement) {
render() {
return html`
<mwc-dialog id="mykeyDialog" heading="Add API key" opened=false>
<mwc-dialog id="mykeyDialog" heading="${translate("apipage.achange1")}" opened=false>
<div style="min-height:200px; min-width: 300px; box-sizing: border-box; position: relative;">
<mwc-textfield icon="fingerprint" id="mykeyInput" style="width:100%;" label="API key"></mwc-textfield>
<p style="margin-top: 45px;">Please enter the API key for this node. It can be found in a file called "apikey.txt" in the directory where the core is installed. Alternatively, click Cancel to use the core with reduced functionality.</p>
<mwc-textfield icon="fingerprint" id="mykeyInput" style="width:100%;" label="${translate("apipage.achange2")}"></mwc-textfield>
<p style="margin-top: 45px;">${translate("apipage.achange3")}</p>
</div>
<mwc-button
slot="secondaryAction"
dialogAction="close"
class="red"
>
Cancel
${translate("apipage.achange4")}
</mwc-button>
<mwc-button
slot="primaryAction"
@click="${this.addMykey}"
>
Add
${translate("apipage.achange5")}
</mwc-button>
</mwc-dialog>
`
@ -77,15 +95,17 @@ class MykeyPage extends connect(store)(LitElement) {
selectedNode.apiKey = mykeyInput;
this.nodeConfig.knownNodes[this.nodeConfig.node] = selectedNode;
localStorage.setItem('myQortalNodes', JSON.stringify(this.nodeConfig.knownNodes));
let snackbar1 = get("apipage.achange6")
snackbar.add({
labelText: 'Successfully Added API Key',
labelText: `${snackbar1}`,
dismiss: true
})
this.shadowRoot.getElementById('mykeyInput').value = ''
this.shadowRoot.querySelector('#mykeyDialog').close()
} else {
let snackbar2 = get("apipage.achange7")
snackbar.add({
labelText: 'API Key Wrong, No Apikey Added',
labelText: `${snackbar2}`,
dismiss: true
})
this.shadowRoot.getElementById('mykeyInput').value = ''

View File

@ -1395,18 +1395,10 @@ class MultiWallet extends LitElement {
return html`${translate("walletpage.wchange1")}`
}
renderFundsText() {
return html`${translate("walletpage.wchange26")}`
}
renderInvalidText() {
return html`${translate("walletpage.wchange27")}`
}
renderEmptyText() {
return html`${translate("walletpage.wchange28")}`
}
renderReceiverText() {
return html`${translate("walletpage.wchange29")}`
}
@ -1512,21 +1504,24 @@ class MultiWallet extends LitElement {
if (parseFloat(amount) + parseFloat(0.001) > parseFloat(this.balance)) {
this.sendMoneyLoading = false
this.btnDisable = false
parentEpml.request('showSnackBar', this.renderFundsText())
let snack1string = get("walletpage.wchange26")
parentEpml.request('showSnackBar', `${snack1string}`)
return false
}
if (parseFloat(amount) <= 0) {
this.sendMoneyLoading = false
this.btnDisable = false
parentEpml.request('showSnackBar', this.renderInvalidText())
let snack2string = get("walletpage.wchange27")
parentEpml.request('showSnackBar', `${snack2string}`)
return false
}
if (recipient.length === 0) {
this.sendMoneyLoading = false
this.btnDisable = false
parentEpml.request('showSnackBar', this.renderEmptyText())
let snack3string = get("walletpage.wchange28")
parentEpml.request('showSnackBar', `${snack3string}`)
return false
}
@ -1797,7 +1792,8 @@ class MultiWallet extends LitElement {
})
.then((res) => {
if (isNaN(Number(res))) {
parentEpml.request('showSnackBar', `${translate("walletpage.wchange32")}`)
let snack4string = get("walletpage.wchange32")
parentEpml.request('showSnackBar', `${snack4string}`)
} else {
if (this._selectedWallet == coin) {
this.wallets.get(coin).balance = Number(res).toFixed(8)
@ -1824,7 +1820,9 @@ class MultiWallet extends LitElement {
})
.then((res) => {
if (isNaN(Number(res))) {
parentEpml.request('showSnackBar', `${translate("walletpage.wchange33")} ${coin.toLocaleUpperCase()} ${translate("walletpage.wchange34")}!`)
let snack5string = get("walletpage.wchange33")
let snack6string = get("walletpage.wchange34")
parentEpml.request('showSnackBar', `${snack5string} ${coin.toLocaleUpperCase()} ${snack6string}!`)
} else {
if (this._selectedWallet == coin) {
this.wallets.get(this._selectedWallet).balance = (Number(res) / 1e8).toFixed(8)