Add loading spinner to new activity page

This commit is contained in:
Ramon Wenger 2024-02-29 13:09:06 +01:00
parent 650f8c05d5
commit 9c4249de01
3 changed files with 117 additions and 113 deletions

View File

@ -9,7 +9,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import LoadingSpinner from '@/components/ui/loadingSpinner.vue'; import LoadingSpinner from '@/components/ui/LoadingSpinner.vue';
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">

View File

@ -1,6 +1,14 @@
<template> <template>
<div class="loading-spinner"><div></div><div></div><div></div><div></div><div></div><div></div><div></div><div></div></div> <div class="loading-spinner">
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
<div></div>
</div>
</template> </template>
<style scoped lang="scss"> <style scoped lang="scss">
@ -21,7 +29,7 @@
} }
div:after { div:after {
content: " "; content: ' ';
display: block; display: block;
position: absolute; position: absolute;
width: var(--calculated-dot-size); width: var(--calculated-dot-size);
@ -53,33 +61,26 @@
animation-delay: -0.108s; animation-delay: -0.108s;
} }
div:nth-child(4) { div:nth-child(4) {
animation-delay: -0.144s; animation-delay: -0.144s;
} }
div:nth-child(5) { div:nth-child(5) {
animation-delay: -0.18s; animation-delay: -0.18s;
} }
div:nth-child(6) { div:nth-child(6) {
animation-delay: -0.216s; animation-delay: -0.216s;
} }
div:nth-child(7) { div:nth-child(7) {
animation-delay: -0.252s; animation-delay: -0.252s;
} }
div:nth-child(8) { div:nth-child(8) {
animation-delay: -0.288s; animation-delay: -0.288s;
} }
div:nth-child(1):after { div:nth-child(1):after {
top: calc(var(--spinner-size, 80px) * 0.7875); top: calc(var(--spinner-size, 80px) * 0.7875);
left: calc(var(--spinner-size, 80px) * 0.7875); left: calc(var(--spinner-size, 80px) * 0.7875);
@ -128,5 +129,4 @@
transform: rotate(360deg); transform: rotate(360deg);
} }
} }
</style> </style>

View File

@ -1,6 +1,8 @@
<template> <template>
<div class="activity"> <div class="activity">
<h1 class="activity__heading">Meine Aktivitäten</h1> <h1 class="activity__heading">Meine Aktivitäten</h1>
<loading-message v-if="loading">Aktivitäten werden geladen</loading-message>
<template v-else>
<div class="activity__categories"> <div class="activity__categories">
<a <a
class="activity__category default-link" class="activity__category default-link"
@ -93,6 +95,7 @@
Übung: {{ item.survey.title }} Übung: {{ item.survey.title }}
</activity-list> </activity-list>
</div> </div>
</template>
</div> </div>
</template> </template>
@ -102,6 +105,7 @@ import { useQuery } from '@vue/apollo-composable';
import { ref, computed } from 'vue'; import { ref, computed } from 'vue';
import ActivityList from '@/components/profile/ActivityList.vue'; import ActivityList from '@/components/profile/ActivityList.vue';
import InstrumentActivityList from '@/components/profile/InstrumentActivityList.vue'; import InstrumentActivityList from '@/components/profile/InstrumentActivityList.vue';
import LoadingMessage from '@/components/ui/LoadingMessage.vue';
import { TopicNode } from '@/__generated__/graphql'; import { TopicNode } from '@/__generated__/graphql';
const HIGHLIGHTS = 'highlights'; const HIGHLIGHTS = 'highlights';
@ -112,7 +116,7 @@ const SURVEYS = 'surveys';
const selectedCategory = ref(HIGHLIGHTS); const selectedCategory = ref(HIGHLIGHTS);
// todo: use fragments to simplify cache updates // todo: use fragments to simplify cache updates
const { result } = useQuery( const { result, loading } = useQuery(
graphql(` graphql(`
query MyActivitiesQuery { query MyActivitiesQuery {
myActivities { myActivities {