decord/source/modules/launchpad/native/shared/renderChannelItem.tsx

128 lines
5.4 KiB
TypeScript
Raw Normal View History

// Module ID: 16993
// Function ID: 16994
2026-07-20 16:05:17 +00:00
// Name: LaunchpadChannelIcon
// Dependencies: [19, 17, 1979, 4209, 1371, 4742, 21, 9775, 4560, 576, 16980, 504, 5584, 12195, 7641, 16982, 10915, 16985, 4713, 2]
2026-07-20 16:05:17 +00:00
// Exports: default, getChannelAccessibilityProps
// Module 16993 (LaunchpadChannelIcon)
2026-08-24 06:08:38 +00:00
import noopAll from "noop" /* 19 */;
import ThemesDefault from "Themes" /* 576 */;
import computeChannelName from "computeChannelName" /* 4713 */;
import GuildIconSizesDefault from "GuildIconSizes" /* 5584 */;
import getRelativeTimestamp from "getRelativeTimestamp" /* 7641 */;
import getChannelA11yLabelDefault from "getChannelA11yLabel" /* 9775 */;
import getLayoutStyleDefault from "getLayoutStyle" /* 16980 */;
import renderChannelWrapperDefault from "renderChannelWrapper" /* 16982 */;
import ChannelContentDefault from "ChannelContent" /* 16985 */;
2026-08-24 06:08:38 +00:00
import { View } from "get ActivityIndicator" /* 17 */;
import closure_4 from "createGuildRecordFromRust" /* 1979 */;
import closure_5 from "markAllUserIdListsStale" /* 4209 */;
import closure_6 from "mergeGuildAvatar" /* 1371 */;
import { UnreadSetting } from "ReadStateTypes" /* 4742 */;
2026-08-24 06:08:38 +00:00
import jsxProd from "jsxProd" /* 21 */;
import createCacheKey from "createCacheKey" /* 4560 */;
2026-07-23 10:11:24 +00:00
2026-08-24 06:08:38 +00:00
require = arg1;
2026-07-20 16:05:17 +00:00
function LaunchpadChannelIcon(channel) {
channel = channel.channel;
const tmp = callback3();
let obj = channel(504);
2026-08-24 06:08:38 +00:00
const items = [closure_4];
2026-07-29 08:29:29 +00:00
obj = { children: null };
obj = { style: tmp.guildBadgeIcon, children: null };
2026-08-24 06:08:38 +00:00
const stateFromStores = obj.useStateFromStores(items, () => closure_1_4.getGuild(channel.guild_id));
const tmp2 = getLayoutStyleDefault();
obj[1] = callback(GuildIconSizesDefault, { guild: stateFromStores, size: getLayoutStyleDefault().icon.guildBadgeIconSize });
const items1 = [callback(View, obj), callback(channel(12195).ChannelIcon, { channel, size: "sm", wrapperSize: 32 })];
2026-07-29 08:29:29 +00:00
obj[0] = items1;
2026-07-20 16:05:17 +00:00
return callback2(closure_9, obj);
}
2026-08-24 06:08:38 +00:00
noopAll;
({ jsx: closure_8, Fragment: c9, jsxs: c10 } = jsxProd);
2026-07-29 08:29:29 +00:00
let closure_11 = createCacheKey.createStyles(() => {
let obj = { guildBadgeIcon: null };
2026-08-24 06:08:38 +00:00
obj = { position: "absolute", zIndex: 1, bottom: -4, right: -4, borderColor: ThemesDefault.colors.BACKGROUND_BASE_LOW, borderWidth: 2, borderRadius: 6 };
2026-07-29 08:29:29 +00:00
obj[0] = obj;
2026-07-20 16:05:17 +00:00
return obj;
});
2026-08-24 06:08:38 +00:00
const result = require("set").fileFinishedImporting("modules/launchpad/native/shared/renderChannelItem.tsx");
2026-07-20 16:05:17 +00:00
export default function renderChannelItem(unread) {
({ channel, locked } = unread);
({ channelCategoryName, subtitle, unreadBadge, mentionBadge } = unread);
if (locked === undefined) {
locked = false;
}
let flag = unread.unread;
if (flag === undefined) {
flag = false;
}
let ONLY_MENTIONS = unread.resolvedUnreadSetting;
if (ONLY_MENTIONS === undefined) {
ONLY_MENTIONS = UnreadSetting.ONLY_MENTIONS;
}
let flag2 = unread.live;
if (flag2 === undefined) {
flag2 = false;
}
let flag3 = unread.muted;
if (flag3 === undefined) {
flag3 = false;
}
({ latestMessageTimestamp, end, channelName, isSubscriptionGated, connected, mentionCount, fontScale } = unread);
if (isSubscriptionGated === undefined) {
isSubscriptionGated = false;
}
let flag4 = unread.needSubscriptionToAccess;
if (flag4 === undefined) {
flag4 = false;
}
let relativeTimestamp = null;
if (null != latestMessageTimestamp) {
relativeTimestamp = null;
if (!flag3) {
2026-08-24 06:08:38 +00:00
let obj = getRelativeTimestamp;
2026-07-20 16:05:17 +00:00
relativeTimestamp = obj.getRelativeTimestamp(latestMessageTimestamp);
}
}
2026-08-24 06:08:38 +00:00
const tmp7 = getLayoutStyleDefault();
2026-07-29 08:29:29 +00:00
const children = [unreadBadge, , , ];
obj = { style: null, children: null };
2026-08-24 06:08:38 +00:00
obj = { position: "relative", borderRadius: ThemesDefault.radii.round, justifyContent: "center", alignItems: "center", flexShrink: 0, flexGrow: 0, width: tmp7.icon.wrapper.size, height: tmp7.icon.wrapper.size };
2026-07-29 08:29:29 +00:00
const merged = Object.assign(tmp7.icon.margin);
obj[0] = obj;
2026-07-20 16:05:17 +00:00
if (channel.isGroupDM()) {
2026-08-24 06:08:38 +00:00
obj1 = { channel: null, size: null };
2026-07-29 08:29:29 +00:00
obj1[0] = channel;
obj1[1] = tmp7.icon.avatarSize;
let tmp11Result = tmp11(tmp5(10915), obj1);
2026-07-20 16:05:17 +00:00
} else {
2026-07-29 08:29:29 +00:00
const obj2 = { channel: null };
obj2[0] = channel;
tmp11Result = tmp11(LaunchpadChannelIcon, obj2);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
obj[1] = tmp11Result;
children[1] = closure_8(View, obj);
const tmp10 = closure_9;
2026-08-24 06:08:38 +00:00
const tmp8 = renderChannelWrapperDefault;
2026-07-29 08:29:29 +00:00
const tmp9 = closure_10;
if (channelName == null) {
2026-08-24 06:08:38 +00:00
channelName = computeChannelName.computeChannelName(channel, closure_6, closure_5);
const obj6 = computeChannelName;
2026-07-20 16:05:17 +00:00
}
2026-08-24 06:08:38 +00:00
children[2] = ChannelContentDefault({ name: channelName, subtitle, unread: flag, resolvedUnreadSetting: ONLY_MENTIONS, muted: flag3, lastMessageTimestampString: relativeTimestamp, channel, channelCategoryName, locked, connected, live: flag2, mentionCount, mentionBadge, isSubscriptionGated, needSubscriptionToAccess: flag4 });
2026-07-29 08:29:29 +00:00
tmp11Result = null;
2026-07-20 16:05:17 +00:00
if (null != end) {
2026-07-29 08:29:29 +00:00
const obj3 = { style: null, children: null };
obj3[0] = { paddingLeft: 8 };
obj3[1] = end;
tmp11Result = tmp11(tmp12, obj3);
2026-07-20 16:05:17 +00:00
}
2026-07-29 08:29:29 +00:00
children[3] = tmp11Result;
return tmp8(tmp9(tmp10, { children }), { fontScale });
2026-07-20 16:05:17 +00:00
};
export const getChannelAccessibilityProps = function getChannelAccessibilityProps(arg0) {
({ channel, unread, mentionCount, voiceStates, embeddedActivitiesCount } = arg0);
2026-08-24 06:08:38 +00:00
return { accessible: true, accessibilityRole: "button", accessibilityLabel: getChannelA11yLabelDefault({ channel, unread, mentionCount, voiceStates, embeddedActivitiesCount }) };
2026-07-20 16:05:17 +00:00
};