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