Rename, reorg
This commit is contained in:
@@ -0,0 +1 @@
|
||||
export * as profile from '#/types/atproto/profile'
|
||||
@@ -21,15 +21,17 @@ export {
|
||||
/**
|
||||
* Matches any profile view exported by our SDK
|
||||
*/
|
||||
export type AnyView =
|
||||
export type AnyProfileView =
|
||||
| AppBskyActorDefs.ProfileViewBasic
|
||||
| AppBskyActorDefs.ProfileView
|
||||
| AppBskyActorDefs.ProfileViewDetailed
|
||||
|
||||
/**
|
||||
* Downgrades any profile view to the most basic form.
|
||||
* Maps any profile view type to `ProfileViewBasic`.
|
||||
*/
|
||||
export function anyToBasic(view: AnyView): AppBskyActorDefs.ProfileViewBasic {
|
||||
export function anyToBasic(
|
||||
view: AnyProfileView,
|
||||
): AppBskyActorDefs.ProfileViewBasic {
|
||||
return {
|
||||
$type: 'app.bsky.actor.defs#profileViewBasic',
|
||||
did: view.did,
|
||||
@@ -44,7 +46,7 @@ export function anyToBasic(view: AnyView): AppBskyActorDefs.ProfileViewBasic {
|
||||
}
|
||||
|
||||
/**
|
||||
* Downgrades a detailed profile view to the `ProfileView` form.
|
||||
* Maps `ProfileViewDetailed` to `ProfileView`.
|
||||
*/
|
||||
export function detailedToView(
|
||||
view: AppBskyActorDefs.ProfileViewDetailed,
|
||||
@@ -11,7 +11,7 @@ import {useModalControls} from '#/state/modals'
|
||||
import {useListMembersQuery} from '#/state/queries/list-members'
|
||||
import {useSession} from '#/state/session'
|
||||
import {ListFooter} from '#/components/Lists'
|
||||
import * as Profile from '#/types/profile'
|
||||
import * as atp from '#/types/atproto'
|
||||
import {ProfileCard} from '../profile/ProfileCard'
|
||||
import {ErrorMessage} from '../util/error/ErrorMessage'
|
||||
import {Button} from '../util/forms/Button'
|
||||
@@ -117,7 +117,7 @@ export function ListMembers({
|
||||
}, [fetchNextPage])
|
||||
|
||||
const onPressEditMembership = React.useCallback(
|
||||
(profile: Profile.AnyView) => {
|
||||
(profile: atp.profile.AnyProfileView) => {
|
||||
openModal({
|
||||
name: 'user-add-remove-lists',
|
||||
subject: profile.did,
|
||||
@@ -132,7 +132,7 @@ export function ListMembers({
|
||||
// =
|
||||
|
||||
const renderMemberButton = React.useCallback(
|
||||
(profile: Profile.AnyView) => {
|
||||
(profile: atp.profile.AnyProfileView) => {
|
||||
if (!isOwner) {
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import {useLingui} from '@lingui/react'
|
||||
|
||||
import {Shadow} from '#/state/cache/types'
|
||||
import {useProfileFollowMutationQueue} from '#/state/queries/profile'
|
||||
import * as Profile from '#/types/profile'
|
||||
import * as atp from '#/types/atproto'
|
||||
import {Button, ButtonType} from '../util/forms/Button'
|
||||
import * as Toast from '../util/Toast'
|
||||
|
||||
@@ -17,7 +17,7 @@ export function FollowButton({
|
||||
}: {
|
||||
unfollowedType?: ButtonType
|
||||
followedType?: ButtonType
|
||||
profile: Shadow<Profile.AnyView>
|
||||
profile: Shadow<atp.profile.AnyProfileView>
|
||||
labelStyle?: StyleProp<TextStyle>
|
||||
logContext: 'ProfileCard' | 'StarterPackProfilesList'
|
||||
}) {
|
||||
|
||||
@@ -24,7 +24,7 @@ import {
|
||||
shouldShowKnownFollowers,
|
||||
} from '#/components/KnownFollowers'
|
||||
import * as Pills from '#/components/Pills'
|
||||
import * as Profile from '#/types/profile'
|
||||
import * as atp from '#/types/atproto'
|
||||
import {Link} from '../util/Link'
|
||||
import {Text} from '../util/text/Text'
|
||||
import {PreviewableUserAvatar} from '../util/UserAvatar'
|
||||
@@ -42,11 +42,13 @@ export function ProfileCard({
|
||||
showKnownFollowers,
|
||||
}: {
|
||||
testID?: string
|
||||
profile: Profile.AnyView
|
||||
profile: atp.profile.AnyProfileView
|
||||
noModFilter?: boolean
|
||||
noBg?: boolean
|
||||
noBorder?: boolean
|
||||
renderButton?: (profile: Shadow<Profile.AnyView>) => React.ReactNode
|
||||
renderButton?: (
|
||||
profile: Shadow<atp.profile.AnyProfileView>,
|
||||
) => React.ReactNode
|
||||
onPress?: () => void
|
||||
style?: StyleProp<ViewStyle>
|
||||
showKnownFollowers?: boolean
|
||||
@@ -59,7 +61,7 @@ export function ProfileCard({
|
||||
|
||||
const onBeforePress = React.useCallback(() => {
|
||||
onPress?.()
|
||||
precacheProfile(queryClient, Profile.anyToBasic(profile))
|
||||
precacheProfile(queryClient, atp.profile.anyToBasic(profile))
|
||||
}, [onPress, profile, queryClient])
|
||||
|
||||
if (!moderationOpts) {
|
||||
@@ -125,7 +127,7 @@ export function ProfileCard({
|
||||
<View style={styles.layoutButton}>{renderButton(profile)}</View>
|
||||
) : undefined}
|
||||
</View>
|
||||
{Profile.isView(profile) || Profile.isDetailedView(profile) ? (
|
||||
{atp.profile.isView(profile) || atp.profile.isDetailedView(profile) ? (
|
||||
<>
|
||||
{profile.description || knownFollowersVisible ? (
|
||||
<View style={styles.details}>
|
||||
@@ -142,7 +144,7 @@ export function ProfileCard({
|
||||
a.gap_sm,
|
||||
!!profile.description && a.mt_md,
|
||||
]}>
|
||||
{Profile.isDetailedView(profile) && (
|
||||
{atp.profile.isDetailedView(profile) && (
|
||||
<KnownFollowers
|
||||
minimal
|
||||
profile={profile}
|
||||
|
||||
Reference in New Issue
Block a user