diondiondion 550299a71c [Glitch] Display collection in search results when searched by URL
Port fe4613ba325f0dd07176b6a7519a4e36d0f59a54 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2026-06-07 14:40:35 +02:00

25 lines
799 B
TypeScript

import type { ApiCollectionJSON } from '@/flavours/glitch/api_types/collections';
import type { ApiSearchResultsJSON } from '@/flavours/glitch/api_types/search';
import type { ApiHashtagJSON } from '@/flavours/glitch/api_types/tags';
export type SearchType = 'account' | 'hashtag' | 'accounts' | 'statuses';
export interface RecentSearch {
q: string;
type?: SearchType;
}
export interface SearchResults {
accounts: string[];
statuses: string[];
hashtags: ApiHashtagJSON[];
collections: ApiCollectionJSON[];
}
export const createSearchResults = (serverJSON: ApiSearchResultsJSON) => ({
accounts: serverJSON.accounts.map((account) => account.id),
statuses: serverJSON.statuses.map((status) => status.id),
hashtags: serverJSON.hashtags,
collections: serverJSON.collections,
});