diff --git a/core/assets/js/svg.js b/core/assets/js/svg.js index bf4e4288..85257c81 100644 --- a/core/assets/js/svg.js +++ b/core/assets/js/svg.js @@ -1,4 +1,4 @@ -import { html } from 'lit' +import {html} from 'lit' export const svgSun = html``; export const svgMoon = html ``; diff --git a/core/src/components/app-info.js b/core/src/components/app-info.js index fc2719c4..3c212b7b 100644 --- a/core/src/components/app-info.js +++ b/core/src/components/app-info.js @@ -1,10 +1,10 @@ -import { LitElement, html, css } from 'lit' -import { connect } from 'pwa-helpers' -import { store } from '../store.js' -import { doPageUrl } from '../redux/app/app-actions.js' -import { translate, translateUnsafeHTML } from 'lit-translate' +import {css, html, LitElement} from 'lit' +import {connect} from 'pwa-helpers' +import {store} from '../store.js' +import {doPageUrl} from '../redux/app/app-actions.js' +import {translate} from 'lit-translate' import WebWorker from 'web-worker:./computePowWorker.js'; -import { routes } from '../plugins/routes.js'; +import {routes} from '../plugins/routes.js'; import '@material/mwc-icon' import '@material/mwc-button' @@ -124,7 +124,7 @@ class AppInfo extends connect(store)(LitElement) { // } catch (error) { // console.error(error) // } - + setInterval(() => { this.getNodeInfo() this.getCoreInfo() @@ -198,13 +198,13 @@ class AppInfo extends connect(store)(LitElement) { lastReference: reference, proofOfWorkNonce: 0, fee: 0, - timestamp: Date.now(), + timestamp: Date.now(), }, disableModal: true }, disableModal: true, }); - + try { const powRes = await _computePow2(chatRes) if(powRes === true) { @@ -216,7 +216,7 @@ class AppInfo extends connect(store)(LitElement) { console.error(error) } } - + if (!data.error && data !== 'false' && data) { clearInterval(this.interval) localStorage.removeItem(this.publicizeAddress) diff --git a/core/src/components/app-view.js b/core/src/components/app-view.js index 253472d2..dd356819 100644 --- a/core/src/components/app-view.js +++ b/core/src/components/app-view.js @@ -1,18 +1,13 @@ -import { LitElement, html, css } from 'lit' -import { connect } from 'pwa-helpers' -import { store } from '../store.js' -import { Epml } from '../epml.js' -import { addTradeBotRoutes } from '../tradebot/addTradeBotRoutes.js' -import { get, translate, translateUnsafeHTML } from 'lit-translate' +import {css, html, LitElement} from 'lit' +import {connect} from 'pwa-helpers' +import {store} from '../store.js' +import {Epml} from '../epml.js' +import {addTradeBotRoutes} from '../tradebot/addTradeBotRoutes.js' +import {get, translate} from 'lit-translate' import localForage from 'localforage' -import { encryptData, decryptData } from '../lockScreen.js' -import { setChatLastSeen } from '../redux/app/app-actions.js' +import {decryptData, encryptData} from '../lockScreen.js' +import {setChatLastSeen} from '../redux/app/app-actions.js' import isElectron from 'is-electron' - -const chatLastSeen = localForage.createInstance({ - name: "chat-last-seen", -}) - import '@material/mwc-button' import '@material/mwc-icon' import '@polymer/paper-icon-button/paper-icon-button.js' @@ -47,6 +42,11 @@ import './friends-view/friends-side-panel-parent.js' import './friends-view/save-settings-qdn.js' import './friends-view/core-sync-status.js' import './controllers/coin-balances-controller.js' + +const chatLastSeen = localForage.createInstance({ + name: "chat-last-seen", +}) + const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) class AppView extends connect(store)(LitElement) { @@ -230,13 +230,13 @@ class AppView extends connect(store)(LitElement) { background-color: whitesmoke; border-radius: 7px; } - + .sideBarMenu::-webkit-scrollbar { width: 6px; border-radius: 7px; background-color: whitesmoke; } - + .sideBarMenu::-webkit-scrollbar-thumb { background-color: rgb(180, 176, 176); border-radius: 7px; @@ -363,7 +363,7 @@ class AppView extends connect(store)(LitElement) { 0%,100% { opacity: 0; } 50% { opacity: 10; } } - + .sideBarMenu::-webkit-scrollbar-thumb:hover { background-color: rgb(148, 146, 146); cursor: pointer; @@ -1837,7 +1837,7 @@ class AppView extends connect(store)(LitElement) { - + diff --git a/core/src/components/base.js b/core/src/components/base.js index d8d24093..e5382038 100644 --- a/core/src/components/base.js +++ b/core/src/components/base.js @@ -1,6 +1,6 @@ -import { LitElement, html, css } from 'lit' -import { connect } from 'pwa-helpers' -import { store } from '../store.js' +import {css, html, LitElement} from 'lit' +import {connect} from 'pwa-helpers' +import {store} from '../store.js' class MyElement extends connect(store)(LitElement) { static get properties () { diff --git a/core/src/components/check-for-update.js b/core/src/components/check-for-update.js index a14c0fd0..92844d79 100644 --- a/core/src/components/check-for-update.js +++ b/core/src/components/check-for-update.js @@ -1,5 +1,5 @@ -import { LitElement, html, css } from 'lit' -import { get, translate, translateUnsafeHTML } from 'lit-translate' +import {css, html, LitElement} from 'lit' +import {translate} from 'lit-translate' import isElectron from 'is-electron' import '@polymer/paper-icon-button/paper-icon-button.js' diff --git a/core/src/components/computePowWorker.js b/core/src/components/computePowWorker.js index 2ed60a20..b89b9d84 100644 --- a/core/src/components/computePowWorker.js +++ b/core/src/components/computePowWorker.js @@ -1,4 +1,4 @@ -import { Sha256 } from 'asmcrypto.js' +import {Sha256} from 'asmcrypto.js' function sbrk(size, heap){ @@ -39,7 +39,7 @@ const computePow = async (chatBytes, path, difficulty) => { const hashAry = new Uint8Array(memory.buffer, hashPtr, 32); hashAry.set(chatBytesHash); - + const workBufferLength = 8 * 1024 * 1024; const workBufferPtr = sbrk(workBufferLength, heap); @@ -72,11 +72,11 @@ loadWebAssembly(path) } resolve() - + }); - }) + }) return response -} \ No newline at end of file +} diff --git a/core/src/components/controllers/coin-balances-controller.js b/core/src/components/controllers/coin-balances-controller.js index 0aef763c..3cddd6d8 100644 --- a/core/src/components/controllers/coin-balances-controller.js +++ b/core/src/components/controllers/coin-balances-controller.js @@ -1,11 +1,10 @@ -import { LitElement, html, css } from 'lit'; +import {html, LitElement} from 'lit'; import '@material/mwc-icon'; -import { store } from '../../store'; -import { connect } from 'pwa-helpers'; +import {store} from '../../store'; +import {connect} from 'pwa-helpers'; import '@vaadin/tooltip'; -import { get } from 'lit-translate'; -import { parentEpml } from '../show-plugin'; -import { setCoinBalances } from '../../redux/app/app-actions'; +import {parentEpml} from '../show-plugin'; +import {setCoinBalances} from '../../redux/app/app-actions'; class CoinBalancesController extends connect(store)(LitElement) { static get properties() { @@ -43,7 +42,7 @@ class CoinBalancesController extends connect(store)(LitElement) { return myNode; } - + async updateArrrWalletBalance() { let _url = `/crosschain/arrr/walletbalance?apiKey=${this.myNode.apiKey}` let _body = store.getState().app.selectedAddress.arrrWallet.seed58 @@ -205,7 +204,7 @@ class CoinBalancesController extends connect(store)(LitElement) { fullValue: Number(res) }) ); - + } }).catch(()=> { console.log('error') @@ -233,7 +232,7 @@ class CoinBalancesController extends connect(store)(LitElement) { this.updateArrrWalletBalance() } } catch (error) { - + } } copyCoinList[coin] = Date.now() + 120000; @@ -264,9 +263,9 @@ class CoinBalancesController extends connect(store)(LitElement) { }) await Promise.all(getCoinBalances); - + } - + async fetchBalance(){ try { let arrayOfCoins = [] @@ -303,7 +302,7 @@ class CoinBalancesController extends connect(store)(LitElement) { } disconnectedCallback() { - + super.disconnectedCallback(); window.removeEventListener( 'ping-coin-controller-with-coin', @@ -316,7 +315,7 @@ class CoinBalancesController extends connect(store)(LitElement) { } - + render() { return html``; diff --git a/core/src/components/friends-view/ChatSideNavHeads.js b/core/src/components/friends-view/ChatSideNavHeads.js index 2bae1d7a..bdbaa599 100644 --- a/core/src/components/friends-view/ChatSideNavHeads.js +++ b/core/src/components/friends-view/ChatSideNavHeads.js @@ -1,6 +1,5 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {css, html, LitElement} from 'lit' +import {get} from 'lit-translate' import '@material/mwc-icon' import '@vaadin/tooltip'; @@ -100,7 +99,7 @@ class ChatSideNavHeads extends LitElement { imageHTMLRes.onload = () => { this.isImageLoaded = true; } - imageHTMLRes.onerror = () => { + imageHTMLRes.onerror = () => { if (this.imageFetches < 4) { setTimeout(() => { this.imageFetches = this.imageFetches + 1; @@ -170,13 +169,13 @@ class ChatSideNavHeads extends LitElement { - +
${this.chatInfo.willFollow ? html` connect_without_contact - +
-
- +
` } diff --git a/core/src/components/settings-view/user-settings.js b/core/src/components/settings-view/user-settings.js index aaaba9b0..b8853489 100644 --- a/core/src/components/settings-view/user-settings.js +++ b/core/src/components/settings-view/user-settings.js @@ -1,7 +1,7 @@ -import { LitElement, html, css } from 'lit' -import { connect } from 'pwa-helpers' -import { store } from '../../store.js' -import { translate, translateUnsafeHTML } from 'lit-translate' +import {css, html, LitElement} from 'lit' +import {connect} from 'pwa-helpers' +import {store} from '../../store.js' +import {translate} from 'lit-translate' import '@polymer/paper-dialog/paper-dialog.js' import '@material/mwc-button' @@ -12,8 +12,6 @@ import './notifications-view.js' import './qr-login-view.js' import './export-keys.js' -import { doLogout } from '../../redux/app/app-actions.js' - class UserSettings extends connect(store)(LitElement) { static get properties() { return { diff --git a/core/src/components/show-plugin.js b/core/src/components/show-plugin.js index 266df4a2..3fec4d91 100644 --- a/core/src/components/show-plugin.js +++ b/core/src/components/show-plugin.js @@ -1,20 +1,14 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { connect } from 'pwa-helpers' -import { store } from '../store.js' -import { Epml } from '../epml.js' -import { addPluginRoutes } from '../plugins/addPluginRoutes.js' -import { repeat } from 'lit/directives/repeat.js'; +import {css, html, LitElement} from 'lit' +import {render} from 'lit/html.js' +import {connect} from 'pwa-helpers' +import {store} from '../store.js' +import {Epml} from '../epml.js' +import {addPluginRoutes} from '../plugins/addPluginRoutes.js' +import {repeat} from 'lit/directives/repeat.js'; import ShortUniqueId from 'short-unique-id'; -import { setIsOpenDevDialog, setNewTab } from '../redux/app/app-actions.js' -import localForage from 'localforage' +import {setIsOpenDevDialog, setNewTab} from '../redux/app/app-actions.js' import FileSaver from 'file-saver' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' - -registerTranslateConfig({ - loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) -}) - +import {get, registerTranslateConfig, translate, use} from 'lit-translate' import '@material/mwc-button' import '@material/mwc-dialog' import '@material/mwc-icon' @@ -26,6 +20,9 @@ import '@vaadin/grid' import '@vaadin/text-field' import '../custom-elements/frag-file-input.js' +registerTranslateConfig({ + loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) +}) export const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -91,7 +88,7 @@ class ShowPlugin extends connect(store)(LitElement) { border-radius: 6px; border: 3px solid var(--scrollbarBG); } - + .hideIframe { display: none; position: absolute; @@ -435,7 +432,7 @@ class ShowPlugin extends connect(store)(LitElement) { }}" @mousedown="${(event) => { if (event.button === 1) { - event.preventDefault(); + event.preventDefault(); this.removeTab(index, tab.id); } }}" @@ -446,8 +443,8 @@ class ShowPlugin extends connect(store)(LitElement) { ` : html` ${icon} `} - - + +
${count ? html` @@ -455,7 +452,7 @@ class ShowPlugin extends connect(store)(LitElement) { ${count} { event.stopPropagation(); this.removeTab(index, tab.id) - + }}>close ` : html` ${title} @@ -465,7 +462,7 @@ class ShowPlugin extends connect(store)(LitElement) {
` })} - @@ -499,8 +496,8 @@ class ShowPlugin extends connect(store)(LitElement) { `)} - { this.shadowRoot.getElementById('domainInput').value = '' this.shadowRoot.getElementById('portInput').value = '' @@ -531,7 +528,7 @@ class ShowPlugin extends connect(store)(LitElement) { > ${translate('tabmenu.tm40')} - + ` } @@ -1018,22 +1015,22 @@ class NavBar extends connect(store)(LitElement) { --mdc-icon-size: 64px; cursor: pointer; } - + .menuIconPos { right: -2px; } - + .removeIconPos { position: absolute; top: -10px; right: -10px; z-index: 1; } - + .menuIconPos:hover .removeIcon { display: inline; } - + .removeIcon { display: none; color: var(--black); @@ -1042,7 +1039,7 @@ class NavBar extends connect(store)(LitElement) { position: relative; z-index: 1; } - + .removeIcon:hover { color: #C6011F; font-weight: bold; @@ -1479,7 +1476,7 @@ class NavBar extends connect(store)(LitElement) { const addressInfo = this.addressInfo const isMinter = addressInfo?.error !== 124 && +addressInfo?.level > 0 const isSponsor = +addressInfo?.level >= 5 - + if (!isMinter) { this.newMenuList = this.myMenuPlugins.filter((minter) => { @@ -1498,7 +1495,7 @@ class NavBar extends connect(store)(LitElement) { } else { this.myMenuList = this.newMenuList } - + this.requestUpdate() } @@ -2208,7 +2205,7 @@ class NavBar extends connect(store)(LitElement) { renderRemoveIcon(appurl, appicon, appname, appid, appplugin) { return html` - +
${this.errorMsg || this.status === 5 ? html` @@ -520,8 +520,8 @@ const nonce = selectedAddress && selectedAddress.nonce;
- - ` : ""} + + ` : ""} ` : ''} `; } diff --git a/core/src/components/theme-toggle.js b/core/src/components/theme-toggle.js index d2af6e82..6a2dcc48 100644 --- a/core/src/components/theme-toggle.js +++ b/core/src/components/theme-toggle.js @@ -1,5 +1,5 @@ -import { LitElement, html, css } from 'lit' -import { get, translate, translateUnsafeHTML } from 'lit-translate' +import {css, html, LitElement} from 'lit' +import {translate} from 'lit-translate' import '@polymer/paper-icon-button/paper-icon-button.js' import '@polymer/iron-icons/image-icons.js' import '@polymer/iron-icons/iron-icons.js' diff --git a/core/src/components/user-info-view/user-info-view.js b/core/src/components/user-info-view/user-info-view.js index f9ae8d83..e63af00b 100644 --- a/core/src/components/user-info-view/user-info-view.js +++ b/core/src/components/user-info-view/user-info-view.js @@ -1,8 +1,8 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { connect } from 'pwa-helpers' -import { store } from '../../store.js' -import { get, translate, translateUnsafeHTML } from 'lit-translate' +import {css, html, LitElement} from 'lit' +import {render} from 'lit/html.js' +import {connect} from 'pwa-helpers' +import {store} from '../../store.js' +import {get, translate} from 'lit-translate' import '@polymer/paper-dialog/paper-dialog.js' import '@material/mwc-button' @@ -354,7 +354,7 @@ class UserInfoView extends connect(store)(LitElement) { .border-wrapper { border: 1px var(--tradeborder) solid; - overflow: hidden; + overflow: hidden; } @@ -1531,7 +1531,7 @@ class UserInfoView extends connect(store)(LitElement) { creatorAddress: item.creatorAddress, recipient: item.recipient, amount: item.amount - + } } }).filter(item => !!item) @@ -1548,7 +1548,7 @@ class UserInfoView extends connect(store)(LitElement) { creatorAddress: item.creatorAddress, recipient: item.recipient, amount: item.amount - + } } }).filter(item => !!item) @@ -1594,7 +1594,7 @@ class UserInfoView extends connect(store)(LitElement) { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1616,7 +1616,7 @@ class UserInfoView extends connect(store)(LitElement) { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1638,7 +1638,7 @@ class UserInfoView extends connect(store)(LitElement) { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1660,7 +1660,7 @@ class UserInfoView extends connect(store)(LitElement) { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1682,7 +1682,7 @@ class UserInfoView extends connect(store)(LitElement) { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1704,7 +1704,7 @@ class UserInfoView extends connect(store)(LitElement) { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1726,7 +1726,7 @@ class UserInfoView extends connect(store)(LitElement) { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1748,7 +1748,7 @@ class UserInfoView extends connect(store)(LitElement) { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1770,7 +1770,7 @@ class UserInfoView extends connect(store)(LitElement) { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1792,7 +1792,7 @@ class UserInfoView extends connect(store)(LitElement) { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1814,7 +1814,7 @@ class UserInfoView extends connect(store)(LitElement) { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1836,7 +1836,7 @@ class UserInfoView extends connect(store)(LitElement) { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) diff --git a/core/src/components/wallet-profile.js b/core/src/components/wallet-profile.js index 07990d7b..1eca986a 100644 --- a/core/src/components/wallet-profile.js +++ b/core/src/components/wallet-profile.js @@ -1,7 +1,7 @@ -import { LitElement, html, css } from 'lit' -import { connect } from 'pwa-helpers' -import { store } from '../store.js' -import { translate, translateUnsafeHTML } from 'lit-translate' +import {css, html, LitElement} from 'lit' +import {connect} from 'pwa-helpers' +import {store} from '../store.js' +import {translate} from 'lit-translate' import '@polymer/paper-toast' import '@material/mwc-icon-button' diff --git a/core/src/custom-elements/frag-file-input.js b/core/src/custom-elements/frag-file-input.js index e35c4dc0..e7c57764 100644 --- a/core/src/custom-elements/frag-file-input.js +++ b/core/src/custom-elements/frag-file-input.js @@ -1,9 +1,9 @@ -import { LitElement, html, css } from 'lit' +import {css, html, LitElement} from 'lit' import '@material/mwc-button' import '@material/mwc-icon' -import { translate, translateUnsafeHTML } from 'lit-translate' +import {translate} from 'lit-translate' class FragFileInput extends LitElement { static get properties () { diff --git a/core/src/epml.js b/core/src/epml.js index 0a0489a5..41892ab8 100644 --- a/core/src/epml.js +++ b/core/src/epml.js @@ -1,4 +1,12 @@ -import { Epml, EpmlReadyPlugin, RequestPlugin, ContentWindow as EpmlContentWindowPlugin, EpmlStreamPlugin, EpmlProxyPlugin, EpmlStream } from 'epml' +import { + ContentWindow as EpmlContentWindowPlugin, + Epml, + EpmlProxyPlugin, + EpmlReadyPlugin, + EpmlStream, + EpmlStreamPlugin, + RequestPlugin +} from 'epml' Epml.registerPlugin(RequestPlugin) Epml.registerPlugin(EpmlReadyPlugin) diff --git a/core/src/functional-components/confirm-transaction-dialog.js b/core/src/functional-components/confirm-transaction-dialog.js index 55e152a0..35909ea1 100644 --- a/core/src/functional-components/confirm-transaction-dialog.js +++ b/core/src/functional-components/confirm-transaction-dialog.js @@ -1,9 +1,9 @@ -import { LitElement, html, css } from 'lit' -import { connect } from 'pwa-helpers' -import { store } from '../store.js' -import { get, translate, translateUnsafeHTML } from 'lit-translate' +import {css, html, LitElement} from 'lit' +import {connect} from 'pwa-helpers' +import {store} from '../store.js' +import {get, translate} from 'lit-translate' -import { listenForRequest } from '../transactionRequest.js' +import {listenForRequest} from '../transactionRequest.js' import '@polymer/paper-dialog/paper-dialog.js' import '@material/mwc-button' diff --git a/core/src/functional-components/loading-ripple.js b/core/src/functional-components/loading-ripple.js index 4f16b2f9..9fc14f13 100644 --- a/core/src/functional-components/loading-ripple.js +++ b/core/src/functional-components/loading-ripple.js @@ -1,4 +1,4 @@ -import { LitElement, html, css } from 'lit' +import {css, html, LitElement} from 'lit' const TRANSITION_EVENT_NAMES = ['transitionend', 'webkitTransitionEnd', 'oTransitionEnd', 'MSTransitionEnd'] @@ -99,7 +99,7 @@ class LoadingRipple extends LitElement { opacity: 1; transition: var(--ripple-activating-transition); } - + ` } diff --git a/core/src/functional-components/my-button.js b/core/src/functional-components/my-button.js index 1d86b6c1..f6fe6eb8 100644 --- a/core/src/functional-components/my-button.js +++ b/core/src/functional-components/my-button.js @@ -1,4 +1,4 @@ -import { LitElement, html, css } from 'lit'; +import {css, html, LitElement} from 'lit'; import '@vaadin/button'; import '@polymer/paper-spinner/paper-spinner-lite.js'; diff --git a/core/src/functional-components/mykey-page.js b/core/src/functional-components/mykey-page.js index 51c903cc..fa159043 100644 --- a/core/src/functional-components/mykey-page.js +++ b/core/src/functional-components/mykey-page.js @@ -1,8 +1,8 @@ -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 {css, html, LitElement} from 'lit' +import {connect} from 'pwa-helpers' +import {store} from '../store.js' +import {testApiKey} from '../apiKeyUtils.js' +import {get, translate} from 'lit-translate' import '@material/mwc-dialog' import '@material/mwc-button' diff --git a/core/src/functional-components/random-sentence-generator.js b/core/src/functional-components/random-sentence-generator.js index b9482fb5..9f27ea08 100644 --- a/core/src/functional-components/random-sentence-generator.js +++ b/core/src/functional-components/random-sentence-generator.js @@ -1,7 +1,7 @@ // Author: irontiga 'use strict' -import { LitElement, html, css } from 'lit' +import {html, LitElement} from 'lit' import * as WORDLISTS from './wordlists.js' class RandomSentenceGenerator extends LitElement { diff --git a/core/src/functional-components/settings-page.js b/core/src/functional-components/settings-page.js index c96e36e0..2aaad8c7 100644 --- a/core/src/functional-components/settings-page.js +++ b/core/src/functional-components/settings-page.js @@ -1,8 +1,8 @@ -import { LitElement, html, css } from 'lit' -import { connect } from 'pwa-helpers' -import { store } from '../store.js' -import { doAddNode, doSetNode, doLoadNodeConfig, doRemoveNode, doEditNode } from '../redux/app/app-actions.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {css, html, LitElement} from 'lit' +import {connect} from 'pwa-helpers' +import {store} from '../store.js' +import {doAddNode, doEditNode, doLoadNodeConfig, doRemoveNode, doSetNode} from '../redux/app/app-actions.js' +import {get, registerTranslateConfig, translate, use} from 'lit-translate' import snackbar from './snackbar.js' import '../components/language-selector.js' import '../custom-elements/frag-file-input.js' diff --git a/core/src/functional-components/side-menu-item-style.js b/core/src/functional-components/side-menu-item-style.js index e30386ce..a9711b12 100644 --- a/core/src/functional-components/side-menu-item-style.js +++ b/core/src/functional-components/side-menu-item-style.js @@ -1,4 +1,4 @@ -import { css } from 'lit' +import {css} from 'lit' export const sideMenuItemStyle = css` :host { @@ -21,7 +21,7 @@ export const sideMenuItemStyle = css` --overlay-box-shadow: 0 2px 4px -1px hsla(214, 53%, 23%, 0.16), 0 3px 12px -1px hsla(214, 50%, 22%, 0.26); --overlay-background-color: #ffffff; - + --spacing: 4px; font-family: var(--font-family); @@ -86,7 +86,7 @@ export const sideMenuItemStyle = css` :host([expanded]){ background-color: var(--item-selected-color); } - + :host([hasSelectedChild]){ background-color: var(--item-selected-color); } @@ -109,7 +109,7 @@ export const sideMenuItemStyle = css` } #collapse-button { - float: right; + float: right; } :host([compact]) #itemLink[level]:not([level="0"]) { @@ -143,7 +143,7 @@ export const sideMenuItemStyle = css` z-index: 1; animation: pop 200ms forwards; } - + @keyframes pop{ 0% { transform: translateX(-5px); diff --git a/core/src/functional-components/side-menu-item.js b/core/src/functional-components/side-menu-item.js index ad0ac02e..a24fffb6 100644 --- a/core/src/functional-components/side-menu-item.js +++ b/core/src/functional-components/side-menu-item.js @@ -1,6 +1,6 @@ -import { LitElement, html, css } from 'lit' -import { ifDefined } from 'lit/directives/if-defined.js' -import { sideMenuItemStyle } from './side-menu-item-style.js' +import {css, html, LitElement} from 'lit' +import {ifDefined} from 'lit/directives/if-defined.js' +import {sideMenuItemStyle} from './side-menu-item-style.js' import '@vaadin/icon' import '@vaadin/icons' import '@polymer/paper-tooltip' @@ -50,8 +50,8 @@ export class SideMenuItem extends LitElement { _itemLinkTemplate() { return html` - CryptoJS.AES.encrypt(JSON.stringify(data), salt).toString() + +export const encryptData = (data, salt) => CryptoJS.AES.encrypt(JSON.stringify(data), salt).toString() export const decryptData = (ciphertext, salt) => { const bytes = CryptoJS.AES.decrypt(ciphertext, salt) try { @@ -8,4 +8,4 @@ export const decryptData = (ciphertext, salt) => { } catch(err) { return null } -} \ No newline at end of file +} diff --git a/core/src/notifications/controller.js b/core/src/notifications/controller.js index 20d4994d..1934fb42 100644 --- a/core/src/notifications/controller.js +++ b/core/src/notifications/controller.js @@ -1,7 +1,7 @@ import config from './config' -import { dispatcher } from './dispatcher' +import {dispatcher} from './dispatcher' import snackbar from '../functional-components/snackbar.js' -import { NEW_MESSAGE, NEW_MESSAGE_NOTIFICATION_QAPP, NEW_MESSAGE_NOTIFICATION_QAPP_LOCAL } from './types' +import {NEW_MESSAGE, NEW_MESSAGE_NOTIFICATION_QAPP, NEW_MESSAGE_NOTIFICATION_QAPP_LOCAL} from './types' let initial = 0 let _state @@ -44,7 +44,7 @@ const notificationCheck = function () { export const doNewMessage = function (req) { const newMessage = () => { - + let data if (req.type && req.type === 'qapp') { data = req @@ -73,7 +73,7 @@ export const doNewMessage = function (req) { } else { _state = notificationState } - } + } const page = window.top.location.href if(req.type && req.type === 'qapp-local-notification'){ try { diff --git a/core/src/notifications/dispatcher.js b/core/src/notifications/dispatcher.js index b0c7713e..e31e6d84 100644 --- a/core/src/notifications/dispatcher.js +++ b/core/src/notifications/dispatcher.js @@ -1,5 +1,5 @@ -import { NEW_MESSAGE, NEW_MESSAGE_NOTIFICATION_QAPP, NEW_MESSAGE_NOTIFICATION_QAPP_LOCAL } from './types' -import { newMessage, newMessageNotificationQapp, newMessageNotificationQappLocal } from './notification-actions' +import {NEW_MESSAGE, NEW_MESSAGE_NOTIFICATION_QAPP, NEW_MESSAGE_NOTIFICATION_QAPP_LOCAL} from './types' +import {newMessage, newMessageNotificationQapp, newMessageNotificationQappLocal} from './notification-actions' export const dispatcher = function (notificationState) { diff --git a/core/src/notifications/notification-actions/new-message.js b/core/src/notifications/notification-actions/new-message.js index b3a50b37..b25902f6 100644 --- a/core/src/notifications/notification-actions/new-message.js +++ b/core/src/notifications/notification-actions/new-message.js @@ -1,5 +1,5 @@ -import { store } from '../../store.js' -import { doPageUrl, setNewTab } from '../../redux/app/app-actions.js' +import {store} from '../../store.js' +import {doPageUrl, setNewTab} from '../../redux/app/app-actions.js' import isElectron from 'is-electron' import ShortUniqueId from 'short-unique-id'; diff --git a/core/src/persistState.js b/core/src/persistState.js index d0195d12..277634a0 100644 --- a/core/src/persistState.js +++ b/core/src/persistState.js @@ -1,5 +1,5 @@ -import { store } from './store.js' -import { saveStateToLocalStorage } from './localStorageHelpers.js' +import {store} from './store.js' +import {saveStateToLocalStorage} from './localStorageHelpers.js' const keys = [ 'config', diff --git a/core/src/plugins/addPluginRoutes.js b/core/src/plugins/addPluginRoutes.js index 59796749..e840dd74 100644 --- a/core/src/plugins/addPluginRoutes.js +++ b/core/src/plugins/addPluginRoutes.js @@ -1,4 +1,4 @@ -import { routes } from './routes.js' +import {routes} from './routes.js' export const addPluginRoutes = epmlInstance => { Object.entries(routes).forEach(([route, handler]) => { diff --git a/core/src/plugins/load-plugins.js b/core/src/plugins/load-plugins.js index 693e255e..63b72729 100644 --- a/core/src/plugins/load-plugins.js +++ b/core/src/plugins/load-plugins.js @@ -1,7 +1,7 @@ -import { store } from '../store.js' -import { Epml } from '../epml.js' -import { addPluginRoutes } from './addPluginRoutes' -import { doAddPlugin } from '../redux/app/app-actions.js' +import {store} from '../store.js' +import {Epml} from '../epml.js' +import {addPluginRoutes} from './addPluginRoutes' +import {doAddPlugin} from '../redux/app/app-actions.js' let retryLoadPluginsInterval = 0 export const loadPlugins = () => fetch('/getPlugins') diff --git a/core/src/plugins/plugin-mainjs-loader.js b/core/src/plugins/plugin-mainjs-loader.js index c185a97b..86ec8917 100644 --- a/core/src/plugins/plugin-mainjs-loader.js +++ b/core/src/plugins/plugin-mainjs-loader.js @@ -1,5 +1,5 @@ 'use strict' -import { Epml, EpmlStream } from '../epml.js' +import {Epml, EpmlStream} from '../epml.js' window.Epml = Epml window.EpmlStream = EpmlStream diff --git a/core/src/plugins/routes.js b/core/src/plugins/routes.js index 62358413..01f33410 100644 --- a/core/src/plugins/routes.js +++ b/core/src/plugins/routes.js @@ -1,22 +1,19 @@ -import { store } from '../store.js' +import {store} from '../store.js' import { doAddPluginUrl, - doUpdateBlockInfo, - doUpdateNodeStatus, - doUpdateNodeInfo, - doSetNode, doPageUrl, doSetChatHeads, + doSetNode, doUpdateAccountInfo, + doUpdateBlockInfo, + doUpdateNodeInfo, + doUpdateNodeStatus, } from '../redux/app/app-actions.js' import * as api from 'qortal-ui-crypto' -import { requestTransactionDialog } from '../functional-components/confirm-transaction-dialog.js' -import { doNewMessage } from '../notifications/controller.js' +import {requestTransactionDialog} from '../functional-components/confirm-transaction-dialog.js' +import {doNewMessage} from '../notifications/controller.js' import snackbar from '../functional-components/snackbar.js' -import { - loadStateFromLocalStorage, - saveStateToLocalStorage, -} from '../localStorageHelpers.js' +import {loadStateFromLocalStorage, saveStateToLocalStorage,} from '../localStorageHelpers.js' const createTransaction = api.createTransaction const processTransaction = api.processTransaction @@ -128,13 +125,13 @@ export const routes = { if(!req.data.apiVersion){ res = await processTransaction(tx.signedBytes) } - + let extraData = {} if(req.data.type === 38 && tx && tx._rewardShareKeyPair && tx._rewardShareKeyPair.secretKey){ extraData.rewardSharePrivateKey = Base58.encode(tx._rewardShareKeyPair.secretKey) } - - + + response = { success: true, data: res, @@ -182,8 +179,8 @@ export const routes = { if(!req.data.apiVersion){ res = await processTransaction(tx.signedBytes) } - - + + response = { success: true, data: res, @@ -234,7 +231,7 @@ export const routes = { req.data.chatNonce, store.getState().app.wallet._addresses[req.data.nonce].keyPair ) - + let res if(req.data.apiVersion && req.data.apiVersion === 2){ @@ -243,7 +240,7 @@ export const routes = { if(!req.data.apiVersion){ res = await processTransaction(signedChatBytes) } - + response = res } catch (e) { console.error(e) @@ -270,7 +267,7 @@ export const routes = { if(!req.data.apiVersion){ res = await processTransaction(signedArbitraryBytes) } - + response = res } catch (e) { console.error(e) @@ -296,7 +293,7 @@ export const routes = { if(!req.data.apiVersion){ res = await processTransaction(signedArbitraryBytes) } - + response = res } catch (e) { console.error(e) @@ -366,7 +363,7 @@ export const routes = { unsignedTxn, store.getState().app.selectedAddress.keyPair ) - + let res if(req.data.apiVersion && req.data.apiVersion === 2){ diff --git a/core/src/plugins/streams.js b/core/src/plugins/streams.js index aae100e1..aafac880 100644 --- a/core/src/plugins/streams.js +++ b/core/src/plugins/streams.js @@ -1,5 +1,5 @@ -import { store } from '../store.js' -import { EpmlStream } from 'epml' +import {store} from '../store.js' +import {EpmlStream} from 'epml' const LOGIN_STREAM_NAME = 'logged_in' const CONFIG_STREAM_NAME = 'config' diff --git a/core/src/redux/app/actions/app-core.js b/core/src/redux/app/actions/app-core.js index 53e9d547..77f99a87 100644 --- a/core/src/redux/app/actions/app-core.js +++ b/core/src/redux/app/actions/app-core.js @@ -1,5 +1,26 @@ // Core App Actions here... -import { UPDATE_BLOCK_INFO, UPDATE_NODE_STATUS, UPDATE_NODE_INFO, CHAT_HEADS, ACCOUNT_INFO, ADD_AUTO_LOAD_IMAGES_CHAT, REMOVE_AUTO_LOAD_IMAGES_CHAT, ALLOW_QAPP_AUTO_AUTH, REMOVE_QAPP_AUTO_AUTH, SET_CHAT_LAST_SEEN, ADD_CHAT_LAST_SEEN, ALLOW_QAPP_AUTO_LISTS, REMOVE_QAPP_AUTO_LISTS, SET_NEW_TAB, ADD_TAB_INFO, SET_TAB_NOTIFICATIONS, IS_OPEN_DEV_DIALOG, SET_NEW_NOTIFICATION, SET_SIDE_EFFECT, SET_COIN_BALANCES } from '../app-action-types.js' +import { + ACCOUNT_INFO, + ADD_AUTO_LOAD_IMAGES_CHAT, + ADD_CHAT_LAST_SEEN, + ADD_TAB_INFO, + ALLOW_QAPP_AUTO_AUTH, + ALLOW_QAPP_AUTO_LISTS, + CHAT_HEADS, + IS_OPEN_DEV_DIALOG, + REMOVE_AUTO_LOAD_IMAGES_CHAT, + REMOVE_QAPP_AUTO_AUTH, + REMOVE_QAPP_AUTO_LISTS, + SET_CHAT_LAST_SEEN, + SET_COIN_BALANCES, + SET_NEW_NOTIFICATION, + SET_NEW_TAB, + SET_SIDE_EFFECT, + SET_TAB_NOTIFICATIONS, + UPDATE_BLOCK_INFO, + UPDATE_NODE_INFO, + UPDATE_NODE_STATUS +} from '../app-action-types.js' export const doUpdateBlockInfo = (blockObj) => { return (dispatch, getState) => { @@ -164,4 +185,4 @@ export const setCoinBalances = (payload)=> { type: SET_COIN_BALANCES, payload } -} \ No newline at end of file +} diff --git a/core/src/redux/app/actions/init-worker.js b/core/src/redux/app/actions/init-worker.js index ce77b25e..3bdff3ee 100644 --- a/core/src/redux/app/actions/init-worker.js +++ b/core/src/redux/app/actions/init-worker.js @@ -1,7 +1,8 @@ -import { Epml } from '../../../epml.js' -import { EpmlWorkerPlugin } from 'epml' +import {Epml} from '../../../epml.js' +import {EpmlWorkerPlugin} from 'epml' + +import {INIT_WORKERS} from '../app-action-types.js' -import { INIT_WORKERS } from '../app-action-types.js' Epml.registerPlugin(EpmlWorkerPlugin) export const doInitWorkers = (numberOfWorkers, workerURL) => { diff --git a/core/src/redux/app/actions/login.js b/core/src/redux/app/actions/login.js index 02ce7e52..0bb8b092 100644 --- a/core/src/redux/app/actions/login.js +++ b/core/src/redux/app/actions/login.js @@ -1,4 +1,4 @@ -import { LOG_IN, LOG_OUT, SELECT_ADDRESS } from '../app-action-types.js' +import {LOG_IN, LOG_OUT, SELECT_ADDRESS} from '../app-action-types.js' export const doSelectAddress = address => { return (dispatch, getState) => { diff --git a/core/src/redux/app/actions/node-config.js b/core/src/redux/app/actions/node-config.js index 700e0c5f..1761239f 100644 --- a/core/src/redux/app/actions/node-config.js +++ b/core/src/redux/app/actions/node-config.js @@ -1,6 +1,6 @@ // Node Config Actions here... -import { LOAD_NODE_CONFIG, SET_NODE, ADD_NODE, REMOVE_NODE, EDIT_NODE } from '../app-action-types.js' -import { UI_VERSION } from '../version.js' +import {ADD_NODE, EDIT_NODE, LOAD_NODE_CONFIG, REMOVE_NODE, SET_NODE} from '../app-action-types.js' +import {UI_VERSION} from '../version.js' const nodeConfigUrl = '/getConfig' diff --git a/core/src/redux/app/actions/plugins.js b/core/src/redux/app/actions/plugins.js index 84e4d820..e376befe 100644 --- a/core/src/redux/app/actions/plugins.js +++ b/core/src/redux/app/actions/plugins.js @@ -1,4 +1,4 @@ -import { ADD_PLUGIN, ADD_PLUGIN_URL, PAGE_URL } from '../app-action-types.js' +import {ADD_PLUGIN, ADD_PLUGIN_URL, PAGE_URL} from '../app-action-types.js' export const doAddPluginUrl = (pluginUrlsConf) => { return (dispatch, getState) => { diff --git a/core/src/redux/app/app-actions.js b/core/src/redux/app/app-actions.js index 51574a58..3dea965a 100644 --- a/core/src/redux/app/app-actions.js +++ b/core/src/redux/app/app-actions.js @@ -1,4 +1,4 @@ -import { NAVIGATE, NETWORK_CONNECTION_STATUS } from './app-action-types.js' +import {NAVIGATE, NETWORK_CONNECTION_STATUS} from './app-action-types.js' export * from './actions/login.js' export * from './actions/init-worker.js' diff --git a/core/src/redux/app/app-reducer.js b/core/src/redux/app/app-reducer.js index e67826dd..8de46a5f 100644 --- a/core/src/redux/app/app-reducer.js +++ b/core/src/redux/app/app-reducer.js @@ -1,10 +1,47 @@ // Loading state, login state, isNavDrawOpen state etc. None of this needs to be saved to localstorage. -import { loadStateFromLocalStorage, saveStateToLocalStorage } from '../../localStorageHelpers.js' -import { LOG_IN, LOG_OUT, NETWORK_CONNECTION_STATUS, INIT_WORKERS, ADD_PLUGIN_URL, ADD_PLUGIN, ADD_NEW_PLUGIN_URL, NAVIGATE, SELECT_ADDRESS, ACCOUNT_INFO, CHAT_HEADS, UPDATE_BLOCK_INFO, UPDATE_NODE_STATUS, UPDATE_NODE_INFO, LOAD_NODE_CONFIG, SET_NODE, ADD_NODE, PAGE_URL, ADD_AUTO_LOAD_IMAGES_CHAT, REMOVE_AUTO_LOAD_IMAGES_CHAT, ALLOW_QAPP_AUTO_AUTH, REMOVE_QAPP_AUTO_AUTH, SET_CHAT_LAST_SEEN, ADD_CHAT_LAST_SEEN, ALLOW_QAPP_AUTO_LISTS, REMOVE_QAPP_AUTO_LISTS, SET_NEW_TAB, ADD_TAB_INFO, SET_TAB_NOTIFICATIONS, IS_OPEN_DEV_DIALOG, REMOVE_NODE, EDIT_NODE, SET_NEW_NOTIFICATION, SET_SIDE_EFFECT, SET_COIN_BALANCES } from './app-action-types.js' -import { initWorkersReducer } from './reducers/init-workers.js' -import { loginReducer } from './reducers/login-reducer.js' -import { setNode, addNode, removeNode, editNode } from './reducers/manage-node.js' +import {loadStateFromLocalStorage, saveStateToLocalStorage} from '../../localStorageHelpers.js' +import { + ACCOUNT_INFO, + ADD_AUTO_LOAD_IMAGES_CHAT, + ADD_CHAT_LAST_SEEN, + ADD_NEW_PLUGIN_URL, + ADD_NODE, + ADD_PLUGIN, + ADD_PLUGIN_URL, + ADD_TAB_INFO, + ALLOW_QAPP_AUTO_AUTH, + ALLOW_QAPP_AUTO_LISTS, + CHAT_HEADS, + EDIT_NODE, + INIT_WORKERS, + IS_OPEN_DEV_DIALOG, + LOAD_NODE_CONFIG, + LOG_IN, + LOG_OUT, + NAVIGATE, + NETWORK_CONNECTION_STATUS, + PAGE_URL, + REMOVE_AUTO_LOAD_IMAGES_CHAT, + REMOVE_NODE, + REMOVE_QAPP_AUTO_AUTH, + REMOVE_QAPP_AUTO_LISTS, + SELECT_ADDRESS, + SET_CHAT_LAST_SEEN, + SET_COIN_BALANCES, + SET_NEW_NOTIFICATION, + SET_NEW_TAB, + SET_NODE, + SET_SIDE_EFFECT, + SET_TAB_NOTIFICATIONS, + UPDATE_BLOCK_INFO, + UPDATE_NODE_INFO, + UPDATE_NODE_STATUS +} from './app-action-types.js' +import {initWorkersReducer} from './reducers/init-workers.js' +import {loginReducer} from './reducers/login-reducer.js' +import {addNode, editNode, removeNode, setNode} from './reducers/manage-node.js' import localForage from "localforage"; + const chatLastSeen = localForage.createInstance({ name: "chat-last-seen", }); @@ -71,7 +108,7 @@ export default (state = INITIAL_STATE, action) => { wallet: INITIAL_STATE.wallet, selectedAddress: INITIAL_STATE.selectedAddress, accountInfo: INITIAL_STATE.accountInfo - + } case ADD_PLUGIN: return { diff --git a/core/src/redux/config/config-reducer.js b/core/src/redux/config/config-reducer.js index 5a53f4d1..81900681 100644 --- a/core/src/redux/config/config-reducer.js +++ b/core/src/redux/config/config-reducer.js @@ -1,8 +1,8 @@ // Must be saved to localstorage. Will storage things such as saved addresses and themes (day/night mode) etc. // Initial state needs to be loaded from either the getConfig url or localstorage...NOT set via this -import { loadStateFromLocalStorage } from '../../localStorageHelpers' -import { LOAD_CONFIG_FROM_API } from './config-actions.js' -import { loadConfigFromAPI } from './reducers/load-config-from-api.js' +import {loadStateFromLocalStorage} from '../../localStorageHelpers' +import {LOAD_CONFIG_FROM_API} from './config-actions.js' +import {loadConfigFromAPI} from './reducers/load-config-from-api.js' const DEFAULT_INITIAL_STATE = { styles: { diff --git a/core/src/redux/reducers.js b/core/src/redux/reducers.js index 8fb963a0..8b9235c8 100644 --- a/core/src/redux/reducers.js +++ b/core/src/redux/reducers.js @@ -1,4 +1,4 @@ -import { combineReducers } from 'redux' +import {combineReducers} from 'redux' import app from './app/app-reducer.js' import config from './config/config-reducer.js' diff --git a/core/src/redux/user/actions/claim-airdrop.js b/core/src/redux/user/actions/claim-airdrop.js index 24f25dda..d94b5fe1 100644 --- a/core/src/redux/user/actions/claim-airdrop.js +++ b/core/src/redux/user/actions/claim-airdrop.js @@ -1,4 +1,4 @@ -import { CLAIM_AIRDROP } from '../user-action-types.js' +import {CLAIM_AIRDROP} from '../user-action-types.js' export const doClaimAirdrop = (address) => { return (dispatch, getState) => { diff --git a/core/src/redux/user/actions/notification-config.js b/core/src/redux/user/actions/notification-config.js index 646865f6..949a32b8 100644 --- a/core/src/redux/user/actions/notification-config.js +++ b/core/src/redux/user/actions/notification-config.js @@ -1,5 +1,4 @@ - -import { LOAD_NOTIFICATION_CONFIG, SET_QCHAT_NOTIFICATION_CONFIG } from '../user-action-types.js' +import {LOAD_NOTIFICATION_CONFIG, SET_QCHAT_NOTIFICATION_CONFIG} from '../user-action-types.js' const configUrl = '/getConfig' diff --git a/core/src/redux/user/actions/store-wallet.js b/core/src/redux/user/actions/store-wallet.js index 2621ad25..07b5f872 100644 --- a/core/src/redux/user/actions/store-wallet.js +++ b/core/src/redux/user/actions/store-wallet.js @@ -1,4 +1,4 @@ -import { STORE_WALLET, REMOVE_WALLET, UPDATE_STORED_WALLET_NAME } from '../user-action-types.js' +import {REMOVE_WALLET, STORE_WALLET, UPDATE_STORED_WALLET_NAME} from '../user-action-types.js' export const doStoreWallet = (wallet, password, name, statusUpdateFn = () => { }) => { return (dispatch, getState) => { diff --git a/core/src/redux/user/actions/update-account-info.js b/core/src/redux/user/actions/update-account-info.js index def4695f..7b80ab82 100644 --- a/core/src/redux/user/actions/update-account-info.js +++ b/core/src/redux/user/actions/update-account-info.js @@ -1,4 +1,4 @@ -import { UPDATE_ACCOUNT_INFO } from '../user-action-types' +import {UPDATE_ACCOUNT_INFO} from '../user-action-types' export const doUpdateAccountInfo = (accInfo) => { return (dispatch, getState) => { diff --git a/core/src/redux/user/actions/update-name.js b/core/src/redux/user/actions/update-name.js index c3eb1772..ae46cee0 100644 --- a/core/src/redux/user/actions/update-name.js +++ b/core/src/redux/user/actions/update-name.js @@ -1,5 +1,5 @@ -import { updateAccountInfo } from './update-account-info.js' -import { doUpdateStoredWalletName } from './store-wallet.js' +import {updateAccountInfo} from './update-account-info.js' +import {doUpdateStoredWalletName} from './store-wallet.js' const GET_NAME_URL = 'names/address/' const CHECK_NAME_INTERVAL = 1000 * 10 // Every 10 seconds diff --git a/core/src/redux/user/user-reducer.js b/core/src/redux/user/user-reducer.js index b6535737..67f24757 100644 --- a/core/src/redux/user/user-reducer.js +++ b/core/src/redux/user/user-reducer.js @@ -1,5 +1,12 @@ -import { loadStateFromLocalStorage } from '../../localStorageHelpers' -import { STORE_WALLET, REMOVE_WALLET, CLAIM_AIRDROP, UPDATE_ACCOUNT_INFO, LOAD_NOTIFICATION_CONFIG, SET_QCHAT_NOTIFICATION_CONFIG } from './user-action-types.js' +import {loadStateFromLocalStorage} from '../../localStorageHelpers' +import { + CLAIM_AIRDROP, + LOAD_NOTIFICATION_CONFIG, + REMOVE_WALLET, + SET_QCHAT_NOTIFICATION_CONFIG, + STORE_WALLET, + UPDATE_ACCOUNT_INFO +} from './user-action-types.js' const DEFAULT_INITIAL_STATE = { storedWallets: {}, diff --git a/core/src/stateAwait.js b/core/src/stateAwait.js index 1668cb54..7736b769 100644 --- a/core/src/stateAwait.js +++ b/core/src/stateAwait.js @@ -1,7 +1,7 @@ /** * Simple helper function so that I can do `await stateAwait(state => state.something === true)` or `await stateAwait(state => state.name === 'myName')` */ -import { store } from './store.js' +import {store} from './store.js' let subscriptions = [] store.subscribe(() => { diff --git a/core/src/store.js b/core/src/store.js index 16622e7d..141f4d6e 100644 --- a/core/src/store.js +++ b/core/src/store.js @@ -1,7 +1,8 @@ -import { createStore, compose, applyMiddleware } from 'redux' +import {applyMiddleware, compose, createStore} from 'redux' import thunk from 'redux-thunk' import reducers from './redux/reducers.js' + const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose export const store = createStore( diff --git a/core/src/styles/app-styles.js b/core/src/styles/app-styles.js index 09a9a1ca..2fac5ce4 100644 --- a/core/src/styles/app-styles.js +++ b/core/src/styles/app-styles.js @@ -1,4 +1,4 @@ -import { LitElement, html } from 'lit' +import {html, LitElement} from 'lit' import './styles.scss' import './app-theme.js' @@ -21,7 +21,7 @@ class AppStyles extends LitElement { --shadow-4: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22); --shadow-5: 0 19px 38px rgba(0,0,0,0.30), 0 15px 12px rgba(0,0,0,0.22); --paper-input-container-focus-color: var(--mdc-theme-secondary); - + font-family: "Roboto", sans-serif; color: var(--mdc-theme-on-surface); --window-height: ${this.windowHeight}; diff --git a/core/src/styles/app-theme.js b/core/src/styles/app-theme.js index 7a94f99f..f2e9f93b 100644 --- a/core/src/styles/app-theme.js +++ b/core/src/styles/app-theme.js @@ -1,6 +1,6 @@ -import { LitElement, html } from 'lit' -import { connect } from 'pwa-helpers' -import { store } from '../store.js' +import {html, LitElement} from 'lit' +import {connect} from 'pwa-helpers' +import {store} from '../store.js' class AppTheme extends connect(store)(LitElement) { @@ -27,7 +27,7 @@ class AppTheme extends connect(store)(LitElement) { --mdc-theme-secondary: ${this.theme.colors.secondary}; /* Sets the text color to the theme secondary color. */ --mdc-theme-secondary-bg: ${this.theme.colors.secondaryBg};/* Sets the background color to the theme secondary color. */ --mdc-theme-on-secondary: ${this.theme.colors.onSecondary}; /* Sets the text color to the color configured for text on the secondary color. */ - + --mdc-theme-surface: ${this.theme.colors.surface}; /* Sets the background color to the surface background color. */ --mdc-theme-on-surface: ${this.theme.colors.onSurface};/* Sets the text color to the color configured for text on the surface color. */ --mdc-theme-background: ${this.theme.colors.background};/* Sets the background color to the theme background color. */ @@ -43,7 +43,7 @@ class AppTheme extends connect(store)(LitElement) { paper-spinner-lite, paper-spinner { --paper-spinner-color: var(--mdc-theme-secondary) } - + ` } diff --git a/core/src/tradebot/addTradeBotRoutes.js b/core/src/tradebot/addTradeBotRoutes.js index 1cef040c..50da648e 100644 --- a/core/src/tradebot/addTradeBotRoutes.js +++ b/core/src/tradebot/addTradeBotRoutes.js @@ -1,4 +1,4 @@ -import { routes } from './trade-bot-routes.js' +import {routes} from './trade-bot-routes.js' export const addTradeBotRoutes = epmlInstance => { Object.entries(routes).forEach(([route, handler]) => { diff --git a/core/src/tradebot/trade-bot-routes.js b/core/src/tradebot/trade-bot-routes.js index aecb989f..4fb72c4c 100644 --- a/core/src/tradebot/trade-bot-routes.js +++ b/core/src/tradebot/trade-bot-routes.js @@ -1,4 +1,4 @@ -import { store } from '../store.js' +import {store} from '../store.js' import * as api from 'qortal-ui-crypto' import snackbar from '../functional-components/snackbar.js' @@ -35,14 +35,14 @@ export const routes = { if (!req.disableModal && !req.data.disableModal) { await requestTransactionDialog.requestTransaction(tx) } - + const res = await processTransaction(tx.signedBytes) let extraData = {} if(req.data.type === 38 && tx && tx._rewardShareKeyPair && tx._rewardShareKeyPair.secretKey){ extraData.rewardSharePrivateKey = Base58.encode(tx._rewardShareKeyPair.secretKey) } - - + + response = { success: true, data: res, diff --git a/core/src/worker.js b/core/src/worker.js index 24a11d8b..a1188062 100644 --- a/core/src/worker.js +++ b/core/src/worker.js @@ -1,7 +1,7 @@ -import { Epml, EpmlReadyPlugin, RequestPlugin, EpmlWorkerPlugin } from 'epml' +import {Epml, EpmlReadyPlugin, EpmlWorkerPlugin, RequestPlugin} from 'epml' import utils from './cryptoUtils.js' -import { Sha512, bytes_to_base64 as bytesToBase64 } from 'asmcrypto.js' +import {bytes_to_base64 as bytesToBase64, Sha512} from 'asmcrypto.js' import bcrypt from 'bcryptjs' Epml.registerPlugin(RequestPlugin) diff --git a/crypto/api.js b/crypto/api.js index 543d875d..e7ea9034 100644 --- a/crypto/api.js +++ b/crypto/api.js @@ -1,9 +1,9 @@ -import { Sha256 } from 'asmcrypto.js' +import {Sha256} from 'asmcrypto.js' import Base58 from './api/deps/Base58' import Base64 from './api/deps/Base64' -import { base58PublicKeyToAddress } from './api/wallet/base58PublicKeyToAddress' -import { validateAddress } from './api/wallet/validateAddress' -import { decryptChatMessage, decryptChatMessageBase64 } from './api/transactions/chat/decryptChatMessage' +import {base58PublicKeyToAddress} from './api/wallet/base58PublicKeyToAddress' +import {validateAddress} from './api/wallet/validateAddress' +import {decryptChatMessage, decryptChatMessageBase64} from './api/transactions/chat/decryptChatMessage' import _ from 'lodash' window.Sha256 = Sha256 diff --git a/crypto/api/PhraseWallet.js b/crypto/api/PhraseWallet.js index 41818a28..bfe81999 100644 --- a/crypto/api/PhraseWallet.js +++ b/crypto/api/PhraseWallet.js @@ -3,11 +3,11 @@ Copyright 2017-2018 @ irontiga and vbcs (original developer) */ 'use strict' import Base58 from './deps/Base58.js' -import { Sha256, Sha512 } from 'asmcrypto.js' +import {Sha256, Sha512} from 'asmcrypto.js' import nacl from './deps/nacl-fast.js' import utils from './deps/utils.js' -import { generateSaveWalletData } from './storeWallet.js' +import {generateSaveWalletData} from './storeWallet.js' import publicKeyToAddress from './wallet/publicKeyToAddress.js' import AltcoinHDWallet from "./bitcoin/AltcoinHDWallet" @@ -93,7 +93,7 @@ export default class PhraseWallet { const address = publicKeyToAddress(addrKeyPair.publicKey); const qoraAddress = publicKeyToAddress(addrKeyPair.publicKey, true); - // Create Bitcoin HD Wallet + // Create Bitcoin HD Wallet const btcSeed = [...addrSeed]; const btcWallet = new AltcoinHDWallet({ mainnet: { @@ -108,7 +108,7 @@ export default class PhraseWallet { } }).createWallet(new Uint8Array(btcSeed), false); - // Create Litecoin HD Wallet + // Create Litecoin HD Wallet const ltcSeed = [...addrSeed]; const ltcWallet = new AltcoinHDWallet({ mainnet: { @@ -123,7 +123,7 @@ export default class PhraseWallet { } }).createWallet(new Uint8Array(ltcSeed), false, 'LTC'); - // Create Dogecoin HD Wallet + // Create Dogecoin HD Wallet const dogeSeed = [...addrSeed]; const dogeWallet = new AltcoinHDWallet({ mainnet: { @@ -138,7 +138,7 @@ export default class PhraseWallet { } }).createWallet(new Uint8Array(dogeSeed), false, 'DOGE'); - // Create Digibyte HD Wallet + // Create Digibyte HD Wallet const dgbSeed = [...addrSeed]; const dgbWallet = new AltcoinHDWallet({ mainnet: { @@ -153,7 +153,7 @@ export default class PhraseWallet { } }).createWallet(new Uint8Array(dgbSeed), false, 'DGB'); - // Create Ravencoin HD Wallet + // Create Ravencoin HD Wallet const rvnSeed = [...addrSeed]; const rvnWallet = new AltcoinHDWallet({ mainnet: { @@ -168,7 +168,7 @@ export default class PhraseWallet { } }).createWallet(new Uint8Array(rvnSeed), false, 'RVN'); - // Create Pirate Chain HD Wallet + // Create Pirate Chain HD Wallet const arrrSeed = [...addrSeed]; const arrrWallet = new AltcoinHDWallet({ mainnet: { diff --git a/crypto/api/bitcoin/AltcoinHDWallet.js b/crypto/api/bitcoin/AltcoinHDWallet.js index 421d19fb..c0131e19 100644 --- a/crypto/api/bitcoin/AltcoinHDWallet.js +++ b/crypto/api/bitcoin/AltcoinHDWallet.js @@ -1,10 +1,10 @@ 'use strict'; import Base58 from '../deps/Base58.js' -import { Sha256, Sha512 } from 'asmcrypto.js' +import {Sha256, Sha512} from 'asmcrypto.js' import jsSHA from 'jssha' import RIPEMD160 from '../deps/ripemd160.js' import utils from '../deps/utils.js' -import { EllipticCurve, BigInteger } from './ecbn.js' +import {BigInteger, EllipticCurve} from './ecbn.js' export default class AltcoinHDWallet { @@ -335,7 +335,7 @@ export default class AltcoinHDWallet { // Append 1 byte '0x00' (to make the key data 33 bytes, DO THIS ONLY FOR PRIVATE KEYS ) s.push(0) - //if the private key length is less than 32 let's add leading zeros + //if the private key length is less than 32 let's add leading zeros if(this.privateKey.length<32){ for(let i=this.privateKey.length;i<32;i++){ s.push(0) diff --git a/crypto/api/createTransaction.js b/crypto/api/createTransaction.js index b4bf7802..faf24803 100644 --- a/crypto/api/createTransaction.js +++ b/crypto/api/createTransaction.js @@ -1,6 +1,6 @@ -import { transactionTypes as transactions } from './transactions/transactions.js' +import {transactionTypes as transactions} from './transactions/transactions.js' import Base58 from './deps/Base58.js' -import { request } from './fetch-request' +import {request} from './fetch-request' import signChat from './transactions/chat/signChat.js' import signArbitrary from './transactions/arbitrary/signArbitrary.js' import signArbitraryWithFee from './transactions/arbitrary/signArbitraryWithFee.js' diff --git a/crypto/api/createWallet.js b/crypto/api/createWallet.js index ed978183..341a2aeb 100644 --- a/crypto/api/createWallet.js +++ b/crypto/api/createWallet.js @@ -1,7 +1,7 @@ -import { kdf } from './kdf.js' +import {kdf} from './kdf.js' import PhraseWallet from './PhraseWallet.js' import Base58 from './deps/Base58.js' -import { decryptStoredWallet } from './decryptStoredWallet.js' +import {decryptStoredWallet} from './decryptStoredWallet.js' export const createWallet = async (sourceType, source, statusUpdateFn) => { let version, seed diff --git a/crypto/api/decryptStoredWallet.js b/crypto/api/decryptStoredWallet.js index 9a045376..0d026e3a 100644 --- a/crypto/api/decryptStoredWallet.js +++ b/crypto/api/decryptStoredWallet.js @@ -1,7 +1,7 @@ import Base58 from './deps/Base58.js' -import { kdf } from './kdf.js' -import { HmacSha512, AES_CBC } from 'asmcrypto.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {kdf} from './kdf.js' +import {AES_CBC, HmacSha512} from 'asmcrypto.js' +import {get, registerTranslateConfig} from 'lit-translate' registerTranslateConfig({ loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) diff --git a/crypto/api/fetch-request.js b/crypto/api/fetch-request.js index f7e5c9b2..a1ccee31 100644 --- a/crypto/api/fetch-request.js +++ b/crypto/api/fetch-request.js @@ -1,4 +1,4 @@ -import { watchConfig, waitForConfig } from '../config.js' +import {waitForConfig, watchConfig} from '../config.js' let config = {} watchConfig((c) => { diff --git a/crypto/api/kdf.js b/crypto/api/kdf.js index bf3daec5..fcff88eb 100644 --- a/crypto/api/kdf.js +++ b/crypto/api/kdf.js @@ -1,8 +1,8 @@ -import { store } from '../api_deps.js' -import { stateAwait } from './utils/stateAwait.js' -import { Sha512 } from 'asmcrypto.js' +import {store} from '../api_deps.js' +import {stateAwait} from './utils/stateAwait.js' +import {Sha512} from 'asmcrypto.js' import utils from '../api/deps/utils.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {get, registerTranslateConfig} from 'lit-translate' registerTranslateConfig({ loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) diff --git a/crypto/api/registerUsername.js b/crypto/api/registerUsername.js index 9715a078..1092e756 100644 --- a/crypto/api/registerUsername.js +++ b/crypto/api/registerUsername.js @@ -1,7 +1,7 @@ /** * Not to be confused with register name...this is a special use case */ -import { request, createTransaction, processTransaction } from './api.js' +import {createTransaction, processTransaction, request} from './api.js' const TX_TYPE = 3 // NAME_REGISTRATION const CHECK_LAST_REF_INTERVAL = 30 * 1000 // err 30 seconds diff --git a/crypto/api/storeWallet.js b/crypto/api/storeWallet.js index 9d16c8af..f63a2ce2 100644 --- a/crypto/api/storeWallet.js +++ b/crypto/api/storeWallet.js @@ -1,5 +1,5 @@ -import { HmacSha512, AES_CBC } from 'asmcrypto.js' -import { kdf } from './kdf.js' +import {AES_CBC, HmacSha512} from 'asmcrypto.js' +import {kdf} from './kdf.js' import Base58 from './deps/Base58.js' const getRandomValues = window.crypto ? window.crypto.getRandomValues.bind(window.crypto) : window.msCrypto.getRandomValues.bind(window.msCrypto) diff --git a/crypto/api/tradeRequest.js b/crypto/api/tradeRequest.js index 797cbe5b..892c1318 100644 --- a/crypto/api/tradeRequest.js +++ b/crypto/api/tradeRequest.js @@ -3,7 +3,7 @@ import TradeBotCreateRequest from './transactions/trade-portal/tradebot/TradeBot import TradeBotRespondRequest from './transactions/trade-portal/tradebot/TradeBotRespondRequest.js' import signTradeBotTransaction from './transactions/trade-portal/tradebot/signTradeBotTransaction.js' import DeleteTradeOffer from './transactions/trade-portal/tradeoffer/DeleteTradeOffer.js' -import { request } from './fetch-request' +import {request} from './fetch-request' // TradeBotCreateRequest export const tradeBotCreateRequest = (requestObject) => { @@ -55,7 +55,7 @@ export const deleteTradeOffer = (requestObject) => { }) } -// Send BTC +// Send BTC export const sendBtc = (requestObject) => { const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node] @@ -69,7 +69,7 @@ export const sendBtc = (requestObject) => { }) } -// Send LTC +// Send LTC export const sendLtc = (requestObject) => { const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node] @@ -83,7 +83,7 @@ export const sendLtc = (requestObject) => { }) } -// Send DOGE +// Send DOGE export const sendDoge = (requestObject) => { const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node] @@ -97,7 +97,7 @@ export const sendDoge = (requestObject) => { }) } -// Send DGB +// Send DGB export const sendDgb = (requestObject) => { const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node] @@ -111,7 +111,7 @@ export const sendDgb = (requestObject) => { }) } -// Send RVN +// Send RVN export const sendRvn = (requestObject) => { const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node] @@ -125,7 +125,7 @@ export const sendRvn = (requestObject) => { }) } -// Send ARRR +// Send ARRR export const sendArrr = (requestObject) => { const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node] diff --git a/crypto/api/transactions/AirdropTransaction.js b/crypto/api/transactions/AirdropTransaction.js index e23029a8..0d366ab5 100644 --- a/crypto/api/transactions/AirdropTransaction.js +++ b/crypto/api/transactions/AirdropTransaction.js @@ -1,6 +1,6 @@ 'use strict' import TransactionBase from './TransactionBase.js' -import { QORT_DECIMALS } from '../constants.js' +import {QORT_DECIMALS} from '../constants.js' export default class PaymentTransaction extends TransactionBase { constructor() { diff --git a/crypto/api/transactions/DeployAtTransaction.js b/crypto/api/transactions/DeployAtTransaction.js index 23e50255..3e4edbc3 100644 --- a/crypto/api/transactions/DeployAtTransaction.js +++ b/crypto/api/transactions/DeployAtTransaction.js @@ -1,7 +1,7 @@ 'use strict' import TransactionBase from './TransactionBase.js' -import { store } from '../../api.js' -import { QORT_DECIMALS } from '../constants.js' +import {store} from '../../api.js' +import {QORT_DECIMALS} from '../constants.js' export default class DeployAtTransaction extends TransactionBase { constructor() { @@ -81,7 +81,7 @@ export default class DeployAtTransaction extends TransactionBase { set rAssetId(rAssetId) { this._rAssetId = this.constructor.utils.int64ToBytes(rAssetId) } - + get params() { const params = super.params diff --git a/crypto/api/transactions/MessageTransaction.js b/crypto/api/transactions/MessageTransaction.js index ea0e4079..5e34c0fa 100644 --- a/crypto/api/transactions/MessageTransaction.js +++ b/crypto/api/transactions/MessageTransaction.js @@ -1,6 +1,5 @@ 'use strict' import PaymentTransaction from './PaymentTransaction.js' -import { QORT_DECIMALS } from '../constants.js' export default class MessageTransaction extends PaymentTransaction { constructor() { diff --git a/crypto/api/transactions/PaymentTransaction.js b/crypto/api/transactions/PaymentTransaction.js index bde396eb..7e86b211 100644 --- a/crypto/api/transactions/PaymentTransaction.js +++ b/crypto/api/transactions/PaymentTransaction.js @@ -1,7 +1,7 @@ 'use strict' import TransactionBase from './TransactionBase.js' import Base58 from '../deps/Base58.js' -import { store } from '../../api.js' +import {store} from '../../api.js' export default class PaymentTransaction extends TransactionBase { constructor() { @@ -17,12 +17,12 @@ export default class PaymentTransaction extends TransactionBase { ${this._dialogto}: - ${this.dialogAddress} ${' '}- - ${Base58.encode(this._recipient)} + ${this.dialogAddress} ${' '}- + ${Base58.encode(this._recipient)} ${this.recipientName ? html` - ${this.dialogName} ${' '}- + ${this.dialogName} ${' '}- ${this.recipientName} ` : ''} diff --git a/crypto/api/transactions/PublicizeTransaction.js b/crypto/api/transactions/PublicizeTransaction.js index 569f5e38..2e1afda4 100644 --- a/crypto/api/transactions/PublicizeTransaction.js +++ b/crypto/api/transactions/PublicizeTransaction.js @@ -1,6 +1,6 @@ "use strict"; import ChatBase from "./chat/ChatBase.js" -import { QORT_DECIMALS } from "../constants.js" +import {QORT_DECIMALS} from "../constants.js" export default class PublicizeTransaction extends ChatBase { constructor() { diff --git a/crypto/api/transactions/TransactionBase.js b/crypto/api/transactions/TransactionBase.js index f41b7749..e29f00b4 100644 --- a/crypto/api/transactions/TransactionBase.js +++ b/crypto/api/transactions/TransactionBase.js @@ -1,5 +1,5 @@ 'use strict' -import { TX_TYPES, QORT_DECIMALS } from '../constants.js' +import {QORT_DECIMALS, TX_TYPES} from '../constants.js' import nacl from '../deps/nacl-fast.js' import Base58 from '../deps/Base58.js' import utils from '../deps/utils.js' diff --git a/crypto/api/transactions/TransferPrivsTransaction.js b/crypto/api/transactions/TransferPrivsTransaction.js index 858ac26a..61029703 100644 --- a/crypto/api/transactions/TransferPrivsTransaction.js +++ b/crypto/api/transactions/TransferPrivsTransaction.js @@ -1,8 +1,7 @@ 'use strict' import TransactionBase from './TransactionBase.js' -import Base58 from '../deps/Base58.js' -import { store } from '../../api.js' -import { QORT_DECIMALS } from '../constants.js' +import {store} from '../../api.js' +import {QORT_DECIMALS} from '../constants.js' export default class TransferPrivsTransaction extends TransactionBase { constructor() { diff --git a/crypto/api/transactions/chat/ChatBase.js b/crypto/api/transactions/chat/ChatBase.js index 240c9068..ce9fe8dc 100644 --- a/crypto/api/transactions/chat/ChatBase.js +++ b/crypto/api/transactions/chat/ChatBase.js @@ -1,5 +1,5 @@ 'use strict' -import { TX_TYPES, QORT_DECIMALS } from '../../constants.js' +import {QORT_DECIMALS, TX_TYPES} from '../../constants.js' import nacl from '../../deps/nacl-fast.js' import Base58 from '../../deps/Base58.js' import utils from '../../deps/utils.js' diff --git a/crypto/api/transactions/chat/ChatTransaction.js b/crypto/api/transactions/chat/ChatTransaction.js index d6313924..b79aa415 100644 --- a/crypto/api/transactions/chat/ChatTransaction.js +++ b/crypto/api/transactions/chat/ChatTransaction.js @@ -2,8 +2,8 @@ import ChatBase from "./ChatBase.js" import nacl from '../../deps/nacl-fast.js' import ed2curve from '../../deps/ed2curve.js' -import { Sha256 } from 'asmcrypto.js' -import { CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP } from '../../constants.js' +import {Sha256} from 'asmcrypto.js' +import {CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP} from '../../constants.js' export default class ChatTransaction extends ChatBase { diff --git a/crypto/api/transactions/chat/GroupChatTransaction.js b/crypto/api/transactions/chat/GroupChatTransaction.js index dc3a856b..a7dd51c3 100644 --- a/crypto/api/transactions/chat/GroupChatTransaction.js +++ b/crypto/api/transactions/chat/GroupChatTransaction.js @@ -1,6 +1,6 @@ 'use strict' import ChatBase from "./ChatBase.js" -import { CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP } from '../../constants.js' +import {CHAT_REFERENCE_FEATURE_TRIGGER_TIMESTAMP} from '../../constants.js' export default class GroupChatTransaction extends ChatBase { constructor() { diff --git a/crypto/api/transactions/chat/decryptChatMessage.js b/crypto/api/transactions/chat/decryptChatMessage.js index e6f8bcd1..38ecea4e 100644 --- a/crypto/api/transactions/chat/decryptChatMessage.js +++ b/crypto/api/transactions/chat/decryptChatMessage.js @@ -1,7 +1,7 @@ import nacl from '../../deps/nacl-fast.js' import Base58 from '../../deps/Base58.js' import ed2curve from '../../deps/ed2curve.js' -import { Sha256 } from 'asmcrypto.js' +import {Sha256} from 'asmcrypto.js' export const decryptChatMessage = (encryptedMessage, privateKey, recipientPublicKey, lastReference) => { let _encryptedMessage = Base58.decode(encryptedMessage) @@ -54,4 +54,4 @@ export const decryptChatMessageBase64 = (encryptedMessage, privateKey, recipient return new TextDecoder('utf-8').decode(_decryptedMessage) -} \ No newline at end of file +} diff --git a/crypto/api/transactions/groups/AddGroupAdminTransaction.js b/crypto/api/transactions/groups/AddGroupAdminTransaction.js index 4f5bf090..4719320c 100644 --- a/crypto/api/transactions/groups/AddGroupAdminTransaction.js +++ b/crypto/api/transactions/groups/AddGroupAdminTransaction.js @@ -1,6 +1,6 @@ 'use strict' import TransactionBase from '../TransactionBase.js' -import { QORT_DECIMALS } from '../../constants.js' +import {QORT_DECIMALS} from '../../constants.js' export default class AddGroupAdminTransaction extends TransactionBase { constructor() { diff --git a/crypto/api/transactions/groups/CancelGroupBanTransaction.js b/crypto/api/transactions/groups/CancelGroupBanTransaction.js index 61de1e34..78d58c85 100644 --- a/crypto/api/transactions/groups/CancelGroupBanTransaction.js +++ b/crypto/api/transactions/groups/CancelGroupBanTransaction.js @@ -1,6 +1,6 @@ 'use strict' import TransactionBase from '../TransactionBase.js' -import { QORT_DECIMALS } from '../../constants.js' +import {QORT_DECIMALS} from '../../constants.js' export default class CancelGroupBanTransaction extends TransactionBase { constructor() { diff --git a/crypto/api/transactions/groups/CancelGroupInviteTransaction.js b/crypto/api/transactions/groups/CancelGroupInviteTransaction.js index 10bb800b..6bf09844 100644 --- a/crypto/api/transactions/groups/CancelGroupInviteTransaction.js +++ b/crypto/api/transactions/groups/CancelGroupInviteTransaction.js @@ -1,6 +1,6 @@ 'use strict' import TransactionBase from '../TransactionBase.js' -import { QORT_DECIMALS } from '../../constants.js' +import {QORT_DECIMALS} from '../../constants.js' export default class CancelGroupInviteTransaction extends TransactionBase { constructor() { diff --git a/crypto/api/transactions/groups/CreateGroupTransaction.js b/crypto/api/transactions/groups/CreateGroupTransaction.js index 0b76ead0..1a6b38c9 100644 --- a/crypto/api/transactions/groups/CreateGroupTransaction.js +++ b/crypto/api/transactions/groups/CreateGroupTransaction.js @@ -1,6 +1,6 @@ 'use strict' import TransactionBase from '../TransactionBase.js' -import { QORT_DECIMALS } from '../../constants.js' +import {QORT_DECIMALS} from '../../constants.js' export default class CreateGroupTransaction extends TransactionBase { constructor() { diff --git a/crypto/api/transactions/groups/GroupBanTransaction.js b/crypto/api/transactions/groups/GroupBanTransaction.js index 101cb364..23aeb769 100644 --- a/crypto/api/transactions/groups/GroupBanTransaction.js +++ b/crypto/api/transactions/groups/GroupBanTransaction.js @@ -1,6 +1,6 @@ 'use strict' import TransactionBase from '../TransactionBase.js' -import { QORT_DECIMALS } from '../../constants.js' +import {QORT_DECIMALS} from '../../constants.js' export default class GroupBanTransaction extends TransactionBase { constructor() { diff --git a/crypto/api/transactions/groups/GroupInviteTransaction.js b/crypto/api/transactions/groups/GroupInviteTransaction.js index 62a89633..0e7397e3 100644 --- a/crypto/api/transactions/groups/GroupInviteTransaction.js +++ b/crypto/api/transactions/groups/GroupInviteTransaction.js @@ -1,6 +1,6 @@ 'use strict' import TransactionBase from '../TransactionBase.js' -import { QORT_DECIMALS } from '../../constants.js' +import {QORT_DECIMALS} from '../../constants.js' export default class GroupInviteTransaction extends TransactionBase { constructor() { diff --git a/crypto/api/transactions/groups/GroupKickTransaction.js b/crypto/api/transactions/groups/GroupKickTransaction.js index 4a2af2c2..22712da4 100644 --- a/crypto/api/transactions/groups/GroupKickTransaction.js +++ b/crypto/api/transactions/groups/GroupKickTransaction.js @@ -1,6 +1,6 @@ 'use strict' import TransactionBase from '../TransactionBase.js' -import { QORT_DECIMALS } from '../../constants.js' +import {QORT_DECIMALS} from '../../constants.js' export default class GroupKickTransaction extends TransactionBase { constructor() { diff --git a/crypto/api/transactions/groups/JoinGroupTransaction.js b/crypto/api/transactions/groups/JoinGroupTransaction.js index 57a42bb5..b42e17d2 100644 --- a/crypto/api/transactions/groups/JoinGroupTransaction.js +++ b/crypto/api/transactions/groups/JoinGroupTransaction.js @@ -1,6 +1,6 @@ 'use strict' import TransactionBase from '../TransactionBase.js' -import { QORT_DECIMALS } from '../../constants.js' +import {QORT_DECIMALS} from '../../constants.js' export default class JoinGroupTransaction extends TransactionBase { constructor() { diff --git a/crypto/api/transactions/groups/LeaveGroupTransaction.js b/crypto/api/transactions/groups/LeaveGroupTransaction.js index 988d768c..fd57381f 100644 --- a/crypto/api/transactions/groups/LeaveGroupTransaction.js +++ b/crypto/api/transactions/groups/LeaveGroupTransaction.js @@ -1,6 +1,6 @@ 'use strict' import TransactionBase from '../TransactionBase.js' -import { QORT_DECIMALS } from '../../constants.js' +import {QORT_DECIMALS} from '../../constants.js' export default class LeaveGroupTransaction extends TransactionBase { constructor() { diff --git a/crypto/api/transactions/groups/RemoveGroupAdminTransaction.js b/crypto/api/transactions/groups/RemoveGroupAdminTransaction.js index 05af0da9..abd8c084 100644 --- a/crypto/api/transactions/groups/RemoveGroupAdminTransaction.js +++ b/crypto/api/transactions/groups/RemoveGroupAdminTransaction.js @@ -1,6 +1,6 @@ 'use strict' import TransactionBase from '../TransactionBase.js' -import { QORT_DECIMALS } from '../../constants.js' +import {QORT_DECIMALS} from '../../constants.js' export default class RemoveGroupAdminTransaction extends TransactionBase { constructor() { diff --git a/crypto/api/transactions/groups/UpdateGroupTransaction.js b/crypto/api/transactions/groups/UpdateGroupTransaction.js index 8709f778..f5071f4e 100644 --- a/crypto/api/transactions/groups/UpdateGroupTransaction.js +++ b/crypto/api/transactions/groups/UpdateGroupTransaction.js @@ -1,8 +1,7 @@ 'use strict'; import TransactionBase from '../TransactionBase.js' -import Base58 from '../../deps/Base58.js' -import { store } from '../../../api.js' -import { QORT_DECIMALS } from "../../constants.js" +import {store} from '../../../api.js' +import {QORT_DECIMALS} from "../../constants.js" export default class UpdateGroupTransaction extends TransactionBase { constructor() { @@ -15,7 +14,7 @@ export default class UpdateGroupTransaction extends TransactionBase { return html` Are you sure to update this group ?
- +
On pressing confirm, the group details will be updated! ` @@ -69,4 +68,4 @@ export default class UpdateGroupTransaction extends TransactionBase { console.log('verify params', params) return params } -} \ No newline at end of file +} diff --git a/crypto/api/transactions/names/BuyNameTransacion.js b/crypto/api/transactions/names/BuyNameTransacion.js index 48671a2a..c03f7b85 100644 --- a/crypto/api/transactions/names/BuyNameTransacion.js +++ b/crypto/api/transactions/names/BuyNameTransacion.js @@ -1,6 +1,6 @@ 'use strict' import TransactionBase from '../TransactionBase.js' -import { QORT_DECIMALS } from '../../constants.js' +import {QORT_DECIMALS} from '../../constants.js' export default class BuyNameTransacion extends TransactionBase { constructor() { diff --git a/crypto/api/transactions/names/CancelSellNameTransacion.js b/crypto/api/transactions/names/CancelSellNameTransacion.js index da8f98bb..cfd59b8d 100644 --- a/crypto/api/transactions/names/CancelSellNameTransacion.js +++ b/crypto/api/transactions/names/CancelSellNameTransacion.js @@ -1,6 +1,6 @@ 'use strict' import TransactionBase from '../TransactionBase.js' -import { QORT_DECIMALS } from '../../constants.js' +import {QORT_DECIMALS} from '../../constants.js' export default class CancelSellNameTransacion extends TransactionBase { constructor() { diff --git a/crypto/api/transactions/names/RegisterNameTransaction.js b/crypto/api/transactions/names/RegisterNameTransaction.js index 6076e7c3..06dde2ea 100644 --- a/crypto/api/transactions/names/RegisterNameTransaction.js +++ b/crypto/api/transactions/names/RegisterNameTransaction.js @@ -1,6 +1,6 @@ 'use strict' import TransactionBase from '../TransactionBase.js' -import { QORT_DECIMALS } from '../../constants.js' +import {QORT_DECIMALS} from '../../constants.js' export default class RegisterNameTransaction extends TransactionBase { constructor() { diff --git a/crypto/api/transactions/names/SellNameTransacion.js b/crypto/api/transactions/names/SellNameTransacion.js index 8659edf7..1ce67835 100644 --- a/crypto/api/transactions/names/SellNameTransacion.js +++ b/crypto/api/transactions/names/SellNameTransacion.js @@ -1,6 +1,6 @@ 'use strict' import TransactionBase from '../TransactionBase.js' -import { QORT_DECIMALS } from '../../constants.js' +import {QORT_DECIMALS} from '../../constants.js' export default class SellNameTransacion extends TransactionBase { constructor() { diff --git a/crypto/api/transactions/names/UpdateNameTransaction.js b/crypto/api/transactions/names/UpdateNameTransaction.js index bfc31563..f7ccf613 100644 --- a/crypto/api/transactions/names/UpdateNameTransaction.js +++ b/crypto/api/transactions/names/UpdateNameTransaction.js @@ -1,6 +1,6 @@ 'use strict' import TransactionBase from '../TransactionBase.js' -import { QORT_DECIMALS } from '../../constants.js' +import {QORT_DECIMALS} from '../../constants.js' export default class UpdateNameTransaction extends TransactionBase { constructor() { @@ -70,4 +70,4 @@ export default class UpdateNameTransaction extends TransactionBase { ) return params } -} \ No newline at end of file +} diff --git a/crypto/api/transactions/polls/CreatePollTransaction.js b/crypto/api/transactions/polls/CreatePollTransaction.js index b7d8bb6c..a99179b1 100644 --- a/crypto/api/transactions/polls/CreatePollTransaction.js +++ b/crypto/api/transactions/polls/CreatePollTransaction.js @@ -1,6 +1,6 @@ 'use strict' import TransactionBase from '../TransactionBase.js' -import { QORT_DECIMALS } from '../../constants.js' +import {QORT_DECIMALS} from '../../constants.js' export default class CreatePollTransaction extends TransactionBase { constructor() { @@ -79,14 +79,14 @@ export default class CreatePollTransaction extends TransactionBase { set rOptions(rOptions) { const optionsArray = rOptions[0].split(', ').map(opt => opt.trim()); - this._pollOptions = optionsArray + this._pollOptions = optionsArray for (let i = 0; i < optionsArray.length; i++) { this.addOption(optionsArray[i]); } - + this._rNumberOfOptionsBytes = this.constructor.utils.int32ToBytes(optionsArray.length); } - + get params() { const params = super.params @@ -108,4 +108,4 @@ export default class CreatePollTransaction extends TransactionBase { return params } -} \ No newline at end of file +} diff --git a/crypto/api/transactions/polls/VoteOnPollTransaction.js b/crypto/api/transactions/polls/VoteOnPollTransaction.js index 9fbba6ff..16c51140 100644 --- a/crypto/api/transactions/polls/VoteOnPollTransaction.js +++ b/crypto/api/transactions/polls/VoteOnPollTransaction.js @@ -1,6 +1,6 @@ 'use strict' import TransactionBase from '../TransactionBase.js' -import { QORT_DECIMALS } from '../../constants.js' +import {QORT_DECIMALS} from '../../constants.js' export default class VoteOnPollTransaction extends TransactionBase { constructor() { @@ -62,4 +62,4 @@ export default class VoteOnPollTransaction extends TransactionBase { ) return params } -} \ No newline at end of file +} diff --git a/crypto/api/transactions/reward-share/RemoveRewardShareTransaction.js b/crypto/api/transactions/reward-share/RemoveRewardShareTransaction.js index 38719b56..2c2f9b3c 100644 --- a/crypto/api/transactions/reward-share/RemoveRewardShareTransaction.js +++ b/crypto/api/transactions/reward-share/RemoveRewardShareTransaction.js @@ -1,8 +1,8 @@ 'use strict' import TransactionBase from '../TransactionBase.js' import publicKeyToAddress from '../../wallet/publicKeyToAddress.js' -import { Base58 } from '../../deps/deps.js' -import { DYNAMIC_FEE_TIMESTAMP } from '../../constants.js' +import {Base58} from '../../deps/deps.js' +import {DYNAMIC_FEE_TIMESTAMP} from '../../constants.js' export default class RemoveRewardShareTransaction extends TransactionBase { constructor() { diff --git a/crypto/api/transactions/reward-share/RewardShareTransaction.js b/crypto/api/transactions/reward-share/RewardShareTransaction.js index af0d6bba..eac8329c 100644 --- a/crypto/api/transactions/reward-share/RewardShareTransaction.js +++ b/crypto/api/transactions/reward-share/RewardShareTransaction.js @@ -3,8 +3,8 @@ import publicKeyToAddress from '../../wallet/publicKeyToAddress.js' import TransactionBase from "../TransactionBase.js" import nacl from '../../deps/nacl-fast.js' import ed2curve from '../../deps/ed2curve.js' -import { Sha256 } from 'asmcrypto.js' -import { DYNAMIC_FEE_TIMESTAMP } from '../../constants.js' +import {Sha256} from 'asmcrypto.js' +import {DYNAMIC_FEE_TIMESTAMP} from '../../constants.js' export default class RewardShareTransaction extends TransactionBase { constructor() { @@ -14,7 +14,7 @@ export default class RewardShareTransaction extends TransactionBase { render(html) { return html` - ${this._rewarddialog1} ${this._percentageShare / 1e8}% ${this._rewarddialog2} ${this.constructor.Base58.encode(this._recipient)}? + ${this._rewarddialog1} ${this._percentageShare / 1e8}% ${this._rewarddialog2} ${this.constructor.Base58.encode(this._recipient)}? ${this._rewarddialog3}
${this._base58RewardShareSeed} diff --git a/crypto/api/transactions/trade-portal/tradeoffer/cancelAllOffers.js b/crypto/api/transactions/trade-portal/tradeoffer/cancelAllOffers.js index e3011a59..c3a91933 100644 --- a/crypto/api/transactions/trade-portal/tradeoffer/cancelAllOffers.js +++ b/crypto/api/transactions/trade-portal/tradeoffer/cancelAllOffers.js @@ -1,6 +1,6 @@ -import { request } from '../../../fetch-request.js' -import { deleteTradeOffer, signTradeBotTxn } from '../../../tradeRequest.js' -import { processTransaction } from '../../../createTransaction.js' +import {request} from '../../../fetch-request.js' +import {deleteTradeOffer, signTradeBotTxn} from '../../../tradeRequest.js' +import {processTransaction} from '../../../createTransaction.js' export const cancelAllOffers = async (requestObject) => { const keyPair = requestObject.keyPair diff --git a/crypto/api/transactions/transactions.js b/crypto/api/transactions/transactions.js index 4f0e92fd..75aeb35b 100644 --- a/crypto/api/transactions/transactions.js +++ b/crypto/api/transactions/transactions.js @@ -17,7 +17,6 @@ import GroupKickTransaction from './groups/GroupKickTransaction.js' import GroupInviteTransaction from './groups/GroupInviteTransaction.js' import CancelGroupInviteTransaction from './groups/CancelGroupInviteTransaction.js' import JoinGroupTransaction from './groups/JoinGroupTransaction.js' -import UpdateGroupTransaction from './groups/UpdateGroupTransaction.js' import LeaveGroupTransaction from './groups/LeaveGroupTransaction.js' import RewardShareTransaction from './reward-share/RewardShareTransaction.js' import RemoveRewardShareTransaction from './reward-share/RemoveRewardShareTransaction.js' diff --git a/crypto/api/utils/stateAwait.js b/crypto/api/utils/stateAwait.js index 8e8278f3..666eb0db 100644 --- a/crypto/api/utils/stateAwait.js +++ b/crypto/api/utils/stateAwait.js @@ -1,4 +1,4 @@ -import { store } from '../../api.js' +import {store} from '../../api.js' let subscriptions = [] diff --git a/crypto/api/wallet/publicKeyToAddress.js b/crypto/api/wallet/publicKeyToAddress.js index 1839a05b..67954a0a 100644 --- a/crypto/api/wallet/publicKeyToAddress.js +++ b/crypto/api/wallet/publicKeyToAddress.js @@ -2,9 +2,9 @@ import Base58 from '../deps/Base58.js' import BROKEN_RIPEMD160 from '../deps/broken-ripemd160.js' import RIPEMD160 from '../deps/ripemd160.js' import utils from '../deps/utils.js' -import { ADDRESS_VERSION } from '../constants.js' -import { Buffer } from 'buffer' -import { Sha256 } from 'asmcrypto.js' +import {ADDRESS_VERSION} from '../constants.js' +import {Buffer} from 'buffer' +import {Sha256} from 'asmcrypto.js' const repeatSHA256 = (passphrase, hashes) => { let hash = passphrase diff --git a/crypto/config.js b/crypto/config.js index e17ca4f2..375b5bd8 100644 --- a/crypto/config.js +++ b/crypto/config.js @@ -1,4 +1,4 @@ -import { store } from './api.js' +import {store} from './api.js' let config = false let loaded = false diff --git a/plugins/epml.js b/plugins/epml.js index 0a0489a5..41892ab8 100644 --- a/plugins/epml.js +++ b/plugins/epml.js @@ -1,4 +1,12 @@ -import { Epml, EpmlReadyPlugin, RequestPlugin, ContentWindow as EpmlContentWindowPlugin, EpmlStreamPlugin, EpmlProxyPlugin, EpmlStream } from 'epml' +import { + ContentWindow as EpmlContentWindowPlugin, + Epml, + EpmlProxyPlugin, + EpmlReadyPlugin, + EpmlStream, + EpmlStreamPlugin, + RequestPlugin +} from 'epml' Epml.registerPlugin(RequestPlugin) Epml.registerPlugin(EpmlReadyPlugin) diff --git a/plugins/plugins/core/become-minter/become-minter-css.src.js b/plugins/plugins/core/become-minter/become-minter-css.src.js index 1efb0c4d..5ed388c9 100644 --- a/plugins/plugins/core/become-minter/become-minter-css.src.js +++ b/plugins/plugins/core/become-minter/become-minter-css.src.js @@ -1,4 +1,4 @@ -import { css } from 'lit'; +import {css} from 'lit'; export const pageStyles = css` * { diff --git a/plugins/plugins/core/become-minter/become-minter.src.js b/plugins/plugins/core/become-minter/become-minter.src.js index 0a9033d4..33f4b6d2 100644 --- a/plugins/plugins/core/become-minter/become-minter.src.js +++ b/plugins/plugins/core/become-minter/become-minter.src.js @@ -1,22 +1,21 @@ -import { LitElement, html } from 'lit' -import { Epml } from '../../../epml.js' +import {html, LitElement} from 'lit' +import {Epml} from '../../../epml.js' import '../components/ButtonIconCopy.js' -import { use, translate, registerTranslateConfig } from 'lit-translate' -import { blocksNeed } from '../../utils/blocks-needed.js' +import {registerTranslateConfig, translate, use} from 'lit-translate' +import {blocksNeed} from '../../utils/blocks-needed.js' import isElectron from 'is-electron' - -registerTranslateConfig({ - loader: (lang) => fetch(`/language/${lang}.json`).then((res) => res.json()), -}) - import '@polymer/paper-spinner/paper-spinner-lite.js' import '@material/mwc-button' import '@material/mwc-textfield' import '@vaadin/button' -import { pageStyles } from './become-minter-css.src.js' +import {pageStyles} from './become-minter-css.src.js' import './components/not-sponsored.js' import './components/yes-sponsored.js' +registerTranslateConfig({ + loader: (lang) => fetch(`/language/${lang}.json`).then((res) => res.json()), +}) + const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) class BecomeMinter extends LitElement { diff --git a/plugins/plugins/core/become-minter/components/not-sponsored.js b/plugins/plugins/core/become-minter/components/not-sponsored.js index 380a992a..516c9c88 100644 --- a/plugins/plugins/core/become-minter/components/not-sponsored.js +++ b/plugins/plugins/core/become-minter/components/not-sponsored.js @@ -1,13 +1,13 @@ -import { LitElement, html } from 'lit' -import { Epml } from '../../../../epml.js' +import {html, LitElement} from 'lit' +import {Epml} from '../../../../epml.js' import '../../components/ButtonIconCopy.js' -import { use, get, translate, registerTranslateConfig } from 'lit-translate' +import {translate} from 'lit-translate' import '@polymer/paper-spinner/paper-spinner-lite.js' import '@material/mwc-button' import '@material/mwc-textfield' import '@vaadin/button' -import { pageStyles } from '../become-minter-css.src.js' +import {pageStyles} from '../become-minter-css.src.js' const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) diff --git a/plugins/plugins/core/become-minter/components/yes-sponsored.js b/plugins/plugins/core/become-minter/components/yes-sponsored.js index f4eea8cf..e1b8783b 100644 --- a/plugins/plugins/core/become-minter/components/yes-sponsored.js +++ b/plugins/plugins/core/become-minter/components/yes-sponsored.js @@ -1,14 +1,13 @@ -import { LitElement, html } from 'lit' -import { Epml } from '../../../../epml.js' +import {html, LitElement} from 'lit' import '../../components/ButtonIconCopy.js' -import { use, get, translate, registerTranslateConfig } from 'lit-translate' +import {translate} from 'lit-translate' import '@polymer/paper-spinner/paper-spinner-lite.js' import '@material/mwc-button' import '@material/mwc-textfield' import '@vaadin/button' -import { blocksNeed } from '../../../utils/blocks-needed.js' -import { pageStyles } from '../become-minter-css.src.js' +import {blocksNeed} from '../../../utils/blocks-needed.js' +import {pageStyles} from '../become-minter-css.src.js' class YesSponsored extends LitElement { static get properties() { diff --git a/plugins/plugins/core/components/ButtonIconCopy.js b/plugins/plugins/core/components/ButtonIconCopy.js index a92e8b15..2604fed8 100644 --- a/plugins/plugins/core/components/ButtonIconCopy.js +++ b/plugins/plugins/core/components/ButtonIconCopy.js @@ -1,5 +1,5 @@ -import { LitElement, html, css } from 'lit' -import { Epml } from '../../../epml.js' +import {html, LitElement} from 'lit' +import {Epml} from '../../../epml.js' import '@material/mwc-icon-button' @@ -44,10 +44,10 @@ class ButtonIconCopy extends LitElement { render() { return html` - this.saveToClipboard(this.textToCopy)} > diff --git a/plugins/plugins/core/components/ChatGifs/ChatGifs-css.js b/plugins/plugins/core/components/ChatGifs/ChatGifs-css.js index dedbdb90..41aab02b 100644 --- a/plugins/plugins/core/components/ChatGifs/ChatGifs-css.js +++ b/plugins/plugins/core/components/ChatGifs/ChatGifs-css.js @@ -1,4 +1,4 @@ -import { css } from 'lit'; +import {css} from 'lit'; export const gifExplorerStyles = css` .gifs-container { diff --git a/plugins/plugins/core/components/ChatGifs/ChatGifs.js b/plugins/plugins/core/components/ChatGifs/ChatGifs.js index 35d511e3..c5ce7bc4 100644 --- a/plugins/plugins/core/components/ChatGifs/ChatGifs.js +++ b/plugins/plugins/core/components/ChatGifs/ChatGifs.js @@ -1,16 +1,15 @@ -import {LitElement, html, css} from 'lit'; -import {render} from 'lit/html.js'; +import {html, LitElement} from 'lit'; import {Epml} from '../../../../epml.js'; import * as zip from '@zip.js/zip.js'; import '@material/mwc-icon'; import ShortUniqueId from 'short-unique-id'; import {publishData} from '../../../utils/publish-image.js'; import {gifExplorerStyles} from './ChatGifs-css.js'; -import { bytesToMegabytes } from '../../../utils/bytesToMegabytes.js'; +import {bytesToMegabytes} from '../../../utils/bytesToMegabytes.js'; import './ChatGifsExplore.js'; import '../ImageComponent.js'; import '@vaadin/tooltip'; -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {get, translate} from 'lit-translate' const parentEpml = new Epml({type: 'WINDOW', source: window.parent}); @@ -429,25 +428,25 @@ setOpenGifModal: { attribute: false } function validateGifSizes(gifs) { const maxSizeInMB = 0.7; const invalidGifs = []; - + for (let i = 0; i < gifs.length; i++) { const gif = gifs[i]; const gifSize = gif.size; - + const gifSizeMB = bytesToMegabytes(gifSize); - + if (gifSizeMB > maxSizeInMB) { invalidGifs.push(gif); } } - + if (invalidGifs.length > 0) { return false; } else { return true; } } - + let validatedSize = validateGifSizes(this.gifsToBeAdded); if (!validatedSize) { @@ -504,7 +503,7 @@ setOpenGifModal: { attribute: false } const zipFileBlob = await zipFileWriter.getData(); const zipSize = bytesToMegabytes(zipFileBlob.size); - + if (zipSize > 10) { parentEpml.request('showSnackBar', get('gifs.gchange27')); this.isLoading = false; @@ -552,13 +551,13 @@ setOpenGifModal: { attribute: false } this.gifsToBeAdded = []; this.newCollectionName = ''; parentEpml.request('showSnackBar', get('gifs.gchange12')); - } + } stop = false; } }; interval = setInterval(getAnswer, 5000); }); - + this.isLoading = false; this.setGifsLoading(false); this.mode = 'myCollection'; @@ -608,7 +607,7 @@ setOpenGifModal: { attribute: false }
-

${translate('gifs.gchange18')}

-
+
` : this.isSearched && this.exploreCollections.length === 0 ? ( html`

${translate('gifs.gchange19')}

` diff --git a/plugins/plugins/core/components/ChatGroupInvites.js b/plugins/plugins/core/components/ChatGroupInvites.js index dbb19579..f36b296c 100644 --- a/plugins/plugins/core/components/ChatGroupInvites.js +++ b/plugins/plugins/core/components/ChatGroupInvites.js @@ -1,13 +1,11 @@ -import { LitElement, html, css } from "lit" -import { render } from "lit/html.js" -import { Epml } from "../../../epml" -import snackbar from "./snackbar.js" +import {css, html, LitElement} from "lit" +import {Epml} from "../../../epml" import "@material/mwc-button" import "@material/mwc-dialog" import "@polymer/paper-spinner/paper-spinner-lite.js" import "@material/mwc-icon" import "./WrapperModal" -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {translate} from 'lit-translate' const parentEpml = new Epml({ type: "WINDOW", source: window.parent }) @@ -147,7 +145,7 @@ class ChatGroupInvites extends LitElement { } }) } - + async process(body){ return await parentEpml.request("apiCall", { type: "api", @@ -277,11 +275,11 @@ class ChatGroupInvites extends LitElement { this.isOpenLeaveModal = true }} class="top-bar-icon" style="margin: 0px 20px" icon="vaadin:users" slot="icon"> - { if (this.isLoading) return this.isOpenLeaveModal = false - }} + }} style=${ this.isOpenLeaveModal ? "display: block" : "display: none" }> @@ -289,7 +287,7 @@ class ChatGroupInvites extends LitElement {

${translate("grouppage.gchange35")}


- +
- - + + diff --git a/plugins/plugins/core/components/ChatGroupManager.js b/plugins/plugins/core/components/ChatGroupManager.js index a6fc68c2..a4f6f73a 100644 --- a/plugins/plugins/core/components/ChatGroupManager.js +++ b/plugins/plugins/core/components/ChatGroupManager.js @@ -1,5 +1,5 @@ -import { LitElement, html, css } from 'lit'; -import { Epml } from '../../../epml'; +import {css, html, LitElement} from 'lit'; +import {Epml} from '../../../epml'; import '@material/mwc-button'; import '@material/mwc-dialog'; import '@polymer/paper-spinner/paper-spinner-lite.js'; @@ -11,9 +11,7 @@ import './TipUser'; import './UserInfo/UserInfo'; import './ChatImage'; import './ReusableImage'; -import { - get -} from 'lit-translate'; +import {get} from 'lit-translate'; const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }); @@ -240,10 +238,10 @@ class ChatGroupsManager extends LitElement { async getGroups() { try { - + let endpoint = `/groups` - - + + const groups = await parentEpml.request('apiCall', { type: 'api', url: endpoint, @@ -265,7 +263,7 @@ class ChatGroupsManager extends LitElement { this.getGroups() } - + elementObserver() { const options = { root: this.viewElement, @@ -314,7 +312,7 @@ class ChatGroupsManager extends LitElement { render() { console.log('this.groups', this.groups) return html` - +
{ @@ -334,8 +332,8 @@ class ChatGroupsManager extends LitElement { this.selectMyImages(e)} ?checked=${this.onlyMyImages}>
- - + +
diff --git a/plugins/plugins/core/components/ChatGroupSettings.js b/plugins/plugins/core/components/ChatGroupSettings.js index 76af8645..4caf123d 100644 --- a/plugins/plugins/core/components/ChatGroupSettings.js +++ b/plugins/plugins/core/components/ChatGroupSettings.js @@ -1,13 +1,11 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml' -import snackbar from './snackbar.js' +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../epml' import '@material/mwc-button' import '@material/mwc-dialog' import '@polymer/paper-spinner/paper-spinner-lite.js' import '@material/mwc-icon' import './WrapperModal' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {get, translate} from 'lit-translate' const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -47,7 +45,7 @@ class ChatGroupSettings extends LitElement { .top-bar-icon:hover { color: var(--black) } - + .modal-button { font-family: Roboto, sans-serif; font-size: 16px; @@ -82,7 +80,7 @@ class ChatGroupSettings extends LitElement { } async confirmRelationship() { - + let interval = null let stop = false @@ -139,8 +137,8 @@ class ChatGroupSettings extends LitElement { }) return convertedBytes } - - + + // Make Transaction Request const makeTransactionRequest = async (lastRef) => { let groupdialog3 = get("transactions.groupdialog3") @@ -235,11 +233,11 @@ class ChatGroupSettings extends LitElement { this.isOpenLeaveModal = true }} class="top-bar-icon" style="margin: 0px 20px" icon="vaadin:cog" slot="icon"> - { if(this.isLoading) return this.isOpenLeaveModal = false - } } + } } style=${(this.isOpenLeaveModal) ? "display: block" : "display: none"}>

${translate("grouppage.gchange35")}

@@ -263,15 +261,15 @@ class ChatGroupSettings extends LitElement { ${this.message}
- - + + @@ -280,4 +278,4 @@ class ChatGroupSettings extends LitElement { } } -customElements.define('chat-group-settings', ChatGroupSettings); \ No newline at end of file +customElements.define('chat-group-settings', ChatGroupSettings); diff --git a/plugins/plugins/core/components/ChatGroupsManagement.js b/plugins/plugins/core/components/ChatGroupsManagement.js index aea8a217..43c2d168 100644 --- a/plugins/plugins/core/components/ChatGroupsManagement.js +++ b/plugins/plugins/core/components/ChatGroupsManagement.js @@ -1,7 +1,5 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml' -import snackbar from './snackbar.js' +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../epml' import '@material/mwc-button' import '@material/mwc-dialog' import '@polymer/paper-spinner/paper-spinner-lite.js' @@ -12,8 +10,7 @@ import '@vaadin/tabs/theme/material/vaadin-tabs.js' import '@vaadin/avatar' import '@vaadin/grid' import '@vaadin/grid/vaadin-grid-filter-column.js' -import { columnBodyRenderer } from '@vaadin/grid/lit.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {get, translate} from 'lit-translate' const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -83,9 +80,9 @@ class ChatGroupsManagement extends LitElement { let _joinedGroups = await this.getJoinedGroups() this.joinedGroups = _joinedGroups } catch (error) { - + } - + } _tabChanged(e) { @@ -105,7 +102,7 @@ class ChatGroupsManagement extends LitElement { } catch (error) { fee = null } - + return fee } @@ -126,7 +123,7 @@ class ChatGroupsManagement extends LitElement { } async confirmRelationship() { - + let interval = null let stop = false @@ -155,7 +152,7 @@ class ChatGroupsManagement extends LitElement { async _leaveGroup(groupId, groupName) { // Reset Default Settings... this.resetDefaultSettings() - + const leaveFeeInput = await this.unitFee() if(!leaveFeeInput){ throw Error() @@ -230,29 +227,29 @@ class ChatGroupsManagement extends LitElement { return html` - { if(this.isLoading) return this.isOpenLeaveModal = false - } } + } } customStyle=${"width: 90%; max-width: 900px; height: 90%"} style=${(this.isOpenLeaveModal) ? "display: block" : "display: none"}> -
+
- + Groups Group Join Requests Invites Blocked Users
- +
- + ${this.currentTab === 0 ? html`
- + @@ -262,10 +259,10 @@ class ChatGroupsManagement extends LitElement {

Current groups as member

` : ''} - - + +
-
+
-
+
`; } } -customElements.define('chat-groups-management', ChatGroupsManagement); \ No newline at end of file +customElements.define('chat-groups-management', ChatGroupsManagement); diff --git a/plugins/plugins/core/components/ChatGroupsModal.js b/plugins/plugins/core/components/ChatGroupsModal.js index f6a299d0..efd29dce 100644 --- a/plugins/plugins/core/components/ChatGroupsModal.js +++ b/plugins/plugins/core/components/ChatGroupsModal.js @@ -1,7 +1,5 @@ -import { LitElement, html, css } from 'lit'; -import { - translate, -} from 'lit-translate'; +import {css, html, LitElement} from 'lit'; +import {translate,} from 'lit-translate'; import '@material/mwc-menu'; import '@material/mwc-list/mwc-list-item.js'; import '@material/mwc-dialog' @@ -22,7 +20,7 @@ export class ChatGroupsModal extends LitElement { --mdc-dialog-max-width: 85vw; --mdc-dialog-max-height: 95vh; } - + .imageContainer { display: flex; justify-content: center; @@ -69,10 +67,10 @@ export class ChatGroupsModal extends LitElement { render() { console.log('hello') return html` - - { this.setOpenDialogGroupsModal(false) }}> diff --git a/plugins/plugins/core/components/ChatHead.js b/plugins/plugins/core/components/ChatHead.js index 6ea78b2e..50b248aa 100644 --- a/plugins/plugins/core/components/ChatHead.js +++ b/plugins/plugins/core/components/ChatHead.js @@ -1,8 +1,7 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml.js' +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../epml.js' import localForage from "localforage" -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {translate} from 'lit-translate' import '@material/mwc-icon' const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -29,7 +28,7 @@ class ChatHead extends LitElement { static get styles() { return css` li { - + width: 100%; padding: 10px 5px 10px 5px; cursor: pointer; @@ -121,7 +120,7 @@ class ChatHead extends LitElement { imageHTMLRes.onload = () => { this.isImageLoaded = true; } - imageHTMLRes.onerror = () => { + imageHTMLRes.onerror = () => { if (this.imageFetches < 4) { setTimeout(() => { this.imageFetches = this.imageFetches + 1 @@ -138,7 +137,7 @@ class ChatHead extends LitElement { let avatarImg = '' let backupAvatarImg = '' let isUnread = false - + if(this.chatInfo.name){ const myNode = window.parent.reduxStore.getState().app.nodeConfig.knownNodes[window.parent.reduxStore.getState().app.nodeConfig.node] const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port @@ -170,16 +169,16 @@ class ChatHead extends LitElement {
${this.chatInfo.groupName ? this.chatInfo.groupName : this.chatInfo.name !== undefined ? this.chatInfo.name : this.chatInfo.address.substr(0, 15)} ${this.chatInfo.groupId !== undefined ? 'lock_open' : 'lock'}
-
+
-
+
${translate('chatpage.cchange90')}
- + ` } @@ -210,7 +209,7 @@ class ChatHead extends LitElement { parentEpml.subscribe('chat_last_seen', async chatList => { const parsedChatList = JSON.parse(chatList) const findChatSeen = parsedChatList.find(chat=> chat.key === this.chatInfo.url) - + if(findChatSeen && this.lastReadMessageTimestamp !== findChatSeen.timestamp){ this.lastReadMessageTimestamp = findChatSeen.timestamp this.requestUpdate() @@ -244,20 +243,20 @@ class ChatHead extends LitElement { return true } if(changedProperties.has('chatInfo')){ - + const prevChatInfo = changedProperties.get('chatInfo') if(prevChatInfo.address !== this.chatInfo.address){ - + this.isImageLoaded = false this.requestUpdate() } return true } - + return false } - + getUrl(chatUrl) { this.setActiveChatHeadUrl(chatUrl) } diff --git a/plugins/plugins/core/components/ChatImage.js b/plugins/plugins/core/components/ChatImage.js index 35a3fde2..15e4aa38 100644 --- a/plugins/plugins/core/components/ChatImage.js +++ b/plugins/plugins/core/components/ChatImage.js @@ -1,13 +1,11 @@ -import { LitElement, html, css } from 'lit'; -import { - get, - translate, -} from 'lit-translate'; +import {css, html, LitElement} from 'lit'; +import {get, translate,} from 'lit-translate'; import axios from 'axios' -import { RequestQueueWithPromise } from '../../utils/queue'; +import {RequestQueueWithPromise} from '../../utils/queue'; import '@material/mwc-menu'; import '@material/mwc-list/mwc-list-item.js' -import { Epml } from '../../../epml'; +import {Epml} from '../../../epml'; + const requestQueue = new RequestQueueWithPromise(5); const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -27,9 +25,9 @@ export class ChatImage extends LitElement { --mdc-theme-text-primary-on-background: var(--black); } img { - max-width:45vh; - max-height:40vh; - border-radius: 5px; + max-width:45vh; + max-height:40vh; + border-radius: 5px; cursor: pointer; position: relative; } @@ -53,7 +51,7 @@ export class ChatImage extends LitElement { } .defaultSize { - width: 45vh; + width: 45vh; height: 40vh; } @@ -152,7 +150,7 @@ getMyNode(){ this.fetchResource() this.url = `${this.nodeUrl}/arbitrary/${this.resource.service}/${this.resource.name}/${this.resource.identifier}?async=true&apiKey=${this.myNode.apiKey}` - + } async fetchStatus(){ @@ -167,7 +165,7 @@ getMyNode(){ const intervalId = setInterval(async () => { if (isCalling) return isCalling = true - + const data = await requestQueue.enqueue(() => { return axios.get(`${this.nodeUrl}/arbitrary/resource/status/${this.resource.service}/${this.resource.name}/${this.resource.identifier}?apiKey=${this.myNode.apiKey}`) }); @@ -191,7 +189,7 @@ getMyNode(){ ...res, status: 'REFETCHING' } - + setTimeout(() => { isCalling = false this.fetchResource() @@ -200,7 +198,7 @@ getMyNode(){ } percentLoaded = res.percentLoaded } - + this.status = res if(this.status.status === 'DOWNLOADED'){ this.fetchResource() @@ -240,40 +238,40 @@ getMyNode(){ return true } - + showContextMenu(e) { e.preventDefault(); - e.stopPropagation(); + e.stopPropagation(); const contextMenu = this.shadowRoot.getElementById('contextMenu'); const containerRect = e.currentTarget.getBoundingClientRect(); - + // Adjusting the positions const adjustedX = e.clientX - containerRect.left; const adjustedY = e.clientY - containerRect.top; - + contextMenu.style.top = `${adjustedY}px`; contextMenu.style.left = `${adjustedX}px`; - + contextMenu.open = true; } - - - + + + async handleCopy(e) { - e.stopPropagation(); + e.stopPropagation(); const image = this.shadowRoot.querySelector('img'); - + // Create a canvas and draw the image on it. const canvas = document.createElement('canvas'); - canvas.width = image.naturalWidth; - canvas.height = image.naturalHeight; + canvas.width = image.naturalWidth; + canvas.height = image.naturalHeight; const ctx = canvas.getContext('2d'); ctx.drawImage(image, 0, 0); - + // Convert canvas image to blob canvas.toBlob(blob => { try { @@ -290,10 +288,10 @@ getMyNode(){ } }, 'image/png'); } - - - - + + + + handleMenuBlur() { setTimeout(() => { if (!this.isMenuItemClicked) { @@ -319,7 +317,7 @@ getMyNode(){ ].join(' ')} > ${ - this.status.status !== 'READY' + this.status.status !== 'READY' ? html`
- + ` - - + + } } diff --git a/plugins/plugins/core/components/ChatLeaveGroup.js b/plugins/plugins/core/components/ChatLeaveGroup.js index 1cd2c38d..bdc904f3 100644 --- a/plugins/plugins/core/components/ChatLeaveGroup.js +++ b/plugins/plugins/core/components/ChatLeaveGroup.js @@ -1,13 +1,11 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml' -import snackbar from './snackbar.js' +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../epml' import '@material/mwc-button' import '@material/mwc-dialog' import '@polymer/paper-spinner/paper-spinner-lite.js' import '@material/mwc-icon' import './WrapperModal' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {get, translate} from 'lit-translate' const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -61,7 +59,7 @@ class ChatLeaveGroup extends LitElement { } firstUpdated() { - + } async unitFee() { @@ -77,7 +75,7 @@ class ChatLeaveGroup extends LitElement { } catch (error) { fee = null } - + return fee } @@ -98,7 +96,7 @@ class ChatLeaveGroup extends LitElement { } async confirmRelationship() { - + let interval = null let stop = false @@ -127,7 +125,7 @@ class ChatLeaveGroup extends LitElement { async _leaveGroup(groupId, groupName) { // Reset Default Settings... this.resetDefaultSettings() - + const leaveFeeInput = await this.unitFee() if(!leaveFeeInput){ throw Error() @@ -195,17 +193,17 @@ class ChatLeaveGroup extends LitElement { this.isOpenLeaveModal = true }} class="top-bar-icon" style="margin: 0px 20px" icon="vaadin:exit" slot="icon"> - { if(this.isLoading) return this.isOpenLeaveModal = false - } } + } } style=${(this.isOpenLeaveModal) ? "display: block" : "display: none"}>

${translate("grouppage.gchange35")}


- +
${translate("grouppage.gchange4")}
@@ -243,7 +241,7 @@ class ChatLeaveGroup extends LitElement { ${this.message}
- + @@ -266,4 +264,4 @@ class ChatLeaveGroup extends LitElement { } } -customElements.define('chat-leave-group', ChatLeaveGroup); \ No newline at end of file +customElements.define('chat-leave-group', ChatLeaveGroup); diff --git a/plugins/plugins/core/components/ChatMessage.js b/plugins/plugins/core/components/ChatMessage.js index 49c76c2e..79185a81 100644 --- a/plugins/plugins/core/components/ChatMessage.js +++ b/plugins/plugins/core/components/ChatMessage.js @@ -1,7 +1,5 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../epml.js' const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) diff --git a/plugins/plugins/core/components/ChatModals.js b/plugins/plugins/core/components/ChatModals.js index 1da17e7c..5b787673 100644 --- a/plugins/plugins/core/components/ChatModals.js +++ b/plugins/plugins/core/components/ChatModals.js @@ -1,8 +1,7 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml' +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../epml' import snackbar from './snackbar.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {get, translate} from 'lit-translate' import '@material/mwc-button' import '@material/mwc-dialog' @@ -343,10 +342,10 @@ class ChatModals extends LitElement { render() { return html` - - this.hideBlockUserModal()} @@ -408,4 +407,4 @@ class ChatModals extends LitElement { } } -customElements.define('chat-modals', ChatModals) \ No newline at end of file +customElements.define('chat-modals', ChatModals) diff --git a/plugins/plugins/core/components/ChatPage-css.js b/plugins/plugins/core/components/ChatPage-css.js index 50d62389..2356129b 100644 --- a/plugins/plugins/core/components/ChatPage-css.js +++ b/plugins/plugins/core/components/ChatPage-css.js @@ -1,10 +1,10 @@ -import { css } from 'lit' +import {css} from 'lit' export const chatpageStyles = css` html { scroll-behavior: smooth; } - + .chat-head-container { display: flex; justify-content: flex-start; @@ -49,7 +49,7 @@ export const chatpageStyles = css` cursor: pointer; color: #494c50; } - + .chat-text-area .typing-area .chatbar { position: relative; display: flex; @@ -159,7 +159,7 @@ export const chatpageStyles = css` .dialogCustomInner ul { padding-left: 0px } - + .dialogCustomInner li { margin-bottom: 10px; } @@ -236,7 +236,7 @@ export const chatpageStyles = css` align-items: center; padding: 10px 10px 8px 10px; } - + .repliedTo-subcontainer { display: flex; flex-direction: row; @@ -286,7 +286,7 @@ export const chatpageStyles = css` cursor: pointer; color: #494c50; } - + .chatbar-container { width: 100%; display: flex; @@ -358,7 +358,7 @@ export const chatpageStyles = css` left: 48px; animation-delay: -1.2s; } - + .lds-grid div:nth-child(9) { top: 95px; left: 90px; @@ -372,7 +372,7 @@ export const chatpageStyles = css` 50% { opacity: 0.5; } - } + } .float-left { float: left; @@ -397,7 +397,7 @@ export const chatpageStyles = css` overflow-x: hidden; width: 100%; } - + .repliedTo-container { display: flex; flex-direction: row; @@ -405,14 +405,14 @@ export const chatpageStyles = css` align-items: center; padding: 10px 10px 8px 10px; } - + .senderName { margin: 0; color: var(--mdc-theme-primary); font-weight: bold; user-select: none; } - + .original-message { color: var(--chat-bubble-msg-color); text-overflow: ellipsis; @@ -421,19 +421,19 @@ export const chatpageStyles = css` margin: 0; width: 800px; } - - + + .close-icon { color: #676b71; width: 18px; transition: all 0.1s ease-in-out; } - + .close-icon:hover { cursor: pointer; color: #494c50; } - + .chat-text-area .typing-area .chatbar { position: relative; display: flex; @@ -444,7 +444,7 @@ export const chatpageStyles = css` padding: 5px 5px 5px 7px; overflow: hidden; } - + .chat-text-area .typing-area .emoji-button { width: 45px; height: 40px; @@ -456,7 +456,7 @@ export const chatpageStyles = css` max-height: 40px; color: var(--black); } - + .emoji-button-caption { width: 45px; height: 40px; @@ -468,7 +468,7 @@ export const chatpageStyles = css` max-height: 40px; color: var(--black); } - + .caption-container { width: 100%; display: flex; @@ -479,7 +479,7 @@ export const chatpageStyles = css` padding: 5px; border-radius: 1px; } - + .chatbar-caption { font-family: Roboto, sans-serif; width: 70%; @@ -494,19 +494,19 @@ export const chatpageStyles = css` border-bottom: 1px solid #cac8c8; padding: 3px; } - + .message-size-container { display: flex; justify-content: flex-end; width: 100%; } - + .message-size { font-family: Roboto, sans-serif; font-size: 12px; color: black; } - + .lds-grid { width: 120px; height: 120px; @@ -514,11 +514,11 @@ export const chatpageStyles = css` left: 50%; top: 40%; } - + img { border-radius: 25%; } - + .dialogCustom { position: fixed; z-index: 10000; @@ -530,7 +530,7 @@ export const chatpageStyles = css` right: 20px; user-select: none; } - + .dialogCustomInner { min-width: 300px; height: 40px; @@ -539,19 +539,19 @@ export const chatpageStyles = css` padding: 10px; border-radius: 4px; } - + .dialogCustomInner ul { padding-left: 0px } - + .dialogCustomInner li { margin-bottom: 10px; } - + .marginLoader { margin-right: 8px; } - + .last-message-ref { position: absolute; font-size: 18px; @@ -565,21 +565,21 @@ export const chatpageStyles = css` border-radius: 50%; transition: all 0.1s ease-in-out; } - + .last-message-ref:hover { cursor: pointer; transform: scale(1.1); } - + .arrow-down-icon { transform: scale(1.15); } - + .chat-container { display: grid; max-height: 100%; } - + .chat-text-area { display: flex; position: relative; @@ -587,7 +587,7 @@ export const chatpageStyles = css` min-height: 60px; max-height: 100%; } - + .chat-text-area .typing-area { display: flex; flex-direction: column; @@ -598,11 +598,11 @@ export const chatpageStyles = css` border-radius: 10px; background: var(--chat-bubble-bg); } - + .chat-text-area .typing-area textarea { display: none; } - + .chat-text-area .typing-area .chat-editor { display: flex; max-height: -webkit-fill-available; @@ -612,7 +612,7 @@ export const chatpageStyles = css` padding: 0; border: none; } - + .repliedTo-container { display: flex; flex-direction: row; @@ -620,7 +620,7 @@ export const chatpageStyles = css` align-items: center; padding: 10px 10px 8px 10px; } - + .repliedTo-subcontainer { display: flex; flex-direction: row; @@ -628,7 +628,7 @@ export const chatpageStyles = css` gap: 15px; width: 100%; } - + .repliedTo-message { display: flex; flex-direction: column; @@ -643,41 +643,41 @@ export const chatpageStyles = css` margin: 0px; padding: 0px; } - + .repliedTo-message pre { white-space: pre-wrap; } - + .repliedTo-message p mark { background-color: #ffe066; border-radius: 0.25em; box-decoration-break: clone; padding: 0.125em 0; } - + .reply-icon { width: 20px; color: var(--mdc-theme-primary); } - + .close-icon { color: #676b71; width: 18px; transition: all 0.1s ease-in-out; } - + .close-icon:hover { cursor: pointer; color: #494c50; } - + .chatbar-container { width: 100%; display: flex; height: auto; overflow: hidden; } - + .lds-grid { width: 120px; height: 120px; @@ -685,7 +685,7 @@ export const chatpageStyles = css` left: 50%; top: 40%; } - + .lds-grid div { position: absolute; width: 34px; @@ -694,61 +694,61 @@ export const chatpageStyles = css` background: #03a9f4; animation: lds-grid 1.2s linear infinite; } - + .lds-grid div:nth-child(1) { top: 4px; left: 4px; animation-delay: 0s; } - + .lds-grid div:nth-child(2) { top: 4px; left: 48px; animation-delay: -0.4s; } - + .lds-grid div:nth-child(3) { top: 4px; left: 90px; animation-delay: -0.8s; } - + .lds-grid div:nth-child(4) { top: 50px; left: 4px; animation-delay: -0.4s; } - + .lds-grid div:nth-child(5) { top: 50px; left: 48px; animation-delay: -0.8s; } - + .lds-grid div:nth-child(6) { top: 50px; left: 90px; animation-delay: -1.2s; } - + .lds-grid div:nth-child(7) { top: 95px; left: 4px; animation-delay: -0.8s; } - + .lds-grid div:nth-child(8) { top: 95px; left: 48px; animation-delay: -1.2s; } - + .lds-grid div:nth-child(9) { top: 95px; left: 90px; animation-delay: -1.6s; } - + @keyframes lds-grid { 0%, 100% { opacity: 1; @@ -756,16 +756,16 @@ export const chatpageStyles = css` 50% { opacity: 0.5; } - } - + } + .float-left { float: left; } - + img { border-radius: 25%; } - + paper-dialog.warning { width: 50%; max-width: 50vw; @@ -782,7 +782,7 @@ export const chatpageStyles = css` .buttons { text-align:right; } - + .dialogCustom { position: fixed; z-index: 10000; @@ -794,11 +794,11 @@ export const chatpageStyles = css` right: 20px; user-select: none; } - + .dialogCustom p { color: var(--black) } - + .dialogCustomInner { min-width: 300px; height: 40px; @@ -807,26 +807,26 @@ export const chatpageStyles = css` padding: 10px; border-radius: 4px; } - + .dialogCustomInner ul { padding-left: 0px } - + .dialogCustomInner li { margin-bottom: 10px; } - + .marginLoader { margin-right: 8px; } - + .smallLoading, .smallLoading:after { border-radius: 50%; width: 2px; height: 2px; } - + .smallLoading { border-width: 0.8em; border-style: solid; @@ -838,7 +838,7 @@ export const chatpageStyles = css` transform: translateZ(0px); animation: 1.1s linear 0s infinite normal none running loadingAnimation; } - + @-webkit-keyframes loadingAnimation { 0% { -webkit-transform: rotate(0deg); @@ -849,7 +849,7 @@ export const chatpageStyles = css` transform: rotate(360deg); } } - + @keyframes loadingAnimation { 0% { -webkit-transform: rotate(0deg); @@ -860,9 +860,9 @@ export const chatpageStyles = css` transform: rotate(360deg); } } - + /* Add Image Modal Dialog Styling */ - + .dialog-container { position: relative; display: flex; @@ -872,14 +872,14 @@ export const chatpageStyles = css` gap: 10px; height: 100%; } - + .dialog-container-title { font-family: Montserrat; color: var(--black); font-size: 20px; margin: 15px 0 0 0; } - + .divider { height: 1px; background-color: var(--chat-bubble-msg-color); @@ -887,7 +887,7 @@ export const chatpageStyles = css` width: 70%; margin-bottom: 20px; } - + .dialog-container-loader { position: relative; display: flex; @@ -896,14 +896,14 @@ export const chatpageStyles = css` gap: 10px; height: 100%; } - + .dialog-image { width: 100%; max-height: 300px; border-radius: 0; object-fit: contain; } - + .chat-right-panel { flex: 0; border-left: 3px solid rgb(221, 221, 221); @@ -911,30 +911,30 @@ export const chatpageStyles = css` overflow-y: auto; background: transparent; } - + .movedin { flex: 1 !important; background: transparent; } - + .main-container { display: flex; height: 100%; } - + .group-nav-container { display: flex; - height: 40px; - padding: 5px; + height: 40px; + padding: 5px; margin: 0px; - background-color: var(--chat-bubble-bg); - box-sizing: border-box; + background-color: var(--chat-bubble-bg); + box-sizing: border-box; align-items: center; justify-content: space-between; box-shadow: var(--group-drop-shadow); z-index: 1; } - + .top-bar-icon { border-radius: 50%; color: var(--chat-bubble-msg-color); @@ -942,13 +942,13 @@ export const chatpageStyles = css` padding: 5px; background-color: transparent; } - + .top-bar-icon:hover { background-color: #e6e6e69b; cursor: pointer; color: var(--black) } - + .group-name { font-family: Raleway, sans-serif; font-size: 16px; @@ -956,8 +956,8 @@ export const chatpageStyles = css` margin:0px; padding:0px; } - - + + .modal-button { font-family: Roboto, sans-serif; font-size: 16px; @@ -968,7 +968,7 @@ export const chatpageStyles = css` border: none; transition: all 0.3s ease-in-out; } - + .modal-button-red { font-family: Roboto, sans-serif; font-size: 16px; @@ -979,17 +979,17 @@ export const chatpageStyles = css` border: none; transition: all 0.3s ease-in-out; } - + .modal-button-red:hover { cursor: pointer; background-color: #f4433663; } - + .modal-button:hover { cursor: pointer; background-color: #03a8f475; } - + .name-input { width: 100%; margin-bottom: 15px; @@ -1003,29 +1003,29 @@ export const chatpageStyles = css` color: var(--chat-bubble-msg-color); box-sizing: border-box; } - + .name-input::selection { background-color: var(--mdc-theme-primary); - color: white; + color: white; } - + .name-input::placeholder { opacity: 0.9; color: var(--black); } - + .search-results-div { position: absolute; top: 25px; right: 25px; } - + .search-field { width: 100%; position: relative; margin-bottom: 5px; } - + .search-icon { position: absolute; right: 3px; @@ -1037,12 +1037,12 @@ export const chatpageStyles = css` padding: 6px 3px; font-size: 21px; } - + .search-icon:hover { cursor: pointer; background: #d7d7d75c; } - + .user-verified { position: absolute; top: 0; @@ -1053,7 +1053,7 @@ export const chatpageStyles = css` color: #04aa2e; font-size: 13px; } - + .user-selected { display: flex; justify-content: space-between; @@ -1065,30 +1065,30 @@ export const chatpageStyles = css` border-radius: 5px; background-color: #ececec96; } - + .user-selected-name { font-family: Roboto, sans-serif; margin: 0; font-size: 16px; } - + .forwarding-container { display: flex; gap: 15px; } - + .user-selected-forwarding { font-family: Livvic, sans-serif; margin: 0; font-size: 16px; } - + .close-forwarding { color: #676b71; width: 14px; transition: all 0.1s ease-in-out; } - + .close-forwarding:hover { cursor: pointer; color: #4e5054; @@ -1110,7 +1110,7 @@ export const chatpageStyles = css` to { transform: translateY(0); } - } + } .gifs-backdrop { top: 0; @@ -1142,7 +1142,7 @@ export const chatpageStyles = css` .attachment-icon { width: 70%; } - + .attachment-name { font-family: Work Sans, sans-serif; font-size: 20px; diff --git a/plugins/plugins/core/components/ChatPage.js b/plugins/plugins/core/components/ChatPage.js index c315007d..b00a6d0b 100644 --- a/plugins/plugins/core/components/ChatPage.js +++ b/plugins/plugins/core/components/ChatPage.js @@ -1,15 +1,14 @@ -import { LitElement, html } from 'lit' -import { animate } from '@lit-labs/motion' -import { Epml } from '../../../epml.js' -import { get, translate } from 'lit-translate' -import { generateHTML } from '@tiptap/core' -import { unsafeHTML } from 'lit/directives/unsafe-html.js' -import { Editor, Extension } from '@tiptap/core' -import { escape } from 'html-escaper' -import { inputKeyCodes } from '../../utils/keyCodes.js' -import { replaceMessagesEdited } from '../../utils/replace-messages-edited.js' -import { publishData } from '../../utils/publish-image.js' -import { EmojiPicker } from 'emoji-picker-js' +import {html, LitElement} from 'lit' +import {animate} from '@lit-labs/motion' +import {Epml} from '../../../epml.js' +import {get, translate} from 'lit-translate' +import {Editor, Extension, generateHTML} from '@tiptap/core' +import {unsafeHTML} from 'lit/directives/unsafe-html.js' +import {escape} from 'html-escaper' +import {inputKeyCodes} from '../../utils/keyCodes.js' +import {replaceMessagesEdited} from '../../utils/replace-messages-edited.js' +import {publishData} from '../../utils/publish-image.js' +import {EmojiPicker} from 'emoji-picker-js' import {ifDefined} from 'lit/directives/if-defined.js'; @@ -45,10 +44,10 @@ import '@material/mwc-dialog' import '@material/mwc-icon' import '@polymer/paper-dialog/paper-dialog.js' import '@polymer/paper-spinner/paper-spinner-lite.js' -import { RequestQueue } from '../../utils/queue.js' -import { modalHelper } from '../../utils/publish-modal.js' -import { generateIdFromAddresses } from '../../utils/id-generation.js' -import { chatpageStyles } from './ChatPage-css.js' +import {RequestQueue} from '../../utils/queue.js' +import {modalHelper} from '../../utils/publish-modal.js' +import {generateIdFromAddresses} from '../../utils/id-generation.js' +import {chatpageStyles} from './ChatPage-css.js' const chatLastSeen = localForage.createInstance({ name: "chat-last-seen", @@ -141,7 +140,7 @@ class ChatPage extends LitElement { } - + constructor() { super() this.getOldMessage = this.getOldMessage.bind(this) @@ -308,7 +307,7 @@ class ChatPage extends LitElement { addToQueue(outSideMsg, messageQueue) { // Push the new message object to the queue - + this.messageQueue = [...messageQueue, { ...outSideMsg, timestamp: Date.now()}]; // Start processing the queue only if the message we just added is the only one in the queue @@ -316,7 +315,7 @@ class ChatPage extends LitElement { if (this.messageQueue.length === 1) { this.processQueue(); } - + // Notify Lit to update/render due to the property change this.requestUpdate(); } @@ -331,7 +330,7 @@ class ChatPage extends LitElement { } else { throw new Error('failed') } - + if (this.messageQueue.length > 0) { setTimeout(() => this.processQueue(), 2000); // Wait for 10 seconds before retrying // setTimeout(() => this.processQueue(), 0); // Process the next message immediately @@ -341,20 +340,20 @@ class ChatPage extends LitElement { setTimeout(() => this.processQueue(), 10000); // Wait for 10 seconds before retrying } } - + async getLastestMessages(){ try { let getInitialMessages = [] if (this.isReceipient) { - + getInitialMessages = await parentEpml.request('apiCall', { type: 'api', url: `/chat/messages?involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${this._chatId}&limit=${chatLimit}&reverse=true&haschatreference=false&encoding=BASE64` }) - + } else { getInitialMessages = await parentEpml.request('apiCall', { @@ -381,15 +380,15 @@ class ChatPage extends LitElement { console.error('Copy to clipboard error:', err); } } - + render() { return html`
-
- +
{ if(+this._chatId === 0 || this.isReceipient)return @@ -400,7 +399,7 @@ class ChatPage extends LitElement { ` : html`

${this.groupInfo && this.groupInfo.groupName}

`} - +
${(!this.isReceipient && +this._chatId !== 0 && this.groupInfo.isOpen) ? @@ -416,7 +415,7 @@ class ChatPage extends LitElement { : ''}
- +
${this.isLoadingMessages ? html` @@ -434,14 +433,14 @@ class ChatPage extends LitElement { ` : this.renderChatScroller()}
-
{ if (this.gifsLoading) return; this.setOpenGifModal(false); this.editor.commands.focus("end"); this.shadowRoot.querySelector("chat-gifs").clearGifSelections(); - }} + }} style=${this.openGifModal ? "visibility: visible; z-index: 4" : "visibility: hidden; z-index: -100"}>
@@ -449,8 +448,8 @@ class ChatPage extends LitElement {
` : ''}
-
{ const chatScrollerElement = this.shadowRoot.querySelector('chat-scroller'); @@ -462,7 +461,7 @@ class ChatPage extends LitElement { behavior: 'smooth', }); } - + }}>
@@ -542,12 +541,12 @@ class ChatPage extends LitElement { .setOpenGifModal=${(val) => this.setOpenGifModal(val)} chatId=${this.chatId} .messageQueue=${this.messageQueue} - > + >
- + ${(this.isUploadingImage || this.isDeletingImage) ? html`
@@ -557,8 +556,8 @@ class ChatPage extends LitElement { ${this.isDeletingImage ? translate("chatpage.cchange31") : translate("chatpage.cchange30")}

-
-
+
+
`: ''} @@ -571,15 +570,15 @@ class ChatPage extends LitElement { ${this.isDeletingAttachment ? translate("chatpage.cchange76") : translate("chatpage.cchange75")}

- - + + `: ''} - { this.removeImage() - }} + }} style=${(this.imageFile && !this.isUploadingImage) ? "visibility:visible; z-index:50" : "visibility: hidden;z-index:-100"}>
@@ -622,12 +621,12 @@ class ChatPage extends LitElement {
- +
- { this.removeAttachment() - }} + }} style=${this.attachment && !this.isUploadingAttachment ? "visibility: visible; z-index: 50" : "visibility: hidden; z-index: -100"}>
@@ -674,7 +673,7 @@ class ChatPage extends LitElement {
- +

${translate("chatpage.cchange41")}

@@ -685,12 +684,12 @@ class ChatPage extends LitElement { this.sendMessage(this.myTrimmedMeassage)} dialog-confirm>${translate("transpage.tchange3")}
- { this.openForwardOpen = false this.forwardActiveChatHeadUrl = {} this.requestUpdate() - }} + }} style=${this.openForwardOpen ? "display: block" : "display: none"}>
@@ -700,11 +699,11 @@ class ChatPage extends LitElement {
- { if (this.forwardActiveChatHeadUrl.selected) { this.forwardActiveChatHeadUrl = {} @@ -721,16 +720,16 @@ class ChatPage extends LitElement {
` ) : ( - html` - ` )} -
+
${this.forwardActiveChatHeadUrl.selected ? ( html`
@@ -741,7 +740,7 @@ class ChatPage extends LitElement {

Forwarding...

- { return html` - { this.forwardActiveChatHeadUrl = { ...this.forwardActiveChatHeadUrl, url: val } this.userFound = [] - }} + }} chatInfo=${JSON.stringify(item)}> ` })} ` )}
- +
- { this.forwardActiveChatHeadUrl = { ...this.forwardActiveChatHeadUrl, @@ -814,7 +813,7 @@ class ChatPage extends LitElement { ?loading=${this.isLoading}>
- +
{ @@ -828,12 +827,12 @@ class ChatPage extends LitElement { .setOpenTipUser=${(val) => this.setOpenTipUser(val)}> - { this.setOpenUserInfo(false) this.setUserName("") this.setSelectedHead({}) - }} + }} style=${this.openUserInfo ? "display: block" : "display: none" }> this.setOpenTipUser(val)} .setOpenPrivateMessage=${(val) => this.setOpenPrivateMessage(val)} .userName=${this.userName} - .selectedHead=${this.selectedHead} + .selectedHead=${this.selectedHead} >
- this.getMoreMembers(val)} - .toggle=${(val) => this._toggle(val)} - .selectedAddress=${this.selectedAddress} - .groupMembers=${this.groupMembers} - .groupAdmin=${this.groupAdmin} + this.getMoreMembers(val)} + .toggle=${(val) => this._toggle(val)} + .selectedAddress=${this.selectedAddress} + .groupMembers=${this.groupMembers} + .groupAdmin=${this.groupAdmin} .leaveGroupObj=${this.groupInfo} .setOpenPrivateMessage=${(val) => this.setOpenPrivateMessage(val)} .setOpenTipUser=${(val) => this.setOpenTipUser(val)} @@ -862,11 +861,11 @@ class ChatPage extends LitElement {
this.getMoreMembers(val)} - .toggle=${(val) => this._toggleResources(val)} - .selectedAddress=${this.selectedAddress} - .groupMembers=${this.groupMembers} - .groupAdmin=${this.groupAdmin} + .getMoreMembers=${(val) => this.getMoreMembers(val)} + .toggle=${(val) => this._toggleResources(val)} + .selectedAddress=${this.selectedAddress} + .groupMembers=${this.groupMembers} + .groupAdmin=${this.groupAdmin} .leaveGroupObj=${this.groupInfo} .setOpenPrivateMessage=${(val) => this.setOpenPrivateMessage(val)} .setOpenTipUser=${(val) => this.setOpenTipUser(val)} @@ -1098,7 +1097,7 @@ class ChatPage extends LitElement { } } } - + async pasteImage(e) { const event = e @@ -1166,7 +1165,7 @@ class ChatPage extends LitElement { return } - + const findOriginalMessage = this.shadowRoot.querySelector('chat-scroller').shadowRoot.getElementById(clickedOnMessage.signature) if (findOriginalMessage) { const messageClientRect = findOriginalMessage.getBoundingClientRect() @@ -1177,10 +1176,10 @@ class ChatPage extends LitElement { top: messageClientRect.top, offsetHeight: findOriginalMessage.offsetHeight } - + await this.getOldMessageDynamic(0, clickedOnMessage.timestamp, message) await this.getUpdateComplete() - + const marginElements = Array.from(this.shadowRoot.querySelector('chat-scroller').shadowRoot.querySelectorAll('message-template')) const findMessage2 = marginElements.find((item) => item.messageObj.signature === message.signature) || marginElements.find((item) => item.messageObj.originalSignature === message.signature) || marginElements.find((item) => item.messageObj.signature === message.originalSignature) || marginElements.find((item) => item.messageObj.originalSignature === message.originalSignature) if (findMessage2) { @@ -1412,9 +1411,9 @@ class ChatPage extends LitElement { async firstUpdated() { this.changeTheme() - + // this.processQueue(); - + window.addEventListener('storage', () => { const checkLanguage = localStorage.getItem('qortalLanguage') const checkTheme = localStorage.getItem('qortalTheme') @@ -1429,9 +1428,9 @@ class ChatPage extends LitElement { document.querySelector('html').setAttribute('theme', this.theme) }) - + this.lastReadMessageTimestamp = await chatLastSeen.getItem(this.chatId) || 0 - + parentEpml.imReady() const isEnabledChatEnter = localStorage.getItem('isEnabledChatEnter') @@ -1474,7 +1473,7 @@ class ChatPage extends LitElement { this.isLoadingMessages = true this.initUpdate() - + if (previousChatId) { window.parent.reduxStore.dispatch(window.parent.reduxAction.addChatLastSeen({ @@ -1498,7 +1497,7 @@ class ChatPage extends LitElement { } return true - + } async getName(recipient) { @@ -1548,11 +1547,11 @@ class ChatPage extends LitElement { renderChatScroller() { return html` - this.setRepliedToMessageObj(val)} @@ -1560,7 +1559,7 @@ class ChatPage extends LitElement { .sendMessage=${(val) => this._sendMessage(val)} .sendMessageForward=${(messageText, typeMessage, chatReference, isForward, forwardParams) => this.sendMessage(messageText, typeMessage, chatReference, isForward, forwardParams)} .showLastMessageRefScroller=${(val) => this.showLastMessageRefScroller(val)} - .emojiPicker=${this.emojiPicker} + .emojiPicker=${this.emojiPicker} ?isLoadingMessages=${this.isLoadingOldMessages} .setIsLoadingMessages=${(val) => this.setIsLoadingMessages(val)} .setForwardProperties=${(forwardedMessage) => this.setForwardProperties(forwardedMessage)} @@ -1637,19 +1636,19 @@ class ChatPage extends LitElement { let decodeMsgs = [] await new Promise((res, rej) => { this.webWorkerDecodeMessages.postMessage({messages: getInitialMessages, isReceipient: this.isReceipient, _publicKey: this._publicKey, privateKey: window.parent.reduxStore.getState().app.selectedAddress.keyPair.privateKey }); - + this.webWorkerDecodeMessages.onmessage = e => { decodeMsgs = e.data res() - + } this.webWorkerDecodeMessages.onerror = () => { rej() - + } }) - + queue.push(() => replaceMessagesEdited({ decodedMessages: decodeMsgs, parentEpml, @@ -1661,16 +1660,16 @@ class ChatPage extends LitElement { let list = [...decodeMsgs] - + await new Promise((res) => { - + this.webWorkerSortMessages.postMessage({list}); - + this.webWorkerSortMessages.onmessage = e => { - + list = e.data res() - + } }) const lastMsg = list.at(-1) @@ -1686,10 +1685,10 @@ class ChatPage extends LitElement { count } } - + this.isLoadingOldMessages = false - + } else { const getInitialMessagesBefore = await parentEpml.request('apiCall', { type: 'api', @@ -1704,15 +1703,15 @@ class ChatPage extends LitElement { let decodeMsgs = [] await new Promise((res, rej) => { this.webWorkerDecodeMessages.postMessage({messages: getInitialMessages, isReceipient: this.isReceipient, _publicKey: this._publicKey, privateKey: window.parent.reduxStore.getState().app.selectedAddress.keyPair.privateKey }); - + this.webWorkerDecodeMessages.onmessage = e => { decodeMsgs = e.data res() - + } this.webWorkerDecodeMessages.onerror = () => { rej() - + } }) @@ -1724,22 +1723,22 @@ class ChatPage extends LitElement { _publicKey: this._publicKey, addToUpdateMessageHashmap: this.addToUpdateMessageHashmap })); - - + + let list = [...decodeMsgs] - + await new Promise((res) => { - + this.webWorkerSortMessages.postMessage({list}); - + this.webWorkerSortMessages.onmessage = e => { - + list = e.data res() - + } }) - + const lastMsg = list.at(-1) if(lastMsg){ const count = await parentEpml.request('apiCall', { @@ -1753,11 +1752,11 @@ class ChatPage extends LitElement { count } } - + this.isLoadingOldMessages = false - + } } @@ -1778,18 +1777,18 @@ class ChatPage extends LitElement { let decodeMsgs = [] await new Promise((res, rej) => { this.webWorkerDecodeMessages.postMessage({messages: getInitialMessages, isReceipient: this.isReceipient, _publicKey: this._publicKey, privateKey: window.parent.reduxStore.getState().app.selectedAddress.keyPair.privateKey }); - + this.webWorkerDecodeMessages.onmessage = e => { decodeMsgs = e.data res() - + } this.webWorkerDecodeMessages.onerror = () => { rej() - + } }) - + queue.push(() => replaceMessagesEdited({ decodedMessages: decodeMsgs, parentEpml, @@ -1798,11 +1797,11 @@ class ChatPage extends LitElement { _publicKey: this._publicKey, addToUpdateMessageHashmap: this.addToUpdateMessageHashmap })); - + let list = [...decodeMsgs] - - - + + + this.messagesRendered = { messages: list, type: 'old', @@ -1826,22 +1825,22 @@ class ChatPage extends LitElement { let decodeMsgs = [] - + await new Promise((res, rej) => { this.webWorkerDecodeMessages.postMessage({messages: getInitialMessages, isReceipient: this.isReceipient, _publicKey: this._publicKey, privateKey: window.parent.reduxStore.getState().app.selectedAddress.keyPair.privateKey }); - + this.webWorkerDecodeMessages.onmessage = e => { decodeMsgs = e.data res() - + } this.webWorkerDecodeMessages.onerror = () => { rej() - + } }) - - + + queue.push(() => replaceMessagesEdited({ decodedMessages: decodeMsgs, parentEpml, @@ -1851,9 +1850,9 @@ class ChatPage extends LitElement { addToUpdateMessageHashmap: this.addToUpdateMessageHashmap })); let list = [...decodeMsgs] - - - + + + this.messagesRendered = { messages: list, type: 'old', @@ -1878,7 +1877,7 @@ class ChatPage extends LitElement { return } const timestamp = scrollElement.messageObj.timestamp - + if (this.isReceipient) { const getInitialMessages = await parentEpml.request('apiCall', { type: 'api', @@ -1888,19 +1887,19 @@ class ChatPage extends LitElement { let decodeMsgs = [] await new Promise((res, rej) => { this.webWorkerDecodeMessages.postMessage({messages: getInitialMessages, isReceipient: this.isReceipient, _publicKey: this._publicKey, privateKey: window.parent.reduxStore.getState().app.selectedAddress.keyPair.privateKey }); - + this.webWorkerDecodeMessages.onmessage = e => { decodeMsgs = e.data res() - + } this.webWorkerDecodeMessages.onerror = () => { rej() - + } }) - + queue.push(() => replaceMessagesEdited({ decodedMessages: decodeMsgs, parentEpml, @@ -1909,26 +1908,26 @@ class ChatPage extends LitElement { _publicKey: this._publicKey, addToUpdateMessageHashmap: this.addToUpdateMessageHashmap })); - + let list = [ ...decodeMsgs] - + await new Promise((res) => { - + this.webWorkerSortMessages.postMessage({list}); - + this.webWorkerSortMessages.onmessage = e => { - + list = e.data res() - + } }) - + this.messagesRendered = { messages: list, type: 'new' } - + this.isLoadingOldMessages = false await this.getUpdateComplete() @@ -1947,19 +1946,19 @@ class ChatPage extends LitElement { let decodeMsgs = [] await new Promise((res, rej) => { this.webWorkerDecodeMessages.postMessage({messages: getInitialMessages, isReceipient: this.isReceipient, _publicKey: this._publicKey, privateKey: window.parent.reduxStore.getState().app.selectedAddress.keyPair.privateKey }); - + this.webWorkerDecodeMessages.onmessage = e => { decodeMsgs = e.data res() - + } this.webWorkerDecodeMessages.onerror = () => { rej() - + } }) - + queue.push(() => replaceMessagesEdited({ decodedMessages: decodeMsgs, parentEpml, @@ -1969,22 +1968,22 @@ class ChatPage extends LitElement { addToUpdateMessageHashmap: this.addToUpdateMessageHashmap })); - + let list = [...decodeMsgs] - + await new Promise((res) => { - + this.webWorkerSortMessages.postMessage({list}); - + this.webWorkerSortMessages.onmessage = e => { - + list = e.data res() - + } }) - + this.messagesRendered = { messages: list, type: 'new' @@ -2002,8 +2001,8 @@ class ChatPage extends LitElement { } async addToUpdateMessageHashmap(array){ - - + + const newObj = {} @@ -2027,7 +2026,7 @@ class ChatPage extends LitElement { findContent(identifier, data) { const [type, id] = identifier.split('/'); - + if (type === 'group') { for (let group of data.groups) { if (group.groupId === parseInt(id, 10)) { @@ -2044,7 +2043,7 @@ class ChatPage extends LitElement { return null; } - + async processMessages(messages, isInitial, isUnread, count) { const isReceipient = this.chatId.includes('direct') @@ -2057,20 +2056,20 @@ class ChatPage extends LitElement { } await new Promise((res, rej) => { this.webWorkerDecodeMessages.postMessage({messages: messages, isReceipient: this.isReceipient, _publicKey: this._publicKey, privateKey: window.parent.reduxStore.getState().app.selectedAddress.keyPair.privateKey }); - + this.webWorkerDecodeMessages.onmessage = e => { decodedMessages = e.data res() - + } this.webWorkerDecodeMessages.onerror = () => { rej() - + } }) if (isInitial) { this.chatEditorPlaceholder = await this.renderPlaceholder() - + try { queue.push(() => replaceMessagesEdited({ @@ -2084,31 +2083,31 @@ class ChatPage extends LitElement { } catch (error) { console.log({error}) } - - + + let list = decodedMessages - + await new Promise((res) => { - + this.webWorkerSortMessages.postMessage({list}); - + this.webWorkerSortMessages.onmessage = e => { - + list = e.data res() - + } }) - + this._messages = list // TODO: Determine number of initial messages by screen height... // this.messagesRendered = this._messages const lastReadMessageTimestamp = this.lastReadMessageTimestamp - + if(isUnread){ this.messagesRendered = { @@ -2128,12 +2127,12 @@ class ChatPage extends LitElement { type: 'initial' } } - + this.isLoadingMessages = false setTimeout(() => this.downElementObserver(), 500) } else { - + queue.push(() => replaceMessagesEdited({ decodedMessages: decodedMessages, parentEpml, @@ -2157,7 +2156,7 @@ class ChatPage extends LitElement { })) } - + } } @@ -2215,7 +2214,7 @@ class ChatPage extends LitElement { if (newMessage.sender === this.selectedAddress.address) { - + this.messagesRendered = { messages: [newMessage], type: 'newComingInAuto', @@ -2235,13 +2234,13 @@ class ChatPage extends LitElement { if(viewElement){ viewElement.scrollTop = viewElement.scrollHeight } - + } else { this.messagesRendered = { messages: [newMessage], type: 'newComingInAuto', - } + } await this.getUpdateComplete() this.showNewMessageBar() @@ -2250,8 +2249,8 @@ class ChatPage extends LitElement { /** * Decode Message Method. Takes in a message object and returns a decoded message object - * @param {Object} encodedMessageObj - * + * @param {Object} encodedMessageObj + * */ decodeMessage(encodedMessageObj, isReceipient, _publicKey) { let isReceipientVar @@ -2303,9 +2302,9 @@ class ChatPage extends LitElement { } else { // Fallback to http directSocketLink = `ws://${nodeUrl}/websockets/chat/messages?involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${cid}&encoding=BASE64&limit=1` - } + } + - this.webSocket = new WebSocket(directSocketLink) // Open Connection @@ -2320,20 +2319,20 @@ class ChatPage extends LitElement { directSocketTimeout = setTimeout(pingDirectSocket, 45000) return } - + if (initial === 0) { this.lastReadMessageTimestamp = await chatLastSeen.getItem(this.chatId) || 0 if (noInitial) return let getInitialMessages = [] let count = 0 let isUnread = false - + const chatId = this.chatId - const findContent = this.chatHeads.find((item)=> item.url === chatId) + const findContent = this.chatHeads.find((item)=> item.url === chatId) const chatInfoTimestamp = findContent.timestamp || 0 const lastReadMessageTimestamp = this.lastReadMessageTimestamp - - + + if(lastReadMessageTimestamp && chatInfoTimestamp){ if(lastReadMessageTimestamp < chatInfoTimestamp){ isUnread = true @@ -2362,8 +2361,8 @@ class ChatPage extends LitElement { url: `/chat/messages?involving=${window.parent.reduxStore.getState().app.selectedAddress.address}&involving=${cid}&limit=${chatLimit}&reverse=true&haschatreference=false&encoding=BASE64` }) } - - + + this.processMessages(getInitialMessages, true, isUnread, count) @@ -2381,9 +2380,9 @@ class ChatPage extends LitElement { // Closed Event this.webSocket.onclose = (e) => { clearTimeout(directSocketTimeout) - + if (e.reason === 'switch chat') return - + restartDirectWebSocket() } @@ -2431,7 +2430,7 @@ class ChatPage extends LitElement { // Fallback to http groupSocketLink = `ws://${nodeUrl}/websockets/chat/messages?txGroupId=${groupId}&encoding=BASE64&limit=1` } - + this.webSocket = new WebSocket(groupSocketLink) // Open Connection @@ -2453,9 +2452,9 @@ class ChatPage extends LitElement { const lastReadMessageTimestamp = this.lastReadMessageTimestamp let isUnread = false - + const chatId = this.chatId - const findContent = this.chatHeads.find((item)=> item.url === chatId) + const findContent = this.chatHeads.find((item)=> item.url === chatId) const chatInfoTimestamp = findContent.timestamp || 0 if(lastReadMessageTimestamp && chatInfoTimestamp){ @@ -2464,7 +2463,7 @@ class ChatPage extends LitElement { } } if(isUnread){ - + const getInitialMessagesBefore = await parentEpml.request('apiCall', { type: 'api', @@ -2482,16 +2481,16 @@ class ChatPage extends LitElement { url: `/chat/messages/count?after=${lastMessage.timestamp}&txGroupId=${groupId}&limit=20&reverse=false` }) } - + } else { getInitialMessages = await parentEpml.request('apiCall', { type: 'api', url: `/chat/messages?txGroupId=${groupId}&limit=${chatLimit}&reverse=true&haschatreference=false&encoding=BASE64` }) } - - - + + + this.processMessages(getInitialMessages, true, isUnread, count) @@ -2537,7 +2536,7 @@ class ChatPage extends LitElement { } else { // ... Render a nice "Error, Go Back" component. } - // Add to the messages... TODO: Save messages to localstorage and fetch from it to make it persistent... + // Add to the messages... TODO: Save messages to localstorage and fetch from it to make it persistent... } resetChatEditor() { @@ -2553,11 +2552,11 @@ class ChatPage extends LitElement { } async _sendMessage(outSideMsg, msg, messageQueue) { - const _chatId= this._chatId - const isReceipient= this.isReceipient - let _publicKey= this._publicKey + const _chatId= this._chatId + const isReceipient= this.isReceipient + let _publicKey= this._publicKey const attachment= this.attachment - + try { if (this.isReceipient) { let hasPublicKey = true @@ -2580,73 +2579,73 @@ class ChatPage extends LitElement { _publicKey.hasPubKey = false } } catch (error) { /* empty */ } - + if (!hasPublicKey || !_publicKey.hasPubKey) { let err4string = get("chatpage.cchange39") parentEpml.request('showSnackBar', `${err4string}`) return } - + } } // have params to determine if it's a reply or not // have variable to determine if it's a response, holds signature in constructor - // need original message signature + // need original message signature // need whole original message object, transform the data and put it in local storage // create new var called repliedToData and use that to modify the UI // find specific object property in local let typeMessage = 'regular' // this.isLoading = true const trimmedMessage = msg - + const getName = async (recipient) => { try { const getNames = await parentEpml.request("apiCall", { type: "api", url: `/names/address/${recipient}` }) - + if (Array.isArray(getNames) && getNames.length > 0) { return getNames[0].name } else { return '' } - + } catch (error) { return "" } } - + if (outSideMsg && outSideMsg.type === 'delete') { this.isDeletingImage = true const userName = outSideMsg.name const identifier = outSideMsg.identifier let compressedFile = '' var str = "iVBORw0KGgoAAAANSUhEUgAAAsAAAAGMAQMAAADuk4YmAAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAADlJREFUeF7twDEBAAAAwiD7p7bGDlgYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAGJrAABgPqdWQAAAABJRU5ErkJggg==" - + if (this.webWorkerFile) { this.webWorkerFile.terminate() this.webWorkerFile = null } - + this.webWorkerFile = new WebWorkerFile() - + const b64toBlob = (b64Data, contentType = '', sliceSize = 512) => { const byteCharacters = atob(b64Data) const byteArrays = [] - + for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) { const slice = byteCharacters.slice(offset, offset + sliceSize) - + const byteNumbers = new Array(slice.length) for (let i = 0; i < slice.length; i++) { byteNumbers[i] = slice.charCodeAt(i) } - + const byteArray = new Uint8Array(byteNumbers) byteArrays.push(byteArray) } - + const blob = new Blob(byteArrays, { type: contentType }) return blob } @@ -2659,7 +2658,7 @@ class ChatPage extends LitElement { const file = new File([result], "name", { type: 'image/png' }) - + compressedFile = file resolve() }, @@ -2695,11 +2694,11 @@ class ChatPage extends LitElement { } typeMessage = 'edit' let chatReference = outSideMsg.editedMessageObj.signature - + if (outSideMsg.editedMessageObj.chatReference) { chatReference = outSideMsg.editedMessageObj.chatReference } - + let message = "" try { const parsedMessageObj = JSON.parse(outSideMsg.editedMessageObj.decodedMessage) @@ -2719,34 +2718,34 @@ class ChatPage extends LitElement { const str = "iVBORw0KGgoAAAANSUhEUgAAAsAAAAGMAQMAAADuk4YmAAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAADlJREFUeF7twDEBAAAAwiD7p7bGDlgYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAGJrAABgPqdWQAAAABJRU5ErkJggg==" const userName = outSideMsg.name const identifier = outSideMsg.identifier - + if (this.webWorkerFile) { this.webWorkerFile.terminate() this.webWorkerFile = null } - + this.webWorkerFile = new WebWorkerFile() - + const b64toBlob = (b64Data, contentType = '', sliceSize = 512) => { const byteCharacters = atob(b64Data) const byteArrays = [] - + for (let offset = 0; offset < byteCharacters.length; offset += sliceSize) { const slice = byteCharacters.slice(offset, offset + sliceSize) - + const byteNumbers = new Array(slice.length) for (let i = 0; i < slice.length; i++) { byteNumbers[i] = slice.charCodeAt(i) } - + const byteArray = new Uint8Array(byteNumbers) byteArrays.push(byteArray) } - + const blob = new Blob(byteArrays, { type: contentType }) return blob } - + const blob = b64toBlob(str, 'image/png') await new Promise(resolve => { new Compressor(blob, { @@ -2756,7 +2755,7 @@ class ChatPage extends LitElement { const file = new File([result], "name", { type: 'image/png' }) - + compressedFile = file resolve() }, @@ -2792,16 +2791,16 @@ class ChatPage extends LitElement { } typeMessage = 'edit' let chatReference = outSideMsg.editedMessageObj.signature - + if (outSideMsg.editedMessageObj.chatReference) { chatReference = outSideMsg.editedMessageObj.chatReference } - + let message = "" try { const parsedMessageObj = JSON.parse(outSideMsg.editedMessageObj.decodedMessage) message = parsedMessageObj - + } catch (error) { message = outSideMsg.editedMessageObj.decodedMessage } @@ -2823,8 +2822,8 @@ class ChatPage extends LitElement { this.imageFile = null return } - - + + let service = "QCHAT_IMAGE" let name = userName let identifier @@ -2840,16 +2839,16 @@ class ChatPage extends LitElement { } ); if (res.action !== 'accept') throw new Error('User declined publish') - + if (this.webWorkerFile) { this.webWorkerFile.terminate() this.webWorkerFile = null } - + this.webWorkerFile = new WebWorkerFile() const image = this.imageFile const id = this.uid.rnd() - let groupPart + let groupPart if(this.isReceipient){ groupPart = `direct_${generateIdFromAddresses(this._chatId, this.selectedAddress.address)}` } else { @@ -2880,9 +2879,9 @@ class ChatPage extends LitElement { this.isUploadingImage = false return } - + try { - + await publishData({ registeredName: userName, file: compressedFile, @@ -2903,9 +2902,9 @@ class ChatPage extends LitElement { this.isUploadingImage = false return } - + } - + const messageObject = { messageText: trimmedMessage, images: [{ @@ -2927,7 +2926,7 @@ class ChatPage extends LitElement { this.isLoading = false return } - + const messageObject = { messageText: '', gifs: [{ @@ -2949,14 +2948,14 @@ class ChatPage extends LitElement { this.isLoading = false return } - + if (this.webWorkerFile) { this.webWorkerFile.terminate() this.webWorkerFile = null } - + this.webWorkerFile = new WebWorkerFile() - + // const attachment = attachment const id = this.uid() const identifier = `qchat_${id}` @@ -3014,20 +3013,20 @@ class ChatPage extends LitElement { const userName = await getName(this.selectedAddress.address) typeMessage = 'edit' let chatReference = outSideMsg.editedMessageObj.signature - + if (outSideMsg.editedMessageObj.chatReference) { chatReference = outSideMsg.editedMessageObj.chatReference } - + let message = "" - + try { const parsedMessageObj = JSON.parse(outSideMsg.editedMessageObj.decodedMessage) message = parsedMessageObj } catch (error) { message = outSideMsg.editedMessageObj.decodedMessage } - + let reactions = message.reactions || [] const findEmojiIndex = reactions.findIndex((reaction) => reaction.type === outSideMsg.reaction) if (findEmojiIndex !== -1) { @@ -3084,16 +3083,16 @@ class ChatPage extends LitElement { } else if (this.editedMessageObj) { typeMessage = 'edit' let chatReference = this.editedMessageObj.signature - + if (this.editedMessageObj.chatReference) { chatReference = this.editedMessageObj.chatReference } - + let message = "" try { const parsedMessageObj = JSON.parse(this.editedMessageObj.decodedMessage) message = parsedMessageObj - + } catch (error) { message = this.editedMessageObj.decodedMessage } @@ -3112,7 +3111,7 @@ class ChatPage extends LitElement { version: 3 } const stringifyMessageObject = JSON.stringify(messageObject) - + if (this.balance < 4) { this.myTrimmedMeassage = '' this.myTrimmedMeassage = stringifyMessageObject @@ -3126,7 +3125,7 @@ class ChatPage extends LitElement { this.isUploadingImage = false return } - + } async sendMessage({messageText, typeMessage, chatReference, isForward,isReceipient, _chatId, _publicKey, messageQueue}) { @@ -3141,7 +3140,7 @@ class ChatPage extends LitElement { if(isForward){ this.isLoading = true } - + let _reference = new Uint8Array(64) window.crypto.getRandomValues(_reference) let reference = window.parent.Base58.encode(_reference) @@ -3420,7 +3419,7 @@ class ChatPage extends LitElement { /** * Method to set if the user's location is down in the chat - * @param { Boolean } isDown + * @param { Boolean } isDown */ setIsUserDown(isDown) { this.isUserDown = isDown diff --git a/plugins/plugins/core/components/ChatRightPanel.js b/plugins/plugins/core/components/ChatRightPanel.js index 24a90f59..b3fef699 100644 --- a/plugins/plugins/core/components/ChatRightPanel.js +++ b/plugins/plugins/core/components/ChatRightPanel.js @@ -1,8 +1,6 @@ -import { LitElement, html, css } from "lit"; -import { render } from "lit/html.js"; -import { Epml } from "../../../epml"; -import { getUserNameFromAddress } from "../../utils/getUserNameFromAddress"; -import snackbar from "./snackbar.js"; +import {css, html, LitElement} from "lit"; +import {Epml} from "../../../epml"; +import {getUserNameFromAddress} from "../../utils/getUserNameFromAddress"; import "@material/mwc-button"; import "@material/mwc-dialog"; import "@polymer/paper-spinner/paper-spinner-lite.js"; @@ -12,7 +10,6 @@ import '@vaadin/button'; import "./WrapperModal"; import "./TipUser" import "./UserInfo/UserInfo"; -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -93,9 +90,9 @@ class ChatRightPanel extends LitElement { .container-body { width: 100%; - display: flex; - flex-direction: column; - flex-grow: 1; + display: flex; + flex-direction: column; + flex-grow: 1; overflow:auto; margin-top: 5px; padding: 0px 6px; @@ -106,13 +103,13 @@ class ChatRightPanel extends LitElement { background-color: whitesmoke; border-radius: 7px; } - + .container-body::-webkit-scrollbar { width: 6px; border-radius: 7px; background-color: whitesmoke; } - + .container-body::-webkit-scrollbar-thumb { background-color: rgb(180, 176, 176); border-radius: 7px; @@ -122,7 +119,7 @@ class ChatRightPanel extends LitElement { .container-body::-webkit-scrollbar-thumb:hover { background-color: rgb(148, 146, 146); cursor: pointer; - } + } p { color: var(--black); @@ -196,7 +193,7 @@ class ChatRightPanel extends LitElement { async updated(changedProperties) { if (changedProperties && changedProperties.has('selectedHead')) { - if (this.selectedHead !== {}) { + if (this.selectedHead !== {}) { const userName = await getUserNameFromAddress(this.selectedHead.address); this.userName = userName; } @@ -237,7 +234,7 @@ class ChatRightPanel extends LitElement { this.toggle(false)} style="margin: 0px 10px" icon="vaadin:close" slot="icon">
-

${this.leaveGroupObj && this.leaveGroupObj.groupName}

+

${this.leaveGroupObj && this.leaveGroupObj.groupName}

${this.leaveGroupObj && this.leaveGroupObj.description}

Members: ${this.leaveGroupObj && this.leaveGroupObj.memberCount}

diff --git a/plugins/plugins/core/components/ChatRightPanelResources.js b/plugins/plugins/core/components/ChatRightPanelResources.js index 23686aac..23073f52 100644 --- a/plugins/plugins/core/components/ChatRightPanelResources.js +++ b/plugins/plugins/core/components/ChatRightPanelResources.js @@ -1,5 +1,5 @@ -import { LitElement, html, css } from 'lit'; -import { Epml } from '../../../epml'; +import {css, html, LitElement} from 'lit'; +import {Epml} from '../../../epml'; import '@material/mwc-button'; import '@material/mwc-dialog'; import '@polymer/paper-spinner/paper-spinner-lite.js'; @@ -11,11 +11,8 @@ import './TipUser'; import './UserInfo/UserInfo'; import './ChatImage'; import './ReusableImage'; -import { - get, - translate, -} from 'lit-translate'; -import { generateIdFromAddresses } from '../../utils/id-generation'; +import {get, translate,} from 'lit-translate'; +import {generateIdFromAddresses} from '../../utils/id-generation'; const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }); @@ -248,7 +245,7 @@ class ChatRightPanelResources extends LitElement { const groupPart = this.isReceipient ? `direct_${generateIdFromAddresses(this._chatId, this.myAddress)}` : `group_${this._chatId}`; - + let offset = reset ? 0 : this.images.length; let endpoint = `/arbitrary/resources/search?service=QCHAT_IMAGE&identifier=qchat_${groupPart}&reverse=true&limit=20&reverse=true&offset=${offset}` if(this.onlyMyImages){ @@ -337,7 +334,7 @@ class ChatRightPanelResources extends LitElement { render() { return html` - +
{ @@ -361,7 +358,7 @@ class ChatRightPanelResources extends LitElement { this.selectMyImages(e)} ?checked=${this.onlyMyImages}>
- + ${this.images.map((image) => { return html``; })} @@ -659,7 +656,7 @@ class ImageParent extends LitElement {
` : ''} - +
` : ''} diff --git a/plugins/plugins/core/components/ChatScroller-css.js b/plugins/plugins/core/components/ChatScroller-css.js index 2aad505d..2897b76b 100644 --- a/plugins/plugins/core/components/ChatScroller-css.js +++ b/plugins/plugins/core/components/ChatScroller-css.js @@ -1,4 +1,4 @@ -import { css } from 'lit' +import {css} from 'lit' export const chatStyles = css` html { @@ -91,7 +91,7 @@ export const chatStyles = css` user-select: none; display: flex; justify-content: space-between; - width: 100%; + width: 100%; padding-top: 2px; } @@ -126,7 +126,7 @@ export const chatStyles = css` .message-subcontainer1 { position: relative; display: flex; - align-items: flex-end; + align-items: flex-end; } .message-subcontainer2 { @@ -143,7 +143,7 @@ export const chatStyles = css` min-width: 150px; } - + .message-myBg { background-color: var(--chat-bubble-myBg) !important; } @@ -234,7 +234,7 @@ export const chatStyles = css` margin: 0; padding: 0; } - + .message { display: flex; flex-direction: column; @@ -252,7 +252,7 @@ export const chatStyles = css` .message-data-avatar { margin: 0px 10px 0px 3px; - width: 42px; + width: 42px; height: 42px; float: left; } @@ -289,7 +289,7 @@ export const chatStyles = css` vertical-align: bottom; object-fit: contain; } - + .align-left { text-align: left; } @@ -351,12 +351,12 @@ export const chatStyles = css` } .tooltip { - position: relative; + position: relative; } .tooltip:before { - content: attr(data-text); - display: none; + content: attr(data-text); + display: none; position: absolute; top: -47px; left: 50%; @@ -430,7 +430,7 @@ export const chatStyles = css` border: 0.5px solid transparent; cursor: pointer; } - + .reactions-bg:hover { border: 0.5px solid var(--reaction-bubble-outline); } @@ -446,7 +446,7 @@ export const chatStyles = css` } .defaultSize { - width: 45vh; + width: 45vh; height: 40vh; } @@ -473,7 +473,7 @@ export const chatStyles = css` color: rgb(228, 222, 222); padding-left: 7px; } - + .image-delete-icon:hover { opacity: 1; } @@ -704,7 +704,7 @@ export const chatStyles = css` flex-direction: column; gap: 5px; } - + .attachment-name { font-family: Work Sans, sans-serif; font-size: 16px; @@ -725,7 +725,7 @@ export const chatStyles = css` letter-spacing: 0.3px; font-weight: 300; } - + .download-icon { position: relative; color: var(--chat-bubble-msg-color); diff --git a/plugins/plugins/core/components/ChatScroller.js b/plugins/plugins/core/components/ChatScroller.js index 12b266ce..1c2a249a 100644 --- a/plugins/plugins/core/components/ChatScroller.js +++ b/plugins/plugins/core/components/ChatScroller.js @@ -1,15 +1,12 @@ -import { LitElement, html, } from 'lit'; -import { repeat } from 'lit/directives/repeat.js'; -import { - get, - translate, -} from 'lit-translate'; -import { unsafeHTML } from 'lit/directives/unsafe-html.js'; -import { chatStyles } from './ChatScroller-css.js'; -import { Epml } from '../../../epml'; -import { cropAddress } from '../../utils/cropAddress'; -import { roundToNearestDecimal } from '../../utils/roundToNearestDecimal.js'; -import { generateHTML } from '@tiptap/core'; +import {html, LitElement,} from 'lit'; +import {repeat} from 'lit/directives/repeat.js'; +import {get, translate,} from 'lit-translate'; +import {unsafeHTML} from 'lit/directives/unsafe-html.js'; +import {chatStyles} from './ChatScroller-css.js'; +import {Epml} from '../../../epml'; +import {cropAddress} from '../../utils/cropAddress'; +import {roundToNearestDecimal} from '../../utils/roundToNearestDecimal.js'; +import {generateHTML} from '@tiptap/core'; import isElectron from 'is-electron'; import axios from 'axios'; @@ -31,7 +28,7 @@ import '@material/mwc-icon'; import '@vaadin/icon'; import '@vaadin/icons'; import '@vaadin/tooltip'; -import { chatLimit, totalMsgCount } from './ChatPage.js'; +import {chatLimit, totalMsgCount} from './ChatPage.js'; const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }); let toggledMessage = {}; @@ -503,7 +500,7 @@ class ChatScroller extends LitElement { !previousMessage || !this.shouldGroupWithLastMessage(message, previousMessage) ) { - + if (currentMessageGroup) { this.messagesToRender.unshift(currentMessageGroup); } @@ -690,7 +687,7 @@ class ChatScroller extends LitElement { } render() { - + let formattedMessages = this.messagesToRender; return html` @@ -1454,19 +1451,19 @@ class MessageTemplate extends LitElement { return hideit ? html`
  • ` : html` -
  • -
    ` } - +
  • @@ -2025,7 +2022,7 @@ class MessageTemplate extends LitElement { ` } - +
    this.hidePrivateMessageModal()} .hideBlockUserModal=${() => this.hideBlockUserModal()} toblockaddress=${this.messageObj.sender} > - { this.openDialogImage = false; }}> @@ -2206,7 +2203,7 @@ class MessageTemplate extends LitElement { ${this.openDialogImage ? html` ` : ''} - +
    - { this.openDialogGif = false; }}>MessageTemplate @@ -2242,7 +2239,7 @@ class MessageTemplate extends LitElement { { this.openDeleteImage = false; }}> @@ -2252,10 +2249,10 @@ class MessageTemplate extends LitElement { ` @@ -312,8 +312,8 @@ class ChatTextEditor extends LitElement { this.emojiPickerHandler = this.shadowRoot.querySelector('.emoji-button'); this.mirrorChatInput = this.shadowRoot.getElementById('messageBox'); - this.chatMessageInput = this.shadowRoot.getElementById(this.iframeId); - + this.chatMessageInput = this.shadowRoot.getElementById(this.iframeId); + this.emojiPicker = new EmojiPicker({ style: "twemoji", twemojiBaseUrl: '/emoji/', @@ -352,7 +352,7 @@ class ChatTextEditor extends LitElement { const captionEditor = this.shadowRoot.getElementById(this.iframeId).contentWindow.document.getElementById('chatbarId') captionEditor.setAttribute('data-placeholder', this.placeholder) } - + if (changedProperties && changedProperties.has("imageFile")) { this.chatMessageInput = "newChat" } @@ -431,7 +431,7 @@ class ChatTextEditor extends LitElement { } catch (error) { console.error(error) } - + } calculateIFrameHeight(height) { @@ -444,7 +444,7 @@ class ChatTextEditor extends LitElement { this.iframeHeight = 42; } initChatEditor() { - const ChatEditor = function (editorConfig) { + const ChatEditor = function (editorConfig) { const ChatEditor = function () { const editor = this; editor.init(); @@ -486,9 +486,9 @@ class ChatTextEditor extends LitElement { html { cursor: text; } - + .chatbar-body { - display: flex; + display: flex; align-items: center; } @@ -496,24 +496,24 @@ class ChatTextEditor extends LitElement { background-color: whitesmoke; border-radius: 7px; } - + .chatbar-body::-webkit-scrollbar { width: 6px; border-radius: 7px; background-color: whitesmoke; } - + .chatbar-body::-webkit-scrollbar-thumb { background-color: rgb(180, 176, 176); border-radius: 7px; transition: all 0.3s ease-in-out; } - + .chatbar-body::-webkit-scrollbar-thumb:hover { background-color: rgb(148, 146, 146); cursor: pointer; - } - + } + div { font-size: 1rem; line-height: 1.38rem; @@ -631,7 +631,7 @@ class ChatTextEditor extends LitElement { }; ChatEditor.prototype.listenChanges = function () { - + const editor = this; const events = ['drop', 'contextmenu', 'mouseup', 'click', 'touchend', 'keydown', 'blur', 'paste'] @@ -650,9 +650,9 @@ class ChatTextEditor extends LitElement { const item_list = await navigator.clipboard.read(); let image_type; // we will feed this later const item = item_list.find( item => // choose the one item holding our image - item.types.some( type => { + item.types.some( type => { if (type.startsWith( 'image/')) { - image_type = type; + image_type = type; return true; } }) @@ -679,8 +679,8 @@ class ChatTextEditor extends LitElement { editor.insertText(textData); }) } - - + + return false; } @@ -780,7 +780,7 @@ class ChatTextEditor extends LitElement { editor.content = (editor.frame.contentDocument || editor.frame.document); editor.content.body.classList.add("chatbar-body"); - + let elemDiv = document.createElement('div'); elemDiv.setAttribute('contenteditable', 'true'); elemDiv.setAttribute('spellcheck', 'false'); @@ -791,7 +791,7 @@ class ChatTextEditor extends LitElement { editor.contentDiv = editor.frame.contentDocument.body.firstChild; editor.styles(); editor.listenChanges(); - + }; diff --git a/plugins/plugins/core/components/ChatTextEditor.js b/plugins/plugins/core/components/ChatTextEditor.js index 99a2522c..645249fc 100644 --- a/plugins/plugins/core/components/ChatTextEditor.js +++ b/plugins/plugins/core/components/ChatTextEditor.js @@ -1,10 +1,9 @@ -import { LitElement, html, css } from "lit"; -import { render } from 'lit/html.js' -import { EmojiPicker } from 'emoji-picker-js' -import { Epml } from '../../../epml.js' +import {css, html, LitElement} from "lit"; +import {EmojiPicker} from 'emoji-picker-js' +import {Epml} from '../../../epml.js' import '@material/mwc-icon' import '@material/mwc-checkbox' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {get, translate} from 'lit-translate' const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -55,9 +54,9 @@ class ChatTextEditor extends LitElement { } * { - + --mdc-checkbox-unchecked-color: var(--black); - + } .chatbar-container { width: 100%; @@ -135,9 +134,9 @@ class ChatTextEditor extends LitElement { overflow: hidden; } - input[type=file]::-webkit-file-upload-button { - cursor: pointer; - } + input[type=file]::-webkit-file-upload-button { + cursor: pointer; + } .chatbar-container textarea { display: none; @@ -152,7 +151,7 @@ class ChatTextEditor extends LitElement { padding: 0; border: none; } - + .checkmark-icon { width: 30px; color: var(--mdc-theme-primary); @@ -177,23 +176,23 @@ class ChatTextEditor extends LitElement { background-color: whitesmoke; border-radius: 7px; } - + .element::-webkit-scrollbar { width: 6px; border-radius: 7px; background-color: whitesmoke; } - + .element::-webkit-scrollbar-thumb { background-color: rgb(180, 176, 176); border-radius: 7px; transition: all 0.3s ease-in-out; } - + .element::-webkit-scrollbar-thumb:hover { background-color: rgb(148, 146, 146); cursor: pointer; - } + } .ProseMirror:focus { outline: none; } @@ -281,7 +280,7 @@ class ChatTextEditor extends LitElement { } .chatbar-button-single:hover { filter: brightness(120%); - + } .chatbar-buttons { @@ -295,7 +294,7 @@ class ChatTextEditor extends LitElement { justify-content: center; } :host(:hover) .chatbar-button-single { - + display: flex; align-items: center; justify-content: center; @@ -383,14 +382,14 @@ mwc-checkbox::shadow .mdc-checkbox::after, mwc-checkbox::shadow .mdc-checkbox::b render() { return html` -
    - +
    ${this.iframeId === "_chatEditorDOM" ? html` @@ -456,26 +455,26 @@ mwc-checkbox::shadow .mdc-checkbox::after, mwc-checkbox::shadow .mdc-checkbox::b for="qChatShowAutoMsg" @click=${() => this.shadowRoot.getElementById('qChatShowAutoMsg').click()} >${translate('chatpage.cchange69')} - + { if(e.target.checked){ window.parent.reduxStore.dispatch( window.parent.reduxAction.removeAutoLoadImageChat(this.chatId)) return } window.parent.reduxStore.dispatch( window.parent.reduxAction.addAutoLoadImageChat(this.chatId)) - + }} ?checked=${(window.parent.reduxStore.getState().app?.autoLoadImageChats || []).includes(this.chatId)}> -
    + ` : ''} - + -
    - -
    { this.preventUserSendingImage(e) }}> @@ -484,26 +483,26 @@ mwc-checkbox::shadow .mdc-checkbox::after, mwc-checkbox::shadow .mdc-checkbox::b icon="vaadin:paperclip" slot="icon" > - +
    - -
    +
    @@ -532,23 +531,23 @@ mwc-checkbox::shadow .mdc-checkbox::after, mwc-checkbox::shadow .mdc-checkbox::b `} ` - ) : + ) : html` -
    ${this.isLoading === false ? html` - send-icon { this.sendMessageFunc(this.messageQueue); - }} + }} /> - ` : + ` : html` `} @@ -556,14 +555,14 @@ mwc-checkbox::shadow .mdc-checkbox::after, mwc-checkbox::shadow .mdc-checkbox::b ` }
    - ${this.chatMessageSize >= 750 ? + ${this.chatMessageSize >= 750 ? html`
    ${`Your message size is of ${this.chatMessageSize} bytes out of a maximum of 4000`}
    - ` : + ` : html``} ` @@ -582,9 +581,9 @@ mwc-checkbox::shadow .mdc-checkbox::after, mwc-checkbox::shadow .mdc-checkbox::b const item_list = await navigator.clipboard.read(); let image_type; // we will feed this later const item = item_list.find( item => // choose the one item holding our image - item.types.some( type => { + item.types.some( type => { if (type.startsWith( 'image/')) { - image_type = type; + image_type = type; return true; } }) @@ -595,29 +594,29 @@ mwc-checkbox::shadow .mdc-checkbox::after, mwc-checkbox::shadow .mdc-checkbox::b type: image_type }); this.insertFile(file); - } + } } } - async firstUpdated() { + async firstUpdated() { window.addEventListener('storage', () => { const checkTheme = localStorage.getItem('qortalTheme'); const chatbar = this.shadowRoot.querySelector('.element') if (checkTheme === 'dark') { this.theme = 'dark' chatbar.style.cssText = "color:#ffffff;" - + } else { this.theme = 'light' chatbar.style.cssText = "color:#080808;" - + } }) this.emojiPickerHandler = this.shadowRoot.querySelector('.emoji-button'); this.mirrorChatInput = this.shadowRoot.getElementById('messageBox'); - this.chatMessageInput = this.shadowRoot.querySelector('.element') - + this.chatMessageInput = this.shadowRoot.querySelector('.element') + this.emojiPicker = new EmojiPicker({ style: "twemoji", twemojiBaseUrl: '/emoji/', @@ -631,7 +630,7 @@ mwc-checkbox::shadow .mdc-checkbox::after, mwc-checkbox::shadow .mdc-checkbox::b }); this.emojiPicker.on('emoji', selection => { - + this.editor.commands.insertContent(selection.emoji, { parseOptions: { preserveWhitespace: false @@ -658,7 +657,7 @@ mwc-checkbox::shadow .mdc-checkbox::after, mwc-checkbox::shadow .mdc-checkbox::b if (changedProperties && changedProperties.has('placeholder') && this.updatePlaceholder && this.editor) { this.updatePlaceholder(this.editor, this.placeholder ) } - + if (changedProperties && changedProperties.has("imageFile")) { this.chatMessageInput = "newChat"; } @@ -749,10 +748,10 @@ mwc-checkbox::shadow .mdc-checkbox::after, mwc-checkbox::shadow .mdc-checkbox::b } catch (error) { console.error(error) } - + } - + } -window.customElements.define("chat-text-editor", ChatTextEditor) \ No newline at end of file +window.customElements.define("chat-text-editor", ChatTextEditor) diff --git a/plugins/plugins/core/components/ChatWelcomePage.js b/plugins/plugins/core/components/ChatWelcomePage.js index b391f5d7..720af6e7 100644 --- a/plugins/plugins/core/components/ChatWelcomePage.js +++ b/plugins/plugins/core/components/ChatWelcomePage.js @@ -1,7 +1,6 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../epml.js' +import {get, registerTranslateConfig, translate, use} from 'lit-translate' import isElectron from 'is-electron' import '@material/mwc-icon' @@ -214,8 +213,8 @@ class ChatWelcomePage extends LitElement {
    chat
    ${this.myAddress.address} -

    ${translate("welcomepage.wcchange3")}

    - +

    - + { this._sendMessage(); } diff --git a/plugins/plugins/core/components/ImageComponent.js b/plugins/plugins/core/components/ImageComponent.js index 80bb6c26..4b33d08f 100644 --- a/plugins/plugins/core/components/ImageComponent.js +++ b/plugins/plugins/core/components/ImageComponent.js @@ -1,12 +1,5 @@ -import { LitElement, html, css } from 'lit'; -import { render } from 'lit/html.js'; -import { - use, - get, - translate, - translateUnsafeHTML, - registerTranslateConfig, -} from 'lit-translate'; +import {css, html, LitElement} from 'lit'; +import {translate,} from 'lit-translate'; export class ImageComponent extends LitElement { static get properties() { diff --git a/plugins/plugins/core/components/LevelFounder.js b/plugins/plugins/core/components/LevelFounder.js index 635dda40..2f9a8fc7 100644 --- a/plugins/plugins/core/components/LevelFounder.js +++ b/plugins/plugins/core/components/LevelFounder.js @@ -1,10 +1,8 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml.js' -import snackbar from './snackbar.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../epml.js' +import {translate} from 'lit-translate' import '@polymer/paper-tooltip/paper-tooltip.js' -import { RequestQueue } from '../../utils/queue.js' +import {RequestQueue} from '../../utils/queue.js' const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -116,7 +114,7 @@ class LevelFounder extends LitElement { } catch (error) { console.error(error) } - + } renderFounder() { diff --git a/plugins/plugins/core/components/NameMenu.js b/plugins/plugins/core/components/NameMenu.js index 9a0d2e5a..73bda1ec 100644 --- a/plugins/plugins/core/components/NameMenu.js +++ b/plugins/plugins/core/components/NameMenu.js @@ -1,8 +1,7 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml.js' +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../epml.js' import snackbar from './snackbar.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {get, translate} from 'lit-translate' import '@material/mwc-snackbar' import '@material/mwc-button' import '@material/mwc-dialog' diff --git a/plugins/plugins/core/components/QortalQrcodeGenerator.js b/plugins/plugins/core/components/QortalQrcodeGenerator.js index 37e41892..bd1c7429 100644 --- a/plugins/plugins/core/components/QortalQrcodeGenerator.js +++ b/plugins/plugins/core/components/QortalQrcodeGenerator.js @@ -1,5 +1,4 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' +import {css, html, LitElement} from 'lit' import QRCode from './QRCode.js' export class QortalQrcodeGenerator extends LitElement { diff --git a/plugins/plugins/core/components/ReusableImage.js b/plugins/plugins/core/components/ReusableImage.js index 8a61c411..def07f5f 100644 --- a/plugins/plugins/core/components/ReusableImage.js +++ b/plugins/plugins/core/components/ReusableImage.js @@ -1,9 +1,7 @@ -import { LitElement, html, css } from 'lit'; -import { - translate, -} from 'lit-translate'; +import {css, html, LitElement} from 'lit'; +import {translate,} from 'lit-translate'; import axios from 'axios'; -import { RequestQueueWithPromise } from '../../utils/queue'; +import {RequestQueueWithPromise} from '../../utils/queue'; import '@material/mwc-menu'; import '@material/mwc-list/mwc-list-item.js'; import '@material/mwc-dialog' @@ -149,7 +147,7 @@ export class ResuableImage extends LitElement { try { if (this.isFetching) return; this.isFetching = true; - + await requestQueue2.enqueue(() => { return axios.get( `${this.nodeUrl}/arbitrary/resource/properties/${this.resource.service}/${this.resource.name}/${this.resource.identifier}?apiKey=${this.myNode.apiKey}` @@ -301,9 +299,9 @@ export class ResuableImage extends LitElement { : ''}
    - { this.openDialogImage = false; }}> @@ -312,7 +310,7 @@ export class ResuableImage extends LitElement { ${this.openDialogImage ? html` ` : ''} - +
    { this.sendMoneyLoading = false; this.btnDisable = false; } - + if (parseFloat(amount) + parseFloat(0.011) > parseFloat(this.walletBalance)) { resetState(); const snack1string = get("chatpage.cchange51"); parentEpml.request('showSnackBar', `${snack1string}`); return false; } - + if (parseFloat(amount) <= 0) { resetState(); const snack2string = get("chatpage.cchange52"); parentEpml.request('showSnackBar', `${snack2string}`); return false; } - + if (recipient.length === 0) { resetState(); const snack3string = get("chatpage.cchange53"); parentEpml.request('showSnackBar', `${snack3string}`); return false; } - + const validateName = async (receiverName) => { const myNameRes = await parentEpml.request('apiCall', { type: 'api', @@ -139,11 +138,11 @@ export class TipUser extends LitElement { }); return myNameRes.error === 401 ? false : myNameRes; }; - + const validateAddress = async (receiverAddress) => { return await window.parent.validateAddress(receiverAddress); }; - + const getName = async (recipient) => { try { const getNames = await parentEpml.request("apiCall", { @@ -155,14 +154,14 @@ export class TipUser extends LitElement { return ""; } }; - + const makeTransactionRequest = async (receiver, lastRef) => { const dialogAmount = get("transactions.amount"); const dialogAddress = get("login.address"); const dialogName = get("login.name"); const dialogTo = get("transactions.to"); const recipientName = await getName(receiver); - + return await parentEpml.request('transaction', { type: 2, nonce: this.myAddress.nonce, @@ -179,7 +178,7 @@ export class TipUser extends LitElement { } }); }; - + const getTxnRequestResponse = (txnResponse) => { if (txnResponse.success === false && txnResponse.message) { this.errorMessage = txnResponse.message; @@ -200,17 +199,17 @@ export class TipUser extends LitElement { throw new Error(txnResponse); } }; - + const validateReceiver = async (recipient) => { let lastRef = await this.getLastRef(); let isAddress; - + try { isAddress = await validateAddress(recipient); } catch (err) { isAddress = false; } - + if (isAddress) { const myTransaction = await makeTransactionRequest(recipient, lastRef); getTxnRequestResponse(myTransaction); @@ -225,14 +224,14 @@ export class TipUser extends LitElement { } } }; - + await validateReceiver(recipient); } - + render() { return html` -
    +

    ${translate("chatpage.cchange43")} ${this.userName}

    @@ -240,16 +239,16 @@ export class TipUser extends LitElement {

    ${translate("chatpage.cchange47")}: ${this.walletBalance} QORT

    ${translate("chatpage.cchange49")}: ${this.qortPaymentFee} QORT

    - ${this.sendMoneyLoading ? - html` + ${this.sendMoneyLoading ? + html` ` : html`
    - this.sendQort()}> ${translate("chatpage.cchange50")} QORT diff --git a/plugins/plugins/core/components/ToolTip.js b/plugins/plugins/core/components/ToolTip.js index d70f25fd..18a9771e 100644 --- a/plugins/plugins/core/components/ToolTip.js +++ b/plugins/plugins/core/components/ToolTip.js @@ -1,6 +1,5 @@ -import { LitElement, html, css } from 'lit' -import { Epml } from '../../../epml.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../epml.js' const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -56,7 +55,7 @@ class ToolTip extends LitElement { display: none; visibility: hidden; opacity: 0; - } + } ` } diff --git a/plugins/plugins/core/components/TraderInfoView.js b/plugins/plugins/core/components/TraderInfoView.js index df9f8043..65bf472f 100644 --- a/plugins/plugins/core/components/TraderInfoView.js +++ b/plugins/plugins/core/components/TraderInfoView.js @@ -1,7 +1,7 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml.js' -import { get, translate, translateUnsafeHTML } from 'lit-translate' +import {css, html, LitElement} from 'lit' +import {render} from 'lit/html.js' +import {Epml} from '../../../epml.js' +import {get, translate} from 'lit-translate' import '@polymer/paper-dialog/paper-dialog.js' import '@material/mwc-button' @@ -355,7 +355,7 @@ class TraderInfoView extends LitElement { .border-wrapper { border: 1px var(--tradeborder) solid; - overflow: hidden; + overflow: hidden; } @@ -1532,7 +1532,7 @@ class TraderInfoView extends LitElement { creatorAddress: item.creatorAddress, recipient: item.recipient, amount: item.amount - + } } }).filter(item => !!item) @@ -1549,7 +1549,7 @@ class TraderInfoView extends LitElement { creatorAddress: item.creatorAddress, recipient: item.recipient, amount: item.amount - + } } }).filter(item => !!item) @@ -1595,7 +1595,7 @@ class TraderInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1617,7 +1617,7 @@ class TraderInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1639,7 +1639,7 @@ class TraderInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1661,7 +1661,7 @@ class TraderInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1683,7 +1683,7 @@ class TraderInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1705,7 +1705,7 @@ class TraderInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1727,7 +1727,7 @@ class TraderInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1749,7 +1749,7 @@ class TraderInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1771,7 +1771,7 @@ class TraderInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1793,7 +1793,7 @@ class TraderInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1815,7 +1815,7 @@ class TraderInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1837,7 +1837,7 @@ class TraderInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) diff --git a/plugins/plugins/core/components/UserInfo/UserInfo-css.js b/plugins/plugins/core/components/UserInfo/UserInfo-css.js index e3478f62..a648d446 100644 --- a/plugins/plugins/core/components/UserInfo/UserInfo-css.js +++ b/plugins/plugins/core/components/UserInfo/UserInfo-css.js @@ -1,4 +1,4 @@ -import { css } from 'lit' +import {css} from 'lit' export const userInfoStyles = css` .user-info-header { diff --git a/plugins/plugins/core/components/UserInfo/UserInfo.js b/plugins/plugins/core/components/UserInfo/UserInfo.js index fc9685a2..313eb197 100644 --- a/plugins/plugins/core/components/UserInfo/UserInfo.js +++ b/plugins/plugins/core/components/UserInfo/UserInfo.js @@ -1,7 +1,7 @@ -import { LitElement, html } from 'lit' -import { translate } from 'lit-translate' -import { userInfoStyles } from './UserInfo-css.js' -import { cropAddress } from '../../../utils/cropAddress.js' +import {html, LitElement} from 'lit' +import {translate} from 'lit-translate' +import {userInfoStyles} from './UserInfo-css.js' +import {cropAddress} from '../../../utils/cropAddress.js' import '@polymer/paper-progress/paper-progress.js' import '@vaadin/button' @@ -38,7 +38,7 @@ export class UserInfo extends LitElement { imageHTMLRes.onload = () => { this.isImageLoaded = true } - imageHTMLRes.onerror = () => { + imageHTMLRes.onerror = () => { if (this.imageFetches < 4) { setTimeout(() => { this.imageFetches = this.imageFetches + 1 @@ -90,7 +90,7 @@ export class UserInfo extends LitElement {
    diff --git a/plugins/plugins/core/components/WrapperModal-css.js b/plugins/plugins/core/components/WrapperModal-css.js index 1e587d7e..468647bd 100644 --- a/plugins/plugins/core/components/WrapperModal-css.js +++ b/plugins/plugins/core/components/WrapperModal-css.js @@ -1,4 +1,4 @@ -import { css } from 'lit' +import {css} from 'lit' export const wrapperModalStyles = css` .backdrop { @@ -9,7 +9,7 @@ export const wrapperModalStyles = css` bottom: 0; background: rgb(186 186 186 / 26%); overflow: hidden; - animation: backdrop_blur cubic-bezier(0.22, 1, 0.36, 1) 1s forwards; + animation: backdrop_blur cubic-bezier(0.22, 1, 0.36, 1) 1s forwards; z-index: 50 } @@ -34,11 +34,11 @@ export const wrapperModalStyles = css` } @keyframes backdrop_blur { - 0% { + 0% { backdrop-filter: blur(0px); background: transparent; } - 100% { + 100% { backdrop-filter: blur(5px); background: rgb(186 186 186 / 26%); } @@ -54,4 +54,4 @@ export const wrapperModalStyles = css` opacity: 1; } } -` \ No newline at end of file +` diff --git a/plugins/plugins/core/components/WrapperModal.js b/plugins/plugins/core/components/WrapperModal.js index e4d5f162..fd7fd96e 100644 --- a/plugins/plugins/core/components/WrapperModal.js +++ b/plugins/plugins/core/components/WrapperModal.js @@ -1,6 +1,5 @@ -import { LitElement, html } from 'lit' -import { render } from 'lit/html.js' -import { wrapperModalStyles } from './WrapperModal-css.js' +import {html, LitElement} from 'lit' +import {wrapperModalStyles} from './WrapperModal-css.js' export class WrapperModal extends LitElement { static get properties() { @@ -16,9 +15,9 @@ export class WrapperModal extends LitElement { render() { return html`
    -
    { this.onClickFunc() }} >
    diff --git a/plugins/plugins/core/components/computePowWorker.js b/plugins/plugins/core/components/computePowWorker.js index 2ed60a20..b89b9d84 100644 --- a/plugins/plugins/core/components/computePowWorker.js +++ b/plugins/plugins/core/components/computePowWorker.js @@ -1,4 +1,4 @@ -import { Sha256 } from 'asmcrypto.js' +import {Sha256} from 'asmcrypto.js' function sbrk(size, heap){ @@ -39,7 +39,7 @@ const computePow = async (chatBytes, path, difficulty) => { const hashAry = new Uint8Array(memory.buffer, hashPtr, 32); hashAry.set(chatBytesHash); - + const workBufferLength = 8 * 1024 * 1024; const workBufferPtr = sbrk(workBufferLength, heap); @@ -72,11 +72,11 @@ loadWebAssembly(path) } resolve() - + }); - }) + }) return response -} \ No newline at end of file +} diff --git a/plugins/plugins/core/components/computePowWorkerFile.js b/plugins/plugins/core/components/computePowWorkerFile.js index d9f5f662..b8bd962d 100644 --- a/plugins/plugins/core/components/computePowWorkerFile.js +++ b/plugins/plugins/core/components/computePowWorkerFile.js @@ -1,5 +1,4 @@ -import { Sha256 } from 'asmcrypto.js' - +import {Sha256} from 'asmcrypto.js' function sbrk(size, heap){ @@ -19,7 +18,7 @@ function sbrk(size, heap){ self.addEventListener('message', async e => { const response = await computePow(e.data.convertedBytes, e.data.path) postMessage(response) - + }) @@ -79,14 +78,14 @@ loadWebAssembly(path) .then(wasmModule => { response = { nonce : wasmModule.exports.compute2(hashPtr, workBufferPtr, workBufferLength, difficulty), - + } resolve() - + }); - }) + }) return response -} \ No newline at end of file +} diff --git a/plugins/plugins/core/components/frag-file-input.js b/plugins/plugins/core/components/frag-file-input.js index e35c4dc0..e7c57764 100644 --- a/plugins/plugins/core/components/frag-file-input.js +++ b/plugins/plugins/core/components/frag-file-input.js @@ -1,9 +1,9 @@ -import { LitElement, html, css } from 'lit' +import {css, html, LitElement} from 'lit' import '@material/mwc-button' import '@material/mwc-icon' -import { translate, translateUnsafeHTML } from 'lit-translate' +import {translate} from 'lit-translate' class FragFileInput extends LitElement { static get properties () { diff --git a/plugins/plugins/core/components/qortal-info-view.js b/plugins/plugins/core/components/qortal-info-view.js index c212e8c7..75fbd603 100644 --- a/plugins/plugins/core/components/qortal-info-view.js +++ b/plugins/plugins/core/components/qortal-info-view.js @@ -1,6 +1,6 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {css, html, LitElement} from 'lit' +import {render} from 'lit/html.js' +import {get, translate} from 'lit-translate' import '@polymer/paper-dialog/paper-dialog.js' import '@material/mwc-button' import '@material/mwc-icon' @@ -1465,7 +1465,7 @@ class QortalInfoView extends LitElement { creatorAddress: item.creatorAddress, recipient: item.recipient, amount: item.amount - + } } }).filter(item => !!item) @@ -1482,7 +1482,7 @@ class QortalInfoView extends LitElement { creatorAddress: item.creatorAddress, recipient: item.recipient, amount: item.amount - + } } }).filter(item => !!item) @@ -1524,7 +1524,7 @@ class QortalInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1546,7 +1546,7 @@ class QortalInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1568,7 +1568,7 @@ class QortalInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1590,7 +1590,7 @@ class QortalInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1612,7 +1612,7 @@ class QortalInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1634,7 +1634,7 @@ class QortalInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1656,7 +1656,7 @@ class QortalInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1678,7 +1678,7 @@ class QortalInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1700,7 +1700,7 @@ class QortalInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1722,7 +1722,7 @@ class QortalInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1744,7 +1744,7 @@ class QortalInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -1766,7 +1766,7 @@ class QortalInfoView extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) diff --git a/plugins/plugins/core/components/snackbar.js b/plugins/plugins/core/components/snackbar.js index 6604d72c..12416b02 100644 --- a/plugins/plugins/core/components/snackbar.js +++ b/plugins/plugins/core/components/snackbar.js @@ -1,4 +1,4 @@ -import { LitElement, html, css } from 'lit' +import {css, html, LitElement} from 'lit' import '@material/mwc-snackbar' let queueElement diff --git a/plugins/plugins/core/components/time-elements/extended-time-element.js b/plugins/plugins/core/components/time-elements/extended-time-element.js index 583dee79..fce17b2d 100644 --- a/plugins/plugins/core/components/time-elements/extended-time-element.js +++ b/plugins/plugins/core/components/time-elements/extended-time-element.js @@ -1,4 +1,5 @@ -import { makeFormatter } from './utils'; +import {makeFormatter} from './utils'; + const datetimes = new WeakMap(); export default class ExtendedTimeElement extends HTMLElement { static get observedAttributes() { diff --git a/plugins/plugins/core/components/time-elements/local-time-element.js b/plugins/plugins/core/components/time-elements/local-time-element.js index 3494d218..f4d1e06b 100644 --- a/plugins/plugins/core/components/time-elements/local-time-element.js +++ b/plugins/plugins/core/components/time-elements/local-time-element.js @@ -1,5 +1,6 @@ -import { strftime, makeFormatter, isDayFirst } from './utils'; +import {isDayFirst, makeFormatter, strftime} from './utils'; import ExtendedTimeElement from './extended-time-element'; + const formatters = new WeakMap(); export default class LocalTimeElement extends ExtendedTimeElement { attributeChangedCallback(attrName, oldValue, newValue) { diff --git a/plugins/plugins/core/components/time-elements/relative-time-element.js b/plugins/plugins/core/components/time-elements/relative-time-element.js index 5654e08d..71cf1a81 100644 --- a/plugins/plugins/core/components/time-elements/relative-time-element.js +++ b/plugins/plugins/core/components/time-elements/relative-time-element.js @@ -1,6 +1,7 @@ import RelativeTime from './relative-time'; import ExtendedTimeElement from './extended-time-element'; -import { localeFromElement } from './utils'; +import {localeFromElement} from './utils'; + export default class RelativeTimeElement extends ExtendedTimeElement { getFormattedDate() { const date = this.date; diff --git a/plugins/plugins/core/components/time-elements/relative-time.js b/plugins/plugins/core/components/time-elements/relative-time.js index a2b4a6e5..f61d94dc 100644 --- a/plugins/plugins/core/components/time-elements/relative-time.js +++ b/plugins/plugins/core/components/time-elements/relative-time.js @@ -1,4 +1,5 @@ -import { strftime, makeFormatter, makeRelativeFormat, isDayFirst, isThisYear, isYearSeparator } from './utils'; +import {isDayFirst, isThisYear, isYearSeparator, makeFormatter, makeRelativeFormat, strftime} from './utils'; + export default class RelativeTime { constructor(date, locale) { this.date = date; diff --git a/plugins/plugins/core/components/time-elements/time-ago-element.js b/plugins/plugins/core/components/time-elements/time-ago-element.js index 6ac6b25a..b673094e 100644 --- a/plugins/plugins/core/components/time-elements/time-ago-element.js +++ b/plugins/plugins/core/components/time-elements/time-ago-element.js @@ -1,6 +1,7 @@ import RelativeTime from './relative-time'; import RelativeTimeElement from './relative-time-element'; -import { localeFromElement } from './utils'; +import {localeFromElement} from './utils'; + export default class TimeAgoElement extends RelativeTimeElement { getFormattedDate() { const format = this.getAttribute('format'); diff --git a/plugins/plugins/core/components/time-elements/time-until-element.js b/plugins/plugins/core/components/time-elements/time-until-element.js index 2b57a845..ebdd9f91 100644 --- a/plugins/plugins/core/components/time-elements/time-until-element.js +++ b/plugins/plugins/core/components/time-elements/time-until-element.js @@ -1,6 +1,7 @@ import RelativeTime from './relative-time'; import RelativeTimeElement from './relative-time-element'; -import { localeFromElement } from './utils'; +import {localeFromElement} from './utils'; + export default class TimeUntilElement extends RelativeTimeElement { getFormattedDate() { const format = this.getAttribute('format'); diff --git a/plugins/plugins/core/components/webworkerDecodeMessages.js b/plugins/plugins/core/components/webworkerDecodeMessages.js index c1fb5cb7..4c6af4f7 100644 --- a/plugins/plugins/core/components/webworkerDecodeMessages.js +++ b/plugins/plugins/core/components/webworkerDecodeMessages.js @@ -1,4 +1,5 @@ -import { Sha256 } from 'asmcrypto.js'; +import {Sha256} from 'asmcrypto.js'; + const nacl = {} //(function(nacl) { 'use strict'; @@ -2767,7 +2768,7 @@ export const decryptChatMessageBase64 = ( recipientPublicKey, lastReference ) => { - + let _encryptedMessage = atob(encryptedMessage); const binaryLength = _encryptedMessage.length; const bytes = new Uint8Array(binaryLength); diff --git a/plugins/plugins/core/group-management/group-management.src.js b/plugins/plugins/core/group-management/group-management.src.js index 3503aaa8..1363427a 100644 --- a/plugins/plugins/core/group-management/group-management.src.js +++ b/plugins/plugins/core/group-management/group-management.src.js @@ -1,13 +1,8 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml.js' +import {css, html, LitElement} from 'lit' +import {render} from 'lit/html.js' +import {Epml} from '../../../epml.js' import isElectron from 'is-electron' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' - -registerTranslateConfig({ - loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) -}) - +import {get, registerTranslateConfig, translate, use} from 'lit-translate' import '../components/time-elements/index.js' import '@material/mwc-button' import '@material/mwc-dialog' @@ -26,6 +21,10 @@ import '@vaadin/grid/vaadin-grid-filter-column.js' import '@vaadin/grid/vaadin-grid-sort-column.js' import '@vaadin/text-field' +registerTranslateConfig({ + loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) +}) + const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) class GroupManagement extends LitElement { @@ -302,7 +301,7 @@ class GroupManagement extends LitElement { } - mwc-textfield { + mwc-textfield { width:100%; } @@ -1505,7 +1504,7 @@ class GroupManagement extends LitElement { ${translate("walletpage.wchange21")} ${this.createFee} QORT.
    - + ${translate("grouppage.gchange30")}
    - +
    ${translate("grouppage.gchange4")}
    @@ -1565,7 +1564,7 @@ class GroupManagement extends LitElement { ${translate("walletpage.wchange21")} ${this.joinFee} QORT.
    - + ${translate("grouppage.gchange35")}
    - +
    ${translate("grouppage.gchange4")}
    @@ -1630,7 +1629,7 @@ class GroupManagement extends LitElement { ${translate("walletpage.wchange21")} ${this.leaveFee} QORT.
    - + { registerPlugins(pluginUrlsConf) } }) -}) \ No newline at end of file +}) diff --git a/plugins/plugins/core/messaging/chain-messaging/chain-messaging.src.js b/plugins/plugins/core/messaging/chain-messaging/chain-messaging.src.js index 7b9de6e1..7bed3eb8 100644 --- a/plugins/plugins/core/messaging/chain-messaging/chain-messaging.src.js +++ b/plugins/plugins/core/messaging/chain-messaging/chain-messaging.src.js @@ -1,6 +1,5 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../../epml.js' +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../../epml.js' import isElectron from 'is-electron' const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) diff --git a/plugins/plugins/core/messaging/messaging.src.js b/plugins/plugins/core/messaging/messaging.src.js index cf7316ac..dfc77b96 100644 --- a/plugins/plugins/core/messaging/messaging.src.js +++ b/plugins/plugins/core/messaging/messaging.src.js @@ -1,5 +1,5 @@ -import { LitElement, html, css } from 'lit' -import { Epml } from '../../../epml.js' +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../epml.js' import isElectron from 'is-electron' const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -57,7 +57,7 @@ class Messaging extends LitElement { } .sub-title:hover { - cursor: pointer; + cursor: pointer; } .sub-url { @@ -102,11 +102,11 @@ class Messaging extends LitElement {
  • this.getUrl('q-chat')}>Q-Chat
  • - +

    this.getUrl('chain-messaging')}>Chain-Based Messaging

    -

    A long-term message that is stored ON CHAIN. - These messages are able to be sent to groups or individual accounts, and are essentially the 'e-mail' of Qortal. +

    A long-term message that is stored ON CHAIN. + These messages are able to be sent to groups or individual accounts, and are essentially the 'e-mail' of Qortal. Use these messages if you intend on the message being a PERMANENT message that stays when and where you send it.

      @@ -121,8 +121,8 @@ class Messaging extends LitElement {

      this.getUrl('q-chat')}>Q-Chat

      -

      Is a custom chat system that is UNLIKE ANY OTHER in existence. It is the FIRST OF ITS KIND IN THE WORLD. - It is a real-time, blockchain-based chat system that utilizes a memory-based PoW (Proof Of Work) algorithm, to implement a specialized transaction that is 'temporary', on the Qortal blockchain. +

      Is a custom chat system that is UNLIKE ANY OTHER in existence. It is the FIRST OF ITS KIND IN THE WORLD. + It is a real-time, blockchain-based chat system that utilizes a memory-based PoW (Proof Of Work) algorithm, to implement a specialized transaction that is 'temporary', on the Qortal blockchain. Q-Chat messages will DISSAPEAR AFTER 24 HOURS and therefore are not a great choice for things you wish to be permanent.

        diff --git a/plugins/plugins/core/messaging/q-chat/computePowWorker.src.js b/plugins/plugins/core/messaging/q-chat/computePowWorker.src.js index 2ed60a20..b89b9d84 100644 --- a/plugins/plugins/core/messaging/q-chat/computePowWorker.src.js +++ b/plugins/plugins/core/messaging/q-chat/computePowWorker.src.js @@ -1,4 +1,4 @@ -import { Sha256 } from 'asmcrypto.js' +import {Sha256} from 'asmcrypto.js' function sbrk(size, heap){ @@ -39,7 +39,7 @@ const computePow = async (chatBytes, path, difficulty) => { const hashAry = new Uint8Array(memory.buffer, hashPtr, 32); hashAry.set(chatBytesHash); - + const workBufferLength = 8 * 1024 * 1024; const workBufferPtr = sbrk(workBufferLength, heap); @@ -72,11 +72,11 @@ loadWebAssembly(path) } resolve() - + }); - }) + }) return response -} \ No newline at end of file +} diff --git a/plugins/plugins/core/messaging/q-chat/q-chat-css.src.js b/plugins/plugins/core/messaging/q-chat/q-chat-css.src.js index 80b11a08..08408ca2 100644 --- a/plugins/plugins/core/messaging/q-chat/q-chat-css.src.js +++ b/plugins/plugins/core/messaging/q-chat/q-chat-css.src.js @@ -1,4 +1,4 @@ -import { css } from 'lit' +import {css} from 'lit' export const qchatStyles = css` * { @@ -115,14 +115,14 @@ export const qchatStyles = css` display: block; opacity: 1; animation: fadeIn 0.6s; -} +} @keyframes fadeIn { from { opacity: 0; top: -10px; } - + to { opacity: 1; top: -60px; @@ -194,7 +194,7 @@ export const qchatStyles = css` padding: 0px 0px 60px 0px; height: 85vh; overflow-y: auto; - overflow-x: hidden; + overflow-x: hidden; } .people-list ul::-webkit-scrollbar-track { @@ -213,7 +213,7 @@ export const qchatStyles = css` border-radius: 7px; transition: all 0.3s ease-in-out; } - + .chat { width: 80vw; height: 100vh; diff --git a/plugins/plugins/core/messaging/q-chat/q-chat.src.js b/plugins/plugins/core/messaging/q-chat/q-chat.src.js index c25fcc2f..dc54877a 100644 --- a/plugins/plugins/core/messaging/q-chat/q-chat.src.js +++ b/plugins/plugins/core/messaging/q-chat/q-chat.src.js @@ -1,10 +1,10 @@ -import { LitElement, html } from 'lit' -import { render } from 'lit/html.js' -import { passiveSupport } from 'passive-events-support/src/utils' -import { Epml } from '../../../../epml.js' -import { get, translate } from 'lit-translate' -import { qchatStyles } from './q-chat-css.src.js' -import { Editor, Extension } from '@tiptap/core' +import {html, LitElement} from 'lit' +import {render} from 'lit/html.js' +import {passiveSupport} from 'passive-events-support/src/utils' +import {Epml} from '../../../../epml.js' +import {get, translate} from 'lit-translate' +import {qchatStyles} from './q-chat-css.src.js' +import {Editor, Extension} from '@tiptap/core' import isElectron from 'is-electron' import WebWorker from 'web-worker:./computePowWorker.src.js' import StarterKit from '@tiptap/starter-kit' @@ -108,7 +108,7 @@ class Chat extends LitElement { async setActiveChatHeadUrl(url) { this.activeChatHeadUrl = url this.requestUpdate() - } + } resetChatEditor(){ this.editor.commands.setContent('') @@ -188,7 +188,7 @@ class Chat extends LitElement { updatePlaceholder(editor, text) { editor.extensionManager.extensions.forEach((extension) => { if (extension.name === "placeholder") { - + extension.options["placeholder"] = text editor.commands.focus('end') } @@ -236,7 +236,7 @@ class Chat extends LitElement {
      - +
      { this.openTabToGroupManagement() }}> group_add ${this.isEmptyArray(this.chatHeads) ? this.renderLoadingText() : this.renderChatHead(this.chatHeads)}
    - +
    this.scrollToBottom()}> @@ -270,19 +270,19 @@ class Chat extends LitElement { ${translate("chatpage.cchange5")} keyboard_arrow_down
    - + ${this.activeChatHeadUrl ? html`${this.renderChatPage()}` : html`${this.renderChatWelcomePage()}`}
    - { this.resetChatEditor() this.openPrivateMessage = false this.shadowRoot.getElementById('sendTo').value = "" this.userFoundModalOpen = false; this.userFound = [] - } } + } } style=${this.openPrivateMessage ? "visibility:visible;z-index:50" : "visibility: hidden;z-index:-100;position: relative"}>
    @@ -292,12 +292,12 @@ class Chat extends LitElement {

    ${translate("chatpage.cchange6")}

    - { this.userSelected = {} @@ -312,19 +312,19 @@ class Chat extends LitElement {
    ` ) : ( - html` - ` )}
    - -
    - { this.userSelected = result; this.userFound = []; @@ -380,7 +380,7 @@ class Chat extends LitElement { ?loading=${this.isLoading}>
    - +
    @@ -417,7 +417,7 @@ class Chat extends LitElement {
    - + ` } @@ -491,20 +491,20 @@ class Chat extends LitElement { } target = target.parentNode; } - + // If it doesn't, show the default Electron context menu event.preventDefault(); window.parent.electronAPI.showMyMenu(); }); - + } let configLoaded = false parentEpml.ready().then(() => { - + parentEpml.subscribe('config', c => { if (!configLoaded) { setTimeout(getBlockedUsers, 1) @@ -534,8 +534,8 @@ class Chat extends LitElement { window.parent.reduxStore.dispatch( window.parent.reduxAction.setSideEffectAction(null)) } - - } + + } }) parentEpml.request('apiCall', { url: `/addresses/balance/${window.parent.reduxStore.getState().app.selectedAddress.address}` @@ -551,7 +551,7 @@ class Chat extends LitElement { }, 60000) } - + clearConsole() { if (!isElectron()) { /* empty */ } else { @@ -581,7 +581,7 @@ class Chat extends LitElement { this.userFound = [] } else { this.userFound = [ - ...this.userFound, + ...this.userFound, result, ]; } @@ -596,7 +596,7 @@ class Chat extends LitElement { window.location.href = `../../group-management/index.html` } - async _sendMessage(outSideMsg, msg) { + async _sendMessage(outSideMsg, msg) { this.isLoading = true; const trimmedMessage = msg @@ -613,17 +613,17 @@ class Chat extends LitElement { this.sendMessage(stringifyMessageObject) } } - + async sendMessage(messageText) { this.isLoading = true - + const _recipient = this.shadowRoot.getElementById('sendTo').value - + let recipient - - const validateName = async (receiverName) => { + + const validateName = async (receiverName) => { let myRes - try { + try { let myNameRes = await parentEpml.request('apiCall', { type: 'api', url: `/names/${receiverName}` @@ -638,23 +638,23 @@ class Chat extends LitElement { return "" } }; - + const myNameRes = await validateName(_recipient) if (!myNameRes) { recipient = _recipient } else { recipient = myNameRes.owner } - + const getAddressPublicKey = async () => { let isEncrypted; let _publicKey; - + let addressPublicKey = await parentEpml.request('apiCall', { type: 'api', url: `/addresses/publickey/${recipient}` }) - + if (addressPublicKey.error === 102) { _publicKey = false let err4string = get("chatpage.cchange19") @@ -689,10 +689,10 @@ class Chat extends LitElement { isText: 1 } }) - + _computePow(chatResponse); }; - + const _computePow = async (chatBytes) => { const difficulty = this.balance < 4 ? 18 : 8 const path = window.parent.location.origin + '/memory-pow/memory-pow.wasm.full' @@ -708,16 +708,16 @@ class Chat extends LitElement { res() } }) - + let _response = await parentEpml.request('sign_chat', { nonce: this.selectedAddress.nonce, chatBytesArray: chatBytesArray, chatNonce: nonce }); - + getSendChatResponse(_response) }; - + const getSendChatResponse = (response) => { if (response === true) { this.setActiveChatHeadUrl(`direct/${recipient}`) @@ -730,20 +730,20 @@ class Chat extends LitElement { let err2string = get("chatpage.cchange21") parentEpml.request('showSnackBar', `${err2string}`) } - + this.isLoading = false } - + // Exec.. getAddressPublicKey() - + } insertImage(file) { if (file.type.includes('image')) { this.imageFile = file return - } + } parentEpml.request('showSnackBar', get("chatpage.cchange28")) } @@ -777,7 +777,7 @@ class Chat extends LitElement { hidelist.push(item) }) localStorage.setItem("MessageBlockedAddresses", JSON.stringify(hidelist)) - + this.blockedUserList = hidelist }) } @@ -885,7 +885,7 @@ class Chat extends LitElement { renderChatWelcomePage() { return html` - this.setOpenPrivateMessage(val)} > @@ -902,14 +902,14 @@ class Chat extends LitElement { // Check for the chat ID from and render chat messages // Else render Welcome to Q-CHat - // TODO: DONE: Do the above in the ChatPage + // TODO: DONE: Do the above in the ChatPage return html` - this.setOpenPrivateMessage(val)} .setActiveChatHeadUrl=${(val)=> this.setActiveChatHeadUrl(val)} balance=${this.balance} @@ -999,4 +999,4 @@ class Chat extends LitElement { } } -window.customElements.define('q-chat', Chat) \ No newline at end of file +window.customElements.define('q-chat', Chat) diff --git a/plugins/plugins/core/minting/minting-info.src.js b/plugins/plugins/core/minting/minting-info.src.js index 49304129..112b6820 100644 --- a/plugins/plugins/core/minting/minting-info.src.js +++ b/plugins/plugins/core/minting/minting-info.src.js @@ -1,18 +1,16 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml.js' +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../epml.js' import isElectron from 'is-electron' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' - -registerTranslateConfig({ - loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) -}) - +import {registerTranslateConfig, translate, use} from 'lit-translate' import '@material/mwc-icon' import '@material/mwc-button' import '@material/mwc-dialog' import '@material/mwc-textfield' +registerTranslateConfig({ + loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) +}) + const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) class MintingInfo extends LitElement { diff --git a/plugins/plugins/core/name-registration/name-registration.src.js b/plugins/plugins/core/name-registration/name-registration.src.js index ecd51d15..f6ae5623 100644 --- a/plugins/plugins/core/name-registration/name-registration.src.js +++ b/plugins/plugins/core/name-registration/name-registration.src.js @@ -1,13 +1,8 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {css, html, LitElement} from 'lit' +import {render} from 'lit/html.js' +import {Epml} from '../../../epml.js' +import {get, registerTranslateConfig, translate, use} from 'lit-translate' import isElectron from 'is-electron' - -registerTranslateConfig({ - loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) -}) - import '@material/mwc-button' import '@material/mwc-dialog' import '@material/mwc-formfield' @@ -21,7 +16,11 @@ import '@vaadin/icon' import '@vaadin/icons' import '@vaadin/grid' import '@vaadin/text-field' -import { warningModal } from '../../utils/warning-modal.js' +import {warningModal} from '../../utils/warning-modal.js' + +registerTranslateConfig({ + loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) +}) const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -1194,4 +1193,4 @@ class NameRegistration extends LitElement { } } -window.customElements.define('name-registration', NameRegistration) \ No newline at end of file +window.customElements.define('name-registration', NameRegistration) diff --git a/plugins/plugins/core/names-market/names-market.src.js b/plugins/plugins/core/names-market/names-market.src.js index d3638920..21ca716a 100644 --- a/plugins/plugins/core/names-market/names-market.src.js +++ b/plugins/plugins/core/names-market/names-market.src.js @@ -1,14 +1,9 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {css, html, LitElement} from 'lit' +import {render} from 'lit/html.js' +import {Epml} from '../../../epml.js' +import {get, registerTranslateConfig, translate, use} from 'lit-translate' import isElectron from 'is-electron' import '../components/qortal-info-view.js' - -registerTranslateConfig({ - loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) -}) - import '@material/mwc-button' import '@material/mwc-dialog' import '@material/mwc-formfield' @@ -24,6 +19,10 @@ import '@vaadin/icons' import '@vaadin/grid' import '@vaadin/text-field' +registerTranslateConfig({ + loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) +}) + const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) class NamesMarket extends LitElement { @@ -1179,4 +1178,4 @@ class NamesMarket extends LitElement { } } -window.customElements.define('names-market', NamesMarket) \ No newline at end of file +window.customElements.define('names-market', NamesMarket) diff --git a/plugins/plugins/core/node-management/node-management.src.js b/plugins/plugins/core/node-management/node-management.src.js index 1da06d97..ea61db18 100644 --- a/plugins/plugins/core/node-management/node-management.src.js +++ b/plugins/plugins/core/node-management/node-management.src.js @@ -1,13 +1,8 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml.js' +import {css, html, LitElement} from 'lit' +import {render} from 'lit/html.js' +import {Epml} from '../../../epml.js' import isElectron from 'is-electron' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' - -registerTranslateConfig({ - loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) -}) - +import {get, registerTranslateConfig, translate, use} from 'lit-translate' import '@polymer/paper-spinner/paper-spinner-lite.js' import '@material/mwc-icon' import '@material/mwc-textfield' @@ -15,6 +10,10 @@ import '@material/mwc-button' import '@material/mwc-dialog' import '@vaadin/grid' +registerTranslateConfig({ + loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) +}) + const parentEpml = new Epml({ type: "WINDOW", source: window.parent }) class NodeManagement extends LitElement { diff --git a/plugins/plugins/core/overview-page/overview-page-css.js b/plugins/plugins/core/overview-page/overview-page-css.js index a5fe82e8..2e3ef30f 100644 --- a/plugins/plugins/core/overview-page/overview-page-css.js +++ b/plugins/plugins/core/overview-page/overview-page-css.js @@ -1,4 +1,4 @@ -import { css } from 'lit' +import {css} from 'lit' export const overviewStyle = css` *, @@ -742,4 +742,4 @@ p { .red { color: #C6011F; } -` \ No newline at end of file +` diff --git a/plugins/plugins/core/overview-page/overview-page.src.js b/plugins/plugins/core/overview-page/overview-page.src.js index 6b6d206e..de8ff4f2 100644 --- a/plugins/plugins/core/overview-page/overview-page.src.js +++ b/plugins/plugins/core/overview-page/overview-page.src.js @@ -1,8 +1,8 @@ -import { LitElement, html, css } from 'lit' -import { Epml } from '../../../epml.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' -import { overviewStyle } from './overview-page-css.js' -import { asyncReplace } from 'lit/directives/async-replace.js' +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../epml.js' +import {get, registerTranslateConfig, translate, use} from 'lit-translate' +import {overviewStyle} from './overview-page-css.js' +import {asyncReplace} from 'lit/directives/async-replace.js' import isElectron from 'is-electron' import "@material/mwc-button" @@ -752,7 +752,7 @@ class StartMintingNow extends LitElement { - + ${this.openDialogRewardShare ? html`
    @@ -806,7 +806,7 @@ class StartMintingNow extends LitElement { Warning: do not close the Qortal UI until completion!

    ${this.errorMsg}

    -
    +
    ${this.errorMsg || this.status === 5 ? html` @@ -881,4 +881,4 @@ class MyButton extends LitElement { ` } } -customElements.define('my-button', MyButton) \ No newline at end of file +customElements.define('my-button', MyButton) diff --git a/plugins/plugins/core/puzzles/puzzles.src.js b/plugins/plugins/core/puzzles/puzzles.src.js index 75611c11..4a958ec8 100644 --- a/plugins/plugins/core/puzzles/puzzles.src.js +++ b/plugins/plugins/core/puzzles/puzzles.src.js @@ -1,13 +1,8 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml.js' +import {css, html, LitElement} from 'lit' +import {render} from 'lit/html.js' +import {Epml} from '../../../epml.js' import isElectron from 'is-electron' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' - -registerTranslateConfig({ - loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) -}) - +import {registerTranslateConfig, translate, use} from 'lit-translate' import nacl from '../../../../crypto/api/deps/nacl-fast.js' import Base58 from '../../../../crypto/api/deps/Base58.js' import publicKeyToAddress from '../../../../crypto/api/wallet/publicKeyToAddress.js' @@ -19,6 +14,10 @@ import '@material/mwc-slider' import '@polymer/paper-spinner/paper-spinner-lite.js' import '@vaadin/grid' +registerTranslateConfig({ + loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) +}) + const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) const DEFAULT_FEE = 0.001 diff --git a/plugins/plugins/core/q-app/q-apps.src.js b/plugins/plugins/core/q-app/q-apps.src.js index abbe1fca..48086c88 100644 --- a/plugins/plugins/core/q-app/q-apps.src.js +++ b/plugins/plugins/core/q-app/q-apps.src.js @@ -1,15 +1,9 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' -import { columnBodyRenderer, gridRowDetailsRenderer } from '@vaadin/grid/lit.js' +import {css, html, LitElement} from 'lit' +import {render} from 'lit/html.js' +import {Epml} from '../../../epml.js' +import {get, registerTranslateConfig, translate, use} from 'lit-translate' import isElectron from 'is-electron' import '@polymer/paper-spinner/paper-spinner-lite.js' - -registerTranslateConfig({ - loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) -}) - import '@material/mwc-dialog' import '@material/mwc-icon' import '@material/mwc-button' @@ -22,6 +16,10 @@ import '@vaadin/icon' import '@vaadin/icons' import '@vaadin/text-field' +registerTranslateConfig({ + loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) +}) + const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) class QApps extends LitElement { @@ -432,7 +430,7 @@ class QApps extends LitElement { ${translate("appspage.schange10")} ` : ''} ${this.renderRelayModeText()}
    - +
    @@ -744,7 +742,7 @@ class QApps extends LitElement { const nodeUrl = myNode.protocol + '://' + myNode.domain + ':' + myNode.port let jsonOffsetUrl = `${nodeUrl}/arbitrary/resources?service=APP&default=true&limit=20&offset=${offset}&reverse=false&includestatus=true&includemetadata=true&excludeblocked=true` this.isLoading = true - + const jsonOffsetRes = await fetch(jsonOffsetUrl) const jsonOffsetData = await jsonOffsetRes.json() diff --git a/plugins/plugins/core/qdn/browser/browser.src.js b/plugins/plugins/core/qdn/browser/browser.src.js index 70622b23..e1cac571 100644 --- a/plugins/plugins/core/qdn/browser/browser.src.js +++ b/plugins/plugins/core/qdn/browser/browser.src.js @@ -1,14 +1,8 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../../epml' +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../../epml' import isElectron from 'is-electron' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {get, registerTranslateConfig, translate, use} from 'lit-translate' import ShortUniqueId from 'short-unique-id'; - -registerTranslateConfig({ - loader: (lang) => fetch(`/language/${lang}.json`).then((res) => res.json()) -}) - import FileSaver from 'file-saver' import * as actions from '../../components/qdn-action-types' import '@material/mwc-button' @@ -16,13 +10,24 @@ import '@material/mwc-icon' import '@material/mwc-checkbox' import WebWorker from 'web-worker:./computePowWorkerFile.src.js' import WebWorkerChat from 'web-worker:./computePowWorker.src.js' -import { publishData } from '../../../utils/publish-image.js' -import { Loader } from '../../../utils/loader.js'; -import { QORT_DECIMALS } from '../../../../../crypto/api/constants' -import nacl from '../../../../../crypto/api/deps/nacl-fast.js' -import ed2curve from '../../../../../crypto/api/deps/ed2curve.js' -import { mimeToExtensionMap } from '../../components/qdn-action-constants'; -import { base64ToUint8Array, decryptDeprecatedSingle, decryptGroupData, encryptDataGroup, fileToBase64, uint8ArrayStartsWith, uint8ArrayToBase64 } from '../../components/qdn-action-encryption'; +import {publishData} from '../../../utils/publish-image.js' +import {Loader} from '../../../utils/loader.js'; +import {QORT_DECIMALS} from '../../../../../crypto/api/constants' +import {mimeToExtensionMap} from '../../components/qdn-action-constants'; +import { + base64ToUint8Array, + decryptDeprecatedSingle, + decryptGroupData, + encryptDataGroup, + fileToBase64, + uint8ArrayStartsWith, + uint8ArrayToBase64 +} from '../../components/qdn-action-encryption'; + +registerTranslateConfig({ + loader: (lang) => fetch(`/language/${lang}.json`).then((res) => res.json()) +}) + const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }); class WebBrowser extends LitElement { @@ -117,7 +122,7 @@ class WebBrowser extends LitElement { input { outline: none } - + paper-progress { --paper-progress-active-color: var(--mdc-theme-primary); @@ -318,7 +323,7 @@ class WebBrowser extends LitElement { } async linkOpenNewTab(link) { - + const value = link let newQuery = value if (newQuery.endsWith('/')) { @@ -337,7 +342,7 @@ class WebBrowser extends LitElement { if (path) { query = query + `&path=${path}` } - + window.parent.reduxStore.dispatch(window.parent.reduxAction.setNewTab({ url: `qdn/browser/index.html${query}`, id: this.uid.rnd(), @@ -352,7 +357,7 @@ class WebBrowser extends LitElement { "parent": false } })) - + } render() { @@ -716,7 +721,7 @@ class WebBrowser extends LitElement { let votedialog5 = get("transactions.votedialog5") let votedialog6 = get("transactions.votedialog6") let feeDialog = get("walletpage.wchange12") - + let myTxnrequest = await parentEpml.request('transaction', { type: 8, nonce: this.selectedAddress.nonce, @@ -1548,10 +1553,10 @@ class WebBrowser extends LitElement { } const pollName = data.pollName - const pollDescription = data.pollDescription + const pollDescription = data.pollDescription const pollOptions = data.pollOptions - const pollOwnerAddress = data.pollOwnerAddress - + const pollOwnerAddress = data.pollOwnerAddress + try { this.loader.show() const resCreatePoll = await this._createPoll(pollName, pollDescription, pollOptions, pollOwnerAddress) @@ -1589,7 +1594,7 @@ class WebBrowser extends LitElement { response = JSON.stringify(obj) break } - + } case actions.NOTIFICATIONS_PERMISSION: { @@ -1609,11 +1614,11 @@ class WebBrowser extends LitElement { response = false break } - + } catch (error) { break } - + } case actions.SEND_LOCAL_NOTIFICATION: { @@ -1627,10 +1632,10 @@ class WebBrowser extends LitElement { const interval = appInfo.interval if (lastNotification && interval) { const timeDifference = Date.now() - lastNotification - + if (timeDifference > interval) { parentEpml.request('showNotification', { - title, type: "qapp-local-notification", sound: '', url, options: { body: message, icon, badge: icon } + title, type: "qapp-local-notification", sound: '', url, options: { body: message, icon, badge: icon } }) response = true this.updateLastNotification(id, this.name) @@ -1640,7 +1645,7 @@ class WebBrowser extends LitElement { } } else if(!lastNotification){ parentEpml.request('showNotification', { - title, type: "qapp-local-notification", sound: '', url, options: { body: message, icon, badge: icon } + title, type: "qapp-local-notification", sound: '', url, options: { body: message, icon, badge: icon } }) response = true this.updateLastNotification(id) @@ -1648,16 +1653,16 @@ class WebBrowser extends LitElement { } else { throw new Error(`invalid data`) } - + } catch (error) { const obj = {} const errorMsg = error.message || "error in pushing notification" obj['error'] = errorMsg response = JSON.stringify(obj) break - + } - + } case actions.SEND_CHAT_MESSAGE: { const message = data.message @@ -2045,7 +2050,7 @@ class WebBrowser extends LitElement { try { this.loader.show() - + const resDeployAt = await this._deployAt(data.name, data.description, data.tags, data.creationBytes, data.amount, data.assetId, data.type) response = JSON.stringify(resDeployAt) } catch (error) { @@ -3196,7 +3201,7 @@ class WebBrowser extends LitElement { if(!appName) throw new Error('unknown app name') const id = `appNotificationList-${this.selectedAddress.address}` const checkData = localStorage.getItem(id) ? JSON.parse(localStorage.getItem(id)) : null - + if (!checkData) { const newData = { [appName]: { @@ -3217,7 +3222,7 @@ class WebBrowser extends LitElement { updateLastNotification(id, appName) { const checkData = localStorage.getItem(id) ? JSON.parse(localStorage.getItem(id)) : null - + if (checkData) { const copyData = { ...checkData } if (copyData[appName]) { @@ -3231,7 +3236,7 @@ class WebBrowser extends LitElement { localStorage.setItem(id, JSON.stringify(copyData)) } } - + renderFollowUnfollowButton() { // Only show the follow/unfollow button if we have permission to modify the list on this node @@ -3510,7 +3515,7 @@ async function showModalAndWait(type, data) {
    ` : ''} - ${type === actions.PUBLISH_MULTIPLE_QDN_RESOURCES ? ` + ${type === actions.PUBLISH_MULTIPLE_QDN_RESOURCES ? ` ` : ''} - + ${type === actions.DELETE_LIST_ITEM ? ` - +
    - + - ` : ''} + ` : ''} ${sponsorship.name || sponsorship.address} @@ -159,7 +159,7 @@ class SponsorshipList extends LitElement { @click=${() => this.removeRewardShare(sponsorship)} > delete_forever ${translate('rewardsharepage.rchange17')} - +
    `)} @@ -169,7 +169,7 @@ class SponsorshipList extends LitElement { ${translate('sponsorshipspage.schange3')}  ${this.sponsorships.length} - +

    ${translate('sponsorshipspage.schange4')}  @@ -240,7 +240,7 @@ class SponsorshipList extends LitElement { - +

    ${translate('sponsorshipspage.schange14')}

    @@ -276,7 +276,7 @@ class SponsorshipList extends LitElement {

    ${this.privateRewardShareKey && this.status === 4 ? html` -
  • +
  • ${translate('sponsorshipspage.schange16')}

    @@ -372,7 +372,7 @@ class SponsorshipList extends LitElement { this.lookupPublicAddressValue = '' this.isOpenDialogPublicKeyLookup = false this.errorLookup = '' - + }} > ${translate('general.close')} @@ -496,7 +496,7 @@ class SponsorshipList extends LitElement { let rewardShares = await this.getRewardShareRelationship(address) rewardShares = rewardShares.filter((rs) => rs.recipient !== address) - + const getAccountInfo = rewardShares.map(async (rs) => { const addressInfo = await parentEpml.request('apiCall', { type: 'api', @@ -514,7 +514,7 @@ class SponsorshipList extends LitElement { const urlPic = `${avatarUrl}/arbitrary/THUMBNAIL/${getNames[0].name}/qortal_avatar?async=true&apiKey=${this.getApiKey()}` url = urlPic } - + let blocksRemaining = this._levelUpBlocks(addressInfo) blocksRemaining = +blocksRemaining > 0 ? +blocksRemaining : 0 return { @@ -567,7 +567,7 @@ class SponsorshipList extends LitElement { } async removeRewardShare(rewardShareObject) { - + const selectedAddress = window.parent.reduxStore.getState().app.selectedAddress const myPercentageShare = -1 @@ -649,7 +649,7 @@ class SponsorshipList extends LitElement { // Check for valid... this.isLoadingCreateSponsorship = true - + // Get Last Ref const getLastRef = async () => { let myRef = await parentEpml.request('apiCall', { @@ -670,17 +670,17 @@ class SponsorshipList extends LitElement { // Validate Reward Share by Level const validateReceiver = async () => { - let accountDetails + let accountDetails try { accountDetails = await getAccountDetails() } catch (error) { this.errorMessage = 'Could not fetch account details' } - + let lastRef = await getLastRef() if (accountDetails.level >= 5 || accountDetails.flags === 1) { this.status = 1 - + this.errorMessage = '' try { @@ -693,7 +693,7 @@ class SponsorshipList extends LitElement { let err5string = get('rewardsharepage.rchange20') this.errorMessage = `${err5string} ${accountDetails.level}` } - + } // Make Transaction Request @@ -747,12 +747,12 @@ class SponsorshipList extends LitElement { this.status = 2 let interval = null let stop = false - + const getAnswer = async () => { - + if (!stop) { stop= true - + try { const recipientAddress = window.parent.base58PublicKeyToAddress(recipientPublicKey) const minterAddress = window.parent.reduxStore.getState().app.selectedAddress.address @@ -764,10 +764,10 @@ class SponsorshipList extends LitElement { clearInterval(interval) this.status = 3 this.timer = countDown(isCopy ? 5 : 180, ()=> this.changeStatus(4)) - } + } } catch (error) { } - + stop = false } } diff --git a/plugins/plugins/core/streams/AddressWatcher.js b/plugins/plugins/core/streams/AddressWatcher.js index ac3fbf7c..c2411aa6 100644 --- a/plugins/plugins/core/streams/AddressWatcher.js +++ b/plugins/plugins/core/streams/AddressWatcher.js @@ -1,4 +1,4 @@ -import { parentEpml } from '../connect.js' +import {parentEpml} from '../connect.js' // Tests to see if a block or transaction should trigger an address reload...but we're not doing that yet, because of no time for good testing const transactionTests = [] diff --git a/plugins/plugins/core/streams/UnconfirmedTransactionWatcher.js b/plugins/plugins/core/streams/UnconfirmedTransactionWatcher.js index 1d95cafd..528ada42 100644 --- a/plugins/plugins/core/streams/UnconfirmedTransactionWatcher.js +++ b/plugins/plugins/core/streams/UnconfirmedTransactionWatcher.js @@ -1,4 +1,4 @@ -import { parentEpml } from '../connect.js' +import {parentEpml} from '../connect.js' export class UnconfirmedTransactionWatcher { constructor() { diff --git a/plugins/plugins/core/streams/onNewBlock.js b/plugins/plugins/core/streams/onNewBlock.js index 990bda65..495f920b 100644 --- a/plugins/plugins/core/streams/onNewBlock.js +++ b/plugins/plugins/core/streams/onNewBlock.js @@ -1,4 +1,4 @@ -import { parentEpml } from '../connect.js' +import {parentEpml} from '../connect.js' let socketObject let activeBlockSocketTimeout diff --git a/plugins/plugins/core/streams/streams.js b/plugins/plugins/core/streams/streams.js index 809bd53d..48d91546 100644 --- a/plugins/plugins/core/streams/streams.js +++ b/plugins/plugins/core/streams/streams.js @@ -1,6 +1,6 @@ -import { parentEpml } from '../connect.js' +import {parentEpml} from '../connect.js' -import { startConfigWatcher } from './onNewBlock.js' +import {startConfigWatcher} from './onNewBlock.js' const setAccountInfo = async (addr) => { diff --git a/plugins/plugins/core/trade-bot/trade-bot-portal.src.js b/plugins/plugins/core/trade-bot/trade-bot-portal.src.js index 20e0e35e..52c279fa 100644 --- a/plugins/plugins/core/trade-bot/trade-bot-portal.src.js +++ b/plugins/plugins/core/trade-bot/trade-bot-portal.src.js @@ -1,15 +1,10 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml.js' +import {css, html, LitElement} from 'lit' +import {render} from 'lit/html.js' +import {Epml} from '../../../epml.js' import isElectron from 'is-electron' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {get, registerTranslateConfig, translate, use} from 'lit-translate' import Base58 from '../../../../crypto/api/deps/Base58.js' -import { encryptData, decryptData } from '../../../../core/src/lockScreen.js' - -registerTranslateConfig({ - loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) -}) - +import {decryptData, encryptData} from '../../../../core/src/lockScreen.js' import '@material/mwc-button' import '@material/mwc-textfield' import '@material/mwc-icon' @@ -28,6 +23,10 @@ import '@vaadin/grid' import '@vaadin/grid/vaadin-grid-sorter' import '@vaadin/password-field' +registerTranslateConfig({ + loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) +}) + const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) let workers = new Map() @@ -168,7 +167,7 @@ class TradeBotPortal extends LitElement { padding-top: 3px; } #tab-sell[active] { - --mdc-theme-primary: rgb(255, 89, 89); + --mdc-theme-primary: rgb(255, 89, 89); } #trade-portal-page { background: var(--white); @@ -2665,7 +2664,7 @@ class TradeBotPortal extends LitElement { return { timestamp: item.tradeTimestamp, foreignAmount: item.foreignAmount, - qortAmount: item.qortAmount + qortAmount: item.qortAmount } } }).filter(item => !!item) @@ -3113,7 +3112,7 @@ class TradeBotPortal extends LitElement { this._historicTradesGrid.clearCache() } this.listedCoins.get(offer.foreignBlockchain).tradeOffersSocketCounter > 1 ? addNewHistoricTrade() : null - + } } catch(e) { console.log("Error processing redeemed trade offer from "+offer.foreignBlockchain) @@ -3123,7 +3122,7 @@ class TradeBotPortal extends LitElement { processTradingTrade(offer) { try { if (this.listedCoins.get(offer.foreignBlockchain).name!='') { - + if (offer.qortalCreator === this.selectedAddress.address && this.listedCoins.get(offer.foreignBlockchain).tradeOffersSocketCounter > 1) { this.updateWalletBalance() } @@ -3143,7 +3142,7 @@ class TradeBotPortal extends LitElement { processRefundedTrade(offer) { try { if (this.listedCoins.get(offer.foreignBlockchain).name!='') { - + if (offer.qortalCreator === this.selectedAddress.address) { if (this.listedCoins.get(offer.foreignBlockchain).tradeOffersSocketCounter > 1) { this.updateWalletBalance() @@ -3161,7 +3160,7 @@ class TradeBotPortal extends LitElement { processCancelledTrade(offer) { try { if (this.listedCoins.get(offer.foreignBlockchain).name!='') { - + if (offer.qortalCreator === this.selectedAddress.address) { if (this.listedCoins.get(offer.foreignBlockchain).tradeOffersSocketCounter > 1) { this.updateWalletBalance() @@ -3842,4 +3841,4 @@ class TradeBotPortal extends LitElement { } } -window.customElements.define('trade-bot-portal', TradeBotPortal) \ No newline at end of file +window.customElements.define('trade-bot-portal', TradeBotPortal) diff --git a/plugins/plugins/core/trade-portal/charts/arrr-charts.js b/plugins/plugins/core/trade-portal/charts/arrr-charts.js index 532259fb..9bed8d4c 100644 --- a/plugins/plugins/core/trade-portal/charts/arrr-charts.js +++ b/plugins/plugins/core/trade-portal/charts/arrr-charts.js @@ -1,18 +1,10 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../../epml.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' - -registerTranslateConfig({ - loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) -}) - +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../../epml.js' +import {get, registerTranslateConfig, translate, use} from 'lit-translate' import '@polymer/paper-dialog/paper-dialog.js' import * as Highcharts from 'highcharts' import Exporting from 'highcharts/modules/exporting' -Exporting(Highcharts) import StockChart from 'highcharts/modules/stock' -StockChart(Highcharts) import 'highcharts/highcharts-more.js' import 'highcharts/modules/accessibility.js' import 'highcharts/modules/boost.js' @@ -20,6 +12,13 @@ import 'highcharts/modules/data.js' import 'highcharts/modules/export-data.js' import 'highcharts/modules/offline-exporting.js' +registerTranslateConfig({ + loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) +}) + +Exporting(Highcharts) +StockChart(Highcharts) + let arrrChartDialog const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -211,4 +210,4 @@ window.customElements.define('arrr-charts', ArrrCharts) const chartsarrr = document.createElement('arrr-charts') arrrChartDialog = document.body.appendChild(chartsarrr) -export default arrrChartDialog \ No newline at end of file +export default arrrChartDialog diff --git a/plugins/plugins/core/trade-portal/charts/btc-charts.js b/plugins/plugins/core/trade-portal/charts/btc-charts.js index 3084db43..438b5887 100644 --- a/plugins/plugins/core/trade-portal/charts/btc-charts.js +++ b/plugins/plugins/core/trade-portal/charts/btc-charts.js @@ -1,18 +1,10 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../../epml.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' - -registerTranslateConfig({ - loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) -}) - +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../../epml.js' +import {get, registerTranslateConfig, translate, use} from 'lit-translate' import '@polymer/paper-dialog/paper-dialog.js' import * as Highcharts from 'highcharts' import Exporting from 'highcharts/modules/exporting' -Exporting(Highcharts) import StockChart from 'highcharts/modules/stock' -StockChart(Highcharts) import 'highcharts/highcharts-more.js' import 'highcharts/modules/accessibility.js' import 'highcharts/modules/boost.js' @@ -20,6 +12,13 @@ import 'highcharts/modules/data.js' import 'highcharts/modules/export-data.js' import 'highcharts/modules/offline-exporting.js' +registerTranslateConfig({ + loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) +}) + +Exporting(Highcharts) +StockChart(Highcharts) + let btcChartDialog const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -212,4 +211,4 @@ window.customElements.define('btc-charts', BtcCharts) const chartsbtc = document.createElement('btc-charts') btcChartDialog = document.body.appendChild(chartsbtc) -export default btcChartDialog \ No newline at end of file +export default btcChartDialog diff --git a/plugins/plugins/core/trade-portal/charts/dgb-charts.js b/plugins/plugins/core/trade-portal/charts/dgb-charts.js index 39ece003..07ce477f 100644 --- a/plugins/plugins/core/trade-portal/charts/dgb-charts.js +++ b/plugins/plugins/core/trade-portal/charts/dgb-charts.js @@ -1,18 +1,10 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../../epml.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' - -registerTranslateConfig({ - loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) -}) - +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../../epml.js' +import {get, registerTranslateConfig, translate, use} from 'lit-translate' import '@polymer/paper-dialog/paper-dialog.js' import * as Highcharts from 'highcharts' import Exporting from 'highcharts/modules/exporting' -Exporting(Highcharts) import StockChart from 'highcharts/modules/stock' -StockChart(Highcharts) import 'highcharts/highcharts-more.js' import 'highcharts/modules/accessibility.js' import 'highcharts/modules/boost.js' @@ -20,6 +12,13 @@ import 'highcharts/modules/data.js' import 'highcharts/modules/export-data.js' import 'highcharts/modules/offline-exporting.js' +registerTranslateConfig({ + loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) +}) + +Exporting(Highcharts) +StockChart(Highcharts) + let dgbChartDialog const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -211,4 +210,4 @@ window.customElements.define('dgb-charts', DgbCharts) const chartsdgb = document.createElement('dgb-charts') dgbChartDialog = document.body.appendChild(chartsdgb) -export default dgbChartDialog \ No newline at end of file +export default dgbChartDialog diff --git a/plugins/plugins/core/trade-portal/charts/doge-charts.js b/plugins/plugins/core/trade-portal/charts/doge-charts.js index eb58801b..b7155ee6 100644 --- a/plugins/plugins/core/trade-portal/charts/doge-charts.js +++ b/plugins/plugins/core/trade-portal/charts/doge-charts.js @@ -1,18 +1,10 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../../epml.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' - -registerTranslateConfig({ - loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) -}) - +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../../epml.js' +import {get, registerTranslateConfig, translate, use} from 'lit-translate' import '@polymer/paper-dialog/paper-dialog.js' import * as Highcharts from 'highcharts' import Exporting from 'highcharts/modules/exporting' -Exporting(Highcharts) import StockChart from 'highcharts/modules/stock' -StockChart(Highcharts) import 'highcharts/highcharts-more.js' import 'highcharts/modules/accessibility.js' import 'highcharts/modules/boost.js' @@ -20,6 +12,13 @@ import 'highcharts/modules/data.js' import 'highcharts/modules/export-data.js' import 'highcharts/modules/offline-exporting.js' +registerTranslateConfig({ + loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) +}) + +Exporting(Highcharts) +StockChart(Highcharts) + let dogeChartDialog const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -211,4 +210,4 @@ window.customElements.define('doge-charts', DogeCharts) const chartsdoge = document.createElement('doge-charts') dogeChartDialog = document.body.appendChild(chartsdoge) -export default dogeChartDialog \ No newline at end of file +export default dogeChartDialog diff --git a/plugins/plugins/core/trade-portal/charts/ltc-charts.js b/plugins/plugins/core/trade-portal/charts/ltc-charts.js index 0c9aad45..3dbe82cc 100644 --- a/plugins/plugins/core/trade-portal/charts/ltc-charts.js +++ b/plugins/plugins/core/trade-portal/charts/ltc-charts.js @@ -1,18 +1,10 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../../epml.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' - -registerTranslateConfig({ - loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) -}) - +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../../epml.js' +import {get, registerTranslateConfig, translate, use} from 'lit-translate' import '@polymer/paper-dialog/paper-dialog.js' import * as Highcharts from 'highcharts' import Exporting from 'highcharts/modules/exporting' -Exporting(Highcharts) import StockChart from 'highcharts/modules/stock' -StockChart(Highcharts) import 'highcharts/highcharts-more.js' import 'highcharts/modules/accessibility.js' import 'highcharts/modules/boost.js' @@ -20,6 +12,13 @@ import 'highcharts/modules/data.js' import 'highcharts/modules/export-data.js' import 'highcharts/modules/offline-exporting.js' +registerTranslateConfig({ + loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) +}) + +Exporting(Highcharts) +StockChart(Highcharts) + let ltcChartDialog const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -211,4 +210,4 @@ window.customElements.define('ltc-charts', LtcCharts) const chartsltc = document.createElement('ltc-charts') ltcChartDialog = document.body.appendChild(chartsltc) -export default ltcChartDialog \ No newline at end of file +export default ltcChartDialog diff --git a/plugins/plugins/core/trade-portal/charts/rvn-charts.js b/plugins/plugins/core/trade-portal/charts/rvn-charts.js index 722fb4cc..11e2ca27 100644 --- a/plugins/plugins/core/trade-portal/charts/rvn-charts.js +++ b/plugins/plugins/core/trade-portal/charts/rvn-charts.js @@ -1,18 +1,10 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../../epml.js' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' - -registerTranslateConfig({ - loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) -}) - +import {css, html, LitElement} from 'lit' +import {Epml} from '../../../../epml.js' +import {get, registerTranslateConfig, translate, use} from 'lit-translate' import '@polymer/paper-dialog/paper-dialog.js' import * as Highcharts from 'highcharts' import Exporting from 'highcharts/modules/exporting' -Exporting(Highcharts) import StockChart from 'highcharts/modules/stock' -StockChart(Highcharts) import 'highcharts/highcharts-more.js' import 'highcharts/modules/accessibility.js' import 'highcharts/modules/boost.js' @@ -20,6 +12,13 @@ import 'highcharts/modules/data.js' import 'highcharts/modules/export-data.js' import 'highcharts/modules/offline-exporting.js' +registerTranslateConfig({ + loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) +}) + +Exporting(Highcharts) +StockChart(Highcharts) + let rvnChartDialog const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -211,4 +210,4 @@ window.customElements.define('rvn-charts', RvnCharts) const chartsrvn = document.createElement('rvn-charts') rvnChartDialog = document.body.appendChild(chartsrvn) -export default rvnChartDialog \ No newline at end of file +export default rvnChartDialog diff --git a/plugins/plugins/core/trade-portal/trade-portal.src.js b/plugins/plugins/core/trade-portal/trade-portal.src.js index f8d4ff7b..7950483c 100644 --- a/plugins/plugins/core/trade-portal/trade-portal.src.js +++ b/plugins/plugins/core/trade-portal/trade-portal.src.js @@ -1,15 +1,10 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml.js' +import {css, html, LitElement} from 'lit' +import {render} from 'lit/html.js' +import {Epml} from '../../../epml.js' import isElectron from 'is-electron' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {get, registerTranslateConfig, translate, use} from 'lit-translate' import Base58 from '../../../../crypto/api/deps/Base58.js' -import { encryptData, decryptData } from '../../../../core/src/lockScreen.js' - -registerTranslateConfig({ - loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) -}) - +import {decryptData, encryptData} from '../../../../core/src/lockScreen.js' import '@material/mwc-button' import '@material/mwc-textfield' import '@material/mwc-icon' @@ -35,6 +30,10 @@ import chartsrvn from './charts/rvn-charts.js' import chartsarrr from './charts/arrr-charts.js' import '../components/TraderInfoView.js' +registerTranslateConfig({ + loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) +}) + const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) let workers = new Map() @@ -193,7 +192,7 @@ class TradePortal extends LitElement { padding-top: 3px; } #tab-sell[active] { - --mdc-theme-primary: rgb(255, 89, 89); + --mdc-theme-primary: rgb(255, 89, 89); } #trade-portal-page { background: var(--white); @@ -1035,7 +1034,7 @@ class TradePortal extends LitElement { required readOnly label="" placeholder="0.0000" - type="text" + type="text" auto-validate="false" outlined value="${this.initialAmount}" > @@ -1155,7 +1154,7 @@ class TradePortal extends LitElement {
  • - + ` } @@ -1308,7 +1307,7 @@ class TradePortal extends LitElement {
    ${this.renderTradeLockButton()}
    - +
    @@ -1455,7 +1454,7 @@ class TradePortal extends LitElement { } disconnectedCallback() { - + super.disconnectedCallback(); if(this.intervalID){ clearInterval(this.intervalID); @@ -2175,7 +2174,7 @@ class TradePortal extends LitElement { this._historicTradesGrid.clearCache() } this.listedCoins.get(offer.foreignBlockchain).tradeOffersSocketCounter > 1 ? addNewHistoricTrade() : null - + } } catch(e) { console.log("Error processing redeemed trade offer from "+offer.foreignBlockchain) @@ -2185,7 +2184,7 @@ class TradePortal extends LitElement { processTradingTrade(offer) { try { if (this.listedCoins.get(offer.foreignBlockchain).name!='') { - + if (offer.qortalCreator === this.selectedAddress.address && this.listedCoins.get(offer.foreignBlockchain).tradeOffersSocketCounter > 1) { this.updateWalletBalance() } @@ -2205,7 +2204,7 @@ class TradePortal extends LitElement { processRefundedTrade(offer) { try { if (this.listedCoins.get(offer.foreignBlockchain).name!='') { - + if (offer.qortalCreator === this.selectedAddress.address) { if (this.listedCoins.get(offer.foreignBlockchain).tradeOffersSocketCounter > 1) { this.updateWalletBalance() @@ -2223,7 +2222,7 @@ class TradePortal extends LitElement { processCancelledTrade(offer) { try { if (this.listedCoins.get(offer.foreignBlockchain).name!='') { - + if (offer.qortalCreator === this.selectedAddress.address) { if (this.listedCoins.get(offer.foreignBlockchain).tradeOffersSocketCounter > 1) { this.updateWalletBalance() @@ -3342,4 +3341,4 @@ class TradePortal extends LitElement { } } -window.customElements.define('trade-portal', TradePortal) \ No newline at end of file +window.customElements.define('trade-portal', TradePortal) diff --git a/plugins/plugins/core/wallet/wallet-app.src.js b/plugins/plugins/core/wallet/wallet-app.src.js index eb66288e..f712cde0 100644 --- a/plugins/plugins/core/wallet/wallet-app.src.js +++ b/plugins/plugins/core/wallet/wallet-app.src.js @@ -1,15 +1,10 @@ -import { LitElement, html, css } from 'lit' -import { render } from 'lit/html.js' -import { Epml } from '../../../epml.js' +import {css, html, LitElement} from 'lit' +import {render} from 'lit/html.js' +import {Epml} from '../../../epml.js' import isElectron from 'is-electron' -import { use, get, translate, translateUnsafeHTML, registerTranslateConfig } from 'lit-translate' +import {get, registerTranslateConfig, translate, use} from 'lit-translate' import Base58 from '../../../../crypto/api/deps/Base58.js' -import { encryptData, decryptData } from '../../../../core/src/lockScreen.js' - -registerTranslateConfig({ - loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) -}) - +import {decryptData, encryptData} from '../../../../core/src/lockScreen.js' import FileSaver from 'file-saver' import '../components/ButtonIconCopy.js' import '../components/QortalQrcodeGenerator.js' @@ -35,6 +30,10 @@ import '@vaadin/icon' import '@vaadin/icons' import '@vaadin/password-field' +registerTranslateConfig({ + loader: lang => fetch(`/language/${lang}.json`).then(res => res.json()) +}) + const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) const coinsNames = ['qort', 'btc', 'ltc', 'doge', 'dgb', 'rvn', 'arrr'] @@ -911,7 +910,7 @@ class MultiWallet extends LitElement { default: break } - + } render() { @@ -988,7 +987,7 @@ class MultiWallet extends LitElement {
    - + ${this.loading ? html`` : ''}
    @@ -2871,7 +2870,7 @@ class MultiWallet extends LitElement { } firstUpdated() { - + this.changeTheme() this.changeLanguage() this.paymentFee() @@ -2987,7 +2986,7 @@ class MultiWallet extends LitElement { } } - + pingCoinBalancesController(){ if(!this._selectedWallet) return const customEvent = new CustomEvent('ping-coin-controller-with-coin', { @@ -3003,7 +3002,7 @@ class MultiWallet extends LitElement { } disconnectedCallback() { - + super.disconnectedCallback(); if(this.intervalID){ clearInterval(this.intervalID); diff --git a/plugins/plugins/utils/getUserNameFromAddress.js b/plugins/plugins/utils/getUserNameFromAddress.js index 1d8bf688..be8a3d69 100644 --- a/plugins/plugins/utils/getUserNameFromAddress.js +++ b/plugins/plugins/utils/getUserNameFromAddress.js @@ -1,5 +1,4 @@ -import { Epml } from '../../epml.js'; -import { cropAddress } from './cropAddress.js'; +import {Epml} from '../../epml.js'; const parentEpml = new Epml({ type: 'WINDOW', source: window.parent }) @@ -18,4 +17,4 @@ export const getUserNameFromAddress = async (address) => { } catch (error) { console.error(error); } -} \ No newline at end of file +} diff --git a/plugins/plugins/utils/publish-modal.js b/plugins/plugins/utils/publish-modal.js index b55af509..7a040aec 100644 --- a/plugins/plugins/utils/publish-modal.js +++ b/plugins/plugins/utils/publish-modal.js @@ -1,4 +1,4 @@ -import { get } from 'lit-translate'; +import {get} from 'lit-translate'; export class ModalHelper { constructor() { @@ -11,7 +11,7 @@ export class ModalHelper { const nodeUrl = `${myNode.protocol}://${myNode.domain}:${myNode.port}`; const url = `${nodeUrl}/transactions/unitfee?txType=ARBITRARY×tamp=${timestamp}`; const response = await fetch(url); - + if (!response.ok) { throw new Error('Error when fetching arbitrary fee'); } @@ -103,7 +103,7 @@ export class ModalHelper { --mdc-checkbox-disabled-color: var(--black); --mdc-checkbox-ink-color: var(--black); } - + .backdrop { position: fixed; top: 0; @@ -112,21 +112,21 @@ export class ModalHelper { height: 100%; background: rgb(186 186 186 / 26%); overflow: hidden; - animation: backdrop_blur cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards; + animation: backdrop_blur cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards; z-index: 1000000; } - + @keyframes backdrop_blur { 0% { backdrop-filter: blur(0px); background: transparent; } - 100% { + 100% { backdrop-filter: blur(5px); background: rgb(186 186 186 / 26%); } } - + @keyframes modal_transition { 0% { visibility: hidden; @@ -137,7 +137,7 @@ export class ModalHelper { opacity: 1; } } - + .modal { position: relative; display: flex; @@ -148,7 +148,7 @@ export class ModalHelper { animation: 0.1s cubic-bezier(0.22, 1, 0.36, 1) 0s 1 normal forwards running modal_transition; z-index: 1000001; } - + @keyframes modal_transition { 0% { visibility: hidden; @@ -159,7 +159,7 @@ export class ModalHelper { opacity: 1; } } - + .modal-content { background-color: var(--white); border-radius: 10px; @@ -171,11 +171,11 @@ export class ModalHelper { flex-direction: column; justify-content: space-between; } - + .modal-body { padding: 25px; } - + .modal-subcontainer { color: var(--black); display: flex; @@ -183,7 +183,7 @@ export class ModalHelper { align-items: flex-start; gap: 15px; } - + .modal-subcontainer-error { color: var(--black); display: flex; @@ -191,7 +191,7 @@ export class ModalHelper { align-items: center; gap: 15px; } - + .modal-paragraph-error { font-family: Roboto, sans-serif; font-size: 20px; @@ -200,7 +200,7 @@ export class ModalHelper { color: var(--black); margin: 0; } - + .modal-paragraph { font-family: Roboto, sans-serif; font-size: 18px; @@ -208,14 +208,14 @@ export class ModalHelper { font-weight: 300; color: var(--black); margin: 0; - word-wrap: break-word; + word-wrap: break-word; overflow-wrap: break-word; } - + .capitalize-first { text-transform: capitalize; } - + .checkbox-row { display: flex; align-items: center; @@ -223,13 +223,13 @@ export class ModalHelper { font-weight: 600; color: var(--black); } - + .modal-buttons { display: flex; justify-content: space-between; margin-top: 20px; } - + .modal-buttons button { background-color: #4caf50; border: none; @@ -239,15 +239,15 @@ export class ModalHelper { cursor: pointer; transition: background-color 0.2s; } - + .modal-buttons button:hover { background-color: #3e8e41; } - + #cancel-button { background-color: #f44336; } - + #cancel-button:hover { background-color: #d32f2f; } @@ -267,4 +267,4 @@ export class ModalHelper { } } -export const modalHelper = ModalHelper.getInstance(); \ No newline at end of file +export const modalHelper = ModalHelper.getInstance(); diff --git a/plugins/plugins/utils/warning-modal.js b/plugins/plugins/utils/warning-modal.js index 7bda31cd..88fdd88b 100644 --- a/plugins/plugins/utils/warning-modal.js +++ b/plugins/plugins/utils/warning-modal.js @@ -1,4 +1,4 @@ -import { get } from 'lit-translate'; +import {get} from 'lit-translate'; export class WarningModal { constructor() { @@ -24,7 +24,7 @@ export class WarningModal { @@ -84,7 +84,7 @@ export class WarningModal { --mdc-checkbox-disabled-color: var(--black); --mdc-checkbox-ink-color: var(--black); } - + .backdrop { position: fixed; top: 0; @@ -93,21 +93,21 @@ export class WarningModal { height: 100%; background: rgb(186 186 186 / 26%); overflow: hidden; - animation: backdrop_blur cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards; + animation: backdrop_blur cubic-bezier(0.22, 1, 0.36, 1) 0.1s forwards; z-index: 1000000; } - + @keyframes backdrop_blur { 0% { backdrop-filter: blur(0px); background: transparent; } - 100% { + 100% { backdrop-filter: blur(5px); background: rgb(186 186 186 / 26%); } } - + @keyframes modal_transition { 0% { visibility: hidden; @@ -118,7 +118,7 @@ export class WarningModal { opacity: 1; } } - + .modal { position: relative; display: flex; @@ -129,7 +129,7 @@ export class WarningModal { animation: 0.1s cubic-bezier(0.22, 1, 0.36, 1) 0s 1 normal forwards running modal_transition; z-index: 1000001; } - + @keyframes modal_transition { 0% { visibility: hidden; @@ -140,7 +140,7 @@ export class WarningModal { opacity: 1; } } - + .modal-content { background-color: var(--white); border-radius: 10px; @@ -152,11 +152,11 @@ export class WarningModal { flex-direction: column; justify-content: space-between; } - + .modal-body { padding: 25px; } - + .modal-subcontainer { color: var(--black); display: flex; @@ -164,7 +164,7 @@ export class WarningModal { align-items: flex-start; gap: 15px; } - + .modal-subcontainer-error { color: var(--black); display: flex; @@ -172,7 +172,7 @@ export class WarningModal { align-items: center; gap: 15px; } - + .modal-paragraph-error { font-family: Roboto, sans-serif; font-size: 20px; @@ -181,7 +181,7 @@ export class WarningModal { color: var(--black); margin: 0; } - + .modal-paragraph { font-family: Roboto, sans-serif; font-size: 18px; @@ -189,14 +189,14 @@ export class WarningModal { font-weight: 300; color: var(--black); margin: 0; - word-wrap: break-word; + word-wrap: break-word; overflow-wrap: break-word; } - + .capitalize-first { text-transform: capitalize; } - + .checkbox-row { display: flex; align-items: center; @@ -204,13 +204,13 @@ export class WarningModal { font-weight: 600; color: var(--black); } - + .modal-buttons { display: flex; justify-content: space-between; margin-top: 20px; } - + .modal-buttons button { background-color: #4caf50; border: none; @@ -220,15 +220,15 @@ export class WarningModal { cursor: pointer; transition: background-color 0.2s; } - + .modal-buttons button:hover { background-color: #3e8e41; } - + #cancel-button { background-color: #f44336; } - + #cancel-button:hover { background-color: #d32f2f; } @@ -240,7 +240,7 @@ export class WarningModal { document.adoptedStyleSheets = [styleSheet]; } - + static getInstance() { if (!WarningModal.instance) { WarningModal.instance = new WarningModal(); @@ -249,4 +249,4 @@ export class WarningModal { } } -export const warningModal = WarningModal.getInstance(); \ No newline at end of file +export const warningModal = WarningModal.getInstance();