fix loading spinner

This commit is contained in:
Nolan Lawson 2018-01-30 22:21:31 -08:00
parent f015e0e2a9
commit cb91271e23
2 changed files with 23 additions and 31 deletions

View file

@ -1,12 +1,5 @@
<div class="lazy-timeline"> <div class="lazy-timeline">
{{#if !$initialized}} {{#await importTimeline}}
<!-- <div transition:fade> -->
<div class="loading-page">
<LoadingSpinner />
</div>
<!-- </div> -->
{{/if}}
{{#await promise}}
{{then constructor}} {{then constructor}}
<:Component {constructor} :timeline /> <:Component {constructor} :timeline />
{{catch error}} {{catch error}}
@ -18,23 +11,9 @@
width: 100%; width: 100%;
min-height: 60vh; min-height: 60vh;
} }
.loading-page {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
display: flex;
align-items: center;
justify-content: center;
z-index: 50;
}
</style> </style>
<script> <script>
import { importTimeline } from '../../_utils/asyncModules' import { importTimeline } from '../../_utils/asyncModules'
import LoadingSpinner from '../LoadingSpinner.html'
// TODO: the transition seems to occasionally cause an error in Svelte, transition_run is undefined
//import { fade } from 'svelte-transitions'
import { store } from '../../_store/store' import { store } from '../../_store/store'
export default { export default {
@ -46,13 +25,7 @@
}, },
store: () => store, store: () => store,
data: () => ({ data: () => ({
promise: importTimeline() importTimeline: importTimeline()
}), })
components: {
LoadingSpinner
}/*,
transitions: {
fade
}*/
} }
</script> </script>

View file

@ -1,4 +1,9 @@
<div class="timeline" role="feed" aria-label="{{label}}"> <div class="timeline" role="feed" aria-label="{{label}}">
{{#if !$initialized}}
<div class="loading-page">
<LoadingSpinner />
</div>
{{/if}}
{{#if virtual}} {{#if virtual}}
<VirtualList component="{{StatusVirtualListItem}}" <VirtualList component="{{StatusVirtualListItem}}"
:makeProps :makeProps
@ -26,6 +31,18 @@
<style> <style>
.timeline { .timeline {
min-height: 60vh; min-height: 60vh;
position: relative;
}
.loading-page {
position: absolute;
top: 0;
left: 0;
right: 0;
height: 100%;
display: flex;
align-items: center;
justify-content: center;
z-index: 50;
} }
</style> </style>
<script> <script>
@ -38,6 +55,7 @@
import { timelines } from '../../_static/timelines' import { timelines } from '../../_static/timelines'
import { database } from '../../_utils/database/database' import { database } from '../../_utils/database/database'
import { initializeTimeline, fetchStatusesOnScrollToBottom, setupTimeline } from '../../_actions/timeline' import { initializeTimeline, fetchStatusesOnScrollToBottom, setupTimeline } from '../../_actions/timeline'
import LoadingSpinner from '../LoadingSpinner.html'
export default { export default {
async oncreate() { async oncreate() {
@ -82,7 +100,8 @@
store: () => store, store: () => store,
components: { components: {
VirtualList, VirtualList,
PseudoVirtualList PseudoVirtualList,
LoadingSpinner
}, },
methods: { methods: {
initialize() { initialize() {