From 4cb29d274b3b518f62ded9320b1122a435aee172 Mon Sep 17 00:00:00 2001
From: MartinBraquet
Date: Mon, 20 Oct 2025 15:28:59 +0200
Subject: [PATCH] Add floating info box
---
web/components/bio/profile-bio.tsx | 70 ++++++++++++++++++++++--------
web/package.json | 1 +
yarn.lock | 27 ++++++++++++
3 files changed, 80 insertions(+), 18 deletions(-)
diff --git a/web/components/bio/profile-bio.tsx b/web/components/bio/profile-bio.tsx
index 99c759c2..fb51e2e9 100644
--- a/web/components/bio/profile-bio.tsx
+++ b/web/components/bio/profile-bio.tsx
@@ -1,11 +1,61 @@
import {Profile} from 'common/love/profile'
-import {useEffect, useState} from 'react'
+import React, {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"
+import {flip, offset, shift, useFloating} from "@floating-ui/react-dom";
+
+export default function TooShortBio() {
+ const [open, setOpen] = useState(false);
+ const {y, refs, strategy} = useFloating({
+ placement: "bottom", // place below the trigger
+ middleware: [
+ offset(8), // small gap between ? and box
+ flip(),
+ shift({padding: 8}), // prevent viewport clipping
+ ],
+ });
+
+ return (
+
+ Bio too short. Profile may be filtered from search results.{" "}
+ setOpen(true)}
+ onMouseLeave={() => setOpen(false)}
+ ref={refs.setReference}
+ >
+
+ ?
+
+
+
+ {open && (
+
+
+ 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.
+
+
+ )}
+
+ );
+}
+
export function ProfileBio(props: {
isCurrentUser: boolean
@@ -29,23 +79,7 @@ export function ProfileBio(props: {
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.
-
-
-
- )}
+ {textLength < MIN_BIO_LENGTH && !edit && }
About Me