From 5d9a1c1bf8473cd4ab864104e0faa35f2a5b1190 Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Thu, 12 Feb 2026 15:49:04 +0100 Subject: [PATCH] Allow bio edition in profile edition --- web/components/bio/editable-bio.tsx | 27 +++++++++++++----------- web/components/optional-profile-form.tsx | 26 ++++++++++++++++++----- web/components/required-profile-form.tsx | 2 +- web/components/widgets/new-tab-link.tsx | 18 ++++++++++++++++ web/pages/signup.tsx | 2 +- 5 files changed, 56 insertions(+), 19 deletions(-) create mode 100644 web/components/widgets/new-tab-link.tsx diff --git a/web/components/bio/editable-bio.tsx b/web/components/bio/editable-bio.tsx index 58b2f671..1bee0a85 100644 --- a/web/components/bio/editable-bio.tsx +++ b/web/components/bio/editable-bio.tsx @@ -1,6 +1,6 @@ import {Editor} from '@tiptap/core' import {MAX_DESCRIPTION_LENGTH} from 'common/envs/constants' -import {Profile} from 'common/profiles/profile' +import {Profile, ProfileWithoutUser} from 'common/profiles/profile' import {tryCatch} from 'common/util/try-catch' import {Button} from 'web/components/buttons/button' import {Col} from 'web/components/layout/col' @@ -10,9 +10,9 @@ import {updateProfile} from 'web/lib/api' import {track} from 'web/lib/service/analytics' import {useEffect, useState} from "react"; import ReactMarkdown from "react-markdown"; -import Link from "next/link" import {MIN_BIO_LENGTH} from "common/constants"; import {ShowMore} from 'web/components/widgets/show-more' +import {NewTabLink} from 'web/components/widgets/new-tab-link' import {useT} from 'web/lib/locale' export function BioTips() { @@ -25,16 +25,17 @@ export function BioTips() { - Availability, how to contact you or start a conversation (email, social media, etc.) - Optional: romantic preferences, lifestyle habits, and conversation starters `); - + return ( -

{t('profile.bio.tips_intro', "Write a clear and engaging bio to help others understand who you are and the connections you seek. Include:")}

{tips} - {t('profile.bio.tips_link', 'Read full tips for writing a high-quality bio')} + {t('profile.bio.tips_link', 'Read full tips for writing a high-quality bio')}
) } @@ -99,11 +100,13 @@ export function EditableBio(props: { export function SignupBio(props: { onChange: (e: Editor) => void + profile?: ProfileWithoutUser | undefined }) { - const {onChange} = props + const {onChange, profile} = props return ( { if (!editor) return onChange(editor) @@ -138,10 +141,10 @@ export function BaseBio({defaultValue, onBlur, onEditor}: BaseBioProps) {
{textLength < MIN_BIO_LENGTH &&

- {remainingChars === 1 - ? t('profile.bio.add_characters_one', 'Add {count} more character so you can appear in search results—or take your time and start by exploring others.', {count: remainingChars}) - : t('profile.bio.add_characters_many', 'Add {count} more characters so you can appear in search results—or take your time and start by exploring others.', {count: remainingChars}) - } + {remainingChars === 1 + ? t('profile.bio.add_characters_one', 'Add {count} more character so you can appear in search results—or take your time and start by exploring others.', {count: remainingChars}) + : t('profile.bio.add_characters_many', 'Add {count} more characters so you can appear in search results—or take your time and start by exploring others.', {count: remainingChars}) + }

} diff --git a/web/components/optional-profile-form.tsx b/web/components/optional-profile-form.tsx index 89ebf801..1e9b5681 100644 --- a/web/components/optional-profile-form.tsx +++ b/web/components/optional-profile-form.tsx @@ -45,6 +45,8 @@ import {db} from "web/lib/supabase/db"; import {fetchChoices} from "web/hooks/use-choices"; import {AddOptionEntry} from "web/components/add-option-entry"; import {sleep} from "common/util/time" +import {SignupBio} from "web/components/bio/editable-bio"; +import {Editor} from "@tiptap/core"; export const OptionalProfileUserForm = (props: { @@ -93,10 +95,10 @@ export const OptionalProfileUserForm = (props: { const handleSubmit = async () => { setIsSubmitting(true) const { - bio: _bio, - bio_text: _bio_text, - bio_tsv: _bio_tsv, - bio_length: _bio_length, + // bio: _bio, + // bio_text: _bio_text, + // bio_tsv: _bio_tsv, + // bio_length: _bio_length, interests, causes, work, @@ -212,6 +214,20 @@ export const OptionalProfileUserForm = (props: { + {!fromSignup && + <> + + { + console.debug('bio changed', e, profile.bio) + setProfile('bio', e.getJSON()) + setProfile('bio_length', e.getText().length) + }} + /> + + } + @@ -818,7 +834,7 @@ export const OptionalProfileUserForm = (props: {