import { EllipsisHorizontalIcon, EyeIcon, EyeSlashIcon, 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 Image from 'next/image' import Link from 'next/link' import Router from 'next/router' import React from 'react' import toast from 'react-hot-toast' 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 {ViewProfileCardButton} from 'web/components/photos-modal' 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 {capitalizePure} from 'web/lib/util/time' import {ShareProfileButton} from '../widgets/share-profile-button' import ProfilePrimaryInfo from './profile-primary-info' export default function ProfileHeader(props: { user: User userActivity?: UserActivity profile: Profile simpleView?: boolean isHiddenFromMe: boolean | undefined }) { const {user, profile, userActivity, simpleView, isHiddenFromMe} = props const currentUser = useUser() const isCurrentUser = currentUser?.id === user.id const disabled = profile.disabled const t = useT() debug('ProfileProfileHeader', { user, profile, userActivity, currentUser, }) 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.', )}
)} {profile.pinned_url && (
)} {/*{!isCurrentUser && }*/} {simpleView ? ( {user.name} ) : ( {user.name} )}
{profile.keywords?.map(capitalizePure)?.map((tag, i) => ( {tag.trim()} ))} {profile.headline && (
" {profile.headline} "
)}
) } export function ProfileHeaderActions(props: { user: User profile: Profile starredUserIds: string[] refreshStars: () => Promise showMessageButton: boolean refreshProfile: () => void isHiddenFromMe: boolean | undefined }) { const {user, profile, starredUserIds, refreshStars, showMessageButton, refreshProfile} = props const currentUser = useUser() const isCurrentUser = currentUser?.id === user.id const disabled = profile.disabled const t = useT() 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', ) } if (currentUser && isCurrentUser) { return ( ) } return ( {currentUser && ( )} {currentUser && showMessageButton && ( )} ) }