New progress guide - 10 follows (#7128)

* new follow-10 progress guide

* find follows dialog

* wip tabs

* flatlist version with search

* hardcode out jake gold

* lazy load followup suggestions

* Update src/components/ProgressGuide/FollowDialog.tsx

Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>

* comment out replacing, enable paging

* rm autofocus

* find shadow profiles in paginated search

* clear search when press tabs

* better tab a11y

* fix label

* adjust scroll indicator insets

* do the same scroll indicator adjustment for searchable people list

* hardcode jake to just be 'tech'

* Retain state on close/reopen

* only change follow btn color when not followed

* add guide to inside dialog

* fix task alignment

* Enable contextual suggestions

* WIP: show multiple suggestions

* Rework so it animates well

* Show more items

* remove card style

* move tabs to own component

* split out header top

* scroll active tab into view

* rm log

* Improve perf a bit

* boost popular interests over alphabetical ones

* scroll active tab into view

* revert back to round buttons

* Fix overrenders of the tab bar items

* Fix unintended animation

* Scroll initial into view if needed

* Unlift state, the dialog thing breaks lifting

* Persist simply

* Fix empty state

* Fix incorrect gate exposure

* Fix another bad useGate

* Nit

---------

Co-authored-by: surfdude29 <149612116+surfdude29@users.noreply.github.com>
Co-authored-by: Dan Abramov <dan.abramov@gmail.com>
This commit is contained in:
Samuel Newman
2024-12-17 17:13:18 +00:00
committed by GitHub
parent 32611391a3
commit 0cbb03cd14
17 changed files with 1039 additions and 47 deletions
+22 -4
View File
@@ -1,6 +1,7 @@
import {AppBskyActorDefs, AppBskyActorSearchActors} from '@atproto/api'
import {
InfiniteData,
keepPreviousData,
QueryClient,
QueryKey,
useInfiniteQuery,
@@ -13,10 +14,8 @@ import {useAgent} from '#/state/session'
const RQKEY_ROOT = 'actor-search'
export const RQKEY = (query: string) => [RQKEY_ROOT, query]
export const RQKEY_PAGINATED = (query: string) => [
`${RQKEY_ROOT}_paginated`,
query,
]
const RQKEY_ROOT_PAGINATED = `${RQKEY_ROOT}_paginated`
export const RQKEY_PAGINATED = (query: string) => [RQKEY_ROOT_PAGINATED, query]
export function useActorSearch({
query,
@@ -42,9 +41,11 @@ export function useActorSearch({
export function useActorSearchPaginated({
query,
enabled,
maintainData,
}: {
query: string
enabled?: boolean
maintainData?: boolean
}) {
const agent = useAgent()
return useInfiniteQuery<
@@ -67,6 +68,7 @@ export function useActorSearchPaginated({
enabled: enabled && !!query,
initialPageParam: undefined,
getNextPageParam: lastPage => lastPage.cursor,
placeholderData: maintainData ? keepPreviousData : undefined,
})
}
@@ -89,4 +91,20 @@ export function* findAllProfilesInQueryData(
}
}
}
const queryDatasPaginated = queryClient.getQueriesData<
InfiniteData<AppBskyActorSearchActors.OutputSchema>
>({
queryKey: [RQKEY_ROOT_PAGINATED],
})
for (const [_queryKey, queryData] of queryDatasPaginated) {
if (!queryData) {
continue
}
for (const actor of queryData.pages.flatMap(page => page.actors)) {
if (actor.did === did) {
yield actor
}
}
}
}
+8 -1
View File
@@ -103,7 +103,13 @@ export function useSuggestedFollowsQuery(options?: SuggestedFollowsOptions) {
})
}
export function useSuggestedFollowsByActorQuery({did}: {did: string}) {
export function useSuggestedFollowsByActorQuery({
did,
enabled,
}: {
did: string
enabled?: boolean
}) {
const agent = useAgent()
return useQuery({
queryKey: suggestedFollowsByActorQueryKey(did),
@@ -116,6 +122,7 @@ export function useSuggestedFollowsByActorQuery({did}: {did: string}) {
: res.data.suggestions.filter(profile => !profile.viewer?.following)
return {suggestions}
},
enabled,
})
}