import { EllipsisHorizontalIcon, EyeIcon, LockClosedIcon, PencilIcon, } from '@heroicons/react/24/outline' import clsx from 'clsx' import {debug} from 'common/logger' import {Profile} from 'common/profiles/profile' import {User, UserActivity} from 'common/user' import {capitalize} from 'lodash' import Link from 'next/link' import Router from 'next/router' import React, {useState} from 'react' import toast from 'react-hot-toast' import {Button} from 'web/components/buttons/button' import {MoreOptionsUserButton} from 'web/components/buttons/more-options-user-button' import DropdownMenu from 'web/components/comments/dropdown-menu' import {Col} from 'web/components/layout/col' import {Row} from 'web/components/layout/row' import {SendMessageButton} from 'web/components/messaging/send-message-button' import HideProfileButton from 'web/components/widgets/hide-profile-button' import {linkClass} from 'web/components/widgets/site-link' import {StarButton} from 'web/components/widgets/star-button' import {Tooltip} from 'web/components/widgets/tooltip' import {useUser} from 'web/hooks/use-user' import {updateProfile} from 'web/lib/api' import {useT} from 'web/lib/locale' import {track} from 'web/lib/service/analytics' import {disableProfile} from 'web/lib/util/disable' import {ShareProfileButton} from '../widgets/share-profile-button' import ProfilePrimaryInfo from './profile-primary-info' import {VisibilityConfirmationModal} from './visibility-confirmation-modal' export default function ProfileHeader(props: { user: User userActivity?: UserActivity profile: Profile simpleView?: boolean starredUserIds: string[] refreshStars: () => Promise isHiddenFromMe: boolean | undefined showMessageButton: boolean refreshProfile: () => void }) { const { user, profile, userActivity, simpleView, starredUserIds, refreshStars, showMessageButton, refreshProfile, isHiddenFromMe, } = props const currentUser = useUser() const isCurrentUser = currentUser?.id === user.id const [showVisibilityModal, setShowVisibilityModal] = useState(false) const disabled = profile.disabled const t = useT() debug('ProfileProfileHeader', { user, profile, userActivity, currentUser, }) let tooltipText = undefined if (!profile.allow_direct_messaging) { tooltipText = t( 'profile.header.tooltip.direct_messaging_off', '{name} turned off direct messaging', { name: user.name, }, ) } if (!profile.allow_direct_messaging && profile.allow_interest_indicating) { tooltipText = tooltipText + t( 'profile.header.tooltip.can_express_interest', ', but you can still express interest at the end of the profile', ) } return ( {currentUser && !isCurrentUser && isHiddenFromMe && (
{t( 'profile_grid.hidden_notice', "You hid this person, so they don't appear in your search results.", )}
)} {currentUser && isCurrentUser && disabled && (
{t( 'profile.header.disabled_notice', 'You disabled your profile, so no one else can access it.', )}
)} {/*{!isCurrentUser && }*/} {simpleView ? ( {user.name} ) : ( {user.name} )} {profile.age && `, ${t('profile.header.age', '{age}', {age: profile.age})}`} {currentUser && isCurrentUser ? ( ) : ( {currentUser && !isCurrentUser && } {currentUser && ( )} {currentUser && showMessageButton && ( )} )} {/**/} {/* */} {/**/} { const newVisibility = profile.visibility === 'member' ? 'public' : 'member' await updateProfile({visibility: newVisibility}) refreshProfile() }} /> {profile.headline && (
{profile.headline}
)} {profile.keywords?.map(capitalize)?.map((tag, i) => ( {tag.trim()} ))} ) }