frontend/src/components/misc/ready.vue

66 lines
1.1 KiB
Vue

<template>
<template v-if="ready">
<slot/>
</template>
<section v-else-if="error !== ''">
{{ error }}
</section>
<section class="vikunja-loading" v-else>
<img alt="Vikunja" :src="logoUrl" width="100" height="100"/>
<p>
<span class="loader-container is-loading-small is-loading"></span>
{{ $t('home.vikunjaLoading') }}
</p>
</section>
</template>
<script>
import logoUrl from '@/assets/logo.svg'
import {setLanguage} from '@/i18n'
export default {
name: 'ready',
data() {
return {
logoUrl,
error: '',
}
},
mounted() {
this.$store.dispatch('loadApp')
.catch(e => {
this.error = e
})
},
computed: {
ready() {
return this.$store.state.vikunjaReady
},
},
}
</script>
<style lang="scss" scoped>
.vikunja-loading {
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
width: 100vw;
flex-direction: column;
img {
margin-bottom: 1rem;
}
.loader-container {
margin-right: 1rem;
&.is-loading:after {
border-left-color: $grey-400;
border-bottom-color: $grey-400;
}
}
}
</style>