mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-05-08 07:03:57 -04:00
Hide likes
This commit is contained in:
@@ -1,25 +1,19 @@
|
||||
import { LoverCommentSection } from 'web/components/lover-comment-section'
|
||||
import {LoverCommentSection} from 'web/components/lover-comment-section'
|
||||
import LoverProfileHeader from 'web/components/profile/lover-profile-header'
|
||||
import ProfileCarousel from 'web/components/profile-carousel'
|
||||
import { Col } from 'web/components/layout/col'
|
||||
import { Row } from 'web/components/layout/row'
|
||||
import { useUser } from 'web/hooks/use-user'
|
||||
import { User } from 'web/lib/firebase/users'
|
||||
import {Col} from 'web/components/layout/col'
|
||||
import {Row} from 'web/components/layout/row'
|
||||
import {useUser} from 'web/hooks/use-user'
|
||||
import {User} from 'web/lib/firebase/users'
|
||||
import LoverAbout from 'web/components/lover-about'
|
||||
import { LoverAnswers } from 'web/components/answers/lover-answers'
|
||||
import { SignUpButton } from 'web/components/nav/love-sidebar'
|
||||
import { Lover } from 'common/love/lover'
|
||||
import { LoverBio } from 'web/components/bio/lover-bio'
|
||||
import { LikesDisplay } from '../widgets/likes-display'
|
||||
import { LikeButton } from '../widgets/like-button'
|
||||
import { ShipButton } from '../widgets/ship-button'
|
||||
import { hasShipped } from 'web/lib/util/ship-util'
|
||||
import { areGenderCompatible } from 'common/love/compatibility-util'
|
||||
import { useLover } from 'web/hooks/use-lover'
|
||||
import { LikeData, ShipData } from 'common/api/love-types'
|
||||
import { useAPIGetter } from 'web/hooks/use-api-getter'
|
||||
import { useGetter } from 'web/hooks/use-getter'
|
||||
import { getStars } from 'web/lib/supabase/stars'
|
||||
import {LoverAnswers} from 'web/components/answers/lover-answers'
|
||||
import {SignUpButton} from 'web/components/nav/love-sidebar'
|
||||
import {Lover} from 'common/love/lover'
|
||||
import {LoverBio} from 'web/components/bio/lover-bio'
|
||||
import {areGenderCompatible} from 'common/love/compatibility-util'
|
||||
import {useLover} from 'web/hooks/use-lover'
|
||||
import {useGetter} from 'web/hooks/use-getter'
|
||||
import {getStars} from 'web/lib/supabase/stars'
|
||||
import {Content} from "web/components/widgets/editor";
|
||||
import {JSONContent} from "@tiptap/core";
|
||||
import React from "react";
|
||||
@@ -32,34 +26,34 @@ export function LoverProfile(props: {
|
||||
fromSignup?: boolean
|
||||
}) {
|
||||
console.log('Rendering LoverProfile for ', props)
|
||||
const { lover, user, refreshLover, fromLoverPage, fromSignup } = props
|
||||
const {lover, user, refreshLover, fromLoverPage, fromSignup} = props
|
||||
|
||||
const currentUser = useUser()
|
||||
const currentLover = useLover()
|
||||
const isCurrentUser = currentUser?.id === user.id
|
||||
// const isCurrentUser = currentUser?.id === user.id
|
||||
|
||||
const { data: starredUserIds, refresh: refreshStars } = useGetter(
|
||||
const {data: starredUserIds, refresh: refreshStars} = useGetter(
|
||||
'stars',
|
||||
currentUser?.id,
|
||||
getStars
|
||||
)
|
||||
|
||||
const { data, refresh } = useAPIGetter('get-likes-and-ships', {
|
||||
userId: user.id,
|
||||
})
|
||||
const { likesGiven, likesReceived, ships } = data ?? {}
|
||||
// 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 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, fromLoverPage?.user_id, user.id, ships)
|
||||
// const shipped =
|
||||
// !!ships && hasShipped(currentUser, fromLoverPage?.user_id, user.id, ships)
|
||||
|
||||
const areCompatible =
|
||||
!!currentLover && areGenderCompatible(currentLover, lover)
|
||||
@@ -87,10 +81,10 @@ export function LoverProfile(props: {
|
||||
refreshLover={refreshLover}
|
||||
fromLoverPage={fromLoverPage}
|
||||
fromSignup={fromSignup}
|
||||
likesGiven={likesGiven ?? []}
|
||||
likesReceived={likesReceived ?? []}
|
||||
ships={ships ?? []}
|
||||
refreshShips={refresh}
|
||||
// likesGiven={likesGiven ?? []}
|
||||
// likesReceived={likesReceived ?? []}
|
||||
// ships={ships ?? []}
|
||||
// refreshShips={refresh}
|
||||
/>
|
||||
) : (
|
||||
<Col className="bg-canvas-0 w-full gap-4 rounded p-4">
|
||||
@@ -98,36 +92,36 @@ export function LoverProfile(props: {
|
||||
<Content className="w-full line-clamp-6" content={lover.bio as JSONContent}/>
|
||||
</div>
|
||||
<Col className="relative gap-4">
|
||||
<div className="bg-ink-200 dark:bg-ink-400 h-4 w-2/5" />
|
||||
<div className="bg-ink-200 dark:bg-ink-400 h-4 w-3/5" />
|
||||
<div className="bg-ink-200 dark:bg-ink-400 h-4 w-1/2" />
|
||||
<div className="from-canvas-0 absolute bottom-0 h-12 w-full bg-gradient-to-t to-transparent" />
|
||||
<div className="bg-ink-200 dark:bg-ink-400 h-4 w-2/5"/>
|
||||
<div className="bg-ink-200 dark:bg-ink-400 h-4 w-3/5"/>
|
||||
<div className="bg-ink-200 dark:bg-ink-400 h-4 w-1/2"/>
|
||||
<div className="from-canvas-0 absolute bottom-0 h-12 w-full bg-gradient-to-t to-transparent"/>
|
||||
</Col>
|
||||
<Row className="gap-2">
|
||||
<SignUpButton text="Sign up to see profile" />
|
||||
<SignUpButton text="Sign up to see profile"/>
|
||||
</Row>
|
||||
</Col>
|
||||
)}
|
||||
{areCompatible &&
|
||||
((!fromLoverPage && !isCurrentUser) ||
|
||||
(fromLoverPage && fromLoverPage.user_id === currentUser?.id)) && (
|
||||
<Row className="right-0 mr-1 self-end lg:bottom-6">
|
||||
<LikeButton targetLover={lover} liked={liked} refresh={refresh} />
|
||||
</Row>
|
||||
)}
|
||||
{fromLoverPage &&
|
||||
fromLoverPage.user_id !== currentUser?.id &&
|
||||
user.id !== currentUser?.id && (
|
||||
<Row className="sticky bottom-[70px] right-0 mr-1 self-end lg:bottom-6">
|
||||
<ShipButton
|
||||
shipped={shipped}
|
||||
targetId1={fromLoverPage.user_id}
|
||||
targetId2={user.id}
|
||||
refresh={refresh}
|
||||
/>
|
||||
</Row>
|
||||
)}
|
||||
{isProfileVisible && lover.photo_urls && <ProfileCarousel lover={lover} />}
|
||||
{/*{areCompatible &&*/}
|
||||
{/* ((!fromLoverPage && !isCurrentUser) ||*/}
|
||||
{/* (fromLoverPage && fromLoverPage.user_id === currentUser?.id)) && (*/}
|
||||
{/* <Row className="right-0 mr-1 self-end lg:bottom-6">*/}
|
||||
{/* <LikeButton targetLover={lover} liked={liked} refresh={refresh} />*/}
|
||||
{/* </Row>*/}
|
||||
{/* )}*/}
|
||||
{/*{fromLoverPage &&*/}
|
||||
{/* fromLoverPage.user_id !== currentUser?.id &&*/}
|
||||
{/* user.id !== currentUser?.id && (*/}
|
||||
{/* <Row className="sticky bottom-[70px] right-0 mr-1 self-end lg:bottom-6">*/}
|
||||
{/* <ShipButton*/}
|
||||
{/* shipped={shipped}*/}
|
||||
{/* targetId1={fromLoverPage.user_id}*/}
|
||||
{/* targetId2={user.id}*/}
|
||||
{/* refresh={refresh}*/}
|
||||
{/* />*/}
|
||||
{/* </Row>*/}
|
||||
{/* )}*/}
|
||||
{isProfileVisible && lover.photo_urls && <ProfileCarousel lover={lover}/>}
|
||||
</>
|
||||
)
|
||||
}
|
||||
@@ -138,10 +132,10 @@ function LoverContent(props: {
|
||||
refreshLover: () => void
|
||||
fromLoverPage?: Lover
|
||||
fromSignup?: boolean
|
||||
likesGiven: LikeData[]
|
||||
likesReceived: LikeData[]
|
||||
ships: ShipData[]
|
||||
refreshShips: () => Promise<void>
|
||||
// likesGiven: LikeData[]
|
||||
// likesReceived: LikeData[]
|
||||
// ships: ShipData[]
|
||||
// refreshShips: () => Promise<void>
|
||||
}) {
|
||||
const {
|
||||
user,
|
||||
@@ -149,10 +143,10 @@ function LoverContent(props: {
|
||||
refreshLover,
|
||||
fromLoverPage,
|
||||
fromSignup,
|
||||
likesGiven,
|
||||
likesReceived,
|
||||
ships,
|
||||
refreshShips,
|
||||
// likesGiven,
|
||||
// likesReceived,
|
||||
// ships,
|
||||
// refreshShips,
|
||||
} = props
|
||||
|
||||
const currentUser = useUser()
|
||||
@@ -160,7 +154,7 @@ function LoverContent(props: {
|
||||
|
||||
return (
|
||||
<>
|
||||
<LoverAbout lover={lover} />
|
||||
<LoverAbout lover={lover}/>
|
||||
<LoverBio
|
||||
isCurrentUser={isCurrentUser}
|
||||
lover={lover}
|
||||
@@ -180,13 +174,13 @@ function LoverContent(props: {
|
||||
currentUser={currentUser}
|
||||
simpleView={!!fromLoverPage}
|
||||
/>
|
||||
<LikesDisplay
|
||||
likesGiven={likesGiven}
|
||||
likesReceived={likesReceived}
|
||||
ships={ships}
|
||||
refreshShips={refreshShips}
|
||||
profileLover={lover}
|
||||
/>
|
||||
{/*<LikesDisplay*/}
|
||||
{/* likesGiven={likesGiven}*/}
|
||||
{/* likesReceived={likesReceived}*/}
|
||||
{/* ships={ships}*/}
|
||||
{/* refreshShips={refreshShips}*/}
|
||||
{/* profileLover={lover}*/}
|
||||
{/*/>*/}
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user