diff --git a/web/components/answers/compatibility-questions-display.tsx b/web/components/answers/compatibility-questions-display.tsx index 8e16f268..8fe4a52d 100644 --- a/web/components/answers/compatibility-questions-display.tsx +++ b/web/components/answers/compatibility-questions-display.tsx @@ -216,8 +216,8 @@ export function CompatibilityQuestionsDisplay(props: { {isCurrentUser - ? t('answers.display.your_prompts', 'Your Compatibility Prompts') - : t('answers.display.user_prompts', "{name}'s Compatibility Prompts", { + ? t('answers.display.your_prompts', 'Compatibility Prompts') + : t('answers.display.user_prompts', 'Compatibility Prompts', { name: shortenName(user.name), })} diff --git a/web/components/back-button.tsx b/web/components/back-button.tsx index 2d57f1d7..6fc28c98 100644 --- a/web/components/back-button.tsx +++ b/web/components/back-button.tsx @@ -1,12 +1,9 @@ -import {ArrowLeftIcon} from '@heroicons/react/24/solid' +import {ChevronLeftIcon} from '@heroicons/react/24/outline' import clsx from 'clsx' -import {useRouter} from 'next/navigation' -import {useEffect, useState} from 'react' -import {Button} from 'web/components/buttons/button' +import React, {useEffect, useState} from 'react' export function BackButton(props: {className?: string}) { const {className} = props - const router = useRouter() const [canGoBack, setCanGoBack] = useState(false) // Can't put this in a useMemo to avoid the page jump else we'll get hydration errors. @@ -17,9 +14,15 @@ export function BackButton(props: {className?: string}) { if (!canGoBack) return null return ( - + ) } diff --git a/web/components/profile-grid.tsx b/web/components/profile-grid.tsx index 6357ca86..d449e92f 100644 --- a/web/components/profile-grid.tsx +++ b/web/components/profile-grid.tsx @@ -5,7 +5,6 @@ import {Gender} from 'common/gender' import {CompatibilityScore} from 'common/profiles/compatibility-score' import {Profile} from 'common/profiles/profile' import {DisplayOptions} from 'common/profiles-rendering' -import {capitalize} from 'lodash' import { Brain, Briefcase, @@ -36,6 +35,7 @@ import {isDark, useTheme} from 'web/hooks/use-theme' import {useUser} from 'web/hooks/use-user' import {useT} from 'web/lib/locale' import {getSeekingConnectionText} from 'web/lib/profile/seeking' +import {capitalizePure} from 'web/lib/util/time' import {Col} from './layout/col' @@ -403,7 +403,7 @@ function ProfilePreview(props: { {profile.keywords ?.slice(0, 10) - ?.map(capitalize) + ?.map(capitalizePure) ?.map((tag, i) => ( {tag.trim()} diff --git a/web/components/profile/profile-header.tsx b/web/components/profile/profile-header.tsx index 9af79521..a41fff4c 100644 --- a/web/components/profile/profile-header.tsx +++ b/web/components/profile/profile-header.tsx @@ -8,10 +8,9 @@ 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 React 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' @@ -19,45 +18,29 @@ 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 {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' -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 {user, profile, userActivity, simpleView, isHiddenFromMe} = props const currentUser = useUser() const isCurrentUser = currentUser?.id === user.id - const [showVisibilityModal, setShowVisibilityModal] = useState(false) const disabled = profile.disabled const t = useT() @@ -68,6 +51,93 @@ export default function ProfileHeader(props: { 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.', + )} +
+ )} + + + + + {/*{!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 + setShowVisibilityModal: (show: boolean) => void +}) { + const { + user, + profile, + starredUserIds, + refreshStars, + showMessageButton, + refreshProfile, + setShowVisibilityModal, + } = 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( @@ -86,184 +156,109 @@ export default function ProfileHeader(props: { ', 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} - )} - - - - - - {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) => ( - + + + + + + + + - + ) + } + + return ( + + + + {currentUser && ( + + )} + {currentUser && showMessageButton && ( + + )} + + ) } diff --git a/web/components/profile/profile-info.tsx b/web/components/profile/profile-info.tsx index 3cb447a1..6b47fd42 100644 --- a/web/components/profile/profile-info.tsx +++ b/web/components/profile/profile-info.tsx @@ -10,9 +10,8 @@ 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 {ViewProfileCardButton} from 'web/components/photos-modal' import {ConnectActions} from 'web/components/profile/connect-actions' -import ProfileHeader from 'web/components/profile/profile-header' +import ProfileHeader, {ProfileHeaderActions} from 'web/components/profile/profile-header' import ProfileAbout from 'web/components/profile-about' import ProfileCarousel from 'web/components/profile-carousel' import {ProfileCommentSection} from 'web/components/profile-comment-section' @@ -25,6 +24,8 @@ 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 @@ -75,7 +76,27 @@ export function ProfileInfo(props: { return ( <> -
+
+
+ + +
+ {}} + /> +
+
+
+ +
{profile.pinned_url && (
@@ -96,10 +117,6 @@ export function ProfileInfo(props: { userActivity={userActivity} profile={profile} simpleView={!!fromProfilePage} - starredUserIds={starredUserIds ?? []} - refreshStars={refreshStars} - showMessageButton={showMessageButton} - refreshProfile={refreshProfile} isHiddenFromMe={isHiddenFromMe} />
@@ -209,23 +226,7 @@ function ProfileContent(props: { return ( <> - -
- -
-
- -
- - - - - - +
+ + + + + +
{/* )} - {currentUser !== undefined && ( - + {profile ? (