chore: cleanup right widget styles & NIP-89 handler

This commit is contained in:
2024-09-19 10:37:11 +01:00
parent 17e8955f54
commit 41c0047f5b
23 changed files with 773 additions and 94 deletions

View File

@ -2,7 +2,7 @@ import { HexKey } from "@snort/system";
import { ReactNode, useMemo } from "react";
import { FormattedMessage } from "react-intl";
import ProfilePreview from "@/Components/User/ProfilePreview";
import ProfilePreview, { ProfilePreviewProps } from "@/Components/User/ProfilePreview";
import useFollowsControls from "@/Hooks/useFollowControls";
import useLogin from "@/Hooks/useLogin";
@ -13,26 +13,22 @@ export interface FollowListBaseProps {
pubkeys: HexKey[];
title?: ReactNode;
showFollowAll?: boolean;
showAbout?: boolean;
className?: string;
actions?: ReactNode;
profileActions?: (pk: string) => ReactNode;
profilePreviewProps?: Omit<ProfilePreviewProps, "pubkey">;
}
export default function FollowListBase({
pubkeys,
title,
showFollowAll,
showAbout,
className,
actions,
profileActions,
profilePreviewProps,
}: FollowListBaseProps) {
const control = useFollowsControls();
const login = useLogin();
const profilePreviewOptions = useMemo(() => ({ about: showAbout, profileCards: true }), [showAbout]);
async function followAll() {
await control.addFollow(pubkeys);
}
@ -50,13 +46,7 @@ export default function FollowListBase({
)}
<div className={className}>
{pubkeys?.map((a, index) => (
<ProfilePreview
pubkey={a}
key={a}
options={profilePreviewOptions}
actions={profileActions?.(a)}
waitUntilInView={index > 10}
/>
<ProfilePreview pubkey={a} key={a} waitUntilInView={index > 10} {...profilePreviewProps} />
))}
</div>
</div>