decord/source/modules/guild_sidebar/SectionFooterHelpers.tsx

121 lines
4.4 KiB
TypeScript
Raw Normal View History

// Module ID: 16337
// Function ID: 16338
// Name: SectionFooterHelpers
// Dependencies: [7220, 4275, 7637, 1074, 7631, 1982, 2]
2026-07-29 08:29:29 +00:00
// Exports: getSectionFooterActiveVoiceChannels, getSectionFooterConfig, isSectionFooterWithActiveVoiceChannels
2026-07-20 16:05:17 +00:00
// Module 16337 (SectionFooterHelpers)
import ChannelListState from "ChannelListState" /* 7631 */;
import CategoryCollapseStore from "CategoryCollapseStore" /* 7220 */;
import PermissionStore from "PermissionStore" /* 4275 */;
2026-07-23 10:11:24 +00:00
require = fn;
const ChannelListGuildActionRow = fn(7637).ChannelListGuildActionRow;
const Permissions = fn(1074).Permissions;
const size = fn(2);
const result = size.fileFinishedImporting("modules/guild_sidebar/SectionFooterHelpers.tsx");
2026-07-29 08:29:29 +00:00
export const getSectionFooterConfig = function getSectionFooterConfig(guildChannels, optInChannelsEnabled, section) {
if (section === ChannelListState.SECTION_INDEX_GUILD_ACTIONS) {
2026-07-29 08:29:29 +00:00
const guildActionSection = guildChannels.getGuildActionSection();
2026-07-20 16:05:17 +00:00
const rows = guildActionSection.getRows();
let isEmptyResult = 1 === rows.length;
if (isEmptyResult) {
isEmptyResult = rows[0] === ChannelListGuildActionRow.GUILD_PREMIUM_PROGRESS_BAR;
}
if (!isEmptyResult) {
2026-07-29 08:29:29 +00:00
const guildActionSection1 = guildChannels.getGuildActionSection();
2026-07-20 16:05:17 +00:00
isEmptyResult = guildActionSection1.isEmpty();
}
2026-07-29 08:29:29 +00:00
let tmp3 = isEmptyResult;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
tmp3 = 0 === guildChannels.getSections(false)[section];
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp6 = !tmp3;
if (!tmp3) {
const tmp7 = section === tmp(7631).SECTION_INDEX_GUILD_ACTIONS;
2026-07-20 16:05:17 +00:00
if (tmp7) {
2026-07-29 08:29:29 +00:00
tmp6 = tmp7;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
if (tmpResult.isFavoritesGuildId(guildChannels.id)) {
let tmp8 = section !== guildChannels.getSections(false).length - 1;
2026-07-25 08:10:48 +00:00
} else {
tmp8 = section === tmp(7631).SECTION_INDEX_FAVORITES;
2026-07-29 08:29:29 +00:00
if (!tmp8) {
let tmp10 = optInChannelsEnabled;
if (tmp10) {
let tmp11 = section !== tmp(7631).SECTION_INDEX_UNCATEGORIZED_CHANNELS;
2026-07-29 08:29:29 +00:00
if (tmp11) {
let flag2 = section === guildChannels.recentsSectionNumber;
2026-07-25 08:10:48 +00:00
if (!flag2) {
2026-07-29 08:29:29 +00:00
const voiceChannelsSectionNumber = guildChannels.voiceChannelsSectionNumber;
2026-07-25 08:10:48 +00:00
flag2 = false;
}
2026-07-29 08:29:29 +00:00
tmp11 = flag2;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp10 = tmp11;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp8 = tmp10;
2026-07-20 16:05:17 +00:00
}
}
tmpResult = tmp(1982);
2026-07-20 16:05:17 +00:00
}
}
const obj = { hasDivider: tmp6, canHaveVoiceSummary: !(section === ChannelListState.SECTION_INDEX_GUILD_ACTIONS || section === ChannelListState.SECTION_INDEX_FAVORITES || section === ChannelListState.SECTION_INDEX_UNCATEGORIZED_CHANNELS || section === guildChannels.recentsSectionNumber || section === guildChannels.voiceChannelsSectionNumber) };
2026-07-29 08:29:29 +00:00
return obj;
};
export const getSectionFooterActiveVoiceChannels = function getSectionFooterActiveVoiceChannels(arg0) {
({ category, voiceStates: require, selectedChannelId: dependencyMap, selectedVoiceChannelId: CategoryCollapseStore } = arg0);
if (true !== CategoryCollapseStore.isCollapsed(category.record.id)) {
2026-07-20 16:05:17 +00:00
let items = [];
} else {
const channelRecords = category.getChannelRecords();
items = channelRecords.filter((id) => {
if (PermissionStore.can(Permissions.VIEW_CHANNEL, id)) {
let items = require[id.id];
2026-07-29 08:29:29 +00:00
if (items == null) {
2026-07-20 16:05:17 +00:00
items = [];
}
let tmp4 = id.id !== CategoryCollapseStore;
2026-07-20 16:05:17 +00:00
if (tmp4) {
tmp4 = id.id !== dependencyMap;
2026-07-20 16:05:17 +00:00
}
if (tmp4) {
tmp4 = items.length > 0;
}
return tmp4;
} else {
return false;
}
});
}
return items;
};
2026-07-29 08:29:29 +00:00
export const isSectionFooterWithActiveVoiceChannels = function isSectionFooterWithActiveVoiceChannels(arg0) {
({ category, voiceStates: require, selectedChannelId: dependencyMap, selectedVoiceChannelId: CategoryCollapseStore } = arg0);
if (true !== CategoryCollapseStore.isCollapsed(category.record.id)) {
2026-07-29 08:29:29 +00:00
let items = [];
} else {
const channelRecords = category.getChannelRecords();
items = channelRecords.filter((id) => {
if (PermissionStore.can(Permissions.VIEW_CHANNEL, id)) {
let items = require[id.id];
2026-07-29 08:29:29 +00:00
if (items == null) {
items = [];
}
let tmp4 = id.id !== CategoryCollapseStore;
2026-07-29 08:29:29 +00:00
if (tmp4) {
tmp4 = id.id !== dependencyMap;
2026-07-29 08:29:29 +00:00
}
if (tmp4) {
tmp4 = items.length > 0;
}
return tmp4;
} else {
return false;
}
});
}
return items.length > 0;
2026-07-20 16:05:17 +00:00
};