Skip to content

Commit 22db188

Browse files
committed
Add spin anim to sync icon on loading
1 parent ac135cb commit 22db188

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

src/components/AppSidebar.vue

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function handleBack() {
3535
v-if="accessToken != null"
3636
@click="store.fetchNotifications(true)"
3737
>
38-
<Icons.Sync16 />
38+
<Icons.Sync16 :class="{ 'sync-icon-spin': store.loadingNotifications }" />
3939
</SidebarButton>
4040

4141
<SidebarButton @click="store.setPage(Page.Settings)">
@@ -46,6 +46,14 @@ function handleBack() {
4646
</template>
4747

4848
<style lang="scss" scoped>
49+
@keyframes spin {
50+
0% {
51+
transform: rotate(0deg);
52+
}
53+
100% {
54+
transform: rotate(360deg);
55+
}
56+
}
4957
.nav {
5058
height: 100%;
5159
flex-shrink: 0;
@@ -55,6 +63,10 @@ function handleBack() {
5563
padding: 10px;
5664
background-color: var(--sidebar-bg);
5765
66+
.sync-icon-spin {
67+
animation: 1s spin linear infinite;
68+
}
69+
5870
.upper,
5971
.lower {
6072
display: flex;
@@ -70,6 +82,5 @@ function handleBack() {
7082
.lower {
7183
margin-top: auto;
7284
}
73-
7485
}
7586
</style>

src/components/EmptyState.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<template />

src/stores/store.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ export const useStore = defineStore('store', () => {
2323
if (withSkeletons)
2424
skeletonVisible.value = true
2525

26+
loadingNotifications.value = true
27+
2628
try {
2729
const { data } = await getNotifications({
2830
accessToken,
@@ -31,12 +33,15 @@ export const useStore = defineStore('store', () => {
3133
})
3234

3335
notifications.value = notificationListFromThreads(data)
34-
skeletonVisible.value = false
3536
}
3637
catch (error) {
3738
console.error('NotificationError: ', error)
3839
notifications.value = []
3940
}
41+
finally {
42+
loadingNotifications.value = false
43+
skeletonVisible.value = false
44+
}
4045
}
4146

4247
const currentPage = ref(Page.Landing)

0 commit comments

Comments
 (0)