mirror of
https://github.com/hzrd149/nostrudel.git
synced 2025-06-10 17:00:58 +02:00
parent
1353ccdfd9
commit
37bf63e88a
5
.changeset/empty-hounds-love.md
Normal file
5
.changeset/empty-hounds-love.md
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"nostrudel": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Hide avatars of muted users
|
@ -1,5 +1,5 @@
|
|||||||
import { forwardRef, memo, useMemo } from "react";
|
import { forwardRef, memo, useMemo } from "react";
|
||||||
import { Avatar, AvatarBadge, AvatarProps } from "@chakra-ui/react";
|
import { Avatar, AvatarProps } from "@chakra-ui/react";
|
||||||
import { useAsync } from "react-use";
|
import { useAsync } from "react-use";
|
||||||
|
|
||||||
import useUserMetadata from "../../hooks/use-user-metadata";
|
import useUserMetadata from "../../hooks/use-user-metadata";
|
||||||
@ -11,8 +11,7 @@ import useCurrentAccount from "../../hooks/use-current-account";
|
|||||||
import { buildImageProxyURL } from "../../helpers/image";
|
import { buildImageProxyURL } from "../../helpers/image";
|
||||||
import UserDnsIdentityIcon from "./user-dns-identity-icon";
|
import UserDnsIdentityIcon from "./user-dns-identity-icon";
|
||||||
import styled from "@emotion/styled";
|
import styled from "@emotion/styled";
|
||||||
import useSubject from "../../hooks/use-subject";
|
import useUserMuteList from "../../hooks/use-user-mute-list";
|
||||||
import localSettings from "../../services/local-settings";
|
|
||||||
|
|
||||||
export const UserIdenticon = memo(({ pubkey }: { pubkey: string }) => {
|
export const UserIdenticon = memo(({ pubkey }: { pubkey: string }) => {
|
||||||
const { value: identicon } = useAsync(() => getIdenticon(pubkey), [pubkey]);
|
const { value: identicon } = useAsync(() => getIdenticon(pubkey), [pubkey]);
|
||||||
@ -35,9 +34,20 @@ export type UserAvatarProps = Omit<MetadataAvatarProps, "pubkey" | "metadata"> &
|
|||||||
export const UserAvatar = forwardRef<HTMLDivElement, UserAvatarProps>(
|
export const UserAvatar = forwardRef<HTMLDivElement, UserAvatarProps>(
|
||||||
({ pubkey, noProxy, relay, size, ...props }, ref) => {
|
({ pubkey, noProxy, relay, size, ...props }, ref) => {
|
||||||
const metadata = useUserMetadata(pubkey, relay ? [relay] : undefined);
|
const metadata = useUserMetadata(pubkey, relay ? [relay] : undefined);
|
||||||
|
const account = useCurrentAccount();
|
||||||
|
const muteList = useUserMuteList(account?.pubkey);
|
||||||
|
|
||||||
|
const muted = muteList?.tags.some((t) => t[0] === "p" && t[1] === pubkey);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<MetadataAvatar pubkey={pubkey} metadata={metadata} noProxy={noProxy} ref={ref} size={size} {...props}>
|
<MetadataAvatar
|
||||||
|
pubkey={pubkey}
|
||||||
|
metadata={muted ? undefined : metadata}
|
||||||
|
noProxy={noProxy}
|
||||||
|
ref={ref}
|
||||||
|
size={size}
|
||||||
|
{...props}
|
||||||
|
>
|
||||||
{size !== "xs" && (
|
{size !== "xs" && (
|
||||||
<UserDnsIdentityIcon
|
<UserDnsIdentityIcon
|
||||||
pubkey={pubkey}
|
pubkey={pubkey}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user