Files
discord-decomp/sources/modules/home_drawer/native/HomeDrawerGuildRow.tsx
T
2026-07-27 16:20:00 +03:00

236 lines
14 KiB
TypeScript

/* Metro module 14428; source: modules/home_drawer/native/HomeDrawerGuildRow.tsx; dependencies: [31, 27, 1379, 1935, 5214, 1867, 4605, 4864, 4865, 482, 33, 4501, 566, 4013, 4010, 14429, 10629, 4573, 6915, 1305, 14431, 14432, 11566, 1244, 14407, 2] */
function _fun109194(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#109194, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14625:6, offset: 0x02341019, size: 380 bytes, params: 8, frame: 19
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const env0_3 = importAll(31) /* metro dependency 31 */;
const env0_4 = (require(27) /* metro dependency 27 */).View;
const channelStore = importDefault(1379) /* metro dependency 1379: ChannelStore */;
const guildChannelStore = importDefault(1935) /* metro dependency 1935: GuildChannelStore */;
const guildReadStateStore = importDefault(5214) /* metro dependency 5214: GuildReadStateStore */;
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
const readStateStore = importDefault(4605) /* metro dependency 4605: ReadStateStore */;
const userGuildSettingsStore = importDefault(4864) /* metro dependency 4864: UserGuildSettingsStore */;
const env0_11 = (require(4865) /* metro dependency 4865: ReadStateConstants */).UnreadSetting;
const env0_12 = (require(482) /* metro dependency 482: Constants */).NOOP;
const value = require(33) /* metro dependency 33 */;
const env0_13 = value.jsx;
const env0_14 = value.jsxs;
const env0_15 = value.Fragment;
const env0_16 = (require(4501) /* metro dependency 4501: createStyles */).createStyles({guildName: {'flexDirection': 'row',
'alignItems': 'center', 'gap': 4}});
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/home_drawer/native/HomeDrawerGuildRow.tsx');
exports.default = HomeDrawerGuildRow;
}
function GuildRowWrapper({guild, disableSubtitle}) { // fn#109195, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14625:346, offset: 0x02341195, size: 877 bytes, params: 2, frame: 34
const styles = useStyles();
const value2 = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildReadStateStore],
function() {
return GuildReadStateStore.hasUnread(guild.id);
});
const env0_3 = value2;
const value3 = env0_3.useMemo(_fun109198,
[(require(566) /* metro dependency 566: flux */).useStateFromStores([UserGuildSettingsStore], function() {
return UserGuildSettingsStore.getMuteConfig(guild.id);
})]);
const value4 = env0_3.useMemo(_fun109199, [guild, value3, styles.guildName]);
const {unreadChannelName,
unreadChannelCount} = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([GuildChannelStore,
ReadStateStore, UserGuildSettingsStore, ChannelStore], _fun109200, [guild.id]);
const {mentionChannelName,
mentionChannelCount} = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([GuildReadStateStore,
ChannelStore], _fun109202, [guild.id]);
const {voiceUsers, streamingUser,
streamingChannelId} = (require(14431) /* metro dependency 14431: HomeDrawerGuildVoiceState */).useVoiceUsers(guild);
const {typingChannelId, typingChannelName,
typingUserIds} = (require(14432) /* metro dependency 14432: useHomeDrawerGuildTyping */).useHomeDrawerGuildTyping(guild.id);
const value9 = (importDefault(11566) /* metro dependency 11566: useTypingText */)({channelId: typingChannelId,
guildId: guild.id, typingUserIds: typingUserIds});
let r2 = value3.isMuted || disableSubtitle;
r2 = !r2 ? voiceUsers.length === 0 : r2;
const value11 = !r2;
const value12 = env0_3.useMemo(_fun109204, [disableSubtitle, value3.isMuted, value2, unreadChannelName,
unreadChannelCount, mentionChannelName, mentionChannelCount, typingChannelId, typingChannelName, value9]);
const value13 = env0_3.useMemo(_fun109207, [value11, voiceUsers]);
const value14 = env0_3.useMemo(_fun109209, [value11, streamingUser]);
const HomeDrawerSharedItem = (require(14407) /* metro dependency 14407: HomeDrawerShared */).HomeDrawerSharedItem;
return (
<HomeDrawerSharedItem
title={value4}
subtitle={r2 ? value12 : streamingUser == null ? value13 : value14}
right={value3.isMuted || disableSubtitle || voiceUsers.length === 0 ? null : ((GuildVoiceState) => <GuildVoiceState voiceUsers={voiceUsers} streamingChannelId={streamingChannelId} streamingUser={streamingUser} guildId={guild.id} />)((require(14431) /* metro dependency 14431: HomeDrawerGuildVoiceState */).GuildVoiceState)}
/>
);
}
function HomeDrawerGuildRow({guildId, disableSubtitle}) { // fn#109210, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14625:3646, offset: 0x02341cf1, size: 196 bytes, params: 2, frame: 19
const guild = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildStore], function() {
return GuildStore.getGuild(guildId);
});
const MobileHomeDrawerExperiment = (require(4013) /* metro dependency 4013: HomeDrawerExperiment */).MobileHomeDrawerExperiment;
const useConfig = MobileHomeDrawerExperiment.useConfig;
return guild == null ? null : Reflect.apply(useConfig, MobileHomeDrawerExperiment,
[{location: 'guild-row'}]).enableHome ? (importDefault(4010) /* metro dependency 4010: useChatLayout */)().isChatBesideChannelList ? null : <GuildRowWrapper guild={guild} disableSubtitle={disableSubtitle} /> : null;
}
function _fun109199() { // fn#109199, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14625:691, offset: 0x023415d0, size: 308 bytes, params: 1, frame: 23
const items2 = [((Component) => <Component size="xs" />)(env0_5.isMuted ? env0_5.isTemporary ? (require(14429) /* metro dependency 14429: BellZIcon */).BellZIcon : (require(10629) /* metro dependency 10629: BellSlashIcon */).BellSlashIcon : NOOP)];
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
const guildBinding = guild;
items2[1] = <Text variant="text-md/medium" style={{flexShrink: 1}} lineClamp={1} color="text-default">{guildBinding.name}</Text>;
const GuildBadgeV2 = importDefault(6915) /* metro dependency 6915: GuildBadgeV2 */;
const Icon = (require(1305) /* metro dependency 1305: native */).Icon;
const Sizes = Icon.Sizes;
const REFRESH_SMALL_16 = Sizes.REFRESH_SMALL_16;
items2[2] = <GuildBadgeV2 guild={guildBinding} size={REFRESH_SMALL_16} />;
return (
<View style={styles.guildName}>
{items2}
</View>
);
}
function _fun109200() { // fn#109200, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14625:1076, offset: 0x02341704, size: 121 bytes, params: 1, frame: 15
var environment;
var r2;
let value = environment.__proto__;
const getSelectableChannelIds = GuildChannelStore.getSelectableChannelIds;
const value4 = Reflect.apply(getSelectableChannelIds, GuildChannelStore, [guild.id]).filter(_fun109201);
const length = value4.length;
const value5 = undefined;
if (length > 0) {
value = ChannelStore.getChannel(value4[0]);
r2 = value == null ? value5 : value.name;
} else {
r2 = value5;
}
return {unreadChannelName: r2, unreadChannelCount: value4.length};
}
function _fun109202() { // fn#109202, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14625:1453, offset: 0x023417cf, size: 174 bytes, params: 1, frame: 16
var environment;
var r2;
var object2;
let value = environment.__proto__;
const property = GuildReadStateStore.getMutableGuildStates()[guild.id];
if (property == null) {
object2 = {mentionChannelName: undefined, mentionChannelCount: 0};
} else {
var Object = global.Object;
var value5 = Object.keys(property.mentionCounts).filter(_fun109203);
object2 = {};
var length = value5.length;
var value6 = undefined;
if (length > 0) {
value = ChannelStore.getChannel(value5[0]);
r2 = value == null ? value6 : value.name;
} else {
r2 = value6;
}
object2.mentionChannelName = r2;
length = value5.length;
object2.mentionChannelCount = length;
}
return object2;
}
function _fun109204() { // fn#109204, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14625:2100, offset: 0x0234189e, size: 633 bytes, params: 1, frame: 27
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const disableSubtitleBinding = disableSubtitle;
const value2 = null;
return disableSubtitleBinding ? value2 : value2 == mentionChannelName ? value2 == typingChannelId || value2 == env0_14 || env0_5.isMuted ? env0_3 && value2 != unreadChannelName && unreadChannelCount > 0 ? <Text variant="text-xs/medium" color="text-strong" lineClamp={1}>{intl.format((require(1244) /* metro dependency 1244: indexNative */).t.OqlmU6,
{channelName: unreadChannelName, channelHook: channelHook_109206,
count: unreadChannelCount - 1})}</Text> : value2 : <Text variant="text-xs/medium" color="text-strong" lineClamp={1}>{value2 != typingChannelName ? <><Text variant="text-xs/semibold">{'#' + typingChannelName}</Text>{' · '}</> : value2}{env0_14}</Text> : mentionChannelCount > 0 ? <Text variant="text-xs/medium" color="text-strong" lineClamp={1}>{intl.format((require(1244) /* metro dependency 1244: indexNative */).t.L9YdGH,
{channelName: mentionChannelName, channelHook: channelHook_109205,
count: mentionChannelCount - 1})}</Text> : value2 == typingChannelId || value2 == env0_14 || env0_5.isMuted ? env0_3 && value2 != unreadChannelName && unreadChannelCount > 0 ? <Text variant="text-xs/medium" color="text-strong" lineClamp={1}>{intl.format((require(1244) /* metro dependency 1244: indexNative */).t.OqlmU6,
{channelName: unreadChannelName, channelHook: channelHook_109206,
count: unreadChannelCount - 1})}</Text> : value2 : <Text variant="text-xs/medium" color="text-strong" lineClamp={1}>{value2 != typingChannelName ? <><Text variant="text-xs/semibold">{'#' + typingChannelName}</Text>{' · '}</> : value2}{env0_14}</Text>;
}
function _fun109207() { // fn#109207, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14625:2866, offset: 0x02341b6a, size: 220 bytes, params: 1, frame: 24
var environment;
var r0;
var value3;
var Text;
var intl;
var format;
var r1Vkoc;
var object;
var voiceUsersBinding;
var Math;
var value;
if (env0_15) {
value3 = environment.__proto__;
Text = (require(4573) /* metro dependency 4573: Text */).Text;
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
format = intl.format;
r1Vkoc = (require(1244) /* metro dependency 1244: indexNative */).t.r1Vkoc;
object = {};
voiceUsersBinding = voiceUsers;
value = voiceUsersBinding.slice(0, 2);
value = value.map(function(a0) {
return a0.username;
});
object.users = value.join(', ');
Math = global.Math;
object.overflowCount = Math.max(voiceUsersBinding.length - 2, 0);
value = <Text variant="text-xs/medium" color="text-feedback-positive" lineClamp={1}>{Reflect.apply(format, intl,
[r1Vkoc, object])}</Text>;
r0 = value;
} else {
r0 = null;
}
return r0;
}
function _fun109209() { // fn#109209, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14625:3124, offset: 0x02341c46, size: 171 bytes, params: 1, frame: 22
var username;
var r0;
var value3;
var value4;
var Text;
var intl;
var format;
var k5IKep;
var value;
const value2 = null;
if (env0_15) {
value3 = environment.__proto__;
value4 = undefined;
Text = (require(4573) /* metro dependency 4573: Text */).Text;
intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
format = intl.format;
k5IKep = (require(1244) /* metro dependency 1244: indexNative */).t.k5IKep;
username = value2 == streamingUser ? value4 : streamingUser.username;
value = '';
value = <Text variant="text-xs/medium" color="text-feedback-positive" lineClamp={1}>{Reflect.apply(format, intl,
[k5IKep, {username: value2 != username ? username : value}])}</Text>;
r0 = value;
} else {
r0 = value2;
}
return r0;
}
function _fun109201(a0) { // fn#109201, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14625:1129, offset: 0x0234177d, size: 82 bytes, params: 2, frame: 14
const value = environment.__proto__.__proto__;
const basicChannel = ChannelStore.getBasicChannel(a0);
return basicChannel != null && (ReadStateStore.hasUnread(a0) && UserGuildSettingsStore.resolveUnreadSetting(basicChannel) === UnreadSetting.ALL_MESSAGES);
}
function _fun109203(a0) { // fn#109203, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14625:1608, offset: 0x0234187d, size: 33 bytes, params: 2, frame: 2
return env0_0.mentionCounts[a0].count > 0;
}
function channelHook_109205(a0) { // fn#109205, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:14625:2273, offset: 0x02341b17, size: 83 bytes, params: 2, frame: 16
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
return (
<Text variant="text-xs/semibold">
{'#' + a0}
</Text>
);
}