snort/packages/app/src/Components/User/MutedList.tsx

43 lines
1.1 KiB
TypeScript
Raw Normal View History

2024-04-22 13:38:14 +00:00
import { HexKey, NostrPrefix } from "@snort/system";
2024-01-04 17:01:18 +00:00
import { FormattedMessage } from "react-intl";
import MuteButton from "@/Components/User/MuteButton";
import ProfilePreview from "@/Components/User/ProfilePreview";
2023-11-17 11:52:10 +00:00
import useModeration from "@/Hooks/useModeration";
2023-01-26 11:34:18 +00:00
2023-09-28 09:26:10 +00:00
import messages from "../messages";
2023-02-08 21:10:26 +00:00
2023-01-26 11:34:18 +00:00
export interface MutedListProps {
2023-02-10 11:12:11 +00:00
pubkeys: HexKey[];
2023-01-26 11:34:18 +00:00
}
2024-04-22 13:38:14 +00:00
export default function MutedList() {
const { muteList } = useModeration();
2023-01-26 11:34:18 +00:00
return (
2023-10-31 15:40:12 +00:00
<div className="p">
<div className="flex justify-between">
2023-09-25 12:59:31 +00:00
<div className="bold">
2024-04-22 13:38:14 +00:00
<FormattedMessage {...messages.MuteCount} values={{ n: muteList?.length }} />
2023-02-08 21:10:26 +00:00
</div>
</div>
2024-04-22 13:38:14 +00:00
{muteList?.map(a => {
switch (a.type) {
case NostrPrefix.Profile:
case NostrPrefix.PublicKey: {
return (
<ProfilePreview
actions={<MuteButton pubkey={a.id} />}
pubkey={a.id}
options={{ about: false }}
key={a.id}
/>
);
}
}
return undefined;
})}
</div>
);
2023-01-26 11:34:18 +00:00
}