refs #574 Add loading icon when load unread statuses

This commit is contained in:
AkiraFukushima 2021-12-18 01:32:25 +09:00
parent 64bcfef151
commit f4f7f9a3ab
No known key found for this signature in database
GPG Key ID: B6E51BAC4DE1A957
2 changed files with 15 additions and 2 deletions

View File

@ -5,7 +5,7 @@
<template v-slot="{ item, index, active }"> <template v-slot="{ item, index, active }">
<template v-if="item.id === 'loading-card'"> <template v-if="item.id === 'loading-card'">
<DynamicScrollerItem :item="item" :active="active" :size-dependencies="[item.id]" :data-index="index" :watchData="true"> <DynamicScrollerItem :item="item" :active="active" :size-dependencies="[item.id]" :data-index="index" :watchData="true">
<StatusLoading :since_id="item.since_id" :max_id="item.max_id" @load_since="fetchTimelineSince" /> <StatusLoading :since_id="item.since_id" :max_id="item.max_id" :loading="loadingMore" @load_since="fetchTimelineSince" />
</DynamicScrollerItem> </DynamicScrollerItem>
</template> </template>
<template v-else> <template v-else>

View File

@ -1,6 +1,7 @@
<template> <template>
<div class="status-loading" tabIndex="0" @click="onClick"> <div class="status-loading" tabIndex="0" @click="onClick">
<p class="load-text">{{ $t('cards.status_loading.message') }}</p> <img v-if="loading" src="../../assets/images/loading-spinner-wide.svg" class="load-icon" />
<p v-else class="load-text">{{ $t('cards.status_loading.message') }}</p>
<div class="fill-line"></div> <div class="fill-line"></div>
</div> </div>
</template> </template>
@ -16,10 +17,17 @@ export default {
since_id: { since_id: {
type: String, type: String,
default: '' default: ''
},
loading: {
type: Boolean,
default: false
} }
}, },
methods: { methods: {
onClick() { onClick() {
if (this.loading) {
return
}
if (this.since_id !== '') { if (this.since_id !== '') {
this.$emit('load_since', this.since_id) this.$emit('load_since', this.since_id)
} else if (this.max_id !== '') { } else if (this.max_id !== '') {
@ -37,6 +45,11 @@ export default {
padding: 12px 0; padding: 12px 0;
height: 36px; height: 36px;
border-bottom: 1px solid var(--theme-border-color); border-bottom: 1px solid var(--theme-border-color);
.load-icon {
width: 36px;
}
.load-text { .load-text {
cursor: pointer; cursor: pointer;
} }