Skip to content

Commit

Permalink
keep aside when empty
Browse files Browse the repository at this point in the history
  • Loading branch information
ezra-sg authored and donnyquixotic committed Jan 29, 2024
1 parent 5098291 commit ec066f7
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 14 deletions.
9 changes: 9 additions & 0 deletions src/components/evm/CollapsibleAside.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ const props = defineProps<{
header: string;
content: { text: string; bold?: boolean; }[];
alwaysOpen?: boolean, // if true, the expansion item will always be open with no toggle
centerOnDesktop?: boolean, // if true, the aside will be centered on large screens (default is off to the side)
}>();
// data
Expand All @@ -25,6 +26,7 @@ function handleExpansionItemUpdate() {
:class="{
'c-collapsible-aside': true,
'c-collapsible-aside--always-open': alwaysOpen,
'c-collapsible-aside--centered': centerOnDesktop,
}"
>
<q-expansion-item
Expand Down Expand Up @@ -58,6 +60,13 @@ function handleExpansionItemUpdate() {
}
}
&--centered {
@include md-and-up {
display: flex;
justify-content: center;
}
}
&__expansion-item {
border-radius: 4px;
border: 2px solid var(--accent-color-5);
Expand Down
29 changes: 15 additions & 14 deletions src/pages/evm/allowances/AllowancesPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ const numberOfAllowancesToBatchRevoke = ref(0);
// computed
const userAddress = computed(() => useAccountStore().currentAccount.account);
const showEmptyState = computed(() => !loading.value && shapedAllowanceRows.value.length === 0);
const shapedAllowanceRows = computed(() => {
const {
asset,
Expand Down Expand Up @@ -253,20 +254,20 @@ function handleRevokeSelectedClicked() {
</template>

<div class="c-allowances-page__body">
<template v-if="loading || shapedAllowanceRows.length > 0">
<CollapsibleAside
:header="asideHeader"
:content="asideContent"
class="q-mb-lg"
/>
<CollapsibleAside
:header="asideHeader"
:content="asideContent"
:center-on-desktop="showEmptyState"
class="q-mb-lg"
/>

<AllowancesPageControls
:enable-revoke-button="enableRevokeButton"
@search-updated="handleSearchUpdated"
@include-cancelled-updated="handleIncludeCancelledUpdated"
@revoke-selected="handleRevokeSelectedClicked"
/>
</template>
<AllowancesPageControls
v-if="!showEmptyState"
:enable-revoke-button="enableRevokeButton"
@search-updated="handleSearchUpdated"
@include-cancelled-updated="handleIncludeCancelledUpdated"
@revoke-selected="handleRevokeSelectedClicked"
/>

<div v-if="loading" class="q-mt-lg">
<q-skeleton
Expand All @@ -276,7 +277,7 @@ function handleRevokeSelectedClicked() {
type="rect"
/>
</div>
<div v-else-if="!loading && shapedAllowanceRows.length === 0">
<div v-else-if="showEmptyState">
<h2 class="c-allowances-page__empty-title">
{{ $t('evm_allowances.no_allowances') }}
</h2>
Expand Down

0 comments on commit ec066f7

Please sign in to comment.