ChannelAffinitiesStore

This commit is contained in:
thororen 2026-09-25 09:48:20 -04:00
parent 6eb61b0482
commit 3d4b9d5099
No known key found for this signature in database
3 changed files with 24 additions and 0 deletions

View file

@ -0,0 +1,21 @@
import { FluxStore } from "..";
export interface ChannelAffinity {
channelId: string;
score: number;
}
export interface ChannelAffinitiesState {
channelAffinities: ChannelAffinity[];
lastFetched: number;
}
export class ChannelAffinitiesStore extends FluxStore {
compare(firstChannelId: string, secondChannelId: string): number;
getChannelAffinities(): ChannelAffinity[];
getChannelAffinitiesMap(): Map<string, ChannelAffinity>;
getChannelAffinity(channelId: string): ChannelAffinity | undefined;
getState(): ChannelAffinitiesState;
isFetching(): boolean;
shouldFetch(): boolean | undefined;
}

View file

@ -11,6 +11,7 @@ export * from "./AuthorizedAppsStore";
export * from "./AuthSessionsStore";
export * from "./BasicGuildStore";
export * from "./CallStore";
export * from "./ChannelAffinitiesStore";
export * from "./ChannelMemberStore";
export * from "./ChannelRTCStore";
export * from "./ChannelSectionStore";

View file

@ -109,6 +109,7 @@ export let GuildAvailabilityStore: t.GuildAvailabilityStore;
export let UserGuildJoinRequestStore: t.UserGuildJoinRequestStore;
export let BasicGuildStore: t.BasicGuildStore;
export let GuildProfileStore: t.GuildProfileStore;
export let ChannelAffinitiesStore: t.ChannelAffinitiesStore;
/**
* @see jsdoc of {@link t.useStateFromStores}
@ -189,6 +190,7 @@ waitForStore("GuildAvailabilityStore", m => GuildAvailabilityStore = m);
waitForStore("UserGuildJoinRequestStore", m => UserGuildJoinRequestStore = m);
waitForStore("BasicGuildStore", m => BasicGuildStore = m);
waitForStore("GuildProfileStore", m => GuildProfileStore = m);
waitForStore("ChannelAffinitiesV2Store", m => ChannelAffinitiesStore = m);
waitForStore("ThemeStore", m => {
ThemeStore = m;
// Importing this directly causes all webpack commons to be imported, which can easily cause circular dependencies.