feat: router load indicator + UI fixes

pull/5698/head
Nicolas Giard 2 years ago
parent c3bd7ff97e
commit bae96fbcbf
No known key found for this signature in database
GPG Key ID: 85061B8F9D55B7C8

@ -478,11 +478,11 @@ exports.up = async knex => {
localeNamespaces: [], localeNamespaces: [],
theme: { theme: {
dark: false, dark: false,
colorPrimary: '#1976d2', colorPrimary: '#1976D2',
colorSecondary: '#02c39a', colorSecondary: '#02C39A',
colorAccent: '#f03a47', colorAccent: '#FF9800',
colorHeader: '#000000', colorHeader: '#000000',
colorSidebar: '#1976d2', colorSidebar: '#1976D2',
injectCSS: '', injectCSS: '',
injectHead: '', injectHead: '',
injectBody: '', injectBody: '',

@ -86,14 +86,15 @@ module.exports = class Site extends Model {
localeNamespaces: [], localeNamespaces: [],
theme: { theme: {
dark: false, dark: false,
colorPrimary: '#1976d2', colorPrimary: '#1976D2',
colorSecondary: '#02c39a', colorSecondary: '#02C39A',
colorAccent: '#f03a47', colorAccent: '#FF9800',
colorHeader: '#000000', colorHeader: '#000000',
colorSidebar: '#1976d2', colorSidebar: '#1976D2',
injectCSS: '', injectCSS: '',
injectHead: '', injectHead: '',
injectBody: '', injectBody: '',
contentWidth: 'full',
sidebarPosition: 'left', sidebarPosition: 'left',
tocPosition: 'right', tocPosition: 'right',
showSharingMenu: true, showSharingMenu: true,

@ -50,6 +50,7 @@ if (typeof siteConfig !== 'undefined') {
} }
router.beforeEach(async (to, from) => { router.beforeEach(async (to, from) => {
siteStore.routerLoading = true
if (!siteStore.id) { if (!siteStore.id) {
console.info('No pre-cached site config. Loading site info...') console.info('No pre-cached site config. Loading site info...')
await siteStore.loadSite(window.location.hostname) await siteStore.loadSite(window.location.hostname)
@ -62,5 +63,6 @@ router.afterEach(() => {
state.isInitialized = true state.isInitialized = true
document.querySelector('.init-loading').remove() document.querySelector('.init-loading').remove()
} }
siteStore.routerLoading = false
}) })
</script> </script>

@ -55,9 +55,9 @@ q-header.bg-header.text-white.site-header(
) )
q-space q-space
transition(name='syncing') transition(name='syncing')
q-spinner-rings.q-mr-sm( q-spinner-rings(
v-show='siteStore.routerLoading' v-show='siteStore.routerLoading'
color='orange' color='accent'
size='34px' size='34px'
) )
q-btn.q-ml-md( q-btn.q-ml-md(
@ -113,18 +113,5 @@ const state = reactive({
</script> </script>
<style lang="scss"> <style lang="scss">
.syncing-enter-active {
animation: syncing-anim .1s;
}
.syncing-leave-active {
animation: syncing-anim 1s reverse;
}
@keyframes syncing-anim {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
</style> </style>

@ -564,7 +564,7 @@ const localAuthId = computed(() => {
const localAuth = computed({ const localAuth = computed({
get () { get () {
return localAuthId.value ? _get(state.user.auth, localAuthId.value, {}) : {} return localAuthId.value ? state.user.auth?.[localAuthId.value] || {} : {}
}, },
set (val) { set (val) {
if (localAuthId.value) { if (localAuthId.value) {

@ -108,7 +108,7 @@ body::-webkit-scrollbar-thumb {
// BUTTONS // BUTTONS
// ------------------------------------------------------------------ // ------------------------------------------------------------------
#app .acrylic-btn { .q-btn.acrylic-btn {
.q-focus-helper { .q-focus-helper {
background-color: currentColor; background-color: currentColor;
opacity: .1; opacity: .1;
@ -168,6 +168,25 @@ body::-webkit-scrollbar-thumb {
} }
} }
// ------------------------------------------------------------------
// LOADING ANIMATIONS
// ------------------------------------------------------------------
.syncing-enter-active {
animation: syncing-anim .1s;
}
.syncing-leave-active {
animation: syncing-anim 1s reverse;
}
@keyframes syncing-anim {
0% {
opacity: 0;
}
100% {
opacity: 1;
}
}
// ------------------------------------------------------------------ // ------------------------------------------------------------------
// IMPORTS // IMPORTS
// ------------------------------------------------------------------ // ------------------------------------------------------------------

@ -16,10 +16,11 @@ q-layout.admin(view='hHh Lpr lff')
) )
q-toolbar(style='height: 64px;', dark) q-toolbar(style='height: 64px;', dark)
q-space q-space
q-spinner-tail( transition(name='syncing')
v-show='siteStore.routerLoading' q-spinner-rings(
color='blue' v-show='siteStore.routerLoading'
size='sm' color='accent'
size='34px'
) )
q-btn.q-ml-md(flat, dense, icon='las la-times-circle', label='Exit' color='pink', to='/') q-btn.q-ml-md(flat, dense, icon='las la-times-circle', label='Exit' color='pink', to='/')
account-menu account-menu

@ -85,7 +85,7 @@ q-page.admin-groups
q-btn.acrylic-btn( q-btn.acrylic-btn(
flat flat
icon='las la-trash' icon='las la-trash'
:color='props.row.isSystem ? `grey` : `accent`' :color='props.row.isSystem ? `grey` : `negative`'
:disabled='props.row.isSystem' :disabled='props.row.isSystem'
@click='deleteGroup(props.row)' @click='deleteGroup(props.row)'
) )

@ -92,7 +92,7 @@ q-page.admin-locale
q-btn.acrylic-btn( q-btn.acrylic-btn(
flat flat
icon='las la-trash' icon='las la-trash'
color='accent' color='negative'
@click='deleteSite(site)' @click='deleteSite(site)'
) )
</template> </template>

@ -400,6 +400,7 @@ Total RAM: ${state.info.ramTotal}`
clip.on('success', () => { clip.on('success', () => {
$q.notify({ $q.notify({
type: 'positive',
message: 'Info copied successfully', message: 'Info copied successfully',
icon: 'las la-clipboard' icon: 'las la-clipboard'
}) })

@ -358,7 +358,7 @@ function resetColors () {
state.config.dark = false state.config.dark = false
state.config.colorPrimary = '#1976D2' state.config.colorPrimary = '#1976D2'
state.config.colorSecondary = '#02C39A' state.config.colorSecondary = '#02C39A'
state.config.colorAccent = '#f03a47' state.config.colorAccent = '#FF9800'
state.config.colorHeader = '#000' state.config.colorHeader = '#000'
state.config.colorSidebar = '#1976D2' state.config.colorSidebar = '#1976D2'
} }

@ -99,7 +99,7 @@ q-page.admin-groups
v-if='!props.row.isSystem' v-if='!props.row.isSystem'
flat flat
icon='las la-trash' icon='las la-trash'
color='accent' color='negative'
@click='deleteUser(props.row)' @click='deleteUser(props.row)'
) )
</template> </template>

Loading…
Cancel
Save