import clsx from 'clsx' import {debug} from 'common/logger' import {Profile} from 'common/profiles/profile' import {UserActivity} from 'common/user' import React, {ReactNode} from 'react' import {ProfileAnswers} from 'web/components/answers/profile-answers' import {ProfileBio} from 'web/components/bio/profile-bio' import {Col} from 'web/components/layout/col' import {Row} from 'web/components/layout/row' import {SignUpButton} from 'web/components/nav/sidebar' import {ConnectActions} from 'web/components/profile/connect-actions' import ProfileHeader, {ProfileHeaderActions} from 'web/components/profile/profile-header' import ProfileAbout, { ProfileInterestsAndCauses, ProfileLinks, ProfilePersonality, } from 'web/components/profile-about' import ProfileCarousel from 'web/components/profile-carousel' import {ProfileCommentSection} from 'web/components/profile-comment-section' import {Subtitle} from 'web/components/widgets/subtitle' import {shortenName} from 'web/components/widgets/user-link' import {useGetter} from 'web/hooks/use-getter' import {useHiddenProfiles} from 'web/hooks/use-hidden-profiles' import {useCompatibilityQuestionGroups} from 'web/hooks/use-questions' import {useUser} from 'web/hooks/use-user' import {useUserActivity} from 'web/hooks/use-user-activity' import {User} from 'web/lib/firebase/users' import {useT} from 'web/lib/locale' import {getStars} from 'web/lib/supabase/stars' import {BackButton} from '../back-button' export function ProfileInfo(props: { profile: Profile user: User refreshProfile: () => void fromProfilePage?: Profile fromSignup?: boolean }) { const {profile, refreshProfile, fromProfilePage, fromSignup} = props const currentUser = useUser() const t = useT() // const currentProfile = useProfile() const isCurrentUser = currentUser?.id === props.user.id const user = isCurrentUser ? currentUser : props.user // to refresh user info after update debug('Rendering Profile for', user.username, user.name, props) const {data: starredUsers, refresh: refreshStars} = useGetter('stars', currentUser?.id, getStars) const starredUserIds = starredUsers?.map((u) => u.id) const {hiddenProfiles} = useHiddenProfiles() const isHiddenFromMe = hiddenProfiles?.some((v) => v.id === user.id) // const { data, refresh } = useAPIGetter('get-likes-and-ships', { // userId: user.id, // }) // const { likesGiven, likesReceived, ships } = data ?? {} // // const liked = // !!currentUser && // !!likesReceived && // likesReceived.map((l) => l.user_id).includes(currentUser.id) // const likedBack = // !!currentUser && // !!likesGiven && // likesGiven.map((l) => l.user_id).includes(currentUser.id) // const shipped = // !!ships && hasShipped(currentUser, fromProfilePage?.user_id, user.id, ships) // const areCompatible = // !!currentProfile && areGenderCompatible(currentProfile, profile) // Allow everyone to message everyone for now const showMessageButton = true // liked || likedBack || !areCompatible const isProfileVisible = currentUser || profile.visibility === 'public' const {data: userActivity} = useUserActivity(user?.id) // const isCurrentUser = currentUser?.id === user.id return ( <>