Something went wrong. Try again.
Monorepo for Tangled tangled.org
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930313233343536import { jsonGet } from "$lib/api/_request";import { getTrending } from "$lib/api/profile";import { toRepoCard } from "$lib/components/timeline/mappers";import type { BobbinContext } from "$lib/api/client";import type * as ShTangledFeedGetTimeline from "$lib/api/lexicons/types/sh/tangled/feed/getTimeline";
const PAGE_LIMIT = 50;
export interface LoadFeedOptions { ctx: BobbinContext; followingOnly: boolean;}
// shared by /timeline and the signed-in homescreen at /export const loadFeed = async ({ ctx, followingOnly }: LoadFeedOptions) => { try { const { feed } = await jsonGet<ShTangledFeedGetTimeline.$output>( ctx, "sh.tangled.feed.getTimeline", { followingOnly, limit: PAGE_LIMIT } ); return feed; } catch { return []; }};
export const loadTrendingRepos = async (ctx: BobbinContext) => { try { const trending = await getTrending(ctx); return trending.repos.map(toRepoCard); } catch { return []; }};