Skip to content

Commit

Permalink
Merge pull request #765 from telosnetwork/develop
Browse files Browse the repository at this point in the history
v1.2.6-rc
  • Loading branch information
donnyquixotic authored Oct 10, 2023
2 parents 4a48fe1 + b0a6801 commit ed94212
Show file tree
Hide file tree
Showing 50 changed files with 828 additions and 433 deletions.
2 changes: 1 addition & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ module.exports = {
},
'./src/layouts/': {
statements: 0,
branches: 100,
branches: 0,
functions: 0,
lines: 0,
},
Expand Down
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "open-block-explorer",
"version": "1.2.5",
"version": "1.2.6",
"description": "..",
"productName": "Telos Block Explorer",
"author": "DonaldPeat <[email protected]>",
Expand All @@ -9,8 +9,8 @@
"dev": "quasar dev",
"build": "quasar clean && quasar build",
"lint": "eslint --ext .js,.ts,.vue ./",
"test": "jest --coverage",
"test:coverage": "quasar serve test/jest/coverage/lcov-report/ --port 8788"
"test": "jest",
"test:coverage": "jest --coverage"
},
"dependencies": {
"@greymass/eosio": "^0.6.8",
Expand Down
Binary file added public/backgrounds/home.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/antelope-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
33 changes: 0 additions & 33 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,37 +1,4 @@
<script lang="ts">
import { setCssVar } from 'quasar';
import ConfigManager from 'src/config/ConfigManager';
import { themeProps } from 'src/types/Theme';
const chain = ConfigManager.get().getCurrentChain();
const chainName = chain.getName();
const theme = chain.getTheme();
setTheme();
setMetaData();
function setTheme(): void {
for (let themeVar of themeProps) {
if (theme[themeVar]) {
setCssVar(themeVar, theme[themeVar]);
}
}
}
function setMetaData(): void {
setFavIcon();
setTitle();
}
function setFavIcon(): void {
let link = document.querySelector('link[rel~="icon"]');
(link as HTMLLinkElement).href = `chains/${chainName}/favicon.png`;
}
function setTitle(): void {
document.title = chainName;
}
export default {
name: 'App',
};
Expand Down
6 changes: 3 additions & 3 deletions src/boot/ual.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ declare module '@vue/runtime-core' {
async function loginHandler() {
let accountName = 'eosio';
let permission = 'active';
if (localStorage.getItem('autoLogin') === 'cleos') {
accountName = localStorage.getItem('account');
if (localStorage.getItem('autoLogin_' + getChain().getChainId()) === 'cleos') {
accountName = localStorage.getItem('account_' + getChain().getChainId());
} else {
await new Promise((resolve) => {
Dialog.create({
Expand Down Expand Up @@ -149,7 +149,7 @@ const authenticators: Authenticator[] = [];
export const getAuthenticators = () => {
// we initialize the authenticators inside this function on demand
if (authenticators.length === 0) {
// UAL is not looking at the chain when checking the localstorage for an already logged in account
// UAL is not looking at the chain when checking the sessionStorage for an already logged in account
// A quick fix is to add the chain in appName until we move forward with WharfKit
const mainChain = getMainChain();
authenticators.push(new Anchor([mainChain], { appName: `${process.env.APP_NAME}_${mainChain.chainId}` })),
Expand Down
46 changes: 27 additions & 19 deletions src/components/AccountCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import { useRouter } from 'vue-router';
import { TableIndexType } from 'src/types/Api';
import { API, UInt64 } from '@greymass/eosio';
import { formatCurrency } from 'src/utils/string-utils';
import ConfigManager from 'src/config/ConfigManager';
const chain = getChain();
export default defineComponent({
Expand All @@ -37,6 +38,8 @@ export default defineComponent({
const router = useRouter();
const store = useAntelopeStore();
const accountPageSettings = computed(() => ConfigManager.get().getCurrentChain().getUiCustomization().accountPageSettings);
const createTime = ref<string>('2019-01-01T00:00:00.000');
const createTransaction = ref<string>('');
const creatingAccount = ref('');
Expand Down Expand Up @@ -140,9 +143,13 @@ export default defineComponent({
};
const loadBalances = async () => {
const total = await getRexBalance();
rexDeposits.value = await getRexFund();
rexStaked.value = total;
try {
const total = await getRexBalance();
rexDeposits.value = await getRexFund();
rexStaked.value = total;
} catch (e) {
$q.notify('REX information not available!');
}
};
const loadResources = () => {
Expand Down Expand Up @@ -365,6 +372,7 @@ export default defineComponent({
);
return {
accountPageSettings,
MICRO_UNIT,
KILO_UNIT,
stakedCPU,
Expand Down Expand Up @@ -463,56 +471,56 @@ export default defineComponent({
</div>
<div v-if="account !== system_account" class="resources">
<PercentCircle
v-if="!accountPageSettings.hideCpuInfo"
:radius="radius"
:fraction="cpu_used"
:total="cpu_max"
label="CPU"
unit="s"
/>
<PercentCircle
v-if="!accountPageSettings.hideNetInfo"
:radius="radius"
:fraction="net_used"
:total="net_max"
label="NET"
unit="kb"
/>
<PercentCircle
v-if="!accountPageSettings.hideRamInfo"
:radius="radius"
:fraction="ram_used"
:total="ram_max"
label="RAM"
unit="kb"
/>
</div>
<div v-else class="resources">
<div v-else-if="!accountPageSettings.hideRamInfo" class="resources">
<div class="usage">RAM USED: {{ ram_used }} kb</div>
</div>
</q-card-section>
<q-card-section class="resources-container">
<div class="row justify-center q-gutter-sm">
<div class="col-3">
<div v-if="isAccount" class="col-3">
<q-btn
v-if='isAccount'
:disable="tokensLoading || isLoading"
:label='tokensLoading ? "Loading..." : "Send"'
color='primary'
:label="tokensLoading ? 'Loading...' : 'Send'"
color="primary"
class="full-width"
@click="openSendDialog = true"
/>
</div>
<div class="col-3">
<div v-if="isAccount && !accountPageSettings.hideResourcesControl" class="col-3">
<q-btn
v-if="isAccount"
:disable="tokensLoading || isLoading"
:label='tokensLoading ? "Loading..." : "Resources"'
class="full-width"
color="primary"
@click="openResourcesDialog = true"
/>
</div>
<div class="col-3">
<div v-if="isAccount && !accountPageSettings.hideRexControl" class="col-3">
<q-btn
v-if="isAccount"
:disable="tokensLoading || isLoading"
:label='tokensLoading ? "Loading..." : "Staking (REX)"'
class="ellipsis full-width"
Expand Down Expand Up @@ -545,31 +553,31 @@ export default defineComponent({
<td class="text-left">LIQUID (Telos native)</td>
<td class="text-right">{{ formatAsset(liquidNative) }}</td>
</tr>
<tr>
<tr v-if="!accountPageSettings.hideRexInfo">
<td class="text-left">REX staked (includes savings)</td>
<td class="text-right">{{ formatAsset(rexStaked) }}</td>
</tr>
<tr>
<tr v-if="!accountPageSettings.hideRexInfo">
<td class="text-left">REX liquid deposits</td>
<td class="text-right">{{ formatAsset(rexDeposits) }}</td>
</tr>
<tr>
<tr v-if="!accountPageSettings.hideCpuInfo">
<td class="text-left">STAKED for CPU</td>
<td class="text-right">{{ formatAsset(stakedCPU) }}</td>
</tr>
<tr>
<tr v-if="!accountPageSettings.hideNetInfo">
<td class="text-left">STAKED for NET</td>
<td class="text-right">{{ formatAsset(stakedNET) }}</td>
</tr>
<tr>
<tr v-if="!accountPageSettings.hideRefundingInfo">
<td class="text-left">REFUNDING from staking</td>
<td class="text-right">{{ formatAsset(stakedRefund) }}</td>
</tr>
<tr>
<tr v-if="!accountPageSettings.hideDelegatedInfo">
<td class="text-left">DELEGATED to others</td>
<td class="text-right">{{ formatAsset(delegatedToOthers) }}</td>
</tr>
<tr>
<tr v-if="!accountPageSettings.hideDelegatedInfo">
<td class="text-left">DELEGATED by others</td>
<td class="text-right">{{ formatAsset(delegatedByOthers) }}</td>
</tr>
Expand Down
150 changes: 150 additions & 0 deletions src/components/ChainsListSelector.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
<script lang="ts">
import { computed, defineComponent } from 'vue';
import ConfigManager from 'src/config/ConfigManager';
import { Chain } from 'src/types/Chain';
import { useRoute, useRouter } from 'vue-router';
const configMgr = ConfigManager.get();
export default defineComponent({
name: 'ChainsSelector',
props: {
onChainSelected: {
type: Function,
required: false,
},
isChainSelected: {
type: Function,
required: false,
default: () => false,
},
},
setup(props) {
const route = useRoute();
const router = useRouter();
const mainnets = computed(() => sortChainsUsingName(configMgr.getMainnets()));
const testnets = computed(() => sortChainsUsingName(configMgr.getTestnets()));
function sortChainsUsingName(chains: Chain[]): Chain[] {
return chains.sort(
(chain1, chain2) => chain1.getName().localeCompare(chain2.getName()),
);
}
function chainSelected(chain: Chain) {
if (props.isChainSelected(chain)) {
return;
}
void router.push({
path: route.path,
query: { network: chain.getName() },
});
props.onChainSelected(chain);
}
return {
mainnets,
testnets,
chainSelected,
};
},
});
</script>

<template>
<q-list>
<div v-if="mainnets.length > 0" class="section-title">MAINNETS</div>
<q-item
v-for="(chain, index) in mainnets"
:key="`mainnet-${index}`"
v-ripple
:class="{ selected: isChainSelected(chain) }"
clickable
@click="chainSelected(chain)"
><img class="sidebar-logo" :src="chain.getSmallLogoPath()">
<q-item-section>
<div class="q-pl-md">{{ chain.getDisplay() }}</div>
</q-item-section>
</q-item>
<q-separator v-if="testnets.length > 0 && mainnets.length > 0" class="separator"/>
<div v-if="testnets.length > 0" class="section-title">TESTNETS</div>
<q-item
v-for="(chain, index) in testnets"
:key="`testnet-${index}`"
v-ripple
:class="{ selected: isChainSelected(chain) }"
clickable
@click="chainSelected(chain)"
>
<div class="testnet-logo-container">
<img class="sidebar-logo sidebar-logo--testnet" :src="chain.getSmallLogoPath()">
<div class="testnet-text">TESTNET</div>
</div>
<q-item-section>
<div class="q-pl-md">{{ chain.getDisplay() }}</div>
</q-item-section>
</q-item>
</q-list>
</template>

<style lang="sass" scoped>
.chain-button
padding: 0px 4px
.q-item
&:hover, &.selected
background-color: var(--q-color-sidebar-selected)
padding-left: 16px
padding-top: 8px
width: auto
.q-list
padding-bottom: 8px
padding-top: 8px
.separator
margin-top: .5rem
margin-bottom: .5rem
min-height: 1px
min-width: 0
width: 100%
background: var(--q-color-sidebar-selected)
.sidebar-logo
height: auto
width: auto
max-height: 32px
max-width: 32px
object-fit: contain
.section-title
padding-left: 16px
padding-top: 8px
padding-bottom: 8px
font-size: 10px
.testnet-logo-container
position: relative
height: 32px
width: 32px
.testnet-text, .sidebar-logo--testnet
position: absolute
margin: auto
top: 0
right: 0
bottom: 0
left: 0
.testnet-text
color: white
font-size: 6px
width: min-content
height: min-content
padding: 0 2px
border-radius: 2px
background-color: rgba(black, 0.6)
</style>
Loading

0 comments on commit ed94212

Please sign in to comment.