2021-07-17 21:44:21 +00:00
|
|
|
<template>
|
2022-04-19 11:02:26 +00:00
|
|
|
<div class="relative overflow-hidden font-sans antialiased text-primary-black">
|
2021-08-09 19:11:32 +00:00
|
|
|
<div class="min-h-screen flex flex-col">
|
|
|
|
<Navbar />
|
2021-08-14 12:30:55 +00:00
|
|
|
<div v-if="activeNetworkId" class="flex-1 overflow-x-hidden ">
|
2022-04-19 11:02:26 +00:00
|
|
|
<div class="px-8 md:px-4 max-w-6xl mx-auto" :class="{ 'text-center': !active, 'py-12': active }">
|
2021-10-01 22:59:37 +00:00
|
|
|
<div v-if="active && activeAccount && activeAccount.version === '1'" class="text-center w-full my-16">
|
|
|
|
<h3 class="font-semibold text-2xl">
|
|
|
|
Assembly doesn't support DSA v1
|
|
|
|
</h3>
|
2022-04-19 11:02:26 +00:00
|
|
|
<p class="mt-4 font-medium leading-normal text-grey-pure text-base">
|
2021-10-01 22:59:37 +00:00
|
|
|
Please create or switch to DSA v2.
|
|
|
|
</p>
|
|
|
|
</div>
|
|
|
|
<Nuxt v-else-if="active" />
|
2021-09-02 23:15:14 +00:00
|
|
|
|
|
|
|
<web-3-modal slim v-else />
|
2021-08-09 19:11:32 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
2021-08-14 12:30:55 +00:00
|
|
|
<div class="flex-1 flex items-center justify-center" v-else>
|
2022-04-19 11:02:26 +00:00
|
|
|
<svg class="animate-spin h-12 w-12 text-[#1874FF]" xmlns="http://www.w3.org/2000/svg" fill="none"
|
|
|
|
viewBox="0 0 24 24">
|
|
|
|
<circle class="opacity-25" cx="12" cy="12" r="10" stroke="currentColor" stroke-width="4"></circle>
|
|
|
|
<path class="opacity-75" fill="currentColor"
|
|
|
|
d="M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z">
|
|
|
|
</path>
|
2021-08-14 12:30:55 +00:00
|
|
|
</svg>
|
|
|
|
</div>
|
2021-08-19 19:36:11 +00:00
|
|
|
|
|
|
|
<Footer />
|
2021-07-17 21:44:21 +00:00
|
|
|
</div>
|
2021-07-26 18:33:52 +00:00
|
|
|
|
|
|
|
<Backdrop :show="isBackdropShown" @click="closeBackdrop" />
|
|
|
|
|
2021-08-01 17:13:24 +00:00
|
|
|
<SidebarContext />
|
2021-07-24 23:40:30 +00:00
|
|
|
|
2021-07-27 21:43:51 +00:00
|
|
|
<Modal />
|
|
|
|
|
2021-07-24 23:40:30 +00:00
|
|
|
<NotificationBar />
|
2021-08-01 18:29:41 +00:00
|
|
|
|
2022-04-19 11:02:26 +00:00
|
|
|
<div v-if="active" class="fixed bottom-0 right-0 mr-5 md:mr-10 mb-5 md:mb-28">
|
|
|
|
<button @click="showSidebarBalances"
|
|
|
|
class="px-9 h-[56px] bg-primary-blue-dark hover:bg-primary-blue-hover text-white rounded-[28px] text-lg font-semibold shadow flex items-center">
|
|
|
|
<svg class="mr-3" width="14" height="16" viewBox="0 0 14 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
2021-08-08 11:34:44 +00:00
|
|
|
<g clip-path="url(#clip123)">
|
2021-08-01 18:29:41 +00:00
|
|
|
<path
|
|
|
|
d="M12.6109 4L2.1875 4C1.94578 4 1.75 3.77625 1.75 3.5C1.75 3.22375 1.94578 3 2.1875 3L12.6875 3C12.9292 3 13.125 2.77625 13.125 2.5C13.125 1.67156 12.5374 1 11.8125 1L1.75 1C0.783399 1 0 1.89531 0 3L0 13C0 14.1047 0.783399 15 1.75 15L12.6109 15C13.3771 15 14 14.3272 14 13.5L14 5.5C14 4.67281 13.3771 4 12.6109 4ZM11.375 10.5C10.8918 10.5 10.5 10.0522 10.5 9.5C10.5 8.94781 10.8918 8.5 11.375 8.5C11.8582 8.5 12.25 8.94781 12.25 9.5C12.25 10.0522 11.8582 10.5 11.375 10.5Z"
|
2022-04-19 11:02:26 +00:00
|
|
|
fill="white" />
|
2021-08-01 18:29:41 +00:00
|
|
|
</g>
|
|
|
|
<defs>
|
2021-08-08 11:34:44 +00:00
|
|
|
<clipPath id="clip123">
|
2021-08-01 18:29:41 +00:00
|
|
|
<rect width="14" height="16" fill="white" />
|
|
|
|
</clipPath>
|
|
|
|
</defs>
|
|
|
|
</svg>
|
|
|
|
|
|
|
|
Balance
|
|
|
|
</button>
|
|
|
|
</div>
|
2021-07-17 21:44:21 +00:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script>
|
2021-08-18 20:20:45 +00:00
|
|
|
import { defineComponent, nextTick, onErrorCaptured, onMounted, useContext, useRoute, watch } from "@nuxtjs/composition-api";
|
2021-07-17 21:52:42 +00:00
|
|
|
import MakerDAOIcon from '~/assets/icons/makerdao.svg?inline'
|
|
|
|
import CompoundIcon from '~/assets/icons/compound.svg?inline'
|
|
|
|
import AaveIcon from '~/assets/icons/aave.svg?inline'
|
2021-09-03 13:59:09 +00:00
|
|
|
import { useWeb3 } from '@instadapp/vue-web3'
|
2021-08-01 18:29:41 +00:00
|
|
|
import { init as initSidebars, useSidebar } from '~/composables/useSidebar'
|
2021-07-26 18:33:52 +00:00
|
|
|
import { useBackdrop } from '@/composables/useBackdrop'
|
2021-07-27 21:43:51 +00:00
|
|
|
import { useNetwork } from "~/composables/useNetwork";
|
2021-08-20 21:53:50 +00:00
|
|
|
import { useModal } from "~/composables/useModal";
|
2021-08-31 19:23:47 +00:00
|
|
|
import { useEagerConnect } from "~/composables/useEagerConnect";
|
2021-09-02 23:15:14 +00:00
|
|
|
import Web3Modal from "~/components/modal/web3/Web3Modal.vue";
|
2021-10-01 22:59:37 +00:00
|
|
|
import { useDSA } from "~/composables/useDSA";
|
2021-07-26 18:33:52 +00:00
|
|
|
|
2021-07-17 21:44:21 +00:00
|
|
|
export default defineComponent({
|
2021-07-17 21:52:42 +00:00
|
|
|
components: {
|
|
|
|
MakerDAOIcon,
|
|
|
|
CompoundIcon,
|
|
|
|
AaveIcon,
|
2021-09-02 23:15:14 +00:00
|
|
|
Web3Modal,
|
2021-07-19 19:35:31 +00:00
|
|
|
},
|
|
|
|
setup() {
|
2021-07-27 21:43:51 +00:00
|
|
|
const { active, activate, deactivate, chainId } = useWeb3();
|
2021-10-01 22:59:37 +00:00
|
|
|
const { activeAccount } = useDSA();
|
2021-08-14 12:30:55 +00:00
|
|
|
const { activeNetworkId, activeNetwork, checkForNetworkMismatch } = useNetwork();
|
2021-07-26 18:33:52 +00:00
|
|
|
const { isShown: isBackdropShown, close: closeBackdrop } = useBackdrop()
|
2021-07-27 21:43:51 +00:00
|
|
|
const { redirect } = useContext()
|
2021-08-01 18:29:41 +00:00
|
|
|
const { showSidebarBalances } = useSidebar()
|
2021-08-20 21:53:50 +00:00
|
|
|
const { showNetworksMismatchDialog } = useModal()
|
2021-09-05 22:40:07 +00:00
|
|
|
useEagerConnect()
|
2021-07-27 21:43:51 +00:00
|
|
|
const route = useRoute()
|
2021-07-26 18:33:52 +00:00
|
|
|
|
|
|
|
watch(isBackdropShown, () => {
|
|
|
|
if (isBackdropShown.value) {
|
|
|
|
document.body.classList.add('overflow-hidden')
|
|
|
|
} else {
|
|
|
|
document.body.classList.remove('overflow-hidden')
|
|
|
|
}
|
|
|
|
})
|
2021-07-19 19:35:31 +00:00
|
|
|
|
2021-07-24 23:40:30 +00:00
|
|
|
initSidebars();
|
|
|
|
|
2021-07-27 21:43:51 +00:00
|
|
|
// global routes guard
|
|
|
|
watch(
|
|
|
|
[activeNetwork, route],
|
|
|
|
async () => {
|
|
|
|
await nextTick()
|
|
|
|
|
|
|
|
if (route.path === '/') {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2022-04-19 11:02:26 +00:00
|
|
|
if (route.value.path.includes(['mainnet', 'polygon', "arbitrum", "avalanche", "optimism"]) && route.value.path.includes(activeNetwork.value.id)) {
|
2021-07-27 21:43:51 +00:00
|
|
|
redirect('/')
|
|
|
|
}
|
|
|
|
}, { immediate: true })
|
|
|
|
|
|
|
|
watch(chainId, (val) => {
|
|
|
|
if (val) {
|
2021-10-17 12:57:51 +00:00
|
|
|
if ([1, 137, 42161, 43114].includes(val)) {
|
2021-08-20 21:53:50 +00:00
|
|
|
checkForNetworkMismatch()
|
|
|
|
} else {
|
|
|
|
showNetworksMismatchDialog();
|
|
|
|
}
|
2021-07-27 21:43:51 +00:00
|
|
|
}
|
|
|
|
}, { immediate: true })
|
|
|
|
|
2021-08-25 11:13:23 +00:00
|
|
|
onErrorCaptured((error) => {
|
|
|
|
console.error(error)
|
2021-08-10 16:11:15 +00:00
|
|
|
return false
|
|
|
|
})
|
2021-08-05 17:47:14 +00:00
|
|
|
|
2021-07-19 19:35:31 +00:00
|
|
|
return {
|
2021-10-01 22:59:37 +00:00
|
|
|
activeAccount,
|
2021-07-19 19:35:31 +00:00
|
|
|
active,
|
|
|
|
activate,
|
|
|
|
deactivate,
|
2021-07-26 18:33:52 +00:00
|
|
|
isBackdropShown,
|
|
|
|
closeBackdrop,
|
2021-08-01 18:29:41 +00:00
|
|
|
showSidebarBalances,
|
2021-08-14 12:30:55 +00:00
|
|
|
activeNetworkId,
|
2021-07-19 19:35:31 +00:00
|
|
|
}
|
2021-07-17 21:52:42 +00:00
|
|
|
}
|
2021-07-17 21:44:21 +00:00
|
|
|
|
|
|
|
})
|
2021-07-24 23:40:30 +00:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style>
|
|
|
|
:root {
|
|
|
|
--min-width-app: 320px;
|
2021-07-26 22:19:20 +00:00
|
|
|
--width-sidebar-context: 385px;
|
2021-07-24 23:40:30 +00:00
|
|
|
--width-container-main: 1016px;
|
|
|
|
--height-navbar: 64px;
|
|
|
|
--height-top-banner: 32px;
|
|
|
|
|
|
|
|
@screen sm {
|
|
|
|
--height-navbar: 82px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|