import {type StyleProp, View, type ViewStyle} from 'react-native' import {msg, Trans} from '@lingui/macro' import {useLingui} from '@lingui/react' import {useProfileFollowsQuery} from '#/state/queries/profile-follows' import {useSession} from '#/state/session' import { useProgressGuide, useProgressGuideControls, } from '#/state/shell/progress-guide' import {UserAvatar} from '#/view/com/util/UserAvatar' import {atoms as a, useBreakpoints, useLayoutBreakpoints, useTheme} from '#/alf' import {Button, ButtonIcon} from '#/components/Button' import {Person_Stroke2_Corner2_Rounded as PersonIcon} from '#/components/icons/Person' import {TimesLarge_Stroke2_Corner0_Rounded as Times} from '#/components/icons/Times' import {Text} from '#/components/Typography' import type * as bsky from '#/types/bsky' import {FollowDialog} from './FollowDialog' import {ProgressGuideTask} from './Task' const TOTAL_AVATARS = 10 export function ProgressGuideList({style}: {style?: StyleProp}) { const t = useTheme() const {_} = useLingui() const {gtPhone} = useBreakpoints() const {rightNavVisible} = useLayoutBreakpoints() const {currentAccount} = useSession() const followProgressGuide = useProgressGuide('follow-10') const followAndLikeProgressGuide = useProgressGuide('like-10-and-follow-7') const guide = followProgressGuide || followAndLikeProgressGuide const {endProgressGuide} = useProgressGuideControls() const {data: follows} = useProfileFollowsQuery(currentAccount?.did, { limit: TOTAL_AVATARS, }) const actualFollowsCount = follows?.pages?.[0]?.follows?.length ?? 0 // Hide if user already follows 10+ people if (guide?.guide === 'follow-10' && actualFollowsCount >= TOTAL_AVATARS) { return null } // Inline layout when left nav visible but no right sidebar (800-1100px) const inlineLayout = gtPhone && !rightNavVisible if (guide) { return ( Follow 10 people to get started {guide.guide === 'follow-10' && ( )} {guide.guide === 'like-10-and-follow-7' && ( <> )} ) } return null } function StackedAvatars({follows}: {follows?: bsky.profile.AnyProfileView[]}) { const t = useTheme() const {centerColumnOffset} = useLayoutBreakpoints() // Smaller avatars for narrower viewport const avatarSize = centerColumnOffset ? 30 : 37 const overlap = centerColumnOffset ? 9 : 11 const iconSize = centerColumnOffset ? 14 : 18 // Use actual follows count, not the guide's event counter const followedAvatars = follows?.slice(0, TOTAL_AVATARS) ?? [] const remainingSlots = TOTAL_AVATARS - followedAvatars.length // Total width calculation: first avatar + (remaining * visible portion) const totalWidth = avatarSize + (TOTAL_AVATARS - 1) * (avatarSize - overlap) return ( {/* Show followed user avatars */} {followedAvatars.map((follow, i) => ( ))} {/* Show placeholder avatars for remaining slots */} {Array(remainingSlots) .fill(0) .map((_, i) => ( ))} ) }