decord/source/modules/home_drawer/native/HomeDrawerGuildRow.tsx

366 lines
14 KiB
TypeScript
Raw Normal View History

2026-08-24 06:08:38 +00:00
// Module ID: 15645
// Function ID: 15646
2026-07-20 16:05:17 +00:00
// Name: GuildRowWrapper
2026-08-24 06:08:38 +00:00
// Dependencies: [19, 17, 4026, 1395, 1391, 1981, 5388, 1910, 4777, 4033, 5048, 1922, 676, 5049, 21, 4668, 589, 4239, 4236, 12781, 10040, 4739, 15646, 15647, 4989, 11, 15648, 15649, 11200, 15650, 15651, 15652, 15654, 15655, 15634, 2]
2026-07-20 16:05:17 +00:00
// Exports: default
2026-08-24 06:08:38 +00:00
// Module 15645 (GuildRowWrapper)
import closure_3 from "noop" /* 19 */;
import { View } from "get ActivityIndicator" /* 17 */;
import closure_5 from "storeThread" /* 4026 */;
import { isThread } from "createChannelRecord" /* 1395 */;
import closure_7 from "ensureGuildLoaded" /* 1391 */;
import closure_8 from "comparator" /* 1981 */;
import closure_9 from "updateGuildUnreadSentinel" /* 5388 */;
import closure_10 from "createGuildRecordFromRust" /* 1910 */;
import closure_11 from "generateOldThreadCutoff" /* 4777 */;
import closure_12 from "markAllUserIdListsStale" /* 4033 */;
import closure_13 from "updateUserGuildSettingsInternal" /* 5048 */;
import closure_14 from "mergeGuildAvatar" /* 1922 */;
import ME from "ME" /* 676 */;
import { UnreadSetting } from "ReadStateTypes" /* 5049 */;
import jsxProd from "jsxProd" /* 21 */;
import createCacheKey from "createCacheKey" /* 4668 */;
2026-07-23 10:11:24 +00:00
const require = arg1;
2026-07-20 16:05:17 +00:00
function GuildRowWrapper(guild) {
guild = guild.guild;
const disableSubtitle = guild.disableSubtitle;
const onActiveHookChange = guild.onActiveHookChange;
2026-07-29 08:29:29 +00:00
let React;
let stateFromStores;
let stateFromStores1;
let memo;
let isHomeDrawerChannelMuted;
let isHomeDrawerChannelInChannelList;
let unreadChannel;
let unreadChannelName;
let unreadChannelCount;
let mentionChannel;
let mentionChannelName;
let mentionChannelCount;
let voiceUsers1;
let streamingUser;
let typingChannelId;
let typingChannelName;
let stateFromStores2;
2026-08-24 06:08:38 +00:00
closure_20 = undefined;
2026-07-20 16:05:17 +00:00
let callback2;
let memo2;
2026-07-23 10:11:24 +00:00
let tmp = callback2();
2026-07-29 08:29:29 +00:00
React = tmp;
2026-08-24 06:08:38 +00:00
obj = guild(onActiveHookChange[16]);
2026-07-23 10:11:24 +00:00
let items = [unreadChannel];
2026-07-29 08:29:29 +00:00
stateFromStores = obj.useStateFromStores(items, () => unreadChannel.hasUnread(guild.id));
2026-08-24 06:08:38 +00:00
obj1 = guild(onActiveHookChange[16]);
2026-07-23 10:11:24 +00:00
const items1 = [mentionChannelName];
2026-07-29 08:29:29 +00:00
stateFromStores1 = obj1.useStateFromStores(items1, () => mentionChannelName.getMuteConfig(guild.id));
2026-07-20 16:05:17 +00:00
const items2 = [stateFromStores1];
2026-07-29 08:29:29 +00:00
memo = React.useMemo(() => {
2026-07-20 16:05:17 +00:00
if (null == stateFromStores1) {
2026-08-24 06:08:38 +00:00
obj = { isMuted: false, isTemporary: false };
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
let tmp2 = null == tmp.end_time;
2026-07-20 16:05:17 +00:00
if (!tmp2) {
const _Date = Date;
2026-07-29 08:29:29 +00:00
const date = new Date(tmp.end_time);
2026-07-20 16:05:17 +00:00
const _Date2 = Date;
const date1 = new Date();
tmp2 = date > date1;
}
2026-07-29 08:29:29 +00:00
obj = { isMuted: null, isTemporary: null };
obj[0] = tmp2;
obj[1] = null != tmp.end_time;
2026-07-20 16:05:17 +00:00
}
return obj;
}, items2);
2026-07-21 06:55:02 +00:00
const items3 = [guild, memo, , ];
({ guildName: arr4[2], guildNameText: arr4[3] } = tmp);
2026-07-20 16:05:17 +00:00
const memo1 = React.useMemo(() => {
if (memo.isMuted) {
2026-07-29 08:29:29 +00:00
let tmp3Result = onActiveHookChange;
if (tmp.isTemporary) {
tmp3Result = tmp3(tmp3Result[19]);
let BellSlashIcon = tmp3Result.BellZIcon;
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
BellSlashIcon = tmp3(tmp3Result[20]).BellSlashIcon;
2026-07-20 16:05:17 +00:00
}
} else {
2026-08-24 06:08:38 +00:00
obj = { style: null, children: null };
obj[0] = closure_3.guildName;
2026-07-29 08:29:29 +00:00
obj = { variant: "text-md/medium", style: null, lineClamp: 1, color: null, children: null };
2026-08-24 06:08:38 +00:00
obj[1] = closure_3.guildNameText;
2026-07-20 16:05:17 +00:00
let str = "text-default";
2026-07-29 08:29:29 +00:00
if (tmp.isMuted) {
2026-07-20 16:05:17 +00:00
str = "text-muted";
}
2026-07-29 08:29:29 +00:00
obj[3] = str;
obj[4] = guild.name;
2026-07-23 10:11:24 +00:00
const items = [typingChannelName(guild(onActiveHookChange[21]).Text, obj), typingChannelName(streamingUser, { size: "xs", color: "icon-muted" })];
2026-07-29 08:29:29 +00:00
obj[1] = items;
2026-07-23 10:11:24 +00:00
return stateFromStores2(stateFromStores, obj);
2026-07-20 16:05:17 +00:00
}
}, items3);
2026-07-29 08:29:29 +00:00
isHomeDrawerChannelMuted = guild(onActiveHookChange[22]).useIsHomeDrawerChannelMuted();
const obj4 = guild(onActiveHookChange[22]);
isHomeDrawerChannelInChannelList = guild(onActiveHookChange[23]).useIsHomeDrawerChannelInChannelList();
const obj5 = guild(onActiveHookChange[23]);
2026-07-23 10:11:24 +00:00
const items4 = [isHomeDrawerChannelInChannelList, isHomeDrawerChannelMuted, mentionChannelCount, mentionChannel, unreadChannelCount, mentionChannelName, stateFromStores1];
const items5 = [guild.id, isHomeDrawerChannelMuted, isHomeDrawerChannelInChannelList];
const stateFromStoresObject = guild(onActiveHookChange[16]).useStateFromStoresObject(items4, () => {
const selectableChannelIds = isHomeDrawerChannelInChannelList.getSelectableChannelIds(guild.id);
2026-07-29 08:29:29 +00:00
const found = selectableChannelIds.filter((id) => {
2026-08-24 06:08:38 +00:00
const basicChannel = closure_1_7.getBasicChannel(id);
2026-07-20 16:05:17 +00:00
let tmp2 = null != basicChannel;
if (tmp2) {
2026-07-29 08:29:29 +00:00
const tmp4 = callback(basicChannel);
let tmp5 = !tmp4;
if (!tmp4) {
2026-08-24 06:08:38 +00:00
let tmp7 = closure_1_6(basicChannel.type);
2026-07-29 08:29:29 +00:00
if (tmp7) {
2026-08-24 06:08:38 +00:00
tmp7 = !closure_1_5.hasJoined(id);
2026-07-23 10:11:24 +00:00
}
2026-07-29 08:29:29 +00:00
let tmp9 = !tmp7;
if (!tmp7) {
let tmp11 = callback2(basicChannel);
if (tmp11) {
2026-08-24 06:08:38 +00:00
let hasUnreadResult = closure_1_11.hasUnread(id);
2026-07-23 10:11:24 +00:00
if (hasUnreadResult) {
2026-08-24 06:08:38 +00:00
hasUnreadResult = closure_1_13.resolveUnreadSetting(basicChannel) === closure_1_17.ALL_MESSAGES;
2026-07-23 10:11:24 +00:00
}
tmp11 = hasUnreadResult;
}
2026-07-29 08:29:29 +00:00
tmp9 = tmp11;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp5 = tmp9;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
tmp2 = tmp5;
2026-07-20 16:05:17 +00:00
}
return tmp2;
});
let channel;
if (found.length > 0) {
2026-07-23 10:11:24 +00:00
channel = isHomeDrawerChannelMuted.getChannel(found[0]);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
obj = { unreadChannel: channel, unreadChannelName: null, unreadChannelCount: null };
2026-07-20 16:05:17 +00:00
let channelName;
if (null != channel) {
2026-07-23 10:11:24 +00:00
channelName = guild(onActiveHookChange[24]).computeChannelName(channel, mentionChannelCount, mentionChannel);
const obj2 = guild(onActiveHookChange[24]);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[1] = channelName;
obj[2] = found.length;
2026-07-20 16:05:17 +00:00
return obj;
}, items5);
2026-07-23 10:11:24 +00:00
unreadChannel = stateFromStoresObject.unreadChannel;
2026-07-29 08:29:29 +00:00
unreadChannelName = stateFromStoresObject.unreadChannelName;
2026-07-23 10:11:24 +00:00
unreadChannelCount = stateFromStoresObject.unreadChannelCount;
2026-07-29 08:29:29 +00:00
const obj6 = guild(onActiveHookChange[16]);
2026-07-23 10:11:24 +00:00
const items6 = [unreadChannel, isHomeDrawerChannelMuted, mentionChannelCount, mentionChannel, stateFromStores1];
const items7 = [guild.id, isHomeDrawerChannelInChannelList];
const stateFromStoresObject1 = guild(onActiveHookChange[16]).useStateFromStoresObject(items6, () => {
const tmp = unreadChannel.getMutableGuildStates()[guild.id];
guild = tmp;
2026-07-20 16:05:17 +00:00
if (null == tmp) {
2026-08-08 06:10:11 +00:00
return { mentionChannel: "disabled", mentionChannelName: "isArray", mentionChannelCount: null };
2026-07-20 16:05:17 +00:00
} else {
2026-07-23 10:11:24 +00:00
const keys = disableSubtitle(onActiveHookChange[25]).keys(tmp.mentionCounts);
2026-07-29 08:29:29 +00:00
const found = keys.filter((id) => {
2026-08-24 06:08:38 +00:00
if (mentionCounts.mentionCounts[id].count <= 0) {
2026-07-23 10:11:24 +00:00
return false;
} else {
2026-07-29 08:29:29 +00:00
const basicChannel = isHomeDrawerChannelMuted.getBasicChannel(id);
2026-07-23 10:11:24 +00:00
let tmp4 = null != basicChannel;
if (tmp4) {
let tmp6 = memo(basicChannel.type);
if (tmp6) {
2026-07-29 08:29:29 +00:00
tmp6 = !stateFromStores1.hasJoined(id);
2026-07-23 10:11:24 +00:00
}
let tmp8 = !tmp6;
2026-07-29 08:29:29 +00:00
if (!tmp6) {
2026-08-24 06:08:38 +00:00
tmp8 = closure_1_8(basicChannel);
2026-07-23 10:11:24 +00:00
}
tmp4 = tmp8;
}
return tmp4;
}
});
2026-07-20 16:05:17 +00:00
let channel;
if (found.length > 0) {
2026-07-23 10:11:24 +00:00
channel = isHomeDrawerChannelMuted.getChannel(found[0]);
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
obj = { mentionChannel: null, mentionChannelName: null, mentionChannelCount: null };
2026-07-29 08:29:29 +00:00
obj[0] = channel;
2026-07-20 16:05:17 +00:00
let channelName;
if (null != channel) {
2026-07-23 10:11:24 +00:00
channelName = guild(onActiveHookChange[24]).computeChannelName(channel, mentionChannelCount, mentionChannel);
const obj2 = guild(onActiveHookChange[24]);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[1] = channelName;
obj[2] = found.length;
2026-07-20 16:05:17 +00:00
return obj;
}
}, items7);
2026-07-23 10:11:24 +00:00
mentionChannel = stateFromStoresObject1.mentionChannel;
mentionChannelName = stateFromStoresObject1.mentionChannelName;
mentionChannelCount = stateFromStoresObject1.mentionChannelCount;
2026-07-29 08:29:29 +00:00
const obj7 = guild(onActiveHookChange[16]);
2026-07-23 10:11:24 +00:00
const voiceUsers = guild(onActiveHookChange[26]).useVoiceUsers(guild);
2026-07-29 08:29:29 +00:00
voiceUsers1 = voiceUsers.voiceUsers;
streamingUser = voiceUsers.streamingUser;
const obj8 = guild(onActiveHookChange[26]);
2026-07-23 10:11:24 +00:00
const homeDrawerGuildTyping = guild(onActiveHookChange[27]).useHomeDrawerGuildTyping(guild.id);
2026-07-29 08:29:29 +00:00
typingChannelId = homeDrawerGuildTyping.typingChannelId;
typingChannelName = homeDrawerGuildTyping.typingChannelName;
const obj9 = guild(onActiveHookChange[27]);
2026-07-23 10:11:24 +00:00
const items8 = [isHomeDrawerChannelMuted];
2026-07-20 16:05:17 +00:00
const items9 = [typingChannelId];
2026-07-29 08:29:29 +00:00
stateFromStores2 = guild(onActiveHookChange[16]).useStateFromStores(items8, () => isHomeDrawerChannelMuted.getChannel(typingChannelId), items9);
let tmp16 = typingChannelId;
const obj10 = guild(onActiveHookChange[16]);
if (typingChannelId == null) {
tmp16 = voiceUsers1;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj = { channelId: tmp16, guildId: guild.id, typingUserIds: homeDrawerGuildTyping.typingUserIds };
const tmp15Result = disableSubtitle(onActiveHookChange[28])(obj);
2026-08-24 06:08:38 +00:00
closure_20 = tmp15Result;
2026-07-29 08:29:29 +00:00
let tmp18 = memo.isMuted || disableSubtitle;
if (!tmp18) {
tmp18 = 0 === voiceUsers1.length;
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
callback2 = tmp19;
const items10 = [!tmp18, streamingUser, disableSubtitle, mentionChannelName, mentionChannelCount, typingChannelId, tmp15Result, memo.isMuted, stateFromStores, unreadChannelName, unreadChannelCount];
memo2 = obj3.useMemo(() => {
2026-08-24 06:08:38 +00:00
if (closure_21) {
2026-07-20 16:05:17 +00:00
if (null != streamingUser) {
2026-08-24 06:08:38 +00:00
let VOICE = constants.STREAMING;
2026-07-20 16:05:17 +00:00
} else {
2026-08-24 06:08:38 +00:00
VOICE = constants.VOICE;
2026-07-20 16:05:17 +00:00
}
} else {
if (disableSubtitle) {
2026-08-24 06:08:38 +00:00
let TYPING = constants.NONE;
2026-07-20 16:05:17 +00:00
} else {
if (null != mentionChannelName) {
if (mentionChannelCount > 0) {
2026-08-24 06:08:38 +00:00
TYPING = constants.MENTION;
2026-07-20 16:05:17 +00:00
}
}
if (null != typingChannelId) {
2026-08-24 06:08:38 +00:00
if (null != constants) {
2026-07-20 16:05:17 +00:00
if (!memo.isMuted) {
2026-08-24 06:08:38 +00:00
TYPING = constants.TYPING;
2026-07-20 16:05:17 +00:00
}
}
}
if (stateFromStores) {
if (null != unreadChannelName) {
2026-08-24 06:08:38 +00:00
const UNREAD = constants.UNREAD;
2026-07-20 16:05:17 +00:00
}
}
2026-08-24 06:08:38 +00:00
const NONE = constants.NONE;
2026-07-20 16:05:17 +00:00
}
return TYPING;
}
}, items10);
const items11 = [memo2, onActiveHookChange];
2026-07-29 08:29:29 +00:00
const effect = obj3.useEffect(() => {
if (onActiveHookChange != null) {
tmp(memo2);
2026-07-20 16:05:17 +00:00
}
}, items11);
2026-07-29 08:29:29 +00:00
const items12 = [memo2, guild, streamingUser, voiceUsers1, mentionChannel, mentionChannelName, mentionChannelCount, stateFromStores2, typingChannelName, tmp15Result, unreadChannel, unreadChannelName, unreadChannelCount];
const memo3 = obj3.useMemo(() => {
2026-08-24 06:08:38 +00:00
if (constants.STREAMING === memo2) {
obj = { guildId: null, streamingUser: null };
2026-07-29 08:29:29 +00:00
obj[0] = guild.id;
obj[1] = streamingUser;
2026-07-23 10:11:24 +00:00
return typingChannelName(disableSubtitle(onActiveHookChange[29]), obj);
2026-07-29 08:29:29 +00:00
} else if (tmp2.VOICE === tmp) {
obj = { guildId: null, voiceUsers: null };
obj[0] = guild.id;
obj[1] = voiceUsers1;
2026-07-23 10:11:24 +00:00
return typingChannelName(disableSubtitle(onActiveHookChange[30]), obj);
2026-07-29 08:29:29 +00:00
} else if (tmp2.MENTION === tmp) {
let tmp20 = null;
2026-07-20 16:05:17 +00:00
if (null != mentionChannelName) {
2026-08-24 06:08:38 +00:00
obj1 = { guild: null, channel: null, channelName: null, count: null };
2026-07-29 08:29:29 +00:00
obj1[0] = guild;
obj1[1] = mentionChannel;
obj1[2] = tmp19;
obj1[3] = mentionChannelCount;
tmp20 = typingChannelName(disableSubtitle(onActiveHookChange[31]), obj1);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp20;
} else if (tmp2.TYPING === tmp) {
const obj2 = { guild: null, channel: null, channelName: null, text: null };
obj2[0] = guild;
obj2[1] = stateFromStores2;
obj2[2] = typingChannelName;
2026-08-24 06:08:38 +00:00
obj2[3] = constants;
2026-07-23 10:11:24 +00:00
return typingChannelName(disableSubtitle(onActiveHookChange[32]), obj2);
2026-07-29 08:29:29 +00:00
} else if (tmp2.UNREAD === tmp) {
let tmp5 = null;
2026-07-20 16:05:17 +00:00
if (null != unreadChannelName) {
2026-07-29 08:29:29 +00:00
obj = { guild: null, channel: null, channelName: null, count: null };
obj[0] = guild;
obj[1] = unreadChannel;
obj[2] = tmp4;
obj[3] = unreadChannelCount;
tmp5 = typingChannelName(disableSubtitle(onActiveHookChange[33]), obj);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
return tmp5;
} else if (tmp2.NONE === tmp) {
2026-07-20 16:05:17 +00:00
return null;
}
}, items12);
2026-07-29 08:29:29 +00:00
obj = { title: memo1, subtitle: memo3, right: null };
let tmp23Result = null;
2026-07-20 16:05:17 +00:00
if (!memo.isMuted) {
2026-07-29 08:29:29 +00:00
tmp23Result = null;
2026-07-20 16:05:17 +00:00
if (!disableSubtitle) {
2026-07-29 08:29:29 +00:00
tmp23Result = null;
2026-07-20 16:05:17 +00:00
if (0 !== voiceUsers1.length) {
2026-07-29 08:29:29 +00:00
obj1 = { voiceUsers: null, streamingChannelId: null, streamingUser: null, guildId: null };
obj1[0] = voiceUsers1;
obj1[1] = voiceUsers.streamingChannelId;
obj1[2] = streamingUser;
obj1[3] = guild.id;
tmp23Result = tmp23(tmp2(tmp3[26]).GuildVoiceState, obj1);
2026-07-20 16:05:17 +00:00
}
}
}
2026-07-29 08:29:29 +00:00
obj[2] = tmp23Result;
2026-07-23 10:11:24 +00:00
return typingChannelName(guild(onActiveHookChange[34]).HomeDrawerSharedItem, obj);
2026-07-20 16:05:17 +00:00
}
2026-07-23 10:11:24 +00:00
({ EMPTY_STRING_SNOWFLAKE_ID: closure_15, NOOP: closure_16 } = ME);
({ jsx: closure_18, jsxs: closure_19 } = jsxProd);
let obj = { STREAMING: "streaming", VOICE: "voice", MENTION: "mention", TYPING: "typing", UNREAD: "unread", NONE: "none" };
2026-07-29 08:29:29 +00:00
let closure_21 = createCacheKey.createStyles({ guildName: { flexDirection: "row", alignItems: "center", gap: 4 }, guildNameText: { flexShrink: 1 } });
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/home_drawer/native/HomeDrawerGuildRow.tsx");
2026-07-20 16:05:17 +00:00
export default function HomeDrawerGuildRow(guildId) {
2026-07-23 10:11:24 +00:00
guildId = guildId.guildId;
2026-07-20 16:05:17 +00:00
({ disableSubtitle, onActiveHookChange } = guildId);
2026-08-24 06:08:38 +00:00
obj = guildId(589);
const items = [closure_10];
const stateFromStores = obj.useStateFromStores(items, () => closure_1_10.getGuild(guildId));
const MobileHomeDrawerExperiment = guildId(4239).MobileHomeDrawerExperiment;
2026-07-20 16:05:17 +00:00
let tmp3 = null;
if (null != stateFromStores) {
tmp3 = null;
if (MobileHomeDrawerExperiment.useConfig({ location: "guild-row" }).enableHome) {
tmp3 = null;
if (!tmp2) {
2026-07-29 08:29:29 +00:00
obj = { guild: null, disableSubtitle: null, onActiveHookChange: null };
obj[0] = stateFromStores;
obj[1] = disableSubtitle;
obj[2] = onActiveHookChange;
2026-07-20 16:05:17 +00:00
tmp3 = callback(GuildRowWrapper, obj);
}
}
}
return tmp3;
};
export const HomeDrawerActiveHook = obj;