Files
discord-decomp/modules/hub/HubUnreadUtils.tsx
T
2026-11-01 12:12:55 +02:00

25 lines
957 B
TypeScript

// Metro module 15179 (f15180).
import GuildDirectoryStore from "../directory_channels/GuildDirectoryStore";
import ReadStateStore from "../../stores/ReadStateStore";
import { useStateFromStores } from "../../_bundle/Module589";
import SnowflakeUtils from "../../utils/SnowflakeUtils";
import { MAX_CATEGORY_SERVERS } from "../directory_channels/GuildDirectoryUtils";
export function useHubUnreadCount(a0) {
return useStateFromStores([GuildDirectoryStore, ReadStateStore], () => {
if (a0 == null) {
return 0;
}
const r11 = ReadStateStore.ackMessageId(a0.id);
let c27959_0 = r11;
if (r11 == null) {
return 0;
}
const r13 = Object;
let r16 = GuildDirectoryStore.getDirectoryEntries(a0.id);
if (r16 == null) {
r16 = {};
}
return Math.min(MAX_CATEGORY_SERVERS, r13.values(r16).filter((item) => new Date(item.createdAt).getTime() > SnowflakeUtils.extractTimestamp(c27959_0)).length);
}, [a0]);
}