49 lines
1.5 KiB
TypeScript
49 lines
1.5 KiB
TypeScript
// Metro module 15353 (f15354).
|
|
import GuildStore from "../../stores/GuildStore";
|
|
import { fromClientDiscoverableGuild } from "../../utils/GuildRecordUtils";
|
|
import { makeDiscoverableGuild } from "../../utils/GuildDiscoveryUtils";
|
|
import Module589 from "../../_bundle/Module589";
|
|
import Dispatcher from "../../Dispatcher";
|
|
let categoryIds = [];
|
|
let c10906_4 = [];
|
|
const offset = 0;
|
|
class ICYMIPopularGuildsStore extends Module589.Store {
|
|
static displayName = "ICYMIPopularGuildsStore";
|
|
initialize() {
|
|
this.waitFor(GuildStore);
|
|
}
|
|
getOnboardingCategoryIds() {
|
|
return categoryIds;
|
|
}
|
|
getOnboardingGuilds() {
|
|
return c10906_4;
|
|
}
|
|
getCurrentOnboardingGuildOffset() {
|
|
return offset;
|
|
}
|
|
}
|
|
const iCYMIPopularGuildsStore = new ICYMIPopularGuildsStore(Dispatcher, {
|
|
LOAD_ICYMI_POPULAR_GUILDS: function loadOnboardingPopularGuilds({ categoryIds: categoryIds2, guilds, offset: offset2 }) {
|
|
let c21887_1;
|
|
c21887_1 = void 0;
|
|
if (offset2 === 0) {
|
|
categoryIds = categoryIds2;
|
|
c10906_4 = [];
|
|
offset = 0;
|
|
}
|
|
let c21887_0 = new Set(c10906_4.map((item) => item.id));
|
|
c21887_1 = new Set(GuildStore.getGuildIds());
|
|
c10906_4 = [...c10906_4, ...guilds.map((guild) => fromClientDiscoverableGuild(makeDiscoverableGuild(guild))).filter((item) => {
|
|
const r7 = c21887_1.has(item.id);
|
|
return r7 ? !r7 : !c21887_0.has(item.id);
|
|
})];
|
|
offset = offset2;
|
|
},
|
|
LOGOUT: function handleLogout() {
|
|
categoryIds = [];
|
|
c10906_4 = [];
|
|
offset = 0;
|
|
}
|
|
});
|
|
export default iCYMIPopularGuildsStore;
|