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

104 lines
7.0 KiB
TypeScript

/* Metro module 15325; source: modules/launchpad/native/shared/SimpleGuild.tsx; dependencies: [31, 27, 1422, 5214, 1867, 661, 33, 4501, 6819, 15326, 566, 15327, 15329, 1244, 14421, 6682, 697, 15328, 2] */
function _fun117208(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#117208, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15522:6, offset: 0x024a8529, size: 286 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 env0_5 = (require(1422) /* metro dependency 1422: GuildRecord */).getGuildIconSource;
const guildReadStateStore = importDefault(5214) /* metro dependency 5214: GuildReadStateStore */;
const guildStore = importDefault(1867) /* metro dependency 1867: GuildStore */;
const env0_8 = (require(661) /* metro dependency 661: Constants */).ME;
const env0_9 = (require(33) /* metro dependency 33 */).jsx;
const env0_10 = (require(4501) /* metro dependency 4501: createStyles */).createStyles({dmsWrapper: {'flex': 1,
'justifyContent': 'center', 'alignItems': 'center'}});
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/launchpad/native/shared/SimpleGuild.tsx');
exports.default = SimpleGuild;
}
function SimpleGuild({guildIconRef, style, guildId, onPress, onLongPress, onAccessibilityAction, onLayout, backgroundColor, animated, altDefaultBackground, selected, size, iconSize = require(dependencyMap[8]).GuildIconSizes.LARGE, borderRadius, unread, badge}) { // fn#117209, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15522:379, offset: 0x024a8647, size: 1128 bytes, params: 2, frame: 47
var color;
var CutoutImage;
var object;
var value23;
var value24;
var ChatIcon;
var colors;
animated = animated === undefined || animated;
altDefaultBackground = !(altDefaultBackground === undefined) && altDefaultBackground;
selected = !(selected === undefined) && selected;
const styles = useStyles();
const {iconStroke, iconBackground,
iconBackgroundBrand} = (importDefault(15326) /* metro dependency 15326: useSimpleGuildDefaultColors */)();
const guild = (require(566) /* metro dependency 566: flux */).useStateFromStores([GuildStore], function() {
return GuildStore.getGuild(guildId);
});
let r17 = guild?.name ?? '';
const value10 = (require(566) /* metro dependency 566: flux */).useStateFromStoresObject([GuildReadStateStore],
function() {
var object = {};
var guildIdBinding = guildId;
object.unread = GuildReadStateStore.hasUnread(guildIdBinding);
object.badge = GuildReadStateStore.getMentionCount(guildIdBinding);
return object;
}, [guildId]);
const unread2 = value10.unread;
const badge2 = value10.badge;
const env0_3 = badge2;
const simpleGuildContainerModule = require(15327) /* metro dependency 15327: SimpleGuildContainer */;
const r2 = animated ? simpleGuildContainerModule.SimpleGuildContainerAnimated : simpleGuildContainerModule.SimpleGuildContainer;
const {containerSize, containerSizeStyle,
containerStyles} = (importDefault(15329) /* metro dependency 15329: useSimpleGuildSize */)({size: size,
style: style});
const value13 = env0_3.useMemo(_fun117212, [r17, unread2, badge2]);
const value14 = (require(14421) /* metro dependency 14421: GuildsBarActivityIndicator */).useActivityIndicatorState(guildId);
let r4 = unread2 || selected;
r4 = !r4 ? badge2 > 0 : r4;
r4 = (!r4 ? value14.source != null : r4) && backgroundColor === 'transparent';
r17 = guild != null ? getGuildIconSource(guild, containerSize, selected && !r4) : undefined;
const r15 = r17 === null || typeof r17 !== 'object' ? r17 != null : 'uri' in r17 ? r17.uri != null : r17 != null;
const r2Props = {guildIconRef: guildIconRef, guildId: guild?.id, style: containerStyles,
backgroundColor: backgroundColor, selected: selected, size: size, borderRadius: borderRadius, onPress: onPress,
onLongPress: onLongPress, unread: unread ?? unread2, badge: badge ?? badge2, onLayout: onLayout,
onAccessibilityAction: onAccessibilityAction, accessibilityLabel: value13, usingCutout: r4,
activityIndicatorState: value14};
if (guildId === ME) {
var viewBindingProps = {style: styles.dmsWrapper};
ChatIcon = (require(6682) /* metro dependency 6682: ChatIcon */).ChatIcon;
colors = (importDefault(697) /* metro dependency 697: native */).colors;
r4 = <View {...viewBindingProps}><ChatIcon color={selected ? colors.WHITE : colors.MOBILE_GUILDBAR_ICON_DEFAULT} /></View>;
} else if (r4) {
CutoutImage = importDefault(15328) /* metro dependency 15328: CutoutImage */;
object = {'cutoutBottomRightSize': null, 'cutoutBottomRightInsetX': 6, 'cutoutBottomRightInsetY': 7,
'cutoutTopRightSize': null, 'cutoutTopRightInsetX': 8, 'cutoutTopRightInsetY': 8};
value23 = 0;
value24 = 13;
object.cutoutBottomRightSize = badge2 > value23 ? value24 : unread2 ? 11 : value23;
object.cutoutTopRightSize = value14.source != null ? value24 : value23;
object.imageSize = containerSize;
object.imageSource = r17;
object.imageBorderRadius = borderRadius;
color = r15 ? iconBackground.color : iconBackgroundBrand.color;
object.imageBackgroundColor = color;
object.clipOuterAmount = selected ? 3 : value23;
object.borderStroke = 1;
color = iconStroke.color;
object.borderStrokeColor = color;
r4 = <CutoutImage {...object} />;
} else {
r4 = ((Component) => <Component guild={guild} size={iconSize} selected={selected} animate={selected} TABS_altDefaultBackground={altDefaultBackground} style={size != null ? containerSizeStyle : null} />)(importDefault(6819) /* metro dependency 6819: GuildIcon */);
}
return ((Component) => <Component {...r2Props}>{r4}</Component>)(r2);
}
function _fun117212() { // fn#117212, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:15522:1122, offset: 0x024a8ae1, size: 297 bytes, params: 1, frame: 17
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
return env0_1 === '' ? env0_1 : badge == null ? unread === true ? intl.formatToPlainString(t.lzqe42,
{guildName: env0_1}) : intl.formatToPlainString(t['/uzRss'], {guildName: env0_1,
mentions: badge}) : badge > 0 ? intl.formatToPlainString(t['/uzRss'], {guildName: env0_1,
mentions: badge}) : unread === true ? intl.formatToPlainString(t.lzqe42,
{guildName: env0_1}) : intl.formatToPlainString(t['/uzRss'], {guildName: env0_1, mentions: badge});
}