Skip to content

Commit 00e1fc4

Browse files
committed
Update notification list design
1 parent 9cdf06a commit 00e1fc4

File tree

9 files changed

+77
-28
lines changed

9 files changed

+77
-28
lines changed

src/assets/main.scss

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@
99

1010
--white-faded: rgb(190, 190, 190);
1111
--white: rgb(255, 255, 255);
12-
--content-bg: rgba(35, 35, 35, .8);
13-
--sidebar-bg: rgba(66, 66, 66, .5);
12+
--content-bg: rgba(30, 30, 30, .8);
13+
--sidebar-bg: rgba(50, 50, 50, .75);
1414
--app-border: rgb(90, 90, 90);
1515
--item-bg: rgba(80, 80, 80, .3);
1616
--item-hover-bg: rgba(80, 80, 80, .75);
1717
--item-border-color: rgb(22, 22, 22, .3);
18-
--notification-title-color: rgba(14, 14, 14, .72);
1918
}
2019

2120
* {

src/components/NotificationList.vue

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import type { Thread } from '../api/notifications'
33
import type { NotificationListData } from '../types'
44
import { formatReason, notificationSubjectIcon } from '../utils/notification'
5+
import Separator from './Separator.vue'
56
67
interface Emits {
78
(e: 'click:notification', notification: Thread): void
@@ -42,6 +43,9 @@ function handleRepoClick() {
4243
{{ props.data.repoFullName }}
4344
</span>
4445
</button>
46+
47+
<Separator />
48+
4549
<button
4650
v-for="item of props.data.items"
4751
:key="item.id"
@@ -70,12 +74,12 @@ function handleRepoClick() {
7074
<style lang="scss" scoped>
7175
.notification {
7276
+ .notification {
73-
margin-top: 5px;
77+
margin-top: 10px;
7478
}
7579
7680
&-title {
7781
@include focus-visible;
78-
// background-color: var(--notification-title-color);
82+
@include text-outline();
7983
border-radius: 8px;
8084
padding: 5px 16px;
8185
width: 100%;
@@ -86,12 +90,9 @@ function handleRepoClick() {
8690
border: 1px solid transparent;
8791
line-height: inherit;
8892
89-
&:hover {
90-
border-color: var(--item-hover-bg);
91-
}
92-
93+
&:hover,
9394
&:active {
94-
background-color: var(--item-border-color);
95+
background-color: var(--item-hover-bg);
9596
}
9697
9798
&-icon {

src/components/NotificationSkeleton.vue

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
<script lang="ts" setup>
2+
import Separator from './Separator.vue'
3+
24
const skeletonProps = [
35
{
46
class: 'skeleton-header',
@@ -13,7 +15,7 @@ const skeletonProps = [
1315
class: 'skeleton-item',
1416
},
1517
{
16-
style: { marginTop: '5px' },
18+
style: { 'marginTop': '10px', '--text-width': '50%' },
1719
class: 'skeleton-header',
1820
},
1921
{
@@ -22,15 +24,23 @@ const skeletonProps = [
2224
{
2325
class: 'skeleton-item',
2426
},
25-
]
27+
] as const
2628
</script>
2729

2830
<template>
29-
<div
31+
<template
3032
v-for="(props, index) in skeletonProps"
3133
:key="index"
32-
v-bind="props"
33-
/>
34+
>
35+
<div v-bind="props">
36+
<template v-if="props.class === 'skeleton-header'">
37+
<div class="skeleton-header-logo" />
38+
<div class="skeleton-header-text" />
39+
</template>
40+
</div>
41+
42+
<Separator v-if="props.class === 'skeleton-header'" />
43+
</template>
3444
</template>
3545

3646
<style lang="scss" scoped>
@@ -52,11 +62,32 @@ const skeletonProps = [
5262
height: 32px;
5363
width: 100%;
5464
border-radius: 8px;
55-
background-color: rgba(14, 14, 14, .72);
65+
padding: 5px 16px;
66+
display: flex;
67+
flex-flow: row nowrap;
68+
align-items: center;
69+
70+
&-logo {
71+
border-radius: 50%;
72+
width: 16px;
73+
height: 16px;
74+
background-color: var(--item-hover-bg);
75+
margin-right: 16px;
76+
}
77+
78+
&-text {
79+
background-color: var(--item-hover-bg);
80+
border-radius: 8px;
81+
height: 8px;
82+
width: var(--text-width, 60%);
83+
}
5684
}
5785
5886
.skeleton-item {
59-
margin-top: 5px;
87+
+ .skeleton-item {
88+
margin-top: 5px
89+
};
90+
6091
width: 100%;
6192
height: 62px;
6293
border-radius: 8px;

src/main.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,10 @@ app.use(pinia)
2727

2828
AppStorage.set('openAtStartup', await isAutostartEnabled())
2929

30-
if (token && user)
30+
if (token && user) {
3131
store.setPage(Page.Home)
32+
store.fetchNotifications(true)
33+
}
3234

3335
app.mount('#app')
3436
})()

src/pages/HomePage.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ import AppButton from '../components/AppButton.vue'
2020
2121
const store = useStore()
2222
23-
if (store.pageFrom === Page.Landing || store.pageFrom == null)
24-
store.fetchNotifications(true)
23+
if (store.currentPageState.fetchOnEnter)
24+
store.fetchNotifications()
2525
2626
function handleNotificationClick(notification: Thread) {
2727
const url = toGithubWebURL({ notification, userId: AppStorage.get('user')!.id })

src/pages/LandingPage.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ useTauriEvent<string>('code', async ({ payload }) => {
3535
AppStorage.set('accessToken', access_token)
3636
AppStorage.set('user', user)
3737
store.setPage(Page.Home)
38+
store.fetchNotifications(true)
3839
}
3940
finally {
4041
processing.value = false

src/pages/SettingsPage.vue

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ import { useKey } from '../composables/useKey'
1515
1616
const store = useStore()
1717
18+
const initialValues = {
19+
showOnlyParticipating: AppStorage.get('showOnlyParticipating'),
20+
showReadNotifications: AppStorage.get('showReadNotifications'),
21+
}
22+
1823
const soundsEnabled = AppStorage.asRef('soundsEnabled')
1924
const openAtStartup = AppStorage.asRef('openAtStartup')
2025
const showOnlyParticipating = AppStorage.asRef('showOnlyParticipating')
@@ -35,12 +40,15 @@ watchDebounced(openAtStartup, (enabled) => {
3540
}, { debounce: 350 })
3641
3742
function handleBack() {
38-
let page = Page.Home
39-
4043
if (accessToken.value == null)
41-
page = Page.Landing
42-
43-
store.setPage(page)
44+
return store.setPage(Page.Landing)
45+
46+
store.setPage(Page.Home, {
47+
fetchOnEnter: (
48+
initialValues.showOnlyParticipating !== showOnlyParticipating.value
49+
|| initialValues.showReadNotifications !== showReadNotifications.value
50+
),
51+
})
4452
}
4553
4654
useKey('esc', handleBack, { prevent: true })

src/stores/store.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import { invoke } from '@tauri-apps/api/tauri'
22
import { defineStore } from 'pinia'
3-
import { readonly, ref, watch } from 'vue'
3+
import { readonly, ref, shallowRef, watch } from 'vue'
44
import type { Thread } from '../api/notifications'
55
import { getNotifications } from '../api/notifications'
66
import { InvokeCommand, Page } from '../constants'
77
import { AppStorage } from '../storage'
8-
import type { NotificationListData, Option } from '../types'
8+
import type { NotificationListData, Option, PageState } from '../types'
99
import { notificationListFromThreads } from '../utils/notification'
1010

1111
function hasNewNotification(newThreads: Thread[], previousThreads: Thread[]) {
@@ -67,6 +67,7 @@ export const useStore = defineStore('store', () => {
6767

6868
const currentPage = ref(Page.Landing)
6969
const pageFrom = ref<Option<Page>>(null)
70+
const currentPageState = shallowRef<PageState>({})
7071

7172
function logout() {
7273
AppStorage.set('accessToken', null)
@@ -75,12 +76,13 @@ export const useStore = defineStore('store', () => {
7576
currentPage.value = Page.Landing
7677
}
7778

78-
function setPage(to: Page) {
79+
function setPage(to: Page, state: PageState = {}) {
7980
if (to === currentPage.value)
8081
return
8182

8283
pageFrom.value = currentPage.value
8384
currentPage.value = to
85+
currentPageState.value = state
8486
}
8587

8688
watch(notifications, () => {
@@ -96,6 +98,7 @@ export const useStore = defineStore('store', () => {
9698
skeletonVisible,
9799
pageFrom,
98100
failedLoadingNotifications,
101+
currentPageState,
99102
fetchNotifications,
100103
logout,
101104
}

src/types.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,7 @@ export interface AppStorageContext {
2828
soundsEnabled: boolean
2929
showReadNotifications: boolean
3030
}
31+
32+
export interface PageState {
33+
fetchOnEnter?: boolean
34+
}

0 commit comments

Comments
 (0)