Hide <hr> on home if no elements above

Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2021-06-10 10:31:05 +02:00
parent c9e50da24a
commit 910cae8562
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773

View File

@ -189,10 +189,7 @@
}}</b-message> }}</b-message>
</section> </section>
<!-- Your upcoming events --> <!-- Your upcoming events -->
<section <section v-if="canShowMyUpcomingEvents" class="container">
v-if="currentActor.id && goingToEvents.size > 0"
class="container"
>
<h3 class="title">{{ $t("Your upcoming events") }}</h3> <h3 class="title">{{ $t("Your upcoming events") }}</h3>
<b-loading :active.sync="$apollo.loading" /> <b-loading :active.sync="$apollo.loading" />
<div v-for="row of goingToEvents" class="upcoming-events" :key="row[0]"> <div v-for="row of goingToEvents" class="upcoming-events" :key="row[0]">
@ -236,7 +233,7 @@
</span> </span>
</section> </section>
<!-- Last week events --> <!-- Last week events -->
<section v-if="currentActor && lastWeekEvents.length > 0"> <section v-if="canShowLastWeekEvents">
<h3 class="title">{{ $t("Last week") }}</h3> <h3 class="title">{{ $t("Last week") }}</h3>
<b-loading :active.sync="$apollo.loading" /> <b-loading :active.sync="$apollo.loading" />
<div> <div>
@ -250,7 +247,7 @@
</div> </div>
</section> </section>
<!-- Events close to you --> <!-- Events close to you -->
<section class="events-close" v-if="closeEvents.total > 0"> <section class="events-close" v-if="canShowCloseEvents">
<h2 class="is-size-2 has-text-weight-bold"> <h2 class="is-size-2 has-text-weight-bold">
{{ $t("Events nearby") }} {{ $t("Events nearby") }}
</h2> </h2>
@ -285,7 +282,12 @@
</div> </div>
</div> </div>
</section> </section>
<hr class="home-separator" /> <hr
class="home-separator"
v-if="
canShowMyUpcomingEvents || canShowLastWeekEvents || canShowCloseEvents
"
/>
<section class="events-recent"> <section class="events-recent">
<h2 class="is-size-2 has-text-weight-bold"> <h2 class="is-size-2 has-text-weight-bold">
{{ $t("Last published events") }} {{ $t("Last published events") }}
@ -586,6 +588,18 @@ export default class Home extends Vue {
}); });
} }
} }
get canShowMyUpcomingEvents(): boolean {
return this.currentActor.id != undefined && this.goingToEvents.size > 0;
}
get canShowLastWeekEvents(): boolean {
return this.currentActor && this.lastWeekEvents.length > 0;
}
get canShowCloseEvents(): boolean {
return this.closeEvents.total > 0;
}
} }
</script> </script>