decord/source/modules/guild_settings/native/GuildSettingsModalLanding.tsx
github-actions 777dc50a28 chore: update source for alpha 346.3
Skipped 1 file(s) >100MB (GitHub limit): source/__polyfill/04xxx/module_4790.js (118.4 MB)
2026-09-10 19:12:31 +00:00

396 lines
17 KiB
TypeScript

// Module ID: 17611
// Function ID: 17612
// Name: GuildSettingsModalLanding
// Dependencies: [19, 2012, 1979, 4243, 1371, 16225, 9133, 1074, 21, 4785, 4605, 5655, 1114, 4560, 17612, 5588, 4248, 17614, 15032, 8827, 10184, 11811, 9136, 8931, 9822, 17616, 4548, 5737, 15673, 5139, 9503, 4306, 576, 1483, 504, 9132, 17617, 7312, 7319, 4302, 8663, 5023, 16948, 1396, 17618, 7092, 2]
// Exports: default
// Module 17611 (GuildSettingsModalLanding)
import AvatarUtilsDefault from "AvatarUtils" /* 1396 */;
import PermissionUtilsAll from "PermissionUtils" /* 4248 */;
import ToastUtils from "ToastUtils" /* 4302 */;
import AppAnalyticsUtilsDefault from "AppAnalyticsUtils" /* 4785 */;
import GuildSettingsActionCreatorsDefault from "GuildSettingsActionCreators" /* 9132 */;
import noop from "module_19" /* 19 */;
import GuildChannelStore from "GuildChannelStore" /* 2012 */;
import GuildStore from "GuildStore" /* 1979 */;
import PermissionStore from "PermissionStore" /* 4243 */;
import UserStore from "UserStore" /* 1371 */;
import GuildSettingsModalChannelsStore from "GuildSettingsModalChannelsStore" /* 16225 */;
import GuildSettingsStore from "GuildSettingsStore" /* 9133 */;
require = fn;
function SettingsSection(guild) {
guild = guild.guild;
({ isGuildAdmin, canManageGuild, canManageChannels, pushScreen: importDefault } = guild);
const tmp2 = guild;
({ canManageGuildExpressions, canViewAuditLog, canManageWebhooks, canUnlinkChannelLobbies, canConfigureOfficialMessages, categories } = guild);
const obj = { label: null, arrow: true, icon: null, onPress: null };
const intl = guild(1114).intl;
obj.label = intl.string(guild(1114).t["/dp6yY"]);
obj.icon = closure_15(guild(5655).TableRow.Icon, { IconComponent: guild(4560).CircleInformationIcon });
obj.onPress = function onPress() {
return importDefault(constants2.OVERVIEW);
};
const items = [closure_15(guild(5655).TableRow, obj, "overview")];
const currentUser = UserStore.getCurrentUser();
if (canManageGuild) {
const obj3 = { label: null, arrow: true, icon: null, onPress: null };
const intl2 = tmp2(1114).intl;
obj3.label = intl2.string(tmp2(1114).t["5tbTdV"]);
const obj4 = { IconComponent: tmp2(17612).ModerationIcon };
obj3.icon = tmp(tmp2(5655).TableRow.Icon, obj4);
obj3.onPress = function onPress() {
return importDefault(constants2.MODERATION);
};
items.push(tmp(tmp2(5655).TableRow, obj3, "moderation"));
}
if (canViewAuditLog) {
const obj5 = { label: null, arrow: true, icon: null, onPress: null };
const intl3 = tmp2(1114).intl;
obj5.label = intl3.string(tmp2(1114).t.SPWLyT);
const obj6 = { IconComponent: tmp2(5588).ClipboardListIcon };
obj5.icon = tmp(tmp2(5655).TableRow.Icon, obj6);
obj5.onPress = function onPress() {
return importDefault(constants2.AUDIT_LOG);
};
items.push(tmp(tmp2(5655).TableRow, obj5, "auditlogs"));
}
if (!canManageChannels) {
let canManageACategoryResult = null != currentUser;
if (canManageACategoryResult) {
canManageACategoryResult = PermissionUtilsAll.canManageACategory(currentUser, guild, categories);
}
canManageChannels = canManageACategoryResult;
}
if (canManageChannels) {
const obj8 = { label: null, arrow: true, icon: null, onPress: null };
const intl4 = tmp2(1114).intl;
obj8.label = intl4.string(tmp2(1114).t.OGiMXJ);
const obj9 = { IconComponent: tmp2(17614).ChannelListIcon };
obj8.icon = tmp(tmp2(5655).TableRow.Icon, obj9);
obj8.onPress = function onPress() {
guild = GuildSettingsModalChannelsStore.initGuild(guild.id);
importDefault(constants2.CHANNELS);
};
items.push(tmp(tmp2(5655).TableRow, obj8, "channels"));
}
let tmp11 = canManageGuild;
if (!canManageGuild) {
tmp11 = canManageWebhooks;
}
if (!tmp11) {
tmp11 = canUnlinkChannelLobbies;
}
if (tmp11) {
const obj10 = { label: null, arrow: true, icon: null, onPress: null };
const intl5 = tmp2(1114).intl;
obj10.label = intl5.string(tmp2(1114).t.CIsNZw);
const obj11 = { IconComponent: tmp2(15032).PuzzlePieceIcon };
obj10.icon = tmp(tmp2(5655).TableRow.Icon, obj11);
obj10.onPress = function onPress() {
return importDefault(constants2.INTEGRATIONS);
};
items.push(tmp(tmp2(5655).TableRow, obj10, "integrations"));
}
if (canManageGuildExpressions) {
const obj12 = { label: null, arrow: true, icon: null, onPress: null };
const intl6 = tmp2(1114).intl;
obj12.label = intl6.string(tmp2(1114).t.sMOuuS);
const obj13 = { IconComponent: tmp2(8827).ReactionIcon };
obj12.icon = tmp(tmp2(5655).TableRow.Icon, obj13);
obj12.onPress = function onPress() {
return importDefault(constants2.EMOJI);
};
items.push(tmp(tmp2(5655).TableRow, obj12, "emoji"));
const obj14 = { label: null, arrow: true, icon: null, onPress: null };
const intl7 = tmp2(1114).intl;
obj14.label = intl7.string(tmp2(1114).t.R5nQkS);
const obj15 = { IconComponent: tmp2(10184).StickerIcon };
obj14.icon = tmp(tmp2(5655).TableRow.Icon, obj15);
obj14.onPress = function onPress() {
return importDefault(constants2.STICKERS);
};
items.push(tmp(tmp2(5655).TableRow, obj14, "stickers"));
}
if (canConfigureOfficialMessages) {
const obj16 = { label: null, arrow: true, icon: null, onPress: null };
const intl8 = tmp2(1114).intl;
obj16.label = intl8.string(tmp2(1114).t.xHEzFh);
const obj17 = { IconComponent: tmp2(11811).StampIcon };
obj16.icon = tmp(tmp2(5655).TableRow.Icon, obj17);
obj16.onPress = function onPress() {
return importDefault(constants2.OFFICIAL_MESSAGES);
};
items.push(tmp(tmp2(5655).TableRow, obj16, "official-messages"));
}
const obj2 = { IconComponent: guild(4560).CircleInformationIcon };
if (tmp2Result.canUseMobileServerTagSettings(guild.id)) {
const obj18 = { label: null, arrow: true, icon: null, onPress: null };
const intl9 = tmp2(1114).intl;
obj18.label = intl9.string(tmp2(1114).t["2QmKZ2"]);
const obj19 = { IconComponent: tmp2(8931).TagIcon };
obj18.icon = tmp(tmp2(5655).TableRow.Icon, obj19);
obj18.onPress = function onPress() {
return importDefault(constants2.TAG);
};
items.push(tmp(tmp2(5655).TableRow, obj18, "server-tag"));
}
if (canManageGuild) {
const obj20 = { label: null, arrow: true, icon: null, onPress: null };
const intl10 = tmp2(1114).intl;
obj20.label = intl10.string(tmp2(1114).t.Am9YHi);
const obj21 = { IconComponent: tmp2(9822).ShieldUserIcon };
obj20.icon = tmp(tmp2(5655).TableRow.Icon, obj21);
obj20.onPress = function onPress() {
return importDefault(constants2.SECURITY);
};
items.push(tmp(tmp2(5655).TableRow, obj20, "security"));
}
if (isGuildAdmin) {
isGuildAdmin = tmp2(17616).canSeeVanityUrlSettings(guild);
const tmp2Result2 = tmp2(17616);
}
if (isGuildAdmin) {
const obj22 = { label: null, arrow: true, icon: null, onPress: null };
const intl11 = tmp2(1114).intl;
obj22.label = intl11.string(tmp2(1114).t["5XZKy/"]);
const obj23 = { IconComponent: tmp2(4548).LinkIcon };
obj22.icon = tmp(tmp2(5655).TableRow.Icon, obj23);
obj22.onPress = function onPress() {
return importDefault(constants2.VANITY_URL);
};
items.push(tmp(tmp2(5655).TableRow, obj22, "vanity"));
}
let tmpResult = null;
if (0 !== items.length) {
const obj24 = { title: null, hasIcons: true, children: null };
const intl12 = tmp2(1114).intl;
obj24.title = intl12.string(tmp2(1114).t["3D5yo/"]);
obj24.children = items;
tmpResult = tmp(tmp2(5737).TableRowGroup, obj24);
}
return tmpResult;
}
function CommunitySection(pushScreen) {
pushScreen = pushScreen.pushScreen;
const features = pushScreen.guild.features;
const hasItem = features.has(constants.COMMUNITY);
const obj = { title: null, hasIcons: true, children: null };
const intl = pushScreen(1114).intl;
obj.title = intl.string(pushScreen(1114).t["1g9A/f"]);
const TableRow = pushScreen(5655).TableRow;
const obj2 = { label: null, arrow: true, icon: null, onPress: null };
const intl2 = pushScreen(1114).intl;
const string = intl2.string;
const t = pushScreen(1114).t;
if (hasItem) {
obj2.label = string(t.nRtNqn);
const obj3 = { IconComponent: tmp3(15673).TreehouseIcon };
obj2.icon = tmp2(tmp3(5655).TableRow.Icon, obj3);
obj2.onPress = function onPress() {
return pushScreen(constants2.COMMUNITY, {});
};
let tmp2Result = tmp2(TableRow, obj2, "community-overview");
} else {
obj2.label = string(t.ElKTeb);
const obj4 = { IconComponent: tmp3(15673).TreehouseIcon };
obj2.icon = tmp2(tmp3(5655).TableRow.Icon, obj4);
obj2.onPress = function onPress() {
return pushScreen(constants2.COMMUNITY_INTRO, {});
};
tmp2Result = tmp2(TableRow, obj2, "community-intro");
}
obj.children = tmp2Result;
return closure_15(pushScreen(5737).TableRowGroup, obj);
}
function UserManagementSection(pushScreen) {
pushScreen = pushScreen.pushScreen;
({ canManageGuild, canManageRoles, canManageBans } = pushScreen);
const obj = { label: null, arrow: true, icon: null, onPress: null };
const intl = pushScreen(1114).intl;
obj.label = intl.string(pushScreen(1114).t["9Oq93m"]);
obj.icon = closure_15(pushScreen(5655).TableRow.Icon, { IconComponent: pushScreen(5139).GroupIcon });
obj.onPress = function onPress() {
return pushScreen(constants2.MEMBERS);
};
const items = [closure_15(pushScreen(5655).TableRow, obj, "members")];
if (canManageRoles) {
const obj3 = { label: null, arrow: true, icon: null, onPress: null };
const intl2 = tmp2(1114).intl;
obj3.label = intl2.string(tmp2(1114).t["LPJmL/"]);
const obj4 = { IconComponent: tmp2(9822).ShieldUserIcon };
obj3.icon = tmp(tmp2(5655).TableRow.Icon, obj4);
obj3.onPress = function onPress() {
return pushScreen(constants2.ROLES);
};
items.push(tmp(tmp2(5655).TableRow, obj3, "roles"));
}
if (canManageGuild) {
const obj5 = { label: null, arrow: true, icon: null, onPress: null };
const intl3 = tmp2(1114).intl;
obj5.label = intl3.string(tmp2(1114).t.ngRFjZ);
const obj6 = { IconComponent: tmp2(4548).LinkIcon };
obj5.icon = tmp(tmp2(5655).TableRow.Icon, obj6);
obj5.onPress = function onPress() {
return pushScreen(constants2.INSTANT_INVITES);
};
items.push(tmp(tmp2(5655).TableRow, obj5, "invites"));
}
if (canManageBans) {
const obj7 = { label: null, arrow: true, icon: null, onPress: null };
const intl4 = tmp2(1114).intl;
obj7.label = intl4.string(tmp2(1114).t.ZbeITS);
const obj8 = { IconComponent: tmp2(9503).HammerIcon };
obj7.icon = tmp(tmp2(5655).TableRow.Icon, obj8);
obj7.onPress = function onPress() {
return pushScreen(constants2.BANS);
};
items.push(tmp(tmp2(5655).TableRow, obj7, "bans"));
}
let tmpResult = null;
if (0 !== items.length) {
const obj9 = { title: null, hasIcons: true, children: null };
const intl5 = tmp2(1114).intl;
obj9.title = intl5.string(tmp2(1114).t["+OecxG"]);
obj9.children = items;
tmpResult = tmp(tmp2(5737).TableRowGroup, obj9);
}
return tmpResult;
}
function GuildSettingsModalLandingInner(guild) {
guild = guild.guild;
const updateErrors = guild.updateErrors;
const token = guild(4306).useToken(updateErrors(576).modules.mobile.TABLE_ROW_PADDING);
const tmp5 = closure_18();
let obj = guild(4306);
const navigation = guild(1483).useNavigation();
let obj2 = guild(1483);
let items = [GuildChannelStore];
const stateFromStores = guild(504).useStateFromStores(items, () => {
let id;
if (guild != null) {
id = guild.id;
}
const channels = GuildChannelStore.getChannels(id);
let tmp4;
if (channels != null) {
tmp4 = channels[constants3.GUILD_CATEGORY];
}
return tmp4;
});
let obj3 = guild(504);
let items1 = [PermissionStore];
const stateFromStoresObject = guild(504).useStateFromStoresObject(items1, () => PermissionStore.getGuildPermissionProps(guild));
const effect = noop.useEffect(() => {
const obj2 = { settings_type: "guild", origin_pane: "Array", destination_pane: constants.LANDING };
updateErrors(dependencyMap[9]).trackWithMetadata(constants2.SETTINGS_PANE_VIEWED, obj2);
}, []);
const items2 = [navigation];
const callback = noop.useCallback(() => {
const items = [...arguments];
const first = items[0];
const state = navigation.getState();
let name;
if (state.routes[state.index] != null) {
name = tmp4.name;
}
if (name !== first) {
GuildSettingsActionCreatorsDefault.setSection(first);
const navigate = tmp2.navigate;
const items1 = [];
HermesBuiltin.arraySpread(items, 0);
HermesBuiltin.apply(items1, tmp2);
const obj3 = { settings_type: "guild", origin_pane: constants2.LANDING, destination_pane: first };
AppAnalyticsUtilsDefault.trackWithMetadata(constants4.SETTINGS_PANE_VIEWED, obj3);
}
}, items2);
({ canManageGuild, isGuildAdmin, canManageRoles, canManageBans, canManageGuildExpressions, canManageChannels, canViewAuditLog, canManageWebhooks } = stateFromStoresObject);
const obj4 = guild(504);
const obj5 = noop;
const obj6 = guild(17617);
const tmp11 = guild(17617).useChannelsAllowedToUnlink(guild.id).length > 0;
const canManageGuildRoleSubscriptions = guild(7312).useCanManageGuildRoleSubscriptions(guild);
let result = canManageGuild;
if (canManageGuild) {
result = tmp(7319).isGuildOfficialMessagesEnabled(guild, "GuildSettingsModalLanding");
const tmpResult = tmp(7319);
}
const items3 = [updateErrors.message];
const layoutEffect = obj5.useLayoutEffect(() => {
if (null != updateErrors.message) {
ToastUtils.presentError(tmp.message);
}
}, items3);
const obj8 = { style: tmp5.container, contentContainerStyle: null, children: null };
const items4 = [tmp5.containerContent, guild.contentContainerStyle];
obj8.contentContainerStyle = items4;
const obj9 = { style: { paddingHorizontal: token }, spacing: updateErrors(576).space.PX_24, children: null };
const items5 = [
closure_15(updateErrors(16948), {
iconProps: {
onUpload(icon) {
GuildSettingsActionCreatorsDefault.updateIcon(guild.id, icon);
},
type: "guild",
icon: guild.icon,
name: guild.name,
makeURL(icon) {
let guildIconURL = icon;
if (icon) {
const obj2 = { id: guild.id, icon, canAnimate: true, size: 64 };
guildIconURL = AvatarUtilsDefault.getGuildIconURL(obj2);
}
return guildIconURL;
},
disabled: !stateFromStoresObject.canManageGuild
},
text: guild.name,
textAccessibilityRole: "header"
}),
closure_15(SettingsSection, { guild, categories: stateFromStores, isGuildAdmin, canManageGuild, canManageGuildExpressions, canManageChannels, canUnlinkChannelLobbies: tmp11, canViewAuditLog, canManageWebhooks, canConfigureOfficialMessages: result, pushScreen: callback }),
,
,
];
let tmp17Result = canManageGuild;
if (canManageGuild) {
const obj11 = { guild, pushScreen: callback };
tmp17Result = tmp17(CommunitySection, obj11);
}
items5[2] = tmp17Result;
let tmp17Result2 = canManageGuildRoleSubscriptions;
if (canManageGuildRoleSubscriptions) {
const obj12 = { guild, pushScreen: callback };
tmp17Result2 = tmp17(tmp3(17618), obj12);
}
const obj13 = { children: null };
items5[3] = tmp17Result2;
items5[4] = closure_15(UserManagementSection, { canManageGuild, canManageRoles, canManageBans, pushScreen: callback });
obj9.children = items5;
obj8.children = closure_16(guild(5023).Stack, obj9);
const items6 = [closure_15(guild(8663).Form, obj8), closure_15(guild(7092).NavScrim, {})];
obj13.children = items6;
return closure_16(closure_17, obj13);
}
const Constants = fn(1074);
({ GuildFeatures: closure_11, GuildSettingsSections: closure_12, ChannelTypes: map1, AnalyticEvents: closure_14 } = Constants);
const jsxProd = fn(21);
({ jsx: closure_15, jsxs: closure_16, Fragment: closure_17 } = jsxProd);
const createStyles = fn(4605);
let closure_18 = createStyles.createStyles({ container: { flex: 1 }, containerContent: { paddingTop: 16 } });
const size = fn(2);
let result = size.fileFinishedImporting("modules/guild_settings/native/GuildSettingsModalLanding.tsx");
export default function GuildSettingsModalLanding(guildId) {
guildId = guildId.guildId;
const items = [GuildStore];
const stateFromStores = guildId(504).useStateFromStores(items, () => GuildStore.getGuild(guildId));
guildId(504);
[][0] = GuildSettingsStore;
let tmp4 = null;
if (null != stateFromStores) {
const obj2 = { guild: stateFromStores, contentContainerStyle: guildId.contentContainerStyle, updateErrors: tmp3 };
tmp4 = closure_15(GuildSettingsModalLandingInner, obj2);
}
return tmp4;
};