import { DEFAULT_AVATAR } from '@lume/stores/constants'; import { useProfile } from '@lume/utils/hooks/useProfile'; import { shortenKey } from '@lume/utils/shortenKey'; import { useState } from 'react'; export default function MutedItem({ data }: { data: any }) { const { user, isError, isLoading } = useProfile(data.content); const [status, setStatus] = useState(data.status); const unmute = async () => { const { updateItemInBlacklist } = await import('@lume/utils/storage'); const res = await updateItemInBlacklist(data.content, 0); if (res) { setStatus(0); } }; const mute = async () => { const { updateItemInBlacklist } = await import('@lume/utils/storage'); const res = await updateItemInBlacklist(data.content, 1); if (res) { setStatus(1); } }; return (
{isError || isLoading ? ( <>
) : ( <>
{data.content}
{user?.display_name || user?.name || 'Pleb'} {shortenKey(data.content)}
{status === 1 ? ( ) : ( )}
)}
); }