forked from Mirrors/elk
feat(search): ✨ show hashtag stats and chart in autocomplete (#779)
This commit is contained in:
parent
4eb9d52fc2
commit
6b5b1f2aed
1 changed files with 11 additions and 4 deletions
|
@ -1,5 +1,11 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
defineProps<{ hashtag: any }>()
|
import type { History, Tag } from 'masto'
|
||||||
|
|
||||||
|
const { hashtag } = defineProps<{ hashtag: Tag }>()
|
||||||
|
|
||||||
|
const totalTrend = $computed(() =>
|
||||||
|
hashtag.history?.reduce((total: number, item) => total + (Number(item.accounts) || 0), 0),
|
||||||
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
|
@ -11,9 +17,10 @@ defineProps<{ hashtag: any }>()
|
||||||
<span>
|
<span>
|
||||||
{{ hashtag.name }}
|
{{ hashtag.name }}
|
||||||
</span>
|
</span>
|
||||||
<span text-xs text-secondary>
|
<CommonTrending :history="hashtag.history" text-xs text-secondary truncate />
|
||||||
{{ hashtag.following ? 'Following' : 'Not Following' }}
|
</div>
|
||||||
</span>
|
<div v-if="totalTrend" w-12 h-12 flex place-items-center place-content-center ml-auto>
|
||||||
|
<CommonTrendingCharts :history="hashtag.history" text-xs text-secondary />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
Loading…
Reference in a new issue