Bluesky app fork with some witchin' additions 馃挮 witchsky.app
bluesky fork client
at main 49 lines 1.5 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 createOnboardingSuggestedStarterPacksQueryKey = ( 13 interests?: string[], 14) => ['onboarding-suggested-starter-packs', interests?.join(',')] 15 16export function useOnboardingSuggestedStarterPacksQuery({ 17 enabled, 18 overrideInterests, 19}: { 20 enabled?: boolean 21 overrideInterests?: string[] 22}) { 23 const agent = useAgent() 24 const {data: preferences} = usePreferencesQuery() 25 const contentLangs = getContentLanguages().join(',') 26 27 return useQuery({ 28 enabled: !!preferences && enabled !== false, 29 staleTime: STALE.MINUTES.THREE, 30 queryKey: createOnboardingSuggestedStarterPacksQueryKey(overrideInterests), 31 queryFn: async () => { 32 const {data} = 33 await agent.app.bsky.unspecced.getOnboardingSuggestedStarterPacks( 34 {limit: 6}, 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}