diff options
author | dan <dan.abramov@gmail.com> | 2023-11-15 01:55:54 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-14 17:55:54 -0800 |
commit | e699df21c66f2f55d34af4d2a14c03d02274b43e (patch) | |
tree | 3112b234b0870ababc3eb8c0834d90bb61bf8fee /src/view/com/profile/ProfileCard.tsx | |
parent | d1cb74febea9725b028dca372e1b7d7e157ad24d (diff) | |
download | voidsky-e699df21c66f2f55d34af4d2a14c03d02274b43e.tar.zst |
Port Profile Followers/Follows to RQ (#1893)
* Port user followers to RQ * Port user follows to RQ * Start porting FollowButton to RQ * Fix RQ key * Check pending * Fix shadow and pending states * Rm unused * Remove last usage of useFollowProfile
Diffstat (limited to 'src/view/com/profile/ProfileCard.tsx')
-rw-r--r-- | src/view/com/profile/ProfileCard.tsx | 63 |
1 files changed, 35 insertions, 28 deletions
diff --git a/src/view/com/profile/ProfileCard.tsx b/src/view/com/profile/ProfileCard.tsx index 95f0ecd93..eeee17d4b 100644 --- a/src/view/com/profile/ProfileCard.tsx +++ b/src/view/com/profile/ProfileCard.tsx @@ -21,8 +21,10 @@ import { getProfileModerationCauses, getModerationCauseKey, } from 'lib/moderation' +import {Shadow} from '#/state/cache/types' import {useModerationOpts} from '#/state/queries/preferences' import {useProfileShadow} from '#/state/cache/profile-shadow' +import {useSession} from '#/state/session' export function ProfileCard({ testID, @@ -40,7 +42,9 @@ export function ProfileCard({ noBg?: boolean noBorder?: boolean followers?: AppBskyActorDefs.ProfileView[] | undefined - renderButton?: (profile: AppBskyActorDefs.ProfileViewBasic) => React.ReactNode + renderButton?: ( + profile: Shadow<AppBskyActorDefs.ProfileViewBasic>, + ) => React.ReactNode style?: StyleProp<ViewStyle> }) { const pal = usePalette('default') @@ -188,34 +192,37 @@ const FollowersList = observer(function FollowersListImpl({ ) }) -export const ProfileCardWithFollowBtn = observer( - function ProfileCardWithFollowBtnImpl({ - profile, - noBg, - noBorder, - followers, - }: { - profile: AppBskyActorDefs.ProfileViewBasic - noBg?: boolean - noBorder?: boolean - followers?: AppBskyActorDefs.ProfileView[] | undefined - }) { - const store = useStores() - const isMe = store.me.did === profile.did +export function ProfileCardWithFollowBtn({ + profile, + noBg, + noBorder, + followers, + dataUpdatedAt, +}: { + profile: AppBskyActorDefs.ProfileViewBasic + noBg?: boolean + noBorder?: boolean + followers?: AppBskyActorDefs.ProfileView[] | undefined + dataUpdatedAt: number +}) { + const {currentAccount} = useSession() + const isMe = profile.did === currentAccount?.did - return ( - <ProfileCard - profile={profile} - noBg={noBg} - noBorder={noBorder} - followers={followers} - renderButton={ - isMe ? undefined : () => <FollowButton profile={profile} /> - } - /> - ) - }, -) + return ( + <ProfileCard + profile={profile} + noBg={noBg} + noBorder={noBorder} + followers={followers} + renderButton={ + isMe + ? undefined + : profileShadow => <FollowButton profile={profileShadow} /> + } + dataUpdatedAt={dataUpdatedAt} + /> + ) +} const styles = StyleSheet.create({ outer: { |