feat: more to explore (#360)
This commit is contained in:
parent
a36a26d745
commit
183b1659d1
23 changed files with 530 additions and 17 deletions
28
components/common/CommonTrendingCharts.vue
Normal file
28
components/common/CommonTrendingCharts.vue
Normal file
|
@ -0,0 +1,28 @@
|
|||
<script lang="ts" setup>
|
||||
import type { History } from 'masto'
|
||||
import sparkline from '@fnando/sparkline'
|
||||
|
||||
const {
|
||||
history,
|
||||
} = $defineProps<{
|
||||
history?: History[]
|
||||
}>()
|
||||
|
||||
const historyNum = $computed(() => {
|
||||
if (!history)
|
||||
return [1, 1, 1, 1, 1, 1, 1]
|
||||
return [...history].reverse().map(item => Number(item.accounts) || 0)
|
||||
})
|
||||
|
||||
const sparklineEl = $ref<SVGSVGElement>()
|
||||
|
||||
watch([$$(historyNum), $$(sparklineEl)], ([historyNum, sparklineEl]) => {
|
||||
if (!sparklineEl)
|
||||
return
|
||||
sparkline(sparklineEl, historyNum)
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<svg ref="sparklineEl" class="sparkline" width="60" height="40" stroke-width="3" />
|
||||
</template>
|
Loading…
Add table
Add a link
Reference in a new issue