Skip to content

Commit c129db6

Browse files
committed
Add loading indicator to sidebar
1 parent 509da08 commit c129db6

File tree

3 files changed

+29
-10
lines changed

3 files changed

+29
-10
lines changed

src/components/AppSidebar.vue

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,11 @@ const store = useStore()
1010

1111
<template>
1212
<nav class="nav">
13+
<div
14+
:class="{ 'nav-loading-indicator-active': store.loadingNotifications }"
15+
class="nav-loading-indicator"
16+
/>
17+
1318
<div class="upper">
1419
<button
1520
class="nav-logo"
@@ -28,7 +33,7 @@ const store = useStore()
2833
title="Reload notifications"
2934
@click="store.fetchNotifications(true)"
3035
>
31-
<Icons.Sync16 :class="{ 'sync-icon-spin': store.loadingNotifications }" />
36+
<Icons.Sync16 />
3237
</SidebarButton>
3338

3439
<SidebarButton
@@ -43,14 +48,15 @@ const store = useStore()
4348
</template>
4449

4550
<style lang="scss" scoped>
46-
@keyframes spin {
51+
@keyframes nav-loading-indicator {
4752
0% {
48-
transform: rotate(0deg);
53+
transform: translateY(-200px);
4954
}
5055
100% {
51-
transform: rotate(360deg);
56+
transform: translateY(600px);
5257
}
5358
}
59+
5460
.nav {
5561
height: 100%;
5662
flex-shrink: 0;
@@ -59,9 +65,22 @@ const store = useStore()
5965
flex-wrap: nowrap;
6066
padding: 20px 10px;
6167
background-color: var(--sidebar-bg);
68+
position: relative;
69+
overflow: hidden;
70+
71+
&-loading-indicator {
72+
position: absolute;
73+
right: 0;
74+
width: 2px;
75+
height: 200px;
76+
top: 0;
77+
background: radial-gradient(circle, rgba(150,150,150) 0%, rgba(255,255,255,0) 100%);
78+
visibility: hidden;
6279
63-
.sync-icon-spin {
64-
animation: 1s spin linear infinite;
80+
&-active {
81+
visibility: visible;
82+
animation: 1s nav-loading-indicator linear infinite;
83+
}
6584
}
6685
6786
.upper,

src/components/NotificationList.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -133,9 +133,9 @@ function handleRepoClick() {
133133
@include focus-visible;
134134
@include text-outline($size: 1px);
135135
136-
// &-read {
137-
// color: var(--white-faded) !important;
138-
// }
136+
&-read {
137+
color: var(--white-faded) !important;
138+
}
139139
140140
&:hover {
141141
background-color: var(--item-hover-bg)

src/stores/store.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export const useStore = defineStore('store', () => {
5555
failedLoadingNotifications.value = true
5656
}
5757

58-
loadingNotifications.value = false
58+
loadingNotifications.value = true
5959
skeletonVisible.value = false
6060

6161
if (

0 commit comments

Comments
 (0)