From 58195e89d87998845a04a2b569cdac15182e5ecf Mon Sep 17 00:00:00 2001 From: 7w1 Date: Mon, 23 Feb 2026 17:29:24 -0600 Subject: [PATCH] Profile bios --- CHANGELOG.md | 2 +- src/app/components/editor/Editor.tsx | 10 +- .../user-profile/UserRoomProfile.tsx | 112 ++++++++-- .../settings/account/BioEditor.css.ts | 23 ++ .../features/settings/account/BioEditor.tsx | 200 ++++++++++++++++++ src/app/features/settings/account/Profile.tsx | 14 +- src/app/hooks/useUserProfile.ts | 9 +- 7 files changed, 343 insertions(+), 27 deletions(-) create mode 100644 src/app/features/settings/account/BioEditor.css.ts create mode 100644 src/app/features/settings/account/BioEditor.tsx diff --git a/CHANGELOG.md b/CHANGELOG.md index 587fb8af..be9dfb1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,7 @@ - Bug fix for images/links/anything that loads after room is opened, properly shifting the scroll to the bottom. - Client-side nicknames for other users. PR #3 - Inline editor for editing messages. -- Pronouns and timezones. +- Pronouns, bios, and timezones. - Pressing send on mobile no longer closes keyboard. - Pressing enter on mobile will always provide a newline, ignores the setting for desktop. - More reactive UI (literally just buttons shifting up and shrinking on click) diff --git a/src/app/components/editor/Editor.tsx b/src/app/components/editor/Editor.tsx index f6177817..9dd1cffd 100644 --- a/src/app/components/editor/Editor.tsx +++ b/src/app/components/editor/Editor.tsx @@ -73,6 +73,8 @@ type CustomEditorProps = { onKeyUp?: KeyboardEventHandler; onChange?: EditorChangeHandler; onPaste?: ClipboardEventHandler; + className?: string; + variant?: "Surface" | "SurfaceVariant" | "Background"; }; export const CustomEditor = forwardRef( ( @@ -89,6 +91,8 @@ export const CustomEditor = forwardRef( onKeyUp, onChange, onPaste, + className, + variant = "SurfaceVariant", }, ref ) => { @@ -127,7 +131,7 @@ export const CustomEditor = forwardRef( ); return ( -
+
{top} @@ -138,10 +142,10 @@ export const CustomEditor = forwardRef( )} str.length > len ? `${str.slice(0, len)}...` : str; const [showMore, setShowMore] = useState(false); @@ -39,13 +49,25 @@ function UserExtendedSection({ profile }: { profile: UserProfile }) { timeZone: timezone, }).format(new Date()) : null; + const bioContent = useMemo(() => { + const rawBio = profile.extended?.["moe.sable.app.bio"] || profile.bio; + if (!rawBio) return null; + + const safetyTrim = rawBio.length > 2048 ? rawBio.slice(0, 2048) : rawBio; + + const visibleText = safetyTrim.replace(/<[^>]*>?/gm, ''); + const VISIBLE_LIMIT = 512; + + if (visibleText.length <= VISIBLE_LIMIT) return safetyTrim; + + return safetyTrim; + }, [profile]); + const unknownFields = Object.entries(profile.extended || {}).filter(([, value]) => typeof value === 'string' || typeof value === 'number'); - if (!pronouns && !localTime && unknownFields.length === 0) return null; - return ( - + {pronouns && ( @@ -63,8 +85,40 @@ function UserExtendedSection({ profile }: { profile: UserProfile }) { )} + {bioContent && ( + + + + About me + + + + + + + + + + + )} + {unknownFields.length > 0 && ( - +