Skip to content

Commit

Permalink
Fix app compilation issues due to sdk source change
Browse files Browse the repository at this point in the history
  • Loading branch information
peterpolman committed May 20, 2024
1 parent 9b37619 commit 9c55473
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 59 deletions.
68 changes: 38 additions & 30 deletions apps/app/src/components/card/BaseCardMembership.vue
Original file line number Diff line number Diff line change
@@ -1,46 +1,54 @@
<template>
<div class="text-center">
<div class="position-relative rounded-circle m-auto gradient-border-xl" style="width: 75px; height: 75px">
<div
class="position-relative bg-dark rounded-circle d-flex align-items-center justify-content-center"
style="z-index: 1; width: 65px; height: 65px"
>
<i class="fas fa-id-card" style="font-size: 1.5rem" />
</div>
</div>
<b-badge class="mt-2 p-2" variant="primary">
<i class="fas fa-trophy me-1 text-opaque" />
{{ membership }}
</b-badge>
</div>
<b-card class="border-0 gradient-shadow-xl" style="min-height: 415px">
<b-tabs v-model="index" pills justified content-class="mt-3" nav-wrapper-class="text-white">
<b-tab>
<template #title>
<i class="fas fa-balance-scale me-1" />
Liquidity
</template>
<hr />
<BaseTabLiquidity @change-tab="index = $event" />
</b-tab>
<b-tab>
<template #title>
<i class="fas fa-id-card me-1" />
Membership
</template>
<hr />
<BaseTabDeposit v-if="veStore.lock && !Number(veStore.lock.amount)" @change-tab="index = $event" />
<BaseTabWithdraw v-else @change-tab="index = $event" />
</b-tab>
</b-tabs>
</b-card>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import { mapStores } from 'pinia';
import { useLiquidityStore } from '../../stores/Liquidity';
import { useVeStore } from '../../stores/VE';
import { fromWei } from 'web3-utils';
export default defineComponent({
name: 'BaseCardMembership',
props: {
tabIndex: {
type: Number,
default: 0,
},
},
data() {
return {};
return {
index: 0,
};
},
computed: {
...mapStores(useVeStore, useLiquidityStore),
membership() {
if (!this.veStore.lock) return;
const price = this.liquidityStore.pricing['20USDC-80THX'];
const amount = Number(fromWei(String(this.veStore.lock.amount)));
const amountInUSD = amount * price;
if (amountInUSD < 5) return 'No Rank';
if (amountInUSD > 5 && amountInUSD < 50) return 'Rookie';
if (amountInUSD > 50 && amountInUSD < 500) return 'Pro';
if (amountInUSD > 500 && amountInUSD < 5000) return 'Elite';
if (amountInUSD > 5000 && amountInUSD < 50000) return 'Master';
if (amountInUSD > 50000 && amountInUSD < 500000) return 'Legend';
...mapStores(useVeStore),
},
watch: {
tabIndex: {
handler(value: number) {
this.index = value;
},
immediate: true,
},
},
methods: {},
Expand Down
2 changes: 1 addition & 1 deletion apps/app/src/components/card/BaseCardQuest.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,11 +117,11 @@
<script lang="ts">
import { PropType, defineComponent } from 'vue';
import { format, formatDistance } from 'date-fns';
import { QuestVariant } from '@thxnetwork/sdk';
import { mapStores } from 'pinia';
import { useAccountStore } from '../../stores/Account';
import { useQuestStore } from '../../stores/Quest';
import { decodeHTML } from '@thxnetwork/app/utils/decode-html';
import { QuestVariant } from '@thxnetwork/sdk/types/enums';
export default defineComponent({
name: 'BaseCardQuest',
Expand Down
25 changes: 1 addition & 24 deletions apps/app/src/views/discovery/Earn.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,30 +39,7 @@
</div>
</template>
<template #secondary>
<b-card class="border-0 gradient-shadow-xl" style="min-height: 415px">
<b-tabs v-model="tabIndex" pills justified content-class="mt-3" nav-wrapper-class="text-white">
<b-tab>
<template #title>
<i class="fas fa-balance-scale me-1" />
Liquidity
</template>
<hr />
<BaseTabLiquidity @change-tab="tabIndex = $event" />
</b-tab>
<b-tab>
<template #title>
<i class="fas fa-id-card me-1" />
Membership
</template>
<hr />
<BaseTabDeposit
v-if="veStore.lock && !Number(veStore.lock.amount)"
@change-tab="tabIndex = $event"
/>
<BaseTabWithdraw v-else @change-tab="tabIndex = $event" />
</b-tab>
</b-tabs>
</b-card>
<BaseCardMembership :tab-index="0" />
</template>
</BaseCardHeader>
<b-container class="mb-5">
Expand Down
5 changes: 1 addition & 4 deletions apps/app/src/views/discovery/Members.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
</p>
</template>
<template #secondary>
<BaseCardMembershipOnboarding v-if="!Number(formatUnits(veStore.lock.amount, 18))" />
<div v-else class="h-100 d-flex align-items-center justify-content-center">
<BaseCardMembership />
</div>
<BaseCardMembership :tab-index="1" />
</template>
</BaseCardHeader>
<b-container class="mt-5">
Expand Down
1 change: 1 addition & 0 deletions apps/app/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const config: UserConfigExport = {
alias: [
{ find: '@thxnetwork/app', replacement: path.resolve(__dirname, './src') },
{ find: '@thxnetwork/common', replacement: path.resolve(__dirname, '../../libs/common/src/lib') },
{ find: '@thxnetwork/sdk', replacement: path.resolve(__dirname, '../../libs/sdk/src/lib') },
],
},
optimizeDeps: {
Expand Down

0 comments on commit 9c55473

Please sign in to comment.