11import { Profile } from 'common/love/profile'
2- import { useEffect , useState } from 'react'
2+ import React , { useEffect , useState } from 'react'
33import { Col } from 'web/components/layout/col'
44import { Subtitle } from '../widgets/profile-subtitle'
55import { BioBlock } from './profile-bio-block'
66import { MAX_INT , MIN_BIO_LENGTH } from "common/constants" ;
77import { useTextEditor } from "web/components/widgets/editor" ;
88import { JSONContent } from "@tiptap/core"
9+ import { flip , offset , shift , useFloating } from "@floating-ui/react-dom" ;
10+
11+ export default function TooShortBio ( ) {
12+ const [ open , setOpen ] = useState ( false ) ;
13+ const { y, refs, strategy} = useFloating ( {
14+ placement : "bottom" , // place below the trigger
15+ middleware : [
16+ offset ( 8 ) , // small gap between ? and box
17+ flip ( ) ,
18+ shift ( { padding : 8 } ) , // prevent viewport clipping
19+ ] ,
20+ } ) ;
21+
22+ return (
23+ < p className = "text-red-600" >
24+ Bio too short. Profile may be filtered from search results.{ " " }
25+ < span
26+ className = "inline-flex align-middle"
27+ onMouseEnter = { ( ) => setOpen ( true ) }
28+ onMouseLeave = { ( ) => setOpen ( false ) }
29+ ref = { refs . setReference }
30+ >
31+ < span
32+ className = "cursor-help text-red-600 border border-red-600 rounded-full w-5 h-5 inline-flex items-center justify-center align-middle" >
33+ ?
34+ </ span >
35+ </ span >
36+
37+ { open && (
38+ < div
39+ ref = { refs . setFloating }
40+ style = { {
41+ position : strategy ,
42+ top : y ?? 0 ,
43+ left : "50%" ,
44+ transform : `translateX(-50%)` ,
45+ } }
46+ className = "p-3 bg-canvas-50 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 z-50 transition-opacity w-72 max-w-[calc(100vw-1rem)] whitespace-normal break-words"
47+ >
48+ < p className = "text-sm text-gray-800 dark:text-gray-100" >
49+ Since your bio is too short, Compass' algorithm filters out your
50+ profile from search results (unless "Include short bios" is
51+ selected). This ensures searches show meaningful profiles.
52+ </ p >
53+ </ div >
54+ ) }
55+ </ p >
56+ ) ;
57+ }
58+
959
1060export function ProfileBio ( props : {
1161 isCurrentUser : boolean
@@ -29,23 +79,7 @@ export function ProfileBio(props: {
2979
3080 return (
3181 < Col >
32- { textLength < MIN_BIO_LENGTH && ! edit && (
33- < div className = "group relative inline-block" >
34- < p className = "text-red-600 cursor-help flex items-center gap-1" >
35- Bio too short. Profile may be filtered from search results.
36- < span className = "text-xs border border-red-600 rounded px-1 animate-pulse" >
37- Hover for details
38- </ span >
39- </ p >
40- < div
41- className = "invisible group-hover:visible absolute left-0 top-full mt-2 p-3 bg-canvas-50 rounded-lg shadow-lg border border-gray-200 dark:border-gray-700 w-72 z-10" >
42- < p className = "text-sm" >
43- Since your bio is too short, Compass' algorithm filters out your profile from search results (unless
44- "Include short bios" is selected). This ensures searches show meaningful profiles.
45- </ p >
46- </ div >
47- </ div >
48- ) }
82+ { textLength < MIN_BIO_LENGTH && ! edit && < TooShortBio /> }
4983 < Subtitle className = "mb-4" > About Me</ Subtitle >
5084 < BioBlock
5185 isCurrentUser = { isCurrentUser }
0 commit comments