Skip to content

Commit 1ff2b65

Browse files
committed
feat(mobile): add global back button in app bar and remove per-view back buttons
1 parent c4a448d commit 1ff2b65

9 files changed

Lines changed: 29 additions & 56 deletions

File tree

packages/mobile/src/App.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,23 @@ onMounted(async () => {
1818
})
1919
2020
const hiddenNavRoutes = ['login', 'app-login', 'oidc-login', 'callback']
21+
const rootRoutes = ['home', 'tools', 'settings']
2122
2223
const showBottomNav = computed(() => {
2324
return !hiddenNavRoutes.includes(route.name as string)
2425
})
2526
27+
const showBackButton = computed(() => {
28+
const name = route.name as string
29+
if (rootRoutes.includes(name)) return false
30+
if (name === 'callback') return false
31+
return true
32+
})
33+
34+
const onGlobalBack = () => {
35+
router.back()
36+
}
37+
2638
const activeTab = computed(() => {
2739
const name = route.name as string
2840
if (name === 'home') return 'home'
@@ -43,6 +55,15 @@ const activeTab = computed(() => {
4355
<LockScreen v-if="AppLockService.locked.value" />
4456

4557
<v-app-bar flat color="surface" border="b" class="app-bar-safe">
58+
<v-btn
59+
v-if="showBackButton"
60+
icon="mdi-arrow-left"
61+
variant="text"
62+
size="small"
63+
class="ml-1"
64+
aria-label="Go back"
65+
@click="onGlobalBack"
66+
/>
4667
<v-app-bar-title class="text-subtitle-1 font-weight-bold">
4768
ID PASS DataCollect
4869
</v-app-bar-title>

packages/mobile/src/views/AppView.vue

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,6 @@ onUnmounted(() => {
6969
}
7070
})
7171
72-
const onBack = () => {
73-
router.replace({ name: 'home' })
74-
}
75-
7672
const onLogout = async () => {
7773
await handleAuthError(route.params.id as string)
7874
}
@@ -113,8 +109,7 @@ const stats = computed(() => [
113109

114110
<template>
115111
<v-container v-if="tenantapp" fluid class="pa-4">
116-
<div class="d-flex justify-space-between align-center mb-4">
117-
<v-btn icon="mdi-arrow-left" variant="tonal" size="small" @click="onBack" aria-label="Back to Collection Programs" />
112+
<div class="d-flex justify-end align-center mb-4">
118113
<div class="d-flex ga-2">
119114
<v-btn
120115
prepend-icon="mdi-sync"

packages/mobile/src/views/Claim169HubView.vue

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,11 @@ import { usePlatform } from '@/platform'
44
55
const router = useRouter()
66
const { isNative } = usePlatform()
7-
8-
const handleBack = () => {
9-
router.back()
10-
}
117
</script>
128

139
<template>
1410
<div class="hub">
1511
<div class="hub-nav">
16-
<button class="hub-back" type="button" @click="handleBack" aria-label="Back to Tools">
17-
<v-icon size="22">mdi-arrow-left</v-icon>
18-
</button>
1912
<span class="hub-nav-title">Claim-169</span>
2013
</div>
2114

packages/mobile/src/views/Claim169IdentityView.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,6 @@ const credentialInfo = computed(() => {
116116
return fields
117117
})
118118
119-
const handleBack = () => router.back()
120119
const handleScanAnother = () => router.push({ name: 'scan-claim169' })
121120
122121
const saveToApp = async (app: TenantAppData) => {
@@ -174,7 +173,6 @@ const handleSaveToRecords = () => {
174173
<template>
175174
<v-container v-if="verifiedIdentity" fluid class="pa-4">
176175
<div class="d-flex align-center ga-3 mb-4">
177-
<v-btn icon="mdi-arrow-left" variant="tonal" size="small" @click="handleBack" aria-label="Go back" />
178176
<span class="text-h6 font-weight-bold">Identity Details</span>
179177
</div>
180178

packages/mobile/src/views/DetailView.vue

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,6 @@ onMounted(async () => {
5858
}
5959
})
6060
61-
const onBack = () => {
62-
navigateToEntityList()
63-
}
64-
6561
const formatEventType = (type: string) => {
6662
return type
6763
.split('-')
@@ -99,13 +95,10 @@ const getEntityName = () => {
9995

10096
<template>
10197
<v-container v-if="tenantapp && storedEntityData" fluid class="pa-4">
102-
<div class="d-flex justify-space-between align-center mb-4">
103-
<div class="d-flex align-center ga-2">
104-
<v-btn icon="mdi-arrow-left" variant="tonal" size="small" @click="onBack" aria-label="Back to submissions" />
105-
<v-chip v-if="isOffline" size="x-small" color="warning" variant="tonal" prepend-icon="mdi-wifi-off">
106-
Offline
107-
</v-chip>
108-
</div>
98+
<div v-if="isOffline" class="d-flex justify-end align-center mb-4">
99+
<v-chip size="x-small" color="warning" variant="tonal" prepend-icon="mdi-wifi-off">
100+
Offline
101+
</v-chip>
109102
</div>
110103

111104
<v-card elevation="2" class="mb-4">

packages/mobile/src/views/EditView.vue

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -105,19 +105,14 @@ const onSubmit = async (submission: any) => {
105105
navigateToDetail()
106106
}
107107
108-
const onBack = () => {
109-
navigateToDetail()
110-
}
111-
112108
const onFormError = (error: unknown) => {
113109
console.error('Form.io renderer error:', error)
114110
}
115111
</script>
116112

117113
<template>
118114
<v-container v-if="storedEntityData" fluid class="pa-4">
119-
<div class="d-flex justify-space-between align-center mb-4">
120-
<v-btn icon="mdi-arrow-left" variant="tonal" size="small" @click="onBack" aria-label="Back" />
115+
<div class="d-flex justify-end align-center mb-4">
121116
<div class="d-flex align-center ga-2">
122117
<v-chip size="small" color="info" variant="tonal">
123118
{{ entityForm?.displayTemplate || 'Edit' }}

packages/mobile/src/views/EntityView.vue

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -172,10 +172,6 @@ onMounted(async () => {
172172
}
173173
})
174174
175-
const onBack = () => {
176-
navigateToParent()
177-
}
178-
179175
const statusConfig = (status: SubmissionStatus) => {
180176
switch (status) {
181177
case 'synced': return { label: 'Synced', color: 'success', icon: 'mdi-check-circle' }
@@ -207,8 +203,7 @@ const formatTimestamp = (timestamp: string) => {
207203

208204
<template>
209205
<v-container v-if="tenantapp" fluid class="pa-4">
210-
<div class="d-flex justify-space-between align-center mb-4">
211-
<v-btn icon="mdi-arrow-left" variant="tonal" size="small" @click="onBack" aria-label="Back to forms" />
206+
<div class="d-flex justify-end align-center mb-4">
212207
<div class="d-flex align-center ga-2">
213208
<v-chip size="small" color="info" variant="tonal">{{ entityForm?.displayTemplate || 'Form' }}</v-chip>
214209
<v-chip v-if="isOffline" size="x-small" color="warning" variant="tonal" prepend-icon="mdi-wifi-off">

packages/mobile/src/views/NewView.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,11 @@ const onSubmit = async (submission: FormSubmissionEvent) => {
9494
navigateToEntityList()
9595
}
9696
97-
const onBack = () => {
98-
navigateToEntityList()
99-
}
10097
</script>
10198

10299
<template>
103100
<v-container v-if="tenantapp && formio" fluid class="pa-4">
104-
<div class="d-flex justify-space-between align-center mb-4">
105-
<v-btn icon="mdi-arrow-left" variant="tonal" size="small" @click="onBack" aria-label="Back to submissions" />
101+
<div class="d-flex justify-end align-center mb-4">
106102
<div class="d-flex align-center ga-2">
107103
<v-chip size="small" color="info" variant="tonal">
108104
{{ entityForm?.displayTemplate || entityTypeLabel }}

packages/mobile/src/views/auth/AuthScreen.vue

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,6 @@ const authenticate = async (provider: string) => {
124124
}
125125
}
126126
127-
const onBack = () => {
128-
router.push(`/`)
129-
}
130-
131127
const getProviderName = (provider: string) => {
132128
const config = authProviders.value.find((c) => c.type === provider)
133129
return config?.type || provider.charAt(0).toUpperCase() + provider.slice(1)
@@ -147,15 +143,6 @@ const onLogin = async () => {
147143
</script>
148144

149145
<template>
150-
<div class="pa-3">
151-
<v-btn
152-
v-if="!isCallback"
153-
icon="mdi-arrow-left"
154-
variant="text"
155-
@click="onBack"
156-
aria-label="Back"
157-
/>
158-
</div>
159146
<AuthContainer>
160147
<div class="py-4">
161148
<!-- Callback processing state -->

0 commit comments

Comments
 (0)