2023-01-01 19:57:27 +00:00
|
|
|
import "./ProfilePreview.css";
|
2023-01-19 00:03:24 +00:00
|
|
|
import { ReactNode } from "react";
|
|
|
|
|
2023-01-01 19:57:27 +00:00
|
|
|
import ProfileImage from "./ProfileImage";
|
|
|
|
import FollowButton from "./FollowButton";
|
2023-01-10 10:30:33 +00:00
|
|
|
import useProfile from "../feed/ProfileFeed";
|
2023-01-16 17:48:25 +00:00
|
|
|
import { HexKey } from "../nostr";
|
2023-01-01 19:57:27 +00:00
|
|
|
|
2023-01-16 17:48:25 +00:00
|
|
|
export interface ProfilePreviewProps {
|
|
|
|
pubkey: HexKey,
|
|
|
|
options?: {
|
|
|
|
about?: boolean
|
2023-01-19 00:03:24 +00:00
|
|
|
},
|
|
|
|
actions?: ReactNode
|
2023-01-16 17:48:25 +00:00
|
|
|
}
|
|
|
|
export default function ProfilePreview(props: ProfilePreviewProps) {
|
2023-01-01 19:57:27 +00:00
|
|
|
const pubkey = props.pubkey;
|
2023-01-16 17:48:25 +00:00
|
|
|
const user = useProfile(pubkey)?.get(pubkey);
|
2023-01-10 10:30:33 +00:00
|
|
|
const options = {
|
|
|
|
about: true,
|
|
|
|
...props.options
|
|
|
|
};
|
2023-01-01 19:57:27 +00:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="profile-preview">
|
2023-01-12 12:00:44 +00:00
|
|
|
<ProfileImage pubkey={pubkey} subHeader=
|
|
|
|
{options.about ? <div className="f-ellipsis about">
|
|
|
|
{user?.about}
|
2023-01-16 17:48:25 +00:00
|
|
|
</div> : undefined} />
|
2023-01-19 00:03:24 +00:00
|
|
|
{props.actions ?? <FollowButton pubkey={pubkey} className="ml5" />}
|
2023-01-01 19:57:27 +00:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
}
|