1
1
<template >
2
2
<ion-page >
3
- <ion-content
4
- class =" ion-padding"
5
- >
3
+ <ion-content class =" ion-padding" >
6
4
<div class =" token-container" >
7
5
<Loader v-if =" loading" />
8
6
70
68
</div >
71
69
<ion-router-outlet
72
70
class =" token-router"
71
+ :style =" { height: routerHeight }"
73
72
/>
74
73
</div >
75
74
</ion-content >
@@ -90,6 +89,7 @@ import {
90
89
onMounted ,
91
90
ref ,
92
91
unref ,
92
+ nextTick ,
93
93
} from ' vue' ;
94
94
import { useStore } from ' vuex' ;
95
95
import { useRoute } from ' vue-router' ;
@@ -194,6 +194,7 @@ export default defineComponent({
194
194
exact: true ,
195
195
},
196
196
];
197
+ const routerHeight = ref <string >();
197
198
const loading = ref <boolean >(true );
198
199
const tokenPairs = ref <Record <string , IToken | null >>({ token0: null , token1: null });
199
200
const tokenBalances = useGetter <IToken []>(' fungibleTokens/tokenBalances' );
@@ -220,12 +221,35 @@ export default defineComponent({
220
221
221
222
const convertedBalance = computed (() => + tokenData .value .convertedBalance ! || 0 );
222
223
224
+ function calculateRouterHeight() {
225
+ nextTick (() => {
226
+ const ionicWrapperBottom = document .querySelector (' .app-wrapper' )?.getBoundingClientRect ()?.bottom ;
227
+ const tabsWrapperElementBottom = document .querySelector (' .sticky-tabs-wrapper' )?.getBoundingClientRect ().bottom ;
228
+ routerHeight .value = ` ${ionicWrapperBottom ! - tabsWrapperElementBottom ! }px ` ! ;
229
+ });
230
+ }
231
+
232
+ /**
233
+ * Observe tabs wrapper height changes and recalculate router height.
234
+ * Tabs change height when filters are shown/hidden
235
+ */
236
+ function observeTabsWrapperHeight() {
237
+ const resizeObserver = new ResizeObserver (() => {
238
+ calculateRouterHeight ();
239
+ });
240
+ resizeObserver .observe (document .querySelector (' .sticky-tabs-wrapper' ) as Element );
241
+ }
242
+
223
243
onMounted (async () => {
224
244
if (isContract (contractId ) && ! isAe ) {
225
245
await getAeSdk ();
226
246
tokenPairs .value = await store .dispatch (' fungibleTokens/getContractTokenPairs' , contractId );
227
247
}
228
248
loading .value = false ;
249
+ setTimeout (() => {
250
+ observeTabsWrapperHeight ();
251
+ calculateRouterHeight ();
252
+ }, 250 );
229
253
});
230
254
231
255
onIonViewDidEnter (() => {
@@ -267,14 +291,15 @@ export default defineComponent({
267
291
routeName ,
268
292
isMultisig ,
269
293
routeParams ,
294
+ routerHeight ,
270
295
};
271
296
},
272
297
});
273
298
</script >
274
299
275
300
<style lang="scss" scoped>
276
- @use ' ../../.. /styles/variables' ;
277
- @use ' ../../.. /styles/typography' ;
301
+ @use ' @ /styles/variables' ;
302
+ @use ' @ /styles/typography' ;
278
303
279
304
.token-container {
280
305
--screen-padding-x : 12px ;
0 commit comments