Something went wrong. Try again.
Mirror — see github.com/blacksky-algorithms/blacksky.community
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829import {createWidgetTopicUrl} from '#/features/trendingWidget/links'import TrendingTopicsWidget from '#/features/trendingWidget/TrendingTopicsWidget'import {type app} from '#/lexicons'
export type TrendingWidgetCopy = { emptyMessage: string shortTitle: string title: string}
type Trend = app.bsky.unspecced.getTrends.$OutputBody['trends'][number]
export function updateTrendingWidgetSnapshot( trends: Trend[], copy: TrendingWidgetCopy, recId?: string,) { TrendingTopicsWidget.updateSnapshot({ emptyMessage: copy.emptyMessage, shortTitle: copy.shortTitle, title: copy.title, topics: trends.map((trend, index) => ({ displayName: trend.displayName, description: trend.description, destination: createWidgetTopicUrl(trend.link, {rank: index + 1, recId}), })), })}