mirror of
https://github.com/elk-zone/elk.git
synced 2024-11-27 19:57:50 +03:00
fix: hashtag id
This commit is contained in:
parent
30e4ef57df
commit
d386a2dbbe
5 changed files with 9 additions and 7 deletions
|
@ -42,7 +42,7 @@ const searchResult = $computed<QueryResult>(() => {
|
||||||
const hashtagList = hashtags.value.slice(0, 3)
|
const hashtagList = hashtags.value.slice(0, 3)
|
||||||
.map<HashTagResult>(hashtag => ({
|
.map<HashTagResult>(hashtag => ({
|
||||||
type: 'hashtag',
|
type: 'hashtag',
|
||||||
id: hashtag.id,
|
id: `hashtag-${hashtag.name}`,
|
||||||
hashtag,
|
hashtag,
|
||||||
to: getTagRoute(hashtag.name),
|
to: getTagRoute(hashtag.name),
|
||||||
}))
|
}))
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import type { Tag } from 'masto'
|
import type { Tag } from 'masto'
|
||||||
|
|
||||||
const { hashtag } = defineProps<{ hashtag: Tag }>()
|
const { hashtag } = defineProps<{
|
||||||
|
hashtag: Tag
|
||||||
|
}>()
|
||||||
|
|
||||||
const totalTrend = $computed(() =>
|
const totalTrend = $computed(() =>
|
||||||
hashtag.history?.reduce((total: number, item) => total + (Number(item.accounts) || 0), 0),
|
hashtag.history?.reduce((total: number, item) => total + (Number(item.accounts) || 0), 0),
|
||||||
|
|
|
@ -17,7 +17,7 @@ const results = computed(() => {
|
||||||
const results = [
|
const results = [
|
||||||
...hashtags.value.slice(0, 3).map<HashTagResult>(hashtag => ({
|
...hashtags.value.slice(0, 3).map<HashTagResult>(hashtag => ({
|
||||||
type: 'hashtag',
|
type: 'hashtag',
|
||||||
id: hashtag.id,
|
id: `hashtag-${hashtag.name}`,
|
||||||
hashtag,
|
hashtag,
|
||||||
to: getTagRoute(hashtag.name),
|
to: getTagRoute(hashtag.name),
|
||||||
})),
|
})),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { Account, Status } from 'masto'
|
import type { Account, Status, Tag } from 'masto'
|
||||||
import type { RouteLocation } from 'vue-router'
|
import type { RouteLocation } from 'vue-router'
|
||||||
|
|
||||||
export type BuildResult<K extends keyof any, T> = {
|
export type BuildResult<K extends keyof any, T> = {
|
||||||
|
@ -10,7 +10,7 @@ export type BuildResult<K extends keyof any, T> = {
|
||||||
href: string
|
href: string
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
export type HashTagResult = BuildResult<'hashtag', any>
|
export type HashTagResult = BuildResult<'hashtag', Tag>
|
||||||
export type AccountResult = BuildResult<'account', Account>
|
export type AccountResult = BuildResult<'account', Account>
|
||||||
export type StatusResult = BuildResult<'status', Status>
|
export type StatusResult = BuildResult<'status', Status>
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { MaybeRef } from '@vueuse/core'
|
import type { MaybeRef } from '@vueuse/core'
|
||||||
import type { Account, Paginator, Results, SearchParams, Status } from 'masto'
|
import type { Account, Paginator, Results, SearchParams, Status, Tag } from 'masto'
|
||||||
|
|
||||||
export interface UseSearchOptions {
|
export interface UseSearchOptions {
|
||||||
type?: MaybeRef<'accounts' | 'hashtags' | 'statuses'>
|
type?: MaybeRef<'accounts' | 'hashtags' | 'statuses'>
|
||||||
|
@ -11,7 +11,7 @@ export function useSearch(query: MaybeRef<string>, options?: UseSearchOptions) {
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
const statuses = ref<Status[]>([])
|
const statuses = ref<Status[]>([])
|
||||||
const accounts = ref<Account[]>([])
|
const accounts = ref<Account[]>([])
|
||||||
const hashtags = ref<any[]>([])
|
const hashtags = ref<Tag[]>([])
|
||||||
|
|
||||||
let paginator: Paginator<SearchParams, Results> | undefined
|
let paginator: Paginator<SearchParams, Results> | undefined
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue