From a615c3d7e9b95fad27333aa506ae157f4da0ce77 Mon Sep 17 00:00:00 2001 From: Tharki-God Date: Tue, 18 Jun 2024 13:54:03 +0530 Subject: [PATCH] fix for badge and unread count --- plugins/pindms/components/GuildPins.tsx | 5 +++-- plugins/pindms/components/index.ts | 2 +- plugins/pindms/stores.tsx | 6 +++++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/plugins/pindms/components/GuildPins.tsx b/plugins/pindms/components/GuildPins.tsx index 63cde0a..d19b4c1 100644 --- a/plugins/pindms/components/GuildPins.tsx +++ b/plugins/pindms/components/GuildPins.tsx @@ -143,8 +143,9 @@ function GuildPin({ id }: { id: string }) { const status = common.flux.useStateFromStores([StatusStore], () => StatusStore!.getStatus(user.id), ); - const unreadCount = common.flux.useStateFromStores([ReadStateStore], () => - ReadStateStore!.getUnreadCount(channel.id), + const unreadCount = common.flux.useStateFromStores( + [ReadStateStore], + () => ReadStateStore!.getUnreadCount(channel.id) || ReadStateStore!.getMentionCount(channel.id), ); const isTyping = common.flux.useStateFromStores([TypingStore], () => TypingStore!.isTyping(channel.id, user.id), diff --git a/plugins/pindms/components/index.ts b/plugins/pindms/components/index.ts index 1196276..6e60a85 100644 --- a/plugins/pindms/components/index.ts +++ b/plugins/pindms/components/index.ts @@ -94,7 +94,7 @@ export const StatusBlob = AvatarRaw?.X as FC | undefined; const BadgeRaw = webpack.getBySource('"count","color","disableColor","shape","className","style"'); -export const Badge = webpack.getByProps<{ +export const Badge = await webpack.waitForProps<{ renderMediaBadge: (props: { activeEvent?: boolean; activity?: boolean; diff --git a/plugins/pindms/stores.tsx b/plugins/pindms/stores.tsx index 8ee72c5..dc59f3d 100644 --- a/plugins/pindms/stores.tsx +++ b/plugins/pindms/stores.tsx @@ -11,7 +11,11 @@ export const TypingStore = webpack.getByStoreName< >("TypingStore"); export const ReadStateStore = webpack.getByStoreName< - Store & { getUnreadCount: (channelId: string) => number; lastMessageId: (id: string) => number } + Store & { + getUnreadCount: (channelId: string) => number; + getMentionCount: (channelId: string) => number; + lastMessageId: (id: string) => number; + } >("ReadStateStore"); export const ChannelStore = webpack.getByStoreName<