Something went wrong. Try again.
A Bsky-like frontend using the atprotocol natively.
Something went wrong. Try again.
1.1 kB · 40 lines
TypeScript
at main
1234567891011121314151617181920212223242526272829303132333435363738394041import { createContext, useContext } from 'react';import type { Did } from '../api/types';
export interface MuteBlockContextValue { mutedDids: Set<Did>; blockedDids: Set<Did>; blockedByDids: Set<Did>; loaded: boolean; ignoreBlocks: boolean; isMuted: (did: Did) => boolean; isBlocked: (did: Did) => boolean; isBlockedBy: (did: Did) => boolean; addBlockedBy: (did: Did) => void; muteActor: (did: Did) => Promise<void>; unmuteActor: (did: Did) => Promise<void>; blockActor: (did: Did) => Promise<string>; unblockActor: (blockUri: string, did: Did) => Promise<void>; reload: () => Promise<void>;}
export const MuteBlockContext = createContext<MuteBlockContextValue>({ mutedDids: new Set(), blockedDids: new Set(), blockedByDids: new Set(), loaded: false, ignoreBlocks: false, isMuted: () => false, isBlocked: () => false, isBlockedBy: () => false, addBlockedBy: () => {}, muteActor: async () => {}, unmuteActor: async () => {}, blockActor: async () => '', unblockActor: async () => {}, reload: async () => {},});
export function useMuteBlock() { return useContext(MuteBlockContext);}