feat(search): show hashtag stats and chart in autocomplete (#779)

zio/stable
Piotrek Tomczewski 2023-01-04 21:08:05 +01:00 committed by GitHub
parent 4eb9d52fc2
commit 6b5b1f2aed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 4 deletions

View File

@ -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>