Skip to content

Commit ef7cb92

Browse files
committed
Some style changes and PR updates.
1 parent aa55f55 commit ef7cb92

File tree

5 files changed

+29
-16
lines changed

5 files changed

+29
-16
lines changed

src/app.vue

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
<script setup lang="ts">
22
import { StatusCodes } from 'http-status-codes'
33
4-
const appLoading = ref(true)
54
// // errors
65
const errorDisplay = ref(false)
76
const errorContactInfo = ref(false)
@@ -10,22 +9,25 @@ const errorInfo: Ref<DialogOptionsI | null> = ref(null)
109
const account = useBcrosAccount()
1110
const { accountErrors } = storeToRefs(account)
1211
13-
const { dashboardIsLoading } = storeToRefs(useBcrosDashboardUi())
12+
const { trackUiLoadingStart, trackUiLoadingStop } = useBcrosDashboardUi()
13+
const loaderTrackingId = 'main-app-loading'
1414
1515
onMounted(async () => {
16-
appLoading.value = true
16+
trackUiLoadingStart(loaderTrackingId)
1717
if (accountErrors.value?.length > 0) {
1818
handleError(accountErrors.value[0])
19-
appLoading.value = false
19+
trackUiLoadingStop(loaderTrackingId)
2020
return
2121
}
2222
if (account.currentAccount?.id) {
2323
// load account products
2424
console.info('Loading active products...', account.currentAccount)
2525
await account.setActiveProducts()
26-
if (accountErrors.value?.length > 0) { return }
26+
if (accountErrors.value?.length > 0) {
27+
return
28+
}
2729
}
28-
appLoading.value = false
30+
trackUiLoadingStop(loaderTrackingId)
2931
console.info('App ready')
3032
})
3133
@@ -57,7 +59,7 @@ const handleError = (error: ErrorI) => {
5759
errorInfo.value = getDefaultError()
5860
errorContactInfo.value = true
5961
errorDisplay.value = true
60-
// Sentry.captureException(error)
62+
// Sentry.captureException(error)
6163
}
6264
}
6365
@@ -68,7 +70,11 @@ const clearDialog = () => {
6870
}
6971
7072
// watchers for errors
71-
watch(accountErrors.value, (val) => { if (val && val.length > 0) { handleError(val[0]) } })
73+
watch(accountErrors.value, (val) => {
74+
if (val && val.length > 0) {
75+
handleError(val[0])
76+
}
77+
})
7278
</script>
7379

7480
<template>
@@ -88,10 +94,7 @@ watch(accountErrors.value, (val) => { if (val && val.length > 0) { handleError(v
8894
<bcros-contact-info class="font-normal font-16 mt-4" :contacts="getContactInfo('registries')" />
8995
</template>
9096
</bcros-dialog>
91-
<div v-if="dashboardIsLoading || appLoading">
92-
<BcrosLoadingIcon class="animate-spin text-6xl text-gray-700 absolute top-40 left-[50%]" />
93-
</div>
94-
<NuxtPage v-else />
97+
<NuxtPage />
9598
</NuxtLayout>
9699
</div>
97100
</template>

src/components/bcros/LoadingIcon.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
<template>
2-
<UIcon class="text-5xl animate-spin" name="i-mdi-loading" data-cy="loading-icon" />
2+
<UIcon class="text-6xl text-gray-700 animate-spin" name="i-mdi-loading" data-cy="loading-icon" />
33
</template>

src/layouts/business.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
const route = useRoute()
33
const { isStaffAccount } = useBcrosAccount()
44
5+
const { dashboardIsLoading } = storeToRefs(useBcrosDashboardUi())
6+
57
const crumbConstructors = computed(() => {
68
if (isStaffAccount) {
79
return (route?.meta?.staffBreadcrumbs || []) as (() => BreadcrumbI)[]
@@ -18,7 +20,10 @@ onMounted(async () => {
1820
</script>
1921

2022
<template>
21-
<div class="app-container" data-cy="default-layout">
23+
<div v-if="dashboardIsLoading" class="w-screen h-screen flex items-center justify-center">
24+
<BcrosLoadingIcon />
25+
</div>
26+
<div v-else class="app-container" data-cy="default-layout">
2227
<bcros-header />
2328
<bcros-system-banner
2429
class="justify-center"

src/layouts/default.vue

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
const route = useRoute()
33
const { isStaffAccount } = useBcrosAccount()
44
5+
const { dashboardIsLoading } = storeToRefs(useBcrosDashboardUi())
6+
57
const crumbConstructors = computed(() => {
68
if (isStaffAccount) {
79
return (route?.meta?.staffBreadcrumbs || []) as (() => BreadcrumbI)[]
@@ -18,7 +20,10 @@ onMounted(async () => {
1820
</script>
1921

2022
<template>
21-
<div class="app-container" data-cy="default-layout">
23+
<div v-if="dashboardIsLoading" class="w-screen h-screen flex items-center justify-center">
24+
<BcrosLoadingIcon />
25+
</div>
26+
<div v-else class="app-container" data-cy="default-layout">
2227
<bcros-header />
2328
<bcros-system-banner
2429
class="justify-center"

src/stores/ui.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ export const useBcrosDashboardUi = defineStore('bcros/dashboardUi', () => {
77
}
88

99
const trackUiLoadingStop = (trackerUuidDone: string) => {
10-
const index = uiIsLoading.value.find(tracker => tracker === trackerUuidDone)
10+
const index = uiIsLoading.value.findIndex(tracker => tracker === trackerUuidDone)
1111
if (index !== -1) {
1212
uiIsLoading.value.splice(index, 1)
1313
}

0 commit comments

Comments
 (0)