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
This commit is contained in:
Eric Bailey 2024-06-14 12:32:57 -05:00 committed by GitHub
parent 94c1f4968d
commit 36e976fe5c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 656 additions and 93 deletions

View file

@ -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
}

View file

@ -23,7 +23,10 @@ import {useAgent, useSession} from '#/state/session'
import {useModerationOpts} from '../preferences/moderation-opts'
const suggestedFollowsQueryKeyRoot = 'suggested-follows'
const suggestedFollowsQueryKey = [suggestedFollowsQueryKeyRoot]
const suggestedFollowsQueryKey = (options?: SuggestedFollowsOptions) => [
suggestedFollowsQueryKeyRoot,
options,
]
const suggestedFollowsByActorQueryKeyRoot = 'suggested-follows-by-actor'
const suggestedFollowsByActorQueryKey = (did: string) => [
@ -31,7 +34,9 @@ const suggestedFollowsByActorQueryKey = (did: string) => [
did,
]
export function useSuggestedFollowsQuery() {
type SuggestedFollowsOptions = {limit?: number}
export function useSuggestedFollowsQuery(options?: SuggestedFollowsOptions) {
const {currentAccount} = useSession()
const agent = useAgent()
const moderationOpts = useModerationOpts()
@ -46,12 +51,12 @@ export function useSuggestedFollowsQuery() {
>({
enabled: !!moderationOpts && !!preferences,
staleTime: STALE.HOURS.ONE,
queryKey: suggestedFollowsQueryKey,
queryKey: suggestedFollowsQueryKey(options),
queryFn: async ({pageParam}) => {
const contentLangs = getContentLanguages().join(',')
const res = await agent.app.bsky.actor.getSuggestions(
{
limit: 25,
limit: options?.limit || 25,
cursor: pageParam,
},
{