-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.vue
127 lines (114 loc) · 3.67 KB
/
App.vue
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
<script lang="ts">
import BigNumber from 'bignumber.js';
import { useRoute } from 'vue-router';
import Notifications from '@/components/notifications/Notifications.vue';
import ThirdPartyServicesModal from '@/components/web3/ThirdPartyServicesModal.vue';
import WalletSelectModal from '@/components/web3/WalletSelectModal.vue';
import useWeb3Watchers from '@/composables/watchers/useWeb3Watchers';
import { DEFAULT_TOKEN_DECIMALS } from '@/constants/tokens';
import * as Layouts from '@/pages/_layouts';
import useWeb3 from '@/services/web3/useWeb3';
import GlobalModalContainer from './components/modals/GlobalModalContainer.vue';
import AppSidebar from './components/navs/AppNav/AppSidebar/AppSidebar.vue';
import SanctionedWalletModal from './components/web3/SanctionedWalletModal.vue';
import useBackgroundColor from './composables/useBackgroundColor';
import useGnosisSafeApp from './composables/useGnosisSafeApp';
import useNavigationGuards from './composables/useNavigationGuards';
import { useSidebar } from './composables/useSidebar';
import useExploitWatcher from './composables/watchers/useExploitWatcher';
import useGlobalQueryWatchers from './composables/watchers/useGlobalQueryWatchers';
import usePoolCreationWatcher from './composables/watchers/usePoolCreationWatcher';
BigNumber.config({ DECIMAL_PLACES: DEFAULT_TOKEN_DECIMALS });
export const isThirdPartyServicesModalVisible = ref(false);
export default defineComponent({
components: {
...Layouts,
WalletSelectModal,
SanctionedWalletModal,
ThirdPartyServicesModal,
Notifications,
AppSidebar,
GlobalModalContainer,
},
setup() {
/**
* STATE
*/
const layout = ref('DefaultLayout');
/**
* COMPOSABLES
*/
useWeb3Watchers();
usePoolCreationWatcher();
useGlobalQueryWatchers();
useGnosisSafeApp();
useExploitWatcher();
useNavigationGuards();
const { isWalletSelectVisible, toggleWalletSelectModal, isBlocked } =
useWeb3();
const route = useRoute();
const { newRouteHandler: updateBgColorFor } = useBackgroundColor();
const { sidebarOpen } = useSidebar();
// ADD FEATURE ALERT HERE
// const featureAlert: Alert = {
// id: 'vebal-gap',
// priority: AlertPriority.LOW,
// label: t('alerts.vebalL2'),
// type: AlertType.FEATURE,
// rememberClose: false,
// actionOnClick: false
// };
// addAlert(featureAlert);
function handleThirdPartyModalToggle(value: boolean) {
isThirdPartyServicesModalVisible.value = value;
}
/**
* WATCHERS
*/
watch(route, newRoute => {
updateBgColorFor(newRoute);
if (newRoute.meta.layout) {
layout.value = newRoute.meta.layout as string;
} else {
layout.value = 'DefaultLayout';
}
});
return {
// state
layout,
isBlocked,
isThirdPartyServicesModalVisible,
// computed
isWalletSelectVisible,
sidebarOpen,
// methods
toggleWalletSelectModal,
handleThirdPartyModalToggle,
};
},
});
</script>
<template>
<div id="modal" />
<div id="app">
<component :is="layout" />
<WalletSelectModal
:isVisible="isWalletSelectVisible"
:onShowThirdParty="() => handleThirdPartyModalToggle(true)"
@close="toggleWalletSelectModal"
/>
<SanctionedWalletModal :isVisible="isBlocked" />
<ThirdPartyServicesModal
:isVisible="isThirdPartyServicesModalVisible"
@close="handleThirdPartyModalToggle(false)"
/>
<AppSidebar v-if="sidebarOpen" />
<Notifications />
</div>
<GlobalModalContainer />
</template>
<style>
.VueQueryDevtoolsPanel + button {
@apply text-black bg-gray-100 p-2 rounded text-sm;
}
</style>