forked from coracle/flotilla
Improve loading indicator in channels
This commit is contained in:
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import {slide, fade} from "svelte/transition"
|
import {slide, fade} from "svelte/transition"
|
||||||
|
|
||||||
export let loading
|
export let loading = false
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<span class="flex min-h-10 items-center">
|
<span class="flex min-h-10 items-center">
|
||||||
|
|||||||
@@ -91,7 +91,7 @@
|
|||||||
})
|
})
|
||||||
|
|
||||||
let limit = 30
|
let limit = 30
|
||||||
let loading = true
|
let loading = sleep(5000)
|
||||||
let unsub: () => void
|
let unsub: () => void
|
||||||
let element: HTMLElement
|
let element: HTMLElement
|
||||||
let scroller: Scroller
|
let scroller: Scroller
|
||||||
@@ -135,6 +135,7 @@
|
|||||||
threshold: 3000,
|
threshold: 3000,
|
||||||
onScroll: () => {
|
onScroll: () => {
|
||||||
limit += 30
|
limit += 30
|
||||||
|
loading = sleep(5000)
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
@@ -146,10 +147,6 @@
|
|||||||
scroller?.stop()
|
scroller?.stop()
|
||||||
unsub?.()
|
unsub?.()
|
||||||
})
|
})
|
||||||
|
|
||||||
setTimeout(() => {
|
|
||||||
loading = false
|
|
||||||
}, 5000)
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="relative flex h-full flex-col">
|
<div class="relative flex h-full flex-col">
|
||||||
@@ -190,13 +187,11 @@
|
|||||||
{/if}
|
{/if}
|
||||||
{/each}
|
{/each}
|
||||||
<p class="flex h-10 items-center justify-center py-20">
|
<p class="flex h-10 items-center justify-center py-20">
|
||||||
<Spinner {loading}>
|
{#await loading}
|
||||||
{#if loading}
|
<Spinner loading>Looking for messages...</Spinner>
|
||||||
Looking for messages...
|
{:then}
|
||||||
{:else}
|
<Spinner>End of message history</Spinner>
|
||||||
End of message history
|
{/await}
|
||||||
{/if}
|
|
||||||
</Spinner>
|
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<ChannelCompose bind:editor {content} {onSubmit} />
|
<ChannelCompose bind:editor {content} {onSubmit} />
|
||||||
|
|||||||
Reference in New Issue
Block a user