Skip to content

Commit

Permalink
Merge pull request #261 from telosnetwork/develop
Browse files Browse the repository at this point in the history
rc1.1.0
  • Loading branch information
karynemayer authored Feb 9, 2023
2 parents f5f6999 + 4112250 commit 9b908d3
Show file tree
Hide file tree
Showing 86 changed files with 8,130 additions and 49 deletions.
5 changes: 5 additions & 0 deletions env.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const sharedEnv = {
GOOGLE_ANALYTICS: "UA-154600181-2",
IMGUR_CLIENT_ID: "b6f46df9d1da9d9",
WEBSERVICES_API_KEY: "XXX",
NETWORK_ENV: "shared",
};

const TESTNET = {
Expand All @@ -24,6 +25,8 @@ const TESTNET = {
WEBSERVICES_URL: "https://api-dev.telos.net",
HYPERION_URL: "https://testnet.telos.net",
BLOCKCHAIN_EXPLORER: "https://explorer-test.telos.net",
NETWORK_ENV: "testnet",
ARB_CONTRACT: 'testtelosarb',
};

const MAINNET = {
Expand All @@ -35,6 +38,8 @@ const MAINNET = {
WEBSERVICES_URL: "https://api.telos.net",
HYPERION_URL: "https://mainnet.telos.net",
BLOCKCHAIN_EXPLORER: "https://explorer.telos.net",
NETWORK_ENV: "mainnet",
ARB_CONTRACT: 'testtelosarb',
};

const env = process.env.NETWORK === "mainnet" ? MAINNET : TESTNET;
Expand Down
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
"prepare": "husky install"
},
"dependencies": {
"@quasar/cli": "^1.3.2",
"@quasar/extras": "^1.0.0",
"@telosnetwork/ual-cleos": "1.13.1",
"assert": "^2.0.0",
Expand All @@ -36,6 +37,7 @@
"universal-authenticator-library": "^0.3.0",
"vue": "^3.0.0",
"vue-croppa": "^1.3.8",
"vue-gravatar": "^1.4.1",
"vue-gtag": "^2.0.1",
"vue-i18n": "^9.0.0",
"vue-moment": "^4.1.0",
Expand All @@ -47,6 +49,7 @@
"@babel/core": "^7.18.10",
"@babel/eslint-parser": "^7.13.14",
"@quasar/app-webpack": "^3.0.0",
"@types/vue-router": "^2.0.0",
"@typescript-eslint/eslint-plugin": "^5.37.0",
"@typescript-eslint/parser": "^5.37.0",
"eslint": "7.16.0",
Expand Down
Binary file added public/statics/fonts/Roboto-Regular.ttf
Binary file not shown.
6 changes: 6 additions & 0 deletions public/statics/fonts/index.sass
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,9 @@
src: url('silka-light-webfont.ttf') format('truetype')
font-weight: normal
font-style: normal

@font-face
font-family: 'Roboto'
src: url('Roboto-Regular.ttf') format('truetype')
font-weight: normal
font-style: normal
9 changes: 6 additions & 3 deletions src/boot/api.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { boot } from 'quasar/wrappers';
import { Api, JsonRpc } from 'eosjs';
import { Notify } from 'quasar';

const signTransaction = async function (actions) {

actions.forEach((action) => {
if (!action.authorization || !action.authorization.length) {
action.authorization = [
Expand All @@ -24,17 +24,20 @@ const signTransaction = async function (actions) {
expireSeconds: 30,
}
);
Notify.create({ type: 'positive', message: 'Transaction signed' });
} catch (e) {
if (e.cause.error) {
throw e.cause.error.details[0].message.replace(
const msg = e.cause.error.details[0].message.replace(
/assertion failure with message: /g,
''
);
Notify.create({ type: 'negative', message: msg });
throw msg;
} else {
Notify.create({ type: 'negative', message: e.message });
throw e;
}
}

return transaction;
};

Expand Down
2 changes: 2 additions & 0 deletions src/boot/layouts.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,13 @@ import { boot } from 'quasar/wrappers';
import AuthLayout from '../layouts/AuthLayout.vue';
import EmptyLayout from '../layouts/EmptyLayout.vue';
import GuestLayout from '../layouts/GuestLayout.vue';
import Gravatar from 'vue-gravatar';

// "async" is optional;
// more info on params: https://v2.quasar.dev/quasar-cli/boot-files
export default boot(({ app }) => {
app.component('LayoutMain', AuthLayout);
app.component('LayoutEmpty', EmptyLayout);
app.component('LayoutGuest', GuestLayout);
app.component('v-gravatar', Gravatar);
});
74 changes: 74 additions & 0 deletions src/components/common/TelosProfileAvatar.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<template>
<div v-if="avatar && !isError" :class="childClass">
<q-avatar v-bind:size="size">
<img @error="onError" v-bind:src="avatar" />
</q-avatar>
</div>
<div v-else :class="childClass">
<profile-avatar
:size="size"
:avatar="isError ? null : avatar"
:account="account_name"
/>
</div>
</template>

<script>
import { GET_TABLE_ROWS } from '../../pages/resolve/util/fetch';
import ProfileAvatar from 'src/pages/profiles/ProfileAvatar.vue';
import md5 from 'md5';
export default {
name: 'TelosProfileAvatar',
components: {
ProfileAvatar,
},
props: ['account_name', 'size', 'childClass'],
data() {
return {
isError: false,
avatar: '',
hash: md5(this.account_name || ''),
styleClass: this.size
? { ...this.childClass, height: this.size, width: this.size }
: this.childClass,
};
},
methods: {
onError() {
console.log('Telos profile image load error');
this.isError = true;
},
},
async beforeMount() {
try {
const { rows } = await GET_TABLE_ROWS({
code: 'profiles',
scope: 'profiles',
table: 'profiles',
json: true,
limit: 1,
lower_bound: this.account_name,
upper_bound: this.account_name,
});
const [profile] = rows;
if (profile) {
const { avatar } = profile;
if (profile.account_name === this.account_name) {
if (avatar) {
this.avatar = avatar;
}
}
}
} catch (err) {
console.log('err: ', err);
}
},
};
</script>

<style scoped>
.profile-avatar {
display: inline;
}
</style>
14 changes: 13 additions & 1 deletion src/components/layout/HeaderMenu.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,23 @@
<script>
import { mapGetters } from 'vuex';
import ResolveMenu from './ResolveMenu.vue';
const NETWORK_ENV = process.env.NETWORK_ENV;
export default {
name: 'HeaderMenu',
computed: {
...mapGetters('accounts', ['isAuthenticated']),
isTestnet () {
return NETWORK_ENV === 'testnet';
}
},
props: {
activeFilter: {},
},
components: {
ResolveMenu,
},
data() {
return {
menuItems: [
Expand All @@ -23,7 +32,7 @@ export default {
{
label: this.$t('menu.proposals'),
route: '/trails/ballots',
},
}
],
localFileter: this.activeFilter,
};
Expand Down Expand Up @@ -78,6 +87,9 @@ q-tabs(
:class="[el.filter === localFileter ? 'active-tab': '']"
)
div.custom-separator
ResolveMenu(
v-if="isTestnet"
)
</template>

<style lang="sass">
Expand Down
15 changes: 15 additions & 0 deletions src/components/layout/LeftMenu.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
<script>
import ResolveSidebarItem from './ResolveSidebarItem.vue';
const NETWORK_ENV = process.env.NETWORK_ENV;
export default {
name: 'LeftMenu',
components: {
ResolveSidebarItem,
},
data() {
return {
menuItems: [
Expand Down Expand Up @@ -35,6 +42,11 @@ export default {
this.clientWidth = window.innerWidth;
},
},
computed : {
isTestnet () {
return NETWORK_ENV === 'testnet';
}
}
};
</script>

Expand Down Expand Up @@ -68,6 +80,9 @@ q-scroll-area.left-menu(style="height: 100%; border-right: 1px solid #ddd")
:to="item.route"
ripple
)
ResolveSidebarItem(
v-if="isTestnet"
)
</template>

<style lang="sass">
Expand Down
99 changes: 99 additions & 0 deletions src/components/layout/ResolveMenu.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
<template>
<q-btn-dropdown id="resolve-menu-dropdown" class="header-submenu-tab" :class="{'resolve-dropdown-active': isResolveRoute}" auto-close stretch flat label="Resolve">
<q-list>
<q-item
clickable
@click="$router.push('/resolve')"
>
<q-item-section>
<q-item-label>
{{$t('pages.resolve.menu_welcome')}}
</q-item-label>
</q-item-section>
</q-item>
<q-item
clickable
@click="$router.push('/resolve/elections')"
>
<q-item-section>
<q-item-label>
{{$t('pages.resolve.menu_elections')}}
</q-item-label>
</q-item-section>
</q-item>
<q-item
clickable
@click="$router.push('/resolve/arbitrator')"
v-if="selfArbitrator"
>
<q-item-section>
<q-item-label>
{{$t('pages.resolve.menu_arbitrator')}}
</q-item-label>
</q-item-section>
</q-item>
<q-item
clickable
@click="$router.push('/resolve/cases')"
>
<q-item-section>
<q-item-label>
{{$t('pages.resolve.menu_cases')}}
</q-item-label>
</q-item-section>
</q-item>
<q-item
v-if="isAuthenticated"
clickable
@click="$router.push('/resolve/account')"
>
<q-item-section>
<q-item-label>
{{$t('pages.resolve.menu_account')}}
</q-item-label>
</q-item-section>
</q-item>
</q-list>
</q-btn-dropdown>
</template>

<script lang="js">
import { mapGetters } from 'vuex';
export default {
computed: {
...mapGetters({
isAuthenticated: 'accounts/account',
selfArbitrator: 'resolve/isArbitrator',
}),
isResolveRoute () {
return this.$route.path.includes('/resolve');
}
},
mounted () {
const el = document.getElementById('resolve-menu-dropdown');
const bottomBorder = document.createElement('div');
bottomBorder.classList.add('resolve-dropdown-bottom');
el?.appendChild(bottomBorder);
}
};
</script>
<style lang="scss">
.resolve-dropdown-active {
.resolve-dropdown-bottom {
height: 5px;
border-radius: 5px 5px 0 0;
transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1) 0s;
transform: none;
opacity: 1;
transform-origin: left /* rtl:ignore */;
color: $primary;
background: currentColor;
right: 0;
bottom: 0;
left: 0;
position: absolute;
}
}
</style>
Loading

0 comments on commit 9b908d3

Please sign in to comment.