Files
discord-decomp/sources/design/void/Badge/native/Badge.tsx
T
2026-07-27 16:20:00 +03:00

212 lines
13 KiB
TypeScript

/* Metro module 12810; source: design/void/Badge/native/Badge.tsx; dependencies: [31, 27, 1949, 661, 1307, 33, 4501, 697, 477, 566, 8002, 1856, 2] */
function _fun97686(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#97686, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13000:6, offset: 0x0218d77a, size: 721 bytes, params: 8, frame: 29
var object2;
const env0_0 = require;
const closure = Badge_97687;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
const value = undefined;
const env0_3 = importAll(31) /* metro dependency 31 */;
const env0_4 = (require(27) /* metro dependency 27 */).View;
const localeStore = importDefault(1949) /* metro dependency 1949: LocaleStore */;
const Fonts = (require(661) /* metro dependency 661: Constants */).Fonts;
const badgeConstantsModule = require(1307) /* metro dependency 1307: BadgeConstants */;
const env0_6 = badgeConstantsModule.BADGE_MASK_SIZE;
const env0_7 = badgeConstantsModule.BADGE_MASK_UNREAD_SIZE;
const BADGE_PADDING = badgeConstantsModule.BADGE_PADDING;
const BADGE_SIZE = badgeConstantsModule.BADGE_SIZE;
const env0_9 = badgeConstantsModule.BADGE_SIZE_UNREAD;
const env0_10 = (require(33) /* metro dependency 33 */).jsx;
const createStylesModule = require(4501) /* metro dependency 4501: createStyles */;
const createStyles = createStylesModule.createStyles;
object2 = {};
object2.badgeMask = {position: 'absolute', bottom: -BADGE_PADDING, right: -BADGE_PADDING, padding: BADGE_PADDING,
zIndex: 1};
const object5 = {'paddingLeft': null, 'paddingRight': null, 'borderRadius': null, 'justifyContent': 'center',
'alignItems': 'center', 'overflow': 'hidden'};
object5.paddingLeft = BADGE_PADDING;
object5.paddingRight = BADGE_PADDING;
let space = (importDefault(697) /* metro dependency 697: native */).space;
const PX_8 = space.PX_8;
object5.borderRadius = PX_8;
const value4 = 'center';
object2.badge = object5;
const object6 = {minWidth: BADGE_SIZE - 2 * BADGE_PADDING};
let WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE;
object6.color = WHITE;
object6.fontSize = 12;
const platformUtilsModule = require(477) /* metro dependency 477: PlatformUtils */;
const isAndroid2 = platformUtilsModule.isAndroid();
space = (importDefault(697) /* metro dependency 697: native */).space;
object6.lineHeight = isAndroid2 ? space.PX_12 : space.PX_16;
const PRIMARY_BOLD = Fonts.PRIMARY_BOLD;
object6.fontFamily = PRIMARY_BOLD;
object6.textAlign = value4;
const value6 = platformUtilsModule;
object6.textAlignVertical = value6.isAndroid() ? value4 : value;
object2.badgeText = object6;
WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE;
object2.noCount = {'width': 5, 'height': 5, 'borderRadius': 2.5, backgroundColor: WHITE};
const MOBILE_LEGACY_BUTTON_SECONDARY_BORDER_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.MOBILE_LEGACY_BUTTON_SECONDARY_BORDER_DEFAULT;
object2.unread = {backgroundColor: MOBILE_LEGACY_BUTTON_SECONDARY_BORDER_DEFAULT};
const BACKGROUND_FEEDBACK_NOTIFICATION = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_FEEDBACK_NOTIFICATION;
object2.mention = {backgroundColor: BACKGROUND_FEEDBACK_NOTIFICATION};
let BACKGROUND_MOD_STRONG = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_MOD_STRONG;
object2.lowImportanceMention = {backgroundColor: BACKGROUND_MOD_STRONG};
BACKGROUND_MOD_STRONG = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_MOD_STRONG;
object2.eventsMentionBadge = {backgroundColor: BACKGROUND_MOD_STRONG};
const env0_11 = Reflect.apply(createStyles, createStylesModule, [object2]);
(require(2) /* metro dependency 2 */).fileFinishedImporting('design/void/Badge/native/Badge.tsx');
exports.default = closure;
exports.MaskedBadge = MaskedBadge_97690;
return value;
}
function Badge_97687({value, style, dotStyle, textStyle, accessible, accessibilityLabel, accessibilityElementsHidden, importantForAccessibility, hideCount, maxValue, unreadIndicator, eventsMentionBadge, isMentionLowImportance}) { // fn#97687, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13000:1127, offset: 0x0218da4b, size: 512 bytes, params: 2, frame: 31
var r6;
var r5;
var r0;
var defaultImport;
var moduleValue2;
var humanizeValue;
var Math;
accessibilityElementsHidden = !(accessibilityElementsHidden === undefined) && accessibilityElementsHidden;
importantForAccessibility = importantForAccessibility === undefined ? 'auto' : importantForAccessibility;
hideCount = !(hideCount === undefined) && hideCount;
maxValue = maxValue === undefined ? Infinity : maxValue;
unreadIndicator = !(unreadIndicator === undefined) && unreadIndicator;
eventsMentionBadge = !(eventsMentionBadge === undefined) && eventsMentionBadge;
const env0_3 = eventsMentionBadge;
isMentionLowImportance = !(isMentionLowImportance === undefined) && isMentionLowImportance;
const styles = useStyles();
const fluxModule = require(566) /* metro dependency 566: flux */;
const useStateFromStores = fluxModule.useStateFromStores;
let object = [LocaleStore];
const locale = Reflect.apply(useStateFromStores, fluxModule, [object, function() {
return LocaleStore.locale;
}]);
const value10 = env0_3.useMemo(_fun97689, [styles, style, unreadIndicator, value, eventsMentionBadge,
isMentionLowImportance]);
if (value > 0) {
object = {pointerEvents: 'none', style: value10, accessible: accessible, accessibilityLabel: accessibilityLabel,
accessibilityElementsHidden: accessibilityElementsHidden,
importantForAccessibility: importantForAccessibility};
if (unreadIndicator) {
if (value === 0) {
r5 = null;
} else {
if (hideCount) {
r6 = <View style={[styles.noCount, dotStyle]} />;
} else {
defaultImport = importDefault(8002) /* metro dependency 8002: LegacyText */;
var defaultImportProps = {'style': null, 'numberOfLines': 1, 'allowFontScaling': false,
style: [styles.badgeText,
textStyle]};
moduleValue2 = require(1856) /* metro dependency 1856: NumberUtils */;
humanizeValue = moduleValue2.humanizeValue;
Math = global.Math;
value = ((Component) => <Component {...defaultImportProps}>{Reflect.apply(humanizeValue,
moduleValue2,
[Math.min(value, maxValue), locale])}</Component>)(defaultImport);
r6 = value;
}
r5 = r6;
}
} else {
if (hideCount) {
r6 = <View style={[styles.noCount, dotStyle]} />;
} else {
defaultImport = importDefault(8002) /* metro dependency 8002: LegacyText */;
var defaultImportProps = {'style': null, 'numberOfLines': 1, 'allowFontScaling': false,
style: [styles.badgeText,
textStyle]};
moduleValue2 = require(1856) /* metro dependency 1856: NumberUtils */;
humanizeValue = moduleValue2.humanizeValue;
Math = global.Math;
value = ((Component) => <Component {...defaultImportProps}>{Reflect.apply(humanizeValue, moduleValue2,
[Math.min(value, maxValue), locale])}</Component>)(defaultImport);
r6 = value;
}
r5 = r6;
}
value = <View {...object}>{r5}</View>;
r0 = value;
} else if (unreadIndicator) {
object = {pointerEvents: 'none', style: value10, accessible: accessible, accessibilityLabel: accessibilityLabel,
accessibilityElementsHidden: accessibilityElementsHidden,
importantForAccessibility: importantForAccessibility};
if (unreadIndicator) {
if (value === 0) {
r5 = null;
} else {
if (hideCount) {
r6 = <View style={[styles.noCount, dotStyle]} />;
} else {
defaultImport = importDefault(8002) /* metro dependency 8002: LegacyText */;
var defaultImportProps = {'style': null, 'numberOfLines': 1, 'allowFontScaling': false,
style: [styles.badgeText,
textStyle]};
moduleValue2 = require(1856) /* metro dependency 1856: NumberUtils */;
humanizeValue = moduleValue2.humanizeValue;
Math = global.Math;
value = ((Component) => <Component {...defaultImportProps}>{Reflect.apply(humanizeValue,
moduleValue2,
[Math.min(value, maxValue), locale])}</Component>)(defaultImport);
r6 = value;
}
r5 = r6;
}
} else {
if (hideCount) {
r6 = <View style={[styles.noCount, dotStyle]} />;
} else {
defaultImport = importDefault(8002) /* metro dependency 8002: LegacyText */;
var defaultImportProps = {'style': null, 'numberOfLines': 1, 'allowFontScaling': false,
style: [styles.badgeText,
textStyle]};
moduleValue2 = require(1856) /* metro dependency 1856: NumberUtils */;
humanizeValue = moduleValue2.humanizeValue;
Math = global.Math;
value = ((Component) => <Component {...defaultImportProps}>{Reflect.apply(humanizeValue, moduleValue2,
[Math.min(value, maxValue), locale])}</Component>)(defaultImport);
r6 = value;
}
r5 = r6;
}
value = <View {...object}>{r5}</View>;
r0 = value;
} else {
r0 = null;
}
return r0;
}
function MaskedBadge_97690({style, maskStyle, dotStyle, textStyle, value, maxValue, accessibilityLabel, accessibilityElementsHidden, importantForAccessibility, onLayout, hideCount, unreadIndicator, isMentionLowImportance}) { // fn#97690, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13000:2038, offset: 0x0218dce9, size: 280 bytes, params: 2, frame: 29
var r0;
unreadIndicator = !(unreadIndicator === undefined) && unreadIndicator;
const styles = useStyles();
const value4 = styles.useMemo(function() {
var r4;
r4 = unreadIndicator && value === 0 ? BADGE_MASK_UNREAD_SIZE : BADGE_MASK_SIZE;
return [styles.badgeMask, {minWidth: r4, height: r4, borderRadius: r4 / 2}, maskStyle];
}, [styles, maskStyle, unreadIndicator, view]);
if (view > 0) {
view = <View pointerEvents="none" style={value4} onLayout={onLayout}><Badge_97687 style={style} textStyle={textStyle} dotStyle={dotStyle} value={view} maxValue={maxValue} hideCount={hideCount} unreadIndicator={unreadIndicator} accessibilityLabel={accessibilityLabel} accessibilityElementsHidden={accessibilityElementsHidden} importantForAccessibility={importantForAccessibility} isMentionLowImportance={isMentionLowImportance} /></View>;
r0 = view;
} else if (unreadIndicator) {
view = <View pointerEvents="none" style={value4} onLayout={onLayout}><Badge_97687 style={style} textStyle={textStyle} dotStyle={dotStyle} value={view} maxValue={maxValue} hideCount={hideCount} unreadIndicator={unreadIndicator} accessibilityLabel={accessibilityLabel} accessibilityElementsHidden={accessibilityElementsHidden} importantForAccessibility={importantForAccessibility} isMentionLowImportance={isMentionLowImportance} /></View>;
r0 = view;
} else {
r0 = null;
}
return r0;
}
function _fun97689() { // fn#97689, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13000:1461, offset: 0x0218dc4b, size: 158 bytes, params: 1, frame: 5
const r3 = unreadIndicator && value === 0 ? BADGE_SIZE_UNREAD : BADGE_SIZE;
return [styles.badge, {height: r3, minWidth: r3},
unreadIndicator && value === 0 ? styles.unread : isMentionLowImportance ? styles.lowImportanceMention : styles.mention,
eventsMentionBadge && styles.eventsMentionBadge, style];
}