From a360f80cdfff805764803d7443efa2c08c47a2cf Mon Sep 17 00:00:00 2001 From: MartinBraquet Date: Mon, 20 Oct 2025 12:51:28 +0200 Subject: [PATCH] Add warning message about short bio --- web/components/bio/profile-bio.tsx | 41 +++++++++++++++++++++++++----- 1 file changed, 35 insertions(+), 6 deletions(-) diff --git a/web/components/bio/profile-bio.tsx b/web/components/bio/profile-bio.tsx index 4c5b9418..bff8e240 100644 --- a/web/components/bio/profile-bio.tsx +++ b/web/components/bio/profile-bio.tsx @@ -1,8 +1,11 @@ -import { Profile } from 'common/love/profile' -import { useState } from 'react' -import { Col } from 'web/components/layout/col' -import { Subtitle } from '../widgets/profile-subtitle' -import { BioBlock } from './profile-bio-block' +import {Profile} from 'common/love/profile' +import {useEffect, useState} from 'react' +import {Col} from 'web/components/layout/col' +import {Subtitle} from '../widgets/profile-subtitle' +import {BioBlock} from './profile-bio-block' +import {MAX_INT, MIN_BIO_LENGTH} from "common/constants"; +import {useTextEditor} from "web/components/widgets/editor"; +import {JSONContent} from "@tiptap/core" export function ProfileBio(props: { isCurrentUser: boolean @@ -10,14 +13,40 @@ export function ProfileBio(props: { refreshProfile: () => void fromProfilePage?: Profile }) { - const { isCurrentUser, profile, refreshProfile, fromProfilePage } = props + const {isCurrentUser, profile, refreshProfile, fromProfilePage} = props const [edit, setEdit] = useState(false) if (!isCurrentUser && !profile.bio) return null if (fromProfilePage && !profile.bio) return null + const editor = useTextEditor({defaultValue: ''}) + const [textLength, setTextLength] = useState(editor?.getText().length ?? MAX_INT) + + useEffect(() => { + if (!editor) return + editor.commands.setContent(profile.bio as JSONContent) + setTextLength(editor.getText().length) + }, [profile.bio, editor]) + return ( + {textLength < MIN_BIO_LENGTH && !edit && ( +
+

+ Bio too short. Profile may be filtered from search results. + + Hover for details + +

+
+

+ Since your bio is too short, Compass' algorithm filters out your profile from search results (unless + "Include short bios" is selected). This ensures searches show meaningful profiles. +

+
+
+ )} About Me