forked from Mirrors/elk
feat: . shortcut to show new items (#2612)
This commit is contained in:
parent
082650d458
commit
3769176eaa
6 changed files with 16 additions and 2 deletions
|
@ -65,6 +65,10 @@ const shortcutItemGroups = computed<ShortcutItemGroup[]>(() => [
|
||||||
description: t('magic_keys.groups.actions.compose'),
|
description: t('magic_keys.groups.actions.compose'),
|
||||||
shortcut: { keys: ['c'], isSequence: false },
|
shortcut: { keys: ['c'], isSequence: false },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
description: t('magic_keys.groups.actions.show_new_items'),
|
||||||
|
shortcut: { keys: ['.'], isSequence: false },
|
||||||
|
},
|
||||||
{
|
{
|
||||||
description: t('magic_keys.groups.actions.favourite'),
|
description: t('magic_keys.groups.actions.favourite'),
|
||||||
shortcut: { keys: ['f'], isSequence: false },
|
shortcut: { keys: ['f'], isSequence: false },
|
||||||
|
|
|
@ -174,7 +174,7 @@ const { formatNumber } = useHumanReadableNumber()
|
||||||
:virtualScroller="virtualScroller"
|
:virtualScroller="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(); clearNotifications() }">
|
<button id="elk_show_new_items" py-4 border="b base" flex="~ col" p-3 w-full text-primary font-bold @click="() => { update(); clearNotifications() }">
|
||||||
{{ $t('timeline.show_new_items', number, { named: { v: formatNumber(number) } }) }}
|
{{ $t('timeline.show_new_items', number, { named: { v: formatNumber(number) } }) }}
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -25,7 +25,7 @@ const showOriginSite = computed(() =>
|
||||||
<template>
|
<template>
|
||||||
<CommonPaginator v-bind="{ paginator, stream, preprocess, buffer, endMessage }" :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 id="elk_show_new_items" 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) } }) }}
|
||||||
</button>
|
</button>
|
||||||
</template>
|
</template>
|
||||||
|
|
|
@ -228,6 +228,7 @@
|
||||||
"compose": "Compose",
|
"compose": "Compose",
|
||||||
"favourite": "Favourite",
|
"favourite": "Favourite",
|
||||||
"search": "Search",
|
"search": "Search",
|
||||||
|
"show_new_items": "Show new items",
|
||||||
"title": "Actions"
|
"title": "Actions"
|
||||||
},
|
},
|
||||||
"media": {
|
"media": {
|
||||||
|
|
|
@ -228,6 +228,7 @@
|
||||||
"compose": "Redactar",
|
"compose": "Redactar",
|
||||||
"favourite": "Favorito",
|
"favourite": "Favorito",
|
||||||
"search": "Búsqueda",
|
"search": "Búsqueda",
|
||||||
|
"show_new_items": "Mostrar nuevas publicaciones",
|
||||||
"title": "Acciones"
|
"title": "Acciones"
|
||||||
},
|
},
|
||||||
"media": {
|
"media": {
|
||||||
|
|
|
@ -55,4 +55,12 @@ export default defineNuxtPlugin(({ $scrollToTop }) => {
|
||||||
?.click()
|
?.click()
|
||||||
}
|
}
|
||||||
whenever(logicAnd(isAuthenticated, notUsingInput, keys.b), toggleBoostActiveStatus)
|
whenever(logicAnd(isAuthenticated, notUsingInput, keys.b), toggleBoostActiveStatus)
|
||||||
|
|
||||||
|
const showNewItems = () => {
|
||||||
|
// TODO: find a better solution than clicking buttons...
|
||||||
|
document
|
||||||
|
?.querySelector<HTMLElement>('button#elk_show_new_items')
|
||||||
|
?.click()
|
||||||
|
}
|
||||||
|
whenever(logicAnd(isAuthenticated, notUsingInput, keys['.']), showNewItems)
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue