feat: 💨
This commit is contained in:
@@ -66,7 +66,7 @@ const UserAggregationList = forwardRef<
|
|||||||
ref
|
ref
|
||||||
) => {
|
) => {
|
||||||
const { t } = useTranslation()
|
const { t } = useTranslation()
|
||||||
const { startLogin } = useNostr()
|
const { pubkey: currentPubkey, startLogin } = useNostr()
|
||||||
const { push } = useSecondaryPage()
|
const { push } = useSecondaryPage()
|
||||||
const { hideUntrustedNotes, isUserTrusted } = useUserTrust()
|
const { hideUntrustedNotes, isUserTrusted } = useUserTrust()
|
||||||
const { mutePubkeySet } = useMuteList()
|
const { mutePubkeySet } = useMuteList()
|
||||||
@@ -229,6 +229,7 @@ const UserAggregationList = forwardRef<
|
|||||||
|
|
||||||
const shouldHideEvent = useCallback(
|
const shouldHideEvent = useCallback(
|
||||||
(evt: Event) => {
|
(evt: Event) => {
|
||||||
|
if (evt.pubkey === currentPubkey) return true
|
||||||
if (isEventDeleted(evt)) return true
|
if (isEventDeleted(evt)) return true
|
||||||
if (hideUntrustedNotes && !isUserTrusted(evt.pubkey)) return true
|
if (hideUntrustedNotes && !isUserTrusted(evt.pubkey)) return true
|
||||||
if (filterMutedNotes && mutePubkeySet.has(evt.pubkey)) return true
|
if (filterMutedNotes && mutePubkeySet.has(evt.pubkey)) return true
|
||||||
@@ -245,7 +246,17 @@ const UserAggregationList = forwardRef<
|
|||||||
|
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
[hideUntrustedNotes, mutePubkeySet, isEventDeleted, filterFn]
|
[
|
||||||
|
hideUntrustedNotes,
|
||||||
|
mutePubkeySet,
|
||||||
|
isEventDeleted,
|
||||||
|
filterFn,
|
||||||
|
currentPubkey,
|
||||||
|
filterMutedNotes,
|
||||||
|
isUserTrusted,
|
||||||
|
hideContentMentioningMutedUsers,
|
||||||
|
isMentioningMutedUsers
|
||||||
|
]
|
||||||
)
|
)
|
||||||
|
|
||||||
const lastXDays = useMemo(() => {
|
const lastXDays = useMemo(() => {
|
||||||
@@ -436,6 +447,7 @@ function UserAggregationItem({
|
|||||||
const [hasNewEvents, setHasNewEvents] = useState(true)
|
const [hasNewEvents, setHasNewEvents] = useState(true)
|
||||||
const [loading, setLoading] = useState(false)
|
const [loading, setLoading] = useState(false)
|
||||||
const { isPinned, togglePin } = usePinnedUsers()
|
const { isPinned, togglePin } = usePinnedUsers()
|
||||||
|
const pinned = useMemo(() => isPinned(aggregation.pubkey), [aggregation.pubkey, isPinned])
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const update = () => {
|
const update = () => {
|
||||||
@@ -518,19 +530,13 @@ function UserAggregationItem({
|
|||||||
size="icon"
|
size="icon"
|
||||||
onClick={onTogglePin}
|
onClick={onTogglePin}
|
||||||
className={`flex-shrink-0 ${
|
className={`flex-shrink-0 ${
|
||||||
isPinned(aggregation.pubkey)
|
pinned
|
||||||
? 'text-primary hover:text-primary/80'
|
? 'text-primary hover:text-primary/80'
|
||||||
: 'text-muted-foreground hover:text-foreground'
|
: 'text-muted-foreground hover:text-foreground'
|
||||||
}`}
|
}`}
|
||||||
title={isPinned(aggregation.pubkey) ? t('Unpin') : t('Pin')}
|
title={pinned ? t('Unpin') : t('Pin')}
|
||||||
>
|
>
|
||||||
{loading ? (
|
{loading ? <Loader className="animate-spin" /> : pinned ? <PinOff /> : <Pin />}
|
||||||
<Loader className="animate-spin" />
|
|
||||||
) : isPinned(aggregation.pubkey) ? (
|
|
||||||
<PinOff />
|
|
||||||
) : (
|
|
||||||
<Pin />
|
|
||||||
)}
|
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ export function NostrProvider({ children }: { children: React.ReactNode }) {
|
|||||||
if (storedPinListEvent) {
|
if (storedPinListEvent) {
|
||||||
setPinListEvent(storedPinListEvent)
|
setPinListEvent(storedPinListEvent)
|
||||||
}
|
}
|
||||||
if (storedPinnedUsersEvent !== undefined) {
|
if (storedPinnedUsersEvent) {
|
||||||
setPinnedUsersEvent(storedPinnedUsersEvent)
|
setPinnedUsersEvent(storedPinnedUsersEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -348,9 +348,6 @@ export function NostrProvider({ children }: { children: React.ReactNode }) {
|
|||||||
if (updatedPinnedUsersEvent.id === pinnedUsersEvent.id) {
|
if (updatedPinnedUsersEvent.id === pinnedUsersEvent.id) {
|
||||||
setPinnedUsersEvent(updatedPinnedUsersEvent)
|
setPinnedUsersEvent(updatedPinnedUsersEvent)
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
await indexedDb.putNullReplaceableEvent(account.pubkey, ExtendedKind.PINNED_USERS)
|
|
||||||
setPinnedUsersEvent(null)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const notificationsSeenAt = Math.max(
|
const notificationsSeenAt = Math.max(
|
||||||
|
|||||||
Reference in New Issue
Block a user