mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-20 07:49:57 +00:00
feat: better messages for no favourites and bookmarks (#2031)
This commit is contained in:
parent
ccf115ca4c
commit
d4e0d5c5f5
6 changed files with 12 additions and 9 deletions
|
@ -11,7 +11,7 @@ const {
|
||||||
virtualScroller = false,
|
virtualScroller = false,
|
||||||
eventType = 'update',
|
eventType = 'update',
|
||||||
preprocess,
|
preprocess,
|
||||||
noEndMessage = false,
|
endMessage = true,
|
||||||
} = defineProps<{
|
} = defineProps<{
|
||||||
paginator: Paginator<T[], O>
|
paginator: Paginator<T[], O>
|
||||||
keyProp?: keyof T
|
keyProp?: keyof T
|
||||||
|
@ -19,7 +19,7 @@ const {
|
||||||
stream?: Promise<WsEvents>
|
stream?: Promise<WsEvents>
|
||||||
eventType?: 'notification' | 'update'
|
eventType?: 'notification' | 'update'
|
||||||
preprocess?: (items: (U | T)[]) => U[]
|
preprocess?: (items: (U | T)[]) => U[]
|
||||||
noEndMessage?: boolean
|
endMessage?: boolean | string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
defineSlots<{
|
defineSlots<{
|
||||||
|
@ -109,9 +109,9 @@ defineExpose({ createEntry, removeEntry, updateEntry })
|
||||||
<slot v-if="state === 'loading'" name="loading">
|
<slot v-if="state === 'loading'" name="loading">
|
||||||
<TimelineSkeleton />
|
<TimelineSkeleton />
|
||||||
</slot>
|
</slot>
|
||||||
<slot v-else-if="state === 'done' && !noEndMessage" name="done">
|
<slot v-else-if="state === 'done' && endMessage !== false" name="done">
|
||||||
<div p5 text-secondary italic text-center>
|
<div p5 text-secondary italic text-center>
|
||||||
{{ t('common.end_of_list') }}
|
{{ t(typeof endMessage === 'string' ? endMessage : 'common.end_of_list') }}
|
||||||
</div>
|
</div>
|
||||||
</slot>
|
</slot>
|
||||||
<div v-else-if="state === 'error'" p5 text-secondary>
|
<div v-else-if="state === 'error'" p5 text-secondary>
|
||||||
|
|
|
@ -30,7 +30,7 @@ async function edit(listId: string) {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CommonPaginator no-end-message :paginator="paginator">
|
<CommonPaginator :end-message="false" :paginator="paginator">
|
||||||
<template #default="{ item }">
|
<template #default="{ item }">
|
||||||
<div p4 hover:bg-active block w="100%" flex justify-between items-center gap-4>
|
<div p4 hover:bg-active block w="100%" flex justify-between items-center gap-4>
|
||||||
<p>{{ item.title }}</p>
|
<p>{{ item.title }}</p>
|
||||||
|
|
|
@ -3,5 +3,5 @@ const paginator = useMastoClient().v1.bookmarks.list()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<TimelinePaginator :paginator="paginator" />
|
<TimelinePaginator end-message="common.no_bookmarks" :paginator="paginator" />
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -3,5 +3,5 @@ const paginator = useMastoClient().v1.favourites.list()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<TimelinePaginator :paginator="paginator" />
|
<TimelinePaginator end-message="common.no_favourites" :paginator="paginator" />
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -4,13 +4,14 @@ import { DynamicScrollerItem } from 'vue-virtual-scroller'
|
||||||
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'
|
import 'vue-virtual-scroller/dist/vue-virtual-scroller.css'
|
||||||
import type { Paginator, WsEvents, mastodon } from 'masto'
|
import type { Paginator, WsEvents, mastodon } from 'masto'
|
||||||
|
|
||||||
const { paginator, stream, account, buffer = 10 } = defineProps<{
|
const { paginator, stream, account, buffer = 10, endMessage } = defineProps<{
|
||||||
paginator: Paginator<mastodon.v1.Status[], mastodon.v1.ListAccountStatusesParams>
|
paginator: Paginator<mastodon.v1.Status[], mastodon.v1.ListAccountStatusesParams>
|
||||||
stream?: Promise<WsEvents>
|
stream?: Promise<WsEvents>
|
||||||
context?: mastodon.v2.FilterContext
|
context?: mastodon.v2.FilterContext
|
||||||
account?: mastodon.v1.Account
|
account?: mastodon.v1.Account
|
||||||
preprocess?: (items: mastodon.v1.Status[]) => mastodon.v1.Status[]
|
preprocess?: (items: mastodon.v1.Status[]) => mastodon.v1.Status[]
|
||||||
buffer?: number
|
buffer?: number
|
||||||
|
endMessage?: boolean | string
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const { formatNumber } = useHumanReadableNumber()
|
const { formatNumber } = useHumanReadableNumber()
|
||||||
|
@ -22,7 +23,7 @@ const showOriginSite = $computed(() =>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<CommonPaginator v-bind="{ paginator, stream, preprocess, buffer }" :virtual-scroller="virtualScroller">
|
<CommonPaginator v-bind="{ paginator, stream, preprocess, buffer, endMessage }" :virtual-scroller="virtualScroller">
|
||||||
<template #updater="{ number, update }">
|
<template #updater="{ number, update }">
|
||||||
<button py-4 border="b base" flex="~ col" p-3 w-full text-primary font-bold @click="update">
|
<button py-4 border="b base" flex="~ col" p-3 w-full text-primary font-bold @click="update">
|
||||||
{{ $t('timeline.show_new_items', number, { named: { v: formatNumber(number) } }) }}
|
{{ $t('timeline.show_new_items', number, { named: { v: formatNumber(number) } }) }}
|
||||||
|
|
|
@ -98,6 +98,8 @@
|
||||||
"error": "ERROR",
|
"error": "ERROR",
|
||||||
"fetching": "Fetching...",
|
"fetching": "Fetching...",
|
||||||
"in": "in",
|
"in": "in",
|
||||||
|
"no_bookmarks": "No bookmarked posts yet",
|
||||||
|
"no_favourites": "No liked posts yet",
|
||||||
"not_found": "404 Not Found",
|
"not_found": "404 Not Found",
|
||||||
"offline_desc": "Seems like you are offline. Please check your network connection."
|
"offline_desc": "Seems like you are offline. Please check your network connection."
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue