From b445c15cc99a56c2baf727d05cf53b44aef4542b Mon Sep 17 00:00:00 2001 From: Paul Frazee Date: Sun, 12 Nov 2023 18:13:11 -0800 Subject: Refactor notifications to use react-query (#1878) * Move broadcast channel to lib * Refactor view/com/post/Post and remove temporary 2 components * Add useModerationOpts hook * Refactor notifications to use react-query * Fix: only trigger updates in useModerationOpts when the values have changed * Implement unread notification tracking * Add moderation filtering to notifications * Handle native/push notifications * Remove dead code --------- Co-authored-by: Eric Bailey --- src/lib/broadcast/index.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 src/lib/broadcast/index.ts (limited to 'src/lib/broadcast/index.ts') diff --git a/src/lib/broadcast/index.ts b/src/lib/broadcast/index.ts new file mode 100644 index 000000000..aa3aef580 --- /dev/null +++ b/src/lib/broadcast/index.ts @@ -0,0 +1,11 @@ +export default class BroadcastChannel { + constructor(public name: string) {} + postMessage(_data: any) {} + close() {} + onmessage: (event: MessageEvent) => void = () => {} + addEventListener(_type: string, _listener: (event: MessageEvent) => void) {} + removeEventListener( + _type: string, + _listener: (event: MessageEvent) => void, + ) {} +} -- cgit 1.4.1