1
0
Fork 1
mirror of https://github.com/elk-zone/elk.git synced 2024-11-10 10:59:58 +00:00
elk/components/common/CommonTrending.vue

24 lines
478 B
Vue
Raw Normal View History

2022-12-11 10:52:36 +00:00
<script lang="ts" setup>
2023-01-08 06:21:09 +00:00
import type { mastodon } from 'masto'
2022-12-11 10:52:36 +00:00
const {
history,
maxDay = 2,
} = defineProps<{
2023-01-08 06:21:09 +00:00
history: mastodon.v1.TagHistory[]
2022-12-11 10:52:36 +00:00
maxDay?: number
}>()
const ongoingHot = computed(() => history.slice(0, maxDay))
2022-12-11 10:52:36 +00:00
const people = computed(() =>
ongoingHot.value.reduce((total: number, item) => total + (Number(item.accounts) || 0), 0),
2022-12-11 10:52:36 +00:00
)
</script>
<template>
<p>
{{ $t('command.n_people_in_the_past_n_days', [people, maxDay]) }}
2022-12-11 10:52:36 +00:00
</p>
</template>