2023-01-20 11:11:50 +00:00
|
|
|
import useEventPublisher from "Feed/EventPublisher";
|
|
|
|
import { HexKey } from "Nostr";
|
|
|
|
import ProfilePreview from "Element/ProfilePreview";
|
2023-01-10 12:05:36 +00:00
|
|
|
|
2023-01-16 17:48:25 +00:00
|
|
|
export interface FollowListBaseProps {
|
|
|
|
pubkeys: HexKey[],
|
|
|
|
title?: string
|
|
|
|
}
|
|
|
|
export default function FollowListBase({ pubkeys, title }: FollowListBaseProps) {
|
2023-01-10 12:05:36 +00:00
|
|
|
const publisher = useEventPublisher();
|
|
|
|
|
|
|
|
async function followAll() {
|
|
|
|
let ev = await publisher.addFollow(pubkeys);
|
|
|
|
publisher.broadcast(ev);
|
|
|
|
}
|
|
|
|
|
|
|
|
return (
|
2023-01-25 18:08:53 +00:00
|
|
|
<div className="main-content">
|
2023-02-05 11:25:35 +00:00
|
|
|
<div className="flex mt10 mb10">
|
2023-01-26 06:51:38 +00:00
|
|
|
<div className="f-grow bold">{title}</div>
|
2023-01-26 07:25:05 +00:00
|
|
|
<button className="transparent" type="button" onClick={() => followAll()}>Follow All</button>
|
2023-01-10 12:05:36 +00:00
|
|
|
</div>
|
2023-01-12 12:00:44 +00:00
|
|
|
{pubkeys?.map(a => <ProfilePreview pubkey={a} key={a} />)}
|
2023-01-25 18:08:53 +00:00
|
|
|
</div>
|
2023-01-10 12:05:36 +00:00
|
|
|
)
|
2023-01-25 18:08:53 +00:00
|
|
|
}
|