Skip to content

Commit

Permalink
fix for badge and unread count
Browse files Browse the repository at this point in the history
  • Loading branch information
yofukashino committed Jun 18, 2024
1 parent eeafddf commit a615c3d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 3 additions & 2 deletions plugins/pindms/components/GuildPins.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -143,8 +143,9 @@ function GuildPin({ id }: { id: string }) {
const status = common.flux.useStateFromStores<string>([StatusStore], () =>
StatusStore!.getStatus(user.id),
);
const unreadCount = common.flux.useStateFromStores<number>([ReadStateStore], () =>
ReadStateStore!.getUnreadCount(channel.id),
const unreadCount = common.flux.useStateFromStores<number>(
[ReadStateStore],
() => ReadStateStore!.getUnreadCount(channel.id) || ReadStateStore!.getMentionCount(channel.id),
);
const isTyping = common.flux.useStateFromStores<boolean>([TypingStore], () =>
TypingStore!.isTyping(channel.id, user.id),
Expand Down
2 changes: 1 addition & 1 deletion plugins/pindms/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 5 additions & 1 deletion plugins/pindms/stores.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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<
Expand Down

0 comments on commit a615c3d

Please sign in to comment.