decord/alpha/source/modules/guild_sidebar/SectionFooterHelpers.tsx

113 lines
4.7 KiB
TypeScript
Raw Normal View History

2026-10-05 08:00:40 +00:00
// Module ID: 16169
// Function ID: 16170
// Name: SectionFooterHelpers
2026-10-03 08:58:59 +00:00
// Dependencies: [6612, 4509, 7045, 1085, 7039, 2077, 2]
2026-07-29 08:29:29 +00:00
// Exports: getSectionFooterActiveVoiceChannels, getSectionFooterConfig, isSectionFooterWithActiveVoiceChannels
2026-07-20 16:05:17 +00:00
2026-10-05 08:00:40 +00:00
// Module 16169 (SectionFooterHelpers)
2026-10-03 08:58:59 +00:00
import Constants from "Constants" /* 1085 */;
import FavoritesUtils from "FavoritesUtils" /* 2077 */;
import ChannelListState from "ChannelListState" /* 7039 */;
import GuildSidebarConstants from "GuildSidebarConstants" /* 7045 */;
import CategoryCollapseStore from "CategoryCollapseStore" /* 6612 */;
import PermissionStore from "PermissionStore" /* 4509 */;
import size from "module_2" /* 2 */;
2026-07-23 10:11:24 +00:00
2026-10-03 08:58:59 +00:00
const ChannelListGuildActionRow = GuildSidebarConstants.ChannelListGuildActionRow;
const Permissions = Constants.Permissions;
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) {
2026-10-03 08:58:59 +00:00
let tmp3;
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();
2026-10-03 08:58:59 +00:00
let isEmptyResult = 1 === rows.length && rows[0] === ChannelListGuildActionRow.GUILD_PREMIUM_PROGRESS_BAR;
2026-07-20 16:05:17 +00:00
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-10-03 08:58:59 +00:00
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;
2026-10-03 08:58:59 +00:00
if (tmp6) {
let tmp7 = section === tmp(7039).SECTION_INDEX_GUILD_ACTIONS;
if (!tmp7) {
let tmp8;
const tmpResult = FavoritesUtils;
2026-07-29 08:29:29 +00:00
if (tmpResult.isFavoritesGuildId(guildChannels.id)) {
2026-10-03 08:58:59 +00:00
tmp8 = section !== guildChannels.getSections(false).length - 1;
2026-07-25 08:10:48 +00:00
} else {
2026-10-03 08:58:59 +00:00
tmp8 = section === tmp(7039).SECTION_INDEX_FAVORITES;
2026-07-29 08:29:29 +00:00
if (!tmp8) {
let tmp10 = optInChannelsEnabled;
if (tmp10) {
2026-10-03 08:58:59 +00:00
let tmp11 = section !== tmp(7039).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
}
}
2026-10-03 08:58:59 +00:00
tmp7 = tmp8;
2026-07-20 16:05:17 +00:00
}
2026-10-03 08:58:59 +00:00
tmp6 = tmp7;
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-10-03 08:58:59 +00:00
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) {
2026-10-03 08:58:59 +00:00
let category;
let items;
({ category, voiceStates: require, selectedChannelId: dependencyMap, selectedVoiceChannelId: CategoryCollapseStore } = arg0);
if (true !== CategoryCollapseStore.isCollapsed(category.record.id)) {
2026-10-03 08:58:59 +00:00
items = [];
2026-07-20 16:05:17 +00:00
} 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 = [];
}
2026-10-03 08:58:59 +00:00
return id.id !== CategoryCollapseStore && id.id !== dependencyMap && items.length > 0;
2026-07-20 16:05:17 +00:00
} else {
return false;
}
});
}
return items;
};
2026-07-29 08:29:29 +00:00
export const isSectionFooterWithActiveVoiceChannels = function isSectionFooterWithActiveVoiceChannels(arg0) {
2026-10-03 08:58:59 +00:00
let category;
let items;
({ category, voiceStates: require, selectedChannelId: dependencyMap, selectedVoiceChannelId: CategoryCollapseStore } = arg0);
if (true !== CategoryCollapseStore.isCollapsed(category.record.id)) {
2026-10-03 08:58:59 +00:00
items = [];
2026-07-29 08:29:29 +00:00
} 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 = [];
}
2026-10-03 08:58:59 +00:00
return id.id !== CategoryCollapseStore && id.id !== dependencyMap && items.length > 0;
2026-07-29 08:29:29 +00:00
} else {
return false;
}
});
}
return items.length > 0;
2026-07-20 16:05:17 +00:00
};