Bluesky app fork with some witchin' additions 馃挮 witchsky.app
bluesky fork client
131
fork

Configure Feed

Select the types of activity you want to include in your feed.

at main 49 lines 1.4 kB view raw
1import {useQuery} from '@tanstack/react-query' 2 3import { 4 aggregateUserInterests, 5 createBskyTopicsHeader, 6} from '#/lib/api/feed/utils' 7import {getContentLanguages} from '#/state/preferences/languages' 8import {STALE} from '#/state/queries' 9import {usePreferencesQuery} from '#/state/queries/preferences' 10import {useAgent} from '#/state/session' 11 12export const createSuggestedStarterPacksQueryKey = (interests?: string[]) => [ 13 'suggested-starter-packs', 14 interests?.join(','), 15] 16 17export function useSuggestedStarterPacksQuery({ 18 enabled, 19 overrideInterests, 20}: { 21 enabled?: boolean 22 overrideInterests?: string[] 23}) { 24 const agent = useAgent() 25 const {data: preferences} = usePreferencesQuery() 26 const contentLangs = getContentLanguages().join(',') 27 28 return useQuery({ 29 enabled: !!preferences && enabled !== false, 30 staleTime: STALE.MINUTES.THREE, 31 queryKey: createSuggestedStarterPacksQueryKey(overrideInterests), 32 queryFn: async () => { 33 const {data} = await agent.app.bsky.unspecced.getSuggestedStarterPacks( 34 undefined, 35 { 36 headers: { 37 ...createBskyTopicsHeader( 38 overrideInterests 39 ? overrideInterests.join(',') 40 : aggregateUserInterests(preferences), 41 ), 42 'Accept-Language': contentLangs, 43 }, 44 }, 45 ) 46 return data 47 }, 48 }) 49}