Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 26 additions & 9 deletions apps/web/modules/users/views/users-public-view.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
"use client";

import { useState } from "react";

import {
sdkActionManager,
useEmbedNonStylesConfig,
Expand Down Expand Up @@ -100,15 +102,7 @@ export function UserPage(props: PageProps) {
/>
)}
</h1>
{!isBioEmpty && (
<>
{/* biome-ignore lint/security/noDangerouslySetInnerHtml: Content is sanitized via safeBio */}
<div
className="text-default wrap-break-word text-sm [&_a]:text-blue-500 [&_a]:underline [&_a]:hover:text-blue-600"
dangerouslySetInnerHTML={{ __html: props.safeBio }}
/>
</>
)}
{!isBioEmpty && <BioSection safeBio={props.safeBio} />}
</div>
</div>

Expand Down Expand Up @@ -155,4 +149,27 @@ export function UserPage(props: PageProps) {
);
}

function BioSection({ safeBio }: { safeBio: string }) {
const [isExpanded, setIsExpanded] = useState(false);

return (
<div>
{/* biome-ignore lint/security/noDangerouslySetInnerHtml: Content is sanitized via safeBio */}
<div
className={classNames(
"text-default wrap-break-word text-sm [&_a]:text-blue-500 [&_a]:underline [&_a]:hover:text-blue-600",
!isExpanded && "line-clamp-3"
)}
dangerouslySetInnerHTML={{ __html: safeBio }}
/>
<button
type="button"
className="text-emphasis hover:text-default mt-1 text-xs font-medium"
onClick={() => setIsExpanded(!isExpanded)}>
{isExpanded ? "Read less" : "Read more"}
</button>
</div>
);
}

export default UserPage;
Loading