diff options
author | Eric Bailey <git@esb.lol> | 2024-06-14 12:32:57 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-14 12:32:57 -0500 |
commit | 36e976fe5c35f66dee51d15b1767da90e8f7a817 (patch) | |
tree | 4012036da2bb6453bf399cfa2f8cccf37415e4d4 /src/state/queries/feed.ts | |
parent | 94c1f4968d7a09e04389b25a17f0125ffc375db3 (diff) | |
download | voidsky-36e976fe5c35f66dee51d15b1767da90e8f7a817.tar.zst |
Redo explore page (#4491)
* Redo explore page, wip * Remove circle icons * Load more styling * Lower limit * Some styling tweaks * Abstract * Add tab, query, factor out * Revert unneeded change * Revert unneeded change v2 * Update copy * Load more styling * Header styles * The thin blue line * Make sure it's hairline * Update query keys * Border * Expand avis * Very load more copy
Diffstat (limited to 'src/state/queries/feed.ts')
-rw-r--r-- | src/state/queries/feed.ts | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/state/queries/feed.ts b/src/state/queries/feed.ts index fed23f5b1..2981b41b4 100644 --- a/src/state/queries/feed.ts +++ b/src/state/queries/feed.ts @@ -190,8 +190,10 @@ export const KNOWN_AUTHED_ONLY_FEEDS = [ type GetPopularFeedsOptions = {limit?: number} -export function createGetPopularFeedsQueryKey(...args: any[]) { - return ['getPopularFeeds', ...args] +export function createGetPopularFeedsQueryKey( + options?: GetPopularFeedsOptions, +) { + return ['getPopularFeeds', options] } export function useGetPopularFeedsQuery(options?: GetPopularFeedsOptions) { @@ -299,6 +301,34 @@ export function useSearchPopularFeedsMutation() { }) } +const popularFeedsSearchQueryKeyRoot = 'popularFeedsSearch' +export const createPopularFeedsSearchQueryKey = (query: string) => [ + popularFeedsSearchQueryKeyRoot, + query, +] + +export function usePopularFeedsSearch({ + query, + enabled, +}: { + query: string + enabled?: boolean +}) { + const agent = useAgent() + return useQuery({ + enabled, + queryKey: createPopularFeedsSearchQueryKey(query), + queryFn: async () => { + const res = await agent.app.bsky.unspecced.getPopularFeedGenerators({ + limit: 10, + query: query, + }) + + return res.data.feeds + }, + }) +} + export type SavedFeedSourceInfo = FeedSourceInfo & { savedFeed: AppBskyActorDefs.SavedFeed } |