From 593617c0ff09d17ea8c8c9a45b39860e3d0974cc Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Wed, 17 Sep 2025 15:43:19 +0200 Subject: [PATCH] Rename Lover -> Profile --- backend/api/src/app.ts | 20 ++-- backend/api/src/compatible-profiles.ts | 6 +- backend/api/src/create-comment.ts | 4 +- backend/api/src/create-lover.ts | 2 +- backend/api/src/get-lover-answers.ts | 2 +- backend/api/src/like-lover.ts | 2 +- backend/api/src/star-lover.ts | 2 +- backend/api/src/update-lover.ts | 8 +- backend/email/emails/functions/helpers.tsx | 10 +- backend/email/emails/functions/mock.ts | 6 +- backend/email/emails/new-match.tsx | 12 +-- backend/email/emails/new-message.tsx | 14 +-- .../shared/src/create-love-notification.ts | 6 +- backend/shared/src/love/supabase.ts | 18 ++-- common/src/api/schema.ts | 10 +- common/src/filters.ts | 6 +- common/src/love/compatibility-score.ts | 6 +- common/src/love/compatibility-util.ts | 16 ++-- common/src/love/lover.ts | 8 +- common/src/love/og-image.ts | 4 +- .../compatibility-questions-display.tsx | 78 ++++++++-------- .../answers/free-response-add-question.tsx | 4 +- .../answers/free-response-display.tsx | 12 +-- web/components/answers/lover-answers.tsx | 14 +-- .../answers/other-lover-answers.tsx | 2 +- web/components/bio/editable-bio.tsx | 8 +- web/components/bio/lover-bio-block.tsx | 16 ++-- web/components/bio/lover-bio.tsx | 16 ++-- web/components/browse-matches-button.tsx | 30 +++--- web/components/filters/desktop-filters.tsx | 14 +-- web/components/filters/location-filter.tsx | 10 +- web/components/filters/mobile-filters.tsx | 14 +-- web/components/filters/my-matches-toggle.tsx | 4 +- web/components/filters/search.tsx | 12 +-- web/components/filters/use-filters.ts | 6 +- web/components/love-page.tsx | 8 +- web/components/lover-about.tsx | 22 ++--- web/components/lover-comment-section.tsx | 26 +++--- web/components/lover-comments.tsx | 10 +- web/components/matches/match-avatars.tsx | 20 ++-- web/components/nav/love-bottom-nav-bar.tsx | 4 +- web/components/nav/love-profile-summary.tsx | 4 +- web/components/nav/love-sidebar.tsx | 4 +- web/components/notification-items.tsx | 4 +- web/components/optional-lover-form.tsx | 92 +++++++++---------- web/components/profile-carousel.tsx | 8 +- web/components/profile-grid.tsx | 8 +- web/components/profile/lover-primary-info.tsx | 8 +- .../profile/lover-profile-header.tsx | 24 ++--- web/components/profile/lover-profile.tsx | 86 ++++++++--------- web/components/profiles/profiles-home.tsx | 14 +-- web/components/required-lover-form.tsx | 10 +- web/components/search-location.tsx | 4 +- web/components/widgets/like-button.tsx | 34 +++---- web/components/widgets/likes-display.tsx | 22 ++--- web/components/widgets/ships-display.tsx | 36 ++++---- web/components/widgets/star-button.tsx | 8 +- web/hooks/use-comments-on-lover.ts | 2 +- web/hooks/use-is-looking.ts | 4 +- web/hooks/use-lover.ts | 54 +++++------ web/hooks/use-online.ts | 4 +- web/hooks/use-profiles.ts | 4 +- web/lib/api.ts | 2 +- web/lib/util/signup.ts | 4 +- web/pages/[username]/index.tsx | 22 ++--- web/pages/api/og/lover.tsx | 4 +- web/pages/profile.tsx | 18 ++-- web/pages/register.tsx | 8 +- web/pages/signin.tsx | 4 +- web/pages/signup.tsx | 24 ++--- 70 files changed, 506 insertions(+), 506 deletions(-) diff --git a/backend/api/src/app.ts b/backend/api/src/app.ts index 6b383657..60b826c1 100644 --- a/backend/api/src/app.ts +++ b/backend/api/src/app.ts @@ -12,11 +12,11 @@ import {blockUser, unblockUser} from './block-user' import {getCompatibleProfilesHandler} from './compatible-profiles' import {createComment} from './create-comment' import {createCompatibilityQuestion} from './create-compatibility-question' -import {createLover} from './create-lover' +import {createProfile} from './create-lover' import {createUser} from './create-user' import {getCompatibilityQuestions} from './get-compatibililty-questions' import {getLikesAndShips} from './get-likes-and-ships' -import {getLoverAnswers} from './get-lover-answers' +import {getProfileAnswers} from './get-lover-answers' import {getProfiles} from './get-profiles' import {getSupabaseToken} from './get-supabase-token' import {getDisplayUser, getUser} from './get-user' @@ -25,15 +25,15 @@ import {hasFreeLike} from './has-free-like' import {health} from './health' import {type APIHandler, typedEndpoint} from './helpers/endpoint' import {hideComment} from './hide-comment' -import {likeLover} from './like-lover' +import {likeProfile} from './like-lover' import {markAllNotifsRead} from './mark-all-notifications-read' import {removePinnedPhoto} from './remove-pinned-photo' import {report} from './report' import {searchLocation} from './search-location' import {searchNearCity} from './search-near-city' import {shipProfiles} from './ship-profiles' -import {starLover} from './star-lover' -import {updateLover} from './update-lover' +import {starProfile} from './star-lover' +import {updateProfile} from './update-lover' import {updateMe} from './update-me' import {deleteMe} from './delete-me' import {getCurrentPrivateUser} from './get-current-private-user' @@ -134,20 +134,20 @@ const handlers: { [k in APIPath]: APIHandler } = { 'ban-user': banUser, report: report, 'create-user': createUser, - 'create-lover': createLover, + 'create-lover': createProfile, me: getMe, 'me/private': getCurrentPrivateUser, 'me/update': updateMe, 'update-notif-settings': updateNotifSettings, 'me/delete': deleteMe, - 'update-lover': updateLover, - 'like-lover': likeLover, + 'update-lover': updateProfile, + 'like-lover': likeProfile, 'ship-profiles': shipProfiles, 'get-likes-and-ships': getLikesAndShips, 'has-free-like': hasFreeLike, - 'star-lover': starLover, + 'star-lover': starProfile, 'get-profiles': getProfiles, - 'get-lover-answers': getLoverAnswers, + 'get-lover-answers': getProfileAnswers, 'get-compatibility-questions': getCompatibilityQuestions, 'remove-pinned-photo': removePinnedPhoto, 'create-comment': createComment, diff --git a/backend/api/src/compatible-profiles.ts b/backend/api/src/compatible-profiles.ts index cabe571e..3b31a4a1 100644 --- a/backend/api/src/compatible-profiles.ts +++ b/backend/api/src/compatible-profiles.ts @@ -2,7 +2,7 @@ import { groupBy, sortBy } from 'lodash' import { APIError, type APIHandler } from 'api/helpers/endpoint' import { getCompatibilityScore } from 'common/love/compatibility-score' import { - getLover, + getProfile, getCompatibilityAnswers, getGenderCompatibleProfiles, } from 'shared/love/supabase' @@ -15,7 +15,7 @@ export const getCompatibleProfilesHandler: APIHandler< } export const getCompatibleProfiles = async (userId: string) => { - const lover = await getLover(userId) + const lover = await getProfile(userId) log('got lover', { id: lover?.id, @@ -23,7 +23,7 @@ export const getCompatibleProfiles = async (userId: string) => { username: lover?.user?.username, }) - if (!lover) throw new APIError(404, 'Lover not found') + if (!lover) throw new APIError(404, 'Profile not found') const profiles = await getGenderCompatibleProfiles(lover) diff --git a/backend/api/src/create-comment.ts b/backend/api/src/create-comment.ts index 5a8c30eb..ed34b532 100644 --- a/backend/api/src/create-comment.ts +++ b/backend/api/src/create-comment.ts @@ -46,7 +46,7 @@ export const createComment: APIHandler<'create-comment'> = async ( ] ) if (onUser.id !== creator.id) - await createNewCommentOnLoverNotification( + await createNewCommentOnProfileNotification( onUser, creator, richTextToString(content), @@ -84,7 +84,7 @@ const validateComment = async ( return { content, creator } } -const createNewCommentOnLoverNotification = async ( +const createNewCommentOnProfileNotification = async ( onUser: User, creator: User, sourceText: string, diff --git a/backend/api/src/create-lover.ts b/backend/api/src/create-lover.ts index 38180ede..fcd6d6dc 100644 --- a/backend/api/src/create-lover.ts +++ b/backend/api/src/create-lover.ts @@ -8,7 +8,7 @@ import { updateUser } from 'shared/supabase/users' import { tryCatch } from 'common/util/try-catch' import { insert } from 'shared/supabase/utils' -export const createLover: APIHandler<'create-lover'> = async (body, auth) => { +export const createProfile: APIHandler<'create-lover'> = async (body, auth) => { const pg = createSupabaseDirectClient() const { data: existingUser } = await tryCatch( diff --git a/backend/api/src/get-lover-answers.ts b/backend/api/src/get-lover-answers.ts index 0e364c65..b712de97 100644 --- a/backend/api/src/get-lover-answers.ts +++ b/backend/api/src/get-lover-answers.ts @@ -2,7 +2,7 @@ import { type APIHandler } from 'api/helpers/endpoint' import { createSupabaseDirectClient } from 'shared/supabase/init' import { Row } from 'common/supabase/utils' -export const getLoverAnswers: APIHandler<'get-lover-answers'> = async ( +export const getProfileAnswers: APIHandler<'get-lover-answers'> = async ( props, _auth ) => { diff --git a/backend/api/src/like-lover.ts b/backend/api/src/like-lover.ts index 683b98d0..01a07cea 100644 --- a/backend/api/src/like-lover.ts +++ b/backend/api/src/like-lover.ts @@ -6,7 +6,7 @@ import { log } from 'shared/utils' import { tryCatch } from 'common/util/try-catch' import { Row } from 'common/supabase/utils' -export const likeLover: APIHandler<'like-lover'> = async (props, auth) => { +export const likeProfile: APIHandler<'like-lover'> = async (props, auth) => { const { targetUserId, remove } = props const creatorId = auth.uid diff --git a/backend/api/src/star-lover.ts b/backend/api/src/star-lover.ts index 91c05b91..12ebc1f2 100644 --- a/backend/api/src/star-lover.ts +++ b/backend/api/src/star-lover.ts @@ -5,7 +5,7 @@ import { tryCatch } from 'common/util/try-catch' import { Row } from 'common/supabase/utils' import { insert } from 'shared/supabase/utils' -export const starLover: APIHandler<'star-lover'> = async (props, auth) => { +export const starProfile: APIHandler<'star-lover'> = async (props, auth) => { const { targetUserId, remove } = props const creatorId = auth.uid diff --git a/backend/api/src/update-lover.ts b/backend/api/src/update-lover.ts index 473fe5b2..618e34cb 100644 --- a/backend/api/src/update-lover.ts +++ b/backend/api/src/update-lover.ts @@ -7,21 +7,21 @@ import { tryCatch } from 'common/util/try-catch' import { update } from 'shared/supabase/utils' import { type Row } from 'common/supabase/utils' -export const updateLover: APIHandler<'update-lover'> = async ( +export const updateProfile: APIHandler<'update-lover'> = async ( parsedBody, auth ) => { log('parsedBody', parsedBody) const pg = createSupabaseDirectClient() - const { data: existingLover } = await tryCatch( + const { data: existingProfile } = await tryCatch( pg.oneOrNone>('select * from profiles where user_id = $1', [ auth.uid, ]) ) - if (!existingLover) { - throw new APIError(404, 'Lover not found') + if (!existingProfile) { + throw new APIError(404, 'Profile not found') } !parsedBody.last_online_time && diff --git a/backend/email/emails/functions/helpers.tsx b/backend/email/emails/functions/helpers.tsx index d0e1b897..57f148f4 100644 --- a/backend/email/emails/functions/helpers.tsx +++ b/backend/email/emails/functions/helpers.tsx @@ -4,7 +4,7 @@ import {sendEmail} from './send-email' import {NewMessageEmail} from '../new-message' import {NewEndorsementEmail} from '../new-endorsement' import {Test} from '../test' -import {getLover} from 'shared/love/supabase' +import {getProfile} from 'shared/love/supabase' import { render } from "@react-email/render" import {MatchesType} from "common/love/bookmarked_searches"; import NewSearchAlertsEmail from "email/new-search_alerts"; @@ -20,7 +20,7 @@ const from = 'Compass ' // 'new_match' // ) // if (!privateUser.email || !sendToEmail) return -// const lover = await getLover(privateUser.id) +// const lover = await getProfile(privateUser.id) // if (!lover) return // // return await sendEmail({ @@ -32,7 +32,7 @@ const from = 'Compass ' // onUser={lover.user} // email={privateUser.email} // matchedWithUser={matchedWithUser} -// matchedLover={lover} +// matchedProfile={lover} // unsubscribeUrl={unsubscribeUrl} // /> // ), @@ -51,7 +51,7 @@ export const sendNewMessageEmail = async ( ) if (!privateUser.email || !sendToEmail) return - const lover = await getLover(fromUser.id) + const lover = await getProfile(fromUser.id) if (!lover) { console.error('Could not send email notification: User not found') @@ -65,7 +65,7 @@ export const sendNewMessageEmail = async ( html: await render( { const name = onUser.name.split(' ')[0] - // const userImgSrc = getLoveOgImageUrl(matchedWithUser, matchedLover) + // const userImgSrc = getLoveOgImageUrl(matchedWithUser, matchedProfile) const userUrl = `https://${DOMAIN}/${matchedWithUser.username}` return ( @@ -72,7 +72,7 @@ export const NewMatchEmail = ({ NewMatchEmail.PreviewProps = { onUser: sinclairUser, matchedWithUser: jamesUser, - matchedLover: jamesLover, + matchedProfile: jamesProfile, email: 'someone@gmail.com', unsubscribeUrl: 'https://compassmeet.com/unsubscribe', } as NewMatchEmailProps diff --git a/backend/email/emails/new-message.tsx b/backend/email/emails/new-message.tsx index a3dd00db..93a1d0d8 100644 --- a/backend/email/emails/new-message.tsx +++ b/backend/email/emails/new-message.tsx @@ -11,11 +11,11 @@ import { Text, } from '@react-email/components' import { type User } from 'common/user' -import { type LoverRow } from 'common/love/lover' +import { type ProfileRow } from 'common/love/lover' import { - jamesLover, + jamesProfile, jamesUser, - sinclairLover, + sinclairProfile, sinclairUser, } from './functions/mock' import { DOMAIN } from 'common/envs/constants' @@ -24,7 +24,7 @@ import {button, container, content, Footer, imageContainer, main, paragraph, pro interface NewMessageEmailProps { fromUser: User - fromUserLover: LoverRow + fromUserProfile: ProfileRow toUser: User channelId: number unsubscribeUrl: string @@ -33,7 +33,7 @@ interface NewMessageEmailProps { export const NewMessageEmail = ({ fromUser, - fromUserLover, + fromUserProfile, toUser, channelId, unsubscribeUrl, @@ -42,7 +42,7 @@ export const NewMessageEmail = ({ const name = toUser.name.split(' ')[0] const creatorName = fromUser.name const messagesUrl = `https://${DOMAIN}/messages/${channelId}` - const userImgSrc = getLoveOgImageUrl(fromUser, fromUserLover) + const userImgSrc = getLoveOgImageUrl(fromUser, fromUserProfile) return ( @@ -90,7 +90,7 @@ export const NewMessageEmail = ({ NewMessageEmail.PreviewProps = { fromUser: jamesUser, - fromUserLover: jamesLover, + fromUserProfile: jamesProfile, toUser: sinclairUser, channelId: 1, email: 'someone@gmail.com', diff --git a/backend/shared/src/create-love-notification.ts b/backend/shared/src/create-love-notification.ts index 756b174f..ab350d2f 100644 --- a/backend/shared/src/create-love-notification.ts +++ b/backend/shared/src/create-love-notification.ts @@ -4,13 +4,13 @@ import { createSupabaseDirectClient } from './supabase/init' import { getNotificationDestinationsForUser } from 'common/user-notification-preferences' import { Notification } from 'common/notifications' import { insertNotificationToSupabase } from './supabase/notifications' -import { getLover } from './love/supabase' +import { getProfile } from './love/supabase' export const createLoveLikeNotification = async (like: Row<'love_likes'>) => { const { creator_id, target_id, like_id } = like const targetPrivateUser = await getPrivateUser(target_id) - const lover = await getLover(creator_id) + const lover = await getProfile(creator_id) if (!targetPrivateUser || !lover) return @@ -48,7 +48,7 @@ export const createLoveShipNotification = async ( const creator = await getUser(creator_id) const targetPrivateUser = await getPrivateUser(recipientId) - const lover = await getLover(otherTargetId) + const lover = await getProfile(otherTargetId) if (!creator || !targetPrivateUser || !lover) { console.error('Could not load user object', { diff --git a/backend/shared/src/love/supabase.ts b/backend/shared/src/love/supabase.ts index 5a75b1f5..421ad261 100644 --- a/backend/shared/src/love/supabase.ts +++ b/backend/shared/src/love/supabase.ts @@ -1,28 +1,28 @@ import { areGenderCompatible } from 'common/love/compatibility-util' -import { type Lover, type LoverRow } from 'common/love/lover' +import { type Profile, type ProfileRow } from 'common/love/lover' import { type User } from 'common/user' import { Row } from 'common/supabase/utils' import { createSupabaseDirectClient } from 'shared/supabase/init' -export type LoverAndUserRow = LoverRow & { +export type ProfileAndUserRow = ProfileRow & { name: string username: string user: any } -export function convertRow(row: LoverAndUserRow): Lover -export function convertRow(row: LoverAndUserRow | undefined): Lover | null { +export function convertRow(row: ProfileAndUserRow): Profile +export function convertRow(row: ProfileAndUserRow | undefined): Profile | null { if (!row) return null return { ...row, user: { ...row.user, name: row.name, username: row.username } as User, - } as Lover + } as Profile } const LOVER_COLS = 'profiles.*, name, username, users.data as user' -export const getLover = async (userId: string) => { +export const getProfile = async (userId: string) => { const pg = createSupabaseDirectClient() return await pg.oneOrNone( ` @@ -58,7 +58,7 @@ export const getProfiles = async (userIds: string[]) => { ) } -export const getGenderCompatibleProfiles = async (lover: LoverRow) => { +export const getGenderCompatibleProfiles = async (lover: ProfileRow) => { const pg = createSupabaseDirectClient() const profiles = await pg.map( ` @@ -77,11 +77,11 @@ export const getGenderCompatibleProfiles = async (lover: LoverRow) => { { ...lover }, convertRow ) - return profiles.filter((l: Lover) => areGenderCompatible(lover, l)) + return profiles.filter((l: Profile) => areGenderCompatible(lover, l)) } export const getCompatibleProfiles = async ( - lover: LoverRow, + lover: ProfileRow, radiusKm: number | undefined ) => { const pg = createSupabaseDirectClient() diff --git a/common/src/api/schema.ts b/common/src/api/schema.ts index a35fc106..72135f56 100644 --- a/common/src/api/schema.ts +++ b/common/src/api/schema.ts @@ -7,7 +7,7 @@ import { import { PrivateChatMessage } from 'common/chat-message' import { CompatibilityScore } from 'common/love/compatibility-score' import { MAX_COMPATIBILITY_QUESTION_LENGTH } from 'common/love/constants' -import { Lover, LoverRow } from 'common/love/lover' +import { Profile, ProfileRow } from 'common/love/lover' import { Row } from 'common/supabase/utils' import { PrivateUser, User } from 'common/user' import { z } from 'zod' @@ -147,7 +147,7 @@ export const API = (_apiTypeCheck = { method: 'POST', authed: true, props: combinedLoveUsersSchema.partial(), - returns: {} as LoverRow, + returns: {} as ProfileRow, }, 'update-notif-settings': { method: 'POST', @@ -217,8 +217,8 @@ export const API = (_apiTypeCheck = { authed: false, props: z.object({ userId: z.string() }), returns: {} as { - lover: Lover - compatibleProfiles: Lover[] + lover: Profile + compatibleProfiles: Profile[] loverCompatibilityScores: { [userId: string]: CompatibilityScore } @@ -331,7 +331,7 @@ export const API = (_apiTypeCheck = { .strict(), returns: {} as { status: 'success' | 'fail' - profiles: Lover[] + profiles: Profile[] }, }, 'get-lover-answers': { diff --git a/common/src/filters.ts b/common/src/filters.ts index e0d6eb8d..eec4e93c 100644 --- a/common/src/filters.ts +++ b/common/src/filters.ts @@ -1,4 +1,4 @@ -import {Lover, LoverRow} from "common/love/lover"; +import {Profile, ProfileRow} from "common/love/lover"; import {cloneDeep} from "lodash"; import {filterDefined} from "common/util/array"; @@ -8,7 +8,7 @@ export type FilterFields = { genders: string[] name: string | undefined } & Pick< - LoverRow, + ProfileRow, | 'wants_kids_strength' | 'pref_relation_styles' | 'is_smoker' @@ -18,7 +18,7 @@ export type FilterFields = { | 'pref_age_max' > export const orderProfiles = ( - profiles: Lover[], + profiles: Profile[], starredUserIds: string[] | undefined ) => { if (!profiles) return diff --git a/common/src/love/compatibility-score.ts b/common/src/love/compatibility-score.ts index 257bed3d..05fa0438 100644 --- a/common/src/love/compatibility-score.ts +++ b/common/src/love/compatibility-score.ts @@ -1,5 +1,5 @@ import { keyBy, sumBy } from 'lodash' -import { LoverRow } from 'common/love/lover' +import { ProfileRow } from 'common/love/lover' import { Row as rowFor } from 'common/supabase/utils' import { areAgeCompatible, @@ -133,8 +133,8 @@ export function getScoredAnswerCompatibility( } export const getProfilesCompatibilityFactor = ( - lover1: LoverRow, - lover2: LoverRow + lover1: ProfileRow, + lover2: ProfileRow ) => { let multiplier = 1 multiplier *= areAgeCompatible(lover1, lover2) ? 1 : 0.5 diff --git a/common/src/love/compatibility-util.ts b/common/src/love/compatibility-util.ts index fa9c646c..74f04421 100644 --- a/common/src/love/compatibility-util.ts +++ b/common/src/love/compatibility-util.ts @@ -1,4 +1,4 @@ -import { LoverRow } from 'common/love/lover' +import { ProfileRow } from 'common/love/lover' import {MAX_INT, MIN_INT} from "common/constants"; const isPreferredGender = ( @@ -18,7 +18,7 @@ const isPreferredGender = ( return preferredGenders.includes(gender) || gender === 'non-binary' } -export const areGenderCompatible = (lover1: LoverRow, lover2: LoverRow) => { +export const areGenderCompatible = (lover1: ProfileRow, lover2: ProfileRow) => { // console.log('areGenderCompatible', isPreferredGender(lover1.pref_gender, lover2.gender), isPreferredGender(lover2.pref_gender, lover1.gender)) return ( isPreferredGender(lover1.pref_gender, lover2.gender) && @@ -26,18 +26,18 @@ export const areGenderCompatible = (lover1: LoverRow, lover2: LoverRow) => { ) } -const satisfiesAgeRange = (lover: LoverRow, age: number | null | undefined) => { +const satisfiesAgeRange = (lover: ProfileRow, age: number | null | undefined) => { return (age ?? MAX_INT) >= (lover.pref_age_min ?? MIN_INT) && (age ?? MIN_INT) <= (lover.pref_age_max ?? MAX_INT) } -export const areAgeCompatible = (lover1: LoverRow, lover2: LoverRow) => { +export const areAgeCompatible = (lover1: ProfileRow, lover2: ProfileRow) => { return ( satisfiesAgeRange(lover1, lover2.age) && satisfiesAgeRange(lover2, lover1.age) ) } -export const areLocationCompatible = (lover1: LoverRow, lover2: LoverRow) => { +export const areLocationCompatible = (lover1: ProfileRow, lover2: ProfileRow) => { if ( !lover1.city_latitude || !lover2.city_latitude || @@ -54,15 +54,15 @@ export const areLocationCompatible = (lover1: LoverRow, lover2: LoverRow) => { } export const areRelationshipStyleCompatible = ( - lover1: LoverRow, - lover2: LoverRow + lover1: ProfileRow, + lover2: ProfileRow ) => { return lover1.pref_relation_styles.some((style) => lover2.pref_relation_styles.includes(style) ) } -export const areWantKidsCompatible = (lover1: LoverRow, lover2: LoverRow) => { +export const areWantKidsCompatible = (lover1: ProfileRow, lover2: ProfileRow) => { const { wants_kids_strength: kids1 } = lover1 const { wants_kids_strength: kids2 } = lover2 diff --git a/common/src/love/lover.ts b/common/src/love/lover.ts index ddba29e7..f0d09a74 100644 --- a/common/src/love/lover.ts +++ b/common/src/love/lover.ts @@ -1,10 +1,10 @@ import { Row, run, SupabaseClient } from 'common/supabase/utils' import { User } from 'common/user' -export type LoverRow = Row<'profiles'> -export type Lover = LoverRow & { user: User } -export const getLoverRow = async (userId: string, db: SupabaseClient) => { - console.log('getLoverRow', userId) +export type ProfileRow = Row<'profiles'> +export type Profile = ProfileRow & { user: User } +export const getProfileRow = async (userId: string, db: SupabaseClient) => { + console.log('getProfileRow', userId) const res = await run(db.from('profiles').select('*').eq('user_id', userId)) return res.data[0] } diff --git a/common/src/love/og-image.ts b/common/src/love/og-image.ts index 35643db5..2e41bd92 100644 --- a/common/src/love/og-image.ts +++ b/common/src/love/og-image.ts @@ -1,5 +1,5 @@ import { User } from 'common/user' -import { LoverRow } from 'common/love/lover' +import { ProfileRow } from 'common/love/lover' import { buildOgUrl } from 'common/util/og' // TODO: handle age, gender undefined better @@ -14,7 +14,7 @@ export type LoveOgProps = { gender: string } -export function getLoveOgImageUrl(user: User, lover?: LoverRow | null) { +export function getLoveOgImageUrl(user: User, lover?: ProfileRow | null) { const loveProps = { avatarUrl: lover?.pinned_url, username: user.username, diff --git a/web/components/answers/compatibility-questions-display.tsx b/web/components/answers/compatibility-questions-display.tsx index 0487f16b..3c385463 100644 --- a/web/components/answers/compatibility-questions-display.tsx +++ b/web/components/answers/compatibility-questions-display.tsx @@ -3,11 +3,11 @@ import { getAnswerCompatibility, getScoredAnswerCompatibility, } from 'common/love/compatibility-score' -import { Lover } from 'common/love/lover' +import { Profile } from 'common/love/lover' import { Row as rowFor } from 'common/supabase/utils' import { User } from 'common/user' import { partition, sortBy, keyBy } from 'lodash' -import { useLover } from 'web/hooks/use-lover' +import { useProfile } from 'web/hooks/use-lover' import { QuestionWithCountType, useCompatibilityQuestionsWithAnswerCount, @@ -81,11 +81,11 @@ type CompatibilitySort = export function CompatibilityQuestionsDisplay(props: { isCurrentUser: boolean user: User - lover: Lover + lover: Profile fromSignup?: boolean - fromLoverPage?: Lover + fromProfilePage?: Profile }) { - const { isCurrentUser, user, fromSignup, fromLoverPage, lover } = props + const { isCurrentUser, user, fromSignup, fromProfilePage, lover } = props const { refreshCompatibilityQuestions, compatibilityQuestions } = useCompatibilityQuestionsWithAnswerCount() @@ -120,12 +120,12 @@ export function CompatibilityQuestionsDisplay(props: { const isLooking = useIsLooking() const [sort, setSort] = usePersistentInMemoryState( - !isLooking && !fromLoverPage ? 'their-important' : 'your-important', + !isLooking && !fromProfilePage ? 'their-important' : 'your-important', `compatibility-sort-${user.id}` ) const currentUser = useUser() - const comparedUserId = fromLoverPage?.user_id ?? currentUser?.id + const comparedUserId = fromProfilePage?.user_id ?? currentUser?.id const { compatibilityAnswers: comparedAnswers } = useUserCompatibilityAnswers(comparedUserId) const questionIdToComparedAnswer = keyBy(comparedAnswers, 'question_id') @@ -178,13 +178,13 @@ export function CompatibilityQuestionsDisplay(props: { {`${ isCurrentUser ? 'Your' : shortenName(user.name) + `'s` } Compatibility Prompts`} - {(!isCurrentUser || fromLoverPage) && ( + {(!isCurrentUser || fromProfilePage) && ( )} @@ -198,7 +198,7 @@ export function CompatibilityQuestionsDisplay(props: { ) : ( <> - {isCurrentUser && !fromLoverPage && ( + {isCurrentUser && !fromProfilePage && ( {otherQuestions.length < 1 ? ( @@ -224,7 +224,7 @@ export function CompatibilityQuestionsDisplay(props: { isCurrentUser={isCurrentUser} refreshCompatibilityAll={refreshCompatibilityAll} lover={lover} - fromLoverPage={fromLoverPage} + fromProfilePage={fromProfilePage} /> ) })} @@ -233,7 +233,7 @@ export function CompatibilityQuestionsDisplay(props: { )} )} - {otherQuestions.length >= 1 && isCurrentUser && !fromLoverPage && ( + {otherQuestions.length >= 1 && isCurrentUser && !fromProfilePage && ( void user: User - fromLoverPage: Lover | undefined + fromProfilePage: Profile | undefined className?: string }) { - const { sort, setSort, user, fromLoverPage, className } = props + const { sort, setSort, user, fromProfilePage, className } = props const currentUser = useUser() const sortToDisplay = { - 'your-important': fromLoverPage - ? `Important to ${fromLoverPage.user.name}` + 'your-important': fromProfilePage + ? `Important to ${fromProfilePage.user.name}` : 'Important to you', 'their-important': `Important to ${user.name}`, disagree: 'Incompatible', @@ -285,7 +285,7 @@ function CompatibilitySortWidget(props: { 'your-important', 'their-important', 'disagree', - (!fromLoverPage || fromLoverPage.user_id === currentUser?.id) && + (!fromProfilePage || fromProfilePage.user_id === currentUser?.id) && 'your-unanswered' ) @@ -314,9 +314,9 @@ function CompatibilityAnswerBlock(props: { yourQuestions: QuestionWithCountType[] user: User isCurrentUser: boolean - lover: Lover + lover: Profile refreshCompatibilityAll: () => void - fromLoverPage?: Lover + fromProfilePage?: Profile }) { const { answer, @@ -325,18 +325,18 @@ function CompatibilityAnswerBlock(props: { lover, isCurrentUser, refreshCompatibilityAll, - fromLoverPage, + fromProfilePage, } = props const question = yourQuestions.find((q) => q.id === answer.question_id) const [editOpen, setEditOpen] = useState(false) const currentUser = useUser() - const currentLover = useLover() + const currentProfile = useProfile() - const comparedLover = isCurrentUser + const comparedProfile = isCurrentUser ? null - : !!fromLoverPage - ? fromLoverPage - : { ...currentLover, user: currentUser } + : !!fromProfilePage + ? fromProfilePage + : { ...currentProfile, user: currentUser } if ( !question || @@ -370,14 +370,14 @@ function CompatibilityAnswerBlock(props: { {question.question} - {comparedLover && ( + {comparedProfile && (
@@ -433,14 +433,14 @@ function CompatibilityAnswerBlock(props: { )} - {comparedLover && ( + {comparedProfile && ( @@ -476,10 +476,10 @@ function CompatibilityAnswerBlock(props: { function CompatibilityDisplay(props: { question: QuestionWithCountType - lover1: Lover - lover2: Lover + lover1: Profile + lover2: Profile answer1: rowFor<'love_compatibility_answers'> - currentUserIsComparedLover: boolean + currentUserIsComparedProfile: boolean currentUser: User | null | undefined className?: string }) { @@ -488,7 +488,7 @@ function CompatibilityDisplay(props: { lover1, lover2, answer1, - currentUserIsComparedLover, + currentUserIsComparedProfile, currentUser, } = props @@ -496,7 +496,7 @@ function CompatibilityDisplay(props: { rowFor<'love_compatibility_answers'> | null | undefined >(undefined) - async function getComparedLoverAnswer() { + async function getComparedProfileAnswer() { db.from('love_compatibility_answers') .select() .eq('creator_id', lover2.user_id) @@ -510,7 +510,7 @@ function CompatibilityDisplay(props: { }) } useEffect(() => { - getComparedLoverAnswer() + getComparedProfileAnswer() }, []) const [open, setOpen] = useState(false) @@ -519,7 +519,7 @@ function CompatibilityDisplay(props: { const showCreateAnswer = (!answer2 || answer2.importance == -1) && - currentUserIsComparedLover && + currentUserIsComparedProfile && !!currentUser const isCurrentUser = currentUser?.id === lover2.user_id @@ -544,7 +544,7 @@ function CompatibilityDisplay(props: { ) : ( diff --git a/web/components/answers/free-response-add-question.tsx b/web/components/answers/free-response-add-question.tsx index caaf66a7..81595d70 100644 --- a/web/components/answers/free-response-add-question.tsx +++ b/web/components/answers/free-response-add-question.tsx @@ -12,7 +12,7 @@ import { import { Row } from 'web/components/layout/row' import { IndividualQuestionRow } from '../questions-form' import { TbMessage } from 'react-icons/tb' -import { OtherLoverAnswers } from './other-lover-answers' +import { OtherProfileAnswers } from './other-lover-answers' import { ArrowLeftIcon } from '@heroicons/react/outline' import { usePersistentInMemoryState } from 'web/hooks/use-persistent-in-memory-state' @@ -87,7 +87,7 @@ function AddQuestionModal(props: { {expandedQuestion.question}
- - {isCurrentUser && !fromLoverPage && ( + {isCurrentUser && !fromProfilePage && ( {question.question} - @@ -20,12 +20,12 @@ export function LoverAnswers(props: { user={user} lover={lover} fromSignup={fromSignup} - fromLoverPage={fromLoverPage} + fromProfilePage={fromProfilePage} /> {/**/} ) diff --git a/web/components/answers/other-lover-answers.tsx b/web/components/answers/other-lover-answers.tsx index 021d2e2b..e1a5d906 100644 --- a/web/components/answers/other-lover-answers.tsx +++ b/web/components/answers/other-lover-answers.tsx @@ -12,7 +12,7 @@ import { capitalize } from 'lodash' import clsx from 'clsx' import { shortenedFromNow } from 'web/lib/util/shortenedFromNow' -export function OtherLoverAnswers(props: { +export function OtherProfileAnswers(props: { question: QuestionWithCountType user?: User className?: string diff --git a/web/components/bio/editable-bio.tsx b/web/components/bio/editable-bio.tsx index 76b8ff64..4a2c640b 100644 --- a/web/components/bio/editable-bio.tsx +++ b/web/components/bio/editable-bio.tsx @@ -1,16 +1,16 @@ import { JSONContent } from '@tiptap/core' import { MAX_DESCRIPTION_LENGTH } from 'common/envs/constants' -import { Lover } from 'common/love/lover' +import { Profile } from 'common/love/lover' import { tryCatch } from 'common/util/try-catch' import { Button } from 'web/components/buttons/button' import { Col } from 'web/components/layout/col' import { Row } from 'web/components/layout/row' import { TextEditor, useTextEditor } from 'web/components/widgets/editor' -import { updateLover } from 'web/lib/api' +import { updateProfile } from 'web/lib/api' import { track } from 'web/lib/service/analytics' export function EditableBio(props: { - lover: Lover + lover: Profile onSave: () => void onCancel?: () => void }) { @@ -25,7 +25,7 @@ export function EditableBio(props: { const saveBio = async () => { if (!editor) return - const { error } = await tryCatch(updateLover({ bio: editor.getJSON() })) + const { error } = await tryCatch(updateProfile({ bio: editor.getJSON() })) if (error) { console.error(error) diff --git a/web/components/bio/lover-bio-block.tsx b/web/components/bio/lover-bio-block.tsx index d4b72b4f..aac56b9e 100644 --- a/web/components/bio/lover-bio-block.tsx +++ b/web/components/bio/lover-bio-block.tsx @@ -2,23 +2,23 @@ import { PencilIcon, XIcon } from '@heroicons/react/outline' import { JSONContent } from '@tiptap/core' import clsx from 'clsx' -import { Lover } from 'common/love/lover' +import { Profile } from 'common/love/lover' import DropdownMenu from 'web/components/comments/dropdown-menu' import { Col } from 'web/components/layout/col' import { Row } from 'web/components/layout/row' import { Content } from 'web/components/widgets/editor' -import { updateLover } from 'web/lib/api' +import { updateProfile } from 'web/lib/api' import { EditableBio } from './editable-bio' import { tryCatch } from 'common/util/try-catch' export function BioBlock(props: { isCurrentUser: boolean - lover: Lover - refreshLover: () => void + lover: Profile + refreshProfile: () => void edit: boolean setEdit: (edit: boolean) => void }) { - const { isCurrentUser, refreshLover, lover, edit, setEdit } = props + const { isCurrentUser, refreshProfile, lover, edit, setEdit } = props return ( setEdit(false) : undefined} onSave={() => { - refreshLover() + refreshProfile() setEdit(false) }} /> @@ -55,9 +55,9 @@ export function BioBlock(props: { name: 'Delete', icon: , onClick: async () => { - const { error } = await tryCatch(updateLover({ bio: null })) + const { error } = await tryCatch(updateProfile({ bio: null })) if (error) console.error(error) - else refreshLover() + else refreshProfile() }, }, ]} diff --git a/web/components/bio/lover-bio.tsx b/web/components/bio/lover-bio.tsx index d2a1c0ee..be0d95cc 100644 --- a/web/components/bio/lover-bio.tsx +++ b/web/components/bio/lover-bio.tsx @@ -1,20 +1,20 @@ -import { Lover } from 'common/love/lover' +import { Profile } from 'common/love/lover' import { useState } from 'react' import { Col } from 'web/components/layout/col' import { Subtitle } from '../widgets/lover-subtitle' import { BioBlock } from './lover-bio-block' -export function LoverBio(props: { +export function ProfileBio(props: { isCurrentUser: boolean - lover: Lover - refreshLover: () => void - fromLoverPage?: Lover + lover: Profile + refreshProfile: () => void + fromProfilePage?: Profile }) { - const { isCurrentUser, lover, refreshLover, fromLoverPage } = props + const { isCurrentUser, lover, refreshProfile, fromProfilePage } = props const [edit, setEdit] = useState(false) if (!isCurrentUser && !lover.bio) return null - if (fromLoverPage && !lover.bio) return null + if (fromProfilePage && !lover.bio) return null return ( @@ -22,7 +22,7 @@ export function LoverBio(props: { diff --git a/web/components/browse-matches-button.tsx b/web/components/browse-matches-button.tsx index aad17f91..755fae0a 100644 --- a/web/components/browse-matches-button.tsx +++ b/web/components/browse-matches-button.tsx @@ -4,7 +4,7 @@ import { useState } from 'react' import Link from 'next/link' import { MAX_COMMENT_LENGTH } from 'common/comment' -import { Lover } from 'common/love/lover' +import { Profile } from 'common/love/lover' import { Button } from 'web/components/buttons/button' import { Col } from 'web/components/layout/col' import { Modal, SCROLLABLE_MODAL_CLASS } from 'web/components/layout/modal' @@ -13,14 +13,14 @@ import { useTextEditor } from 'web/components/widgets/editor' import { useUser } from 'web/hooks/use-user' import { CompatibilityScore } from 'common/love/compatibility-score' import { CompatibleBadge } from './widgets/compatible-badge' -import { LoverProfile } from './profile/lover-profile' +import { ProfileProfile } from './profile/lover-profile' import { Pagination } from 'web/components/widgets/pagination' import { Title } from 'web/components/widgets/title' import { Input } from 'web/components/widgets/input' export const BrowseMatchesButton = (props: { - lover: Lover - potentialProfiles: Lover[] + lover: Profile + potentialProfiles: Profile[] compatibilityScores: Record className?: string }) => { @@ -95,8 +95,8 @@ export const BrowseMatchesButton = (props: { } const BrowseMatchesDialog = (props: { - lover: Lover - potentialProfiles: Lover[] + lover: Profile + potentialProfiles: Profile[] compatibilityScores: Record isSubmitting: boolean setOpen: (open: boolean) => void @@ -124,10 +124,10 @@ const BrowseMatchesDialog = (props: { ) const [potentialIndex, setPotentialIndex] = useState(0) const index = Math.min(potentialIndex, filteredProfiles.length - 1) - const potentialLover = filteredProfiles[index] + const potentialProfile = filteredProfiles[index] - const compatibility = potentialLover - ? compatibilityScores[potentialLover.user_id] + const compatibility = potentialProfile + ? compatibilityScores[potentialProfile.user_id] : undefined return ( @@ -168,14 +168,14 @@ const BrowseMatchesDialog = (props: { /> )} - {potentialLover && ( + {potentialProfile && ( <> - window.location.reload()} - fromLoverPage={lover} + window.location.reload()} + fromProfilePage={lover} /> {/* diff --git a/web/components/filters/desktop-filters.tsx b/web/components/filters/desktop-filters.tsx index 28c4146c..d53f8164 100644 --- a/web/components/filters/desktop-filters.tsx +++ b/web/components/filters/desktop-filters.tsx @@ -22,13 +22,13 @@ import { import { KidsLabel, wantsKidsLabelsWithIcon } from './wants-kids-filter' import { HasKidsLabel } from './has-kids-filter' import { MyMatchesToggle } from './my-matches-toggle' -import { Lover } from 'common/love/lover' +import { Profile } from 'common/love/lover' import {FilterFields} from "common/filters"; import {hasKidsLabels} from "common/has-kids"; export function DesktopFilters(props: { filters: Partial - youLover: Lover | undefined | null + youProfile: Profile | undefined | null updateFilter: (newState: Partial) => void clearFilters: () => void setYourFilters: (checked: boolean) => void @@ -37,7 +37,7 @@ export function DesktopFilters(props: { }) { const { filters, - youLover, + youProfile, updateFilter, clearFilters, setYourFilters, @@ -49,9 +49,9 @@ export function DesktopFilters(props: { <>