diff --git a/src/components/ProfileCard.tsx b/src/components/ProfileCard.tsx
index a263d19461..b9d21bf9d3 100644
--- a/src/components/ProfileCard.tsx
+++ b/src/components/ProfileCard.tsx
@@ -220,8 +220,10 @@ export function NameAndHandlePlaceholder() {
export function Description({
profile: profileUnshadowed,
+ numberOfLines = 3,
}: {
profile: AppBskyActorDefs.ProfileViewDetailed
+ numberOfLines?: number
}) {
const profile = useProfileShadow(profileUnshadowed)
const {description} = profile
@@ -244,7 +246,7 @@ export function Description({
diff --git a/src/screens/Profile/Header/ProfileHeaderStandard.tsx b/src/screens/Profile/Header/ProfileHeaderStandard.tsx
index 36b00ff26f..909d80cb2c 100644
--- a/src/screens/Profile/Header/ProfileHeaderStandard.tsx
+++ b/src/screens/Profile/Header/ProfileHeaderStandard.tsx
@@ -6,7 +6,6 @@ import {
ModerationOpts,
RichText as RichTextAPI,
} from '@atproto/api'
-import {FontAwesomeIcon} from '@fortawesome/react-native-fontawesome'
import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
@@ -23,11 +22,12 @@ import {useRequireAuth, useSession} from '#/state/session'
import {useAnalytics} from 'lib/analytics/analytics'
import {sanitizeDisplayName} from 'lib/strings/display-names'
import {useProfileShadow} from 'state/cache/profile-shadow'
-import {ProfileHeaderSuggestedFollows} from '#/view/com/profile/ProfileHeaderSuggestedFollows'
+import {SimilarAccountsDialog} from '#/view/com/profile/ProfileHeaderSuggestedFollows'
import {ProfileMenu} from '#/view/com/profile/ProfileMenu'
import * as Toast from '#/view/com/util/Toast'
-import {atoms as a, useTheme} from '#/alf'
+import {atoms as a} from '#/alf'
import {Button, ButtonIcon, ButtonText} from '#/components/Button'
+import {useDialogControl} from '#/components/Dialog'
import {MessageProfileButton} from '#/components/dms/MessageProfileButton'
import {Check_Stroke2_Corner0_Rounded as Check} from '#/components/icons/Check'
import {PlusLarge_Stroke2_Corner0_Rounded as Plus} from '#/components/icons/Plus'
@@ -59,7 +59,6 @@ let ProfileHeaderStandard = ({
}: Props): React.ReactNode => {
const profile: Shadow =
useProfileShadow(profileUnshadowed)
- const t = useTheme()
const {currentAccount, hasSession} = useSession()
const {_} = useLingui()
const {openModal} = useModalControls()
@@ -68,13 +67,13 @@ let ProfileHeaderStandard = ({
() => moderateProfile(profile, moderationOpts),
[profile, moderationOpts],
)
- const [showSuggestedFollows, setShowSuggestedFollows] = React.useState(false)
const [queueFollow, queueUnfollow] = useProfileFollowMutationQueue(
profile,
'ProfileHeader',
)
const [_queueBlock, queueUnblock] = useProfileBlockMutationQueue(profile)
const unblockPromptControl = Prompt.usePromptControl()
+ const similarAccountsControl = useDialogControl()
const requireAuth = useRequireAuth()
const isBlockedUser =
profile.viewer?.blocking ||
@@ -104,7 +103,7 @@ let ProfileHeaderStandard = ({
),
)
if (gate('auto_show_prof_sugg_follows')) {
- setShowSuggestedFollows(true)
+ similarAccountsControl.open()
}
} catch (e: any) {
if (e?.name !== 'AbortError') {
@@ -205,32 +204,7 @@ let ProfileHeaderStandard = ({
)
) : !profile.viewer?.blockedBy ? (
<>
- {hasSession && (
- <>
-
-
- >
- )}
+ {hasSession && }
)}
- {showSuggestedFollows && (
- {
- if (showSuggestedFollows) {
- setShowSuggestedFollows(false)
- } else {
- track('ProfileHeader:SuggestedFollowsOpened')
- setShowSuggestedFollows(true)
- }
- }}
- />
- )}
+
)
}
diff --git a/src/view/com/profile/ProfileHeaderSuggestedFollows.tsx b/src/view/com/profile/ProfileHeaderSuggestedFollows.tsx
index 356b3f09cf..e2b144e1cc 100644
--- a/src/view/com/profile/ProfileHeaderSuggestedFollows.tsx
+++ b/src/view/com/profile/ProfileHeaderSuggestedFollows.tsx
@@ -1,23 +1,19 @@
import React from 'react'
-import {ScrollView, View} from 'react-native'
+import {View} from 'react-native'
+import {AppBskyActorDefs} from '@atproto/api'
import {msg, Trans} from '@lingui/macro'
import {useLingui} from '@lingui/react'
import {logEvent} from '#/lib/statsig/statsig'
import {useModerationOpts} from '#/state/preferences/moderation-opts'
import {useSuggestedFollowsByActorQuery} from '#/state/queries/suggested-follows'
-import {isWeb} from 'platform/detection'
import {atoms as a, useTheme, ViewStyleProp} from '#/alf'
-import {Button, ButtonIcon} from '#/components/Button'
-import {TimesLarge_Stroke2_Corner0_Rounded as X} from '#/components/icons/Times'
+import {Button, ButtonText} from '#/components/Button'
+import * as Dialog from '#/components/Dialog'
+import {KnownFollowers} from '#/components/KnownFollowers'
import * as ProfileCard from '#/components/ProfileCard'
import {Text} from '#/components/Typography'
-const OUTER_PADDING = a.p_md.padding
-const INNER_PADDING = a.p_lg.padding
-const TOTAL_HEIGHT = 232
-const MOBILE_CARD_WIDTH = 300
-
function CardOuter({
children,
style,
@@ -30,10 +26,9 @@ function CardOuter({
a.p_lg,
a.rounded_md,
a.border,
- t.atoms.bg,
- t.atoms.border_contrast_low,
+ t.atoms.bg_contrast_25,
{
- width: MOBILE_CARD_WIDTH,
+ borderColor: t.atoms.bg_contrast_25.backgroundColor,
},
style,
]}>
@@ -56,106 +51,116 @@ export function SuggestedFollowPlaceholder() {
)
}
-export function ProfileHeaderSuggestedFollows({
- actorDid,
- requestDismiss,
-}: {
- actorDid: string
- requestDismiss: () => void
-}) {
+export type ProfileSuggestedFollowsProps = {
+ control: Dialog.DialogOuterProps['control']
+ profile: AppBskyActorDefs.ProfileViewDetailed
+}
+
+export function SimilarAccountsDialog({
+ control,
+ profile,
+}: ProfileSuggestedFollowsProps) {
const t = useTheme()
const {_} = useLingui()
+ const [show, setShow] = React.useState(false)
+ return (
+
+
+
+ {show ? (
+
+ ) : (
+ <>
+
+ Similar accounts
+
+
+ These are accounts similar to @{profile.handle}
+
+
+
+ >
+ )}
+
+
+
+ )
+}
+
+export function SimilarAccounts({
+ profile,
+}: {
+ profile: AppBskyActorDefs.ProfileViewDetailed
+}) {
+ const t = useTheme()
const {isLoading: isSuggestionsLoading, data} =
useSuggestedFollowsByActorQuery({
- did: actorDid,
+ did: profile.did,
})
const moderationOpts = useModerationOpts()
const isLoading = isSuggestionsLoading || !moderationOpts
return (
-
-
+
+ Similar accounts
+
+
-
-
- Similar accounts
-
+ These are accounts similar to @{profile.handle}
+
-
-
-
-
-
- {isLoading ? (
- <>
-
-
-
-
-
- >
- ) : data ? (
- data.suggestions
- .filter(s => (s.associated?.labeler ? false : true))
- .map(profile => (
- {
- logEvent('profile:header:suggestedFollowsCard:press', {})
- }}
- style={[a.flex_1]}>
- {({hovered, pressed}) => (
-
-
+
+ {isLoading ? (
+ <>
+
+
+
+
+
+ >
+ ) : data ? (
+ data.suggestions
+ .filter(s => (s.associated?.labeler ? false : true))
+ .map(profile => (
+ {
+ logEvent('profile:header:suggestedFollowsCard:press', {})
+ }}
+ style={[]}>
+ {({hovered, pressed}) => (
+
+
+
+
-
-
-
- )}
-
- ))
- ) : (
-
- )}
-
-
+
+
+
+
+
+
+
+ )}
+
+ ))
+ ) : (
+
+ )}
)