Skip to content

Commit b5c25b1

Browse files
committed
Show back button on settings page
1 parent 4e926c4 commit b5c25b1

File tree

3 files changed

+28
-19
lines changed

3 files changed

+28
-19
lines changed

src/components/AppButton.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
color: var(--white);
1515
border-radius: 8px;
1616
@include focus-visible;
17+
@include text-outline();
1718
1819
&:active {
1920
background-color: var(--item-hover-bg);

src/components/AppSidebar.vue

Lines changed: 25 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,45 @@
11
<script lang="ts" setup>
22
import { exit } from '@tauri-apps/api/process'
33
import { Page } from '../constants'
4+
import { AppStorage } from '../storage'
45
import { useStore } from '../stores/store'
56
import { Icons } from './Icons'
67
import SidebarButton from './SidebarButton.vue'
78
89
const store = useStore()
10+
11+
const accessToken = AppStorage.asComputed('accessToken')
12+
13+
function handleBack() {
14+
let page = Page.Home
15+
16+
if (accessToken.value == null)
17+
page = Page.Landing
18+
19+
store.setPage(page)
20+
}
921
</script>
1022

1123
<template>
1224
<nav class="nav">
13-
<div
14-
v-if="store.currentPage !== Page.Landing"
15-
class="upper"
16-
>
17-
<SidebarButton @click="store.setPage(Page.Home)">
18-
<Icons.Bell16 />
25+
<div class="upper">
26+
<SidebarButton
27+
v-if="store.currentPage === Page.Settings"
28+
@click="handleBack"
29+
>
30+
<Icons.ChevronLeft />
1931
</SidebarButton>
2032
</div>
2133
<div class="lower">
22-
<template v-if="store.currentPage !== Page.Landing">
23-
<SidebarButton @click="store.fetchNotifications(true)">
24-
<Icons.Sync16 />
25-
</SidebarButton>
26-
27-
<SidebarButton @click="store.setPage(Page.Settings)">
28-
<Icons.Gear16 />
29-
</SidebarButton>
30-
</template>
31-
3234
<SidebarButton
33-
v-else
34-
@click="exit(0)"
35+
v-if="accessToken != null"
36+
@click="store.fetchNotifications(true)"
3537
>
36-
<Icons.SignOut16 />
38+
<Icons.Sync16 />
39+
</SidebarButton>
40+
41+
<SidebarButton @click="store.setPage(Page.Settings)">
42+
<Icons.Gear16 />
3743
</SidebarButton>
3844
</div>
3945
</nav>

src/components/Icons.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import AlertIcon from 'virtual:icons/octicon/alert-24'
2323
import QuestionIcon from 'virtual:icons/octicon/question-24'
2424
import MailIcon from 'virtual:icons/octicon/mail-24'
2525
import SignOutIcon16 from 'virtual:icons/octicon/sign-out-16'
26+
import ChevronLeftIcon from 'virtual:icons/octicon/chevron-left'
2627

2728
export const Icons = {
2829
More: markRaw(MoreIcon),
@@ -48,4 +49,5 @@ export const Icons = {
4849
Bell16: markRaw(BellIcon16),
4950
Gear16: markRaw(GearIcon16),
5051
Sync16: markRaw(SyncIcon16),
52+
ChevronLeft: markRaw(ChevronLeftIcon),
5153
}

0 commit comments

Comments
 (0)