260 lines
15 KiB
TypeScript
260 lines
15 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] */
|
|
import LocaleStore from '../../../../modules/user_settings/LocaleStore.tsx'; /* Metro dependency 1949 */
|
|
import * as FileImportTrackerModule from '../../../../by-id/module-00002-FileImportTracker.js'; /* Metro dependency 2 */
|
|
import * as ReactNativeModule from '../../../../by-id/module-00027-ReactNative.js'; /* Metro dependency 27 */
|
|
import * as ReactModule from '../../../../by-id/module-00031-React.js'; /* Metro dependency 31 */
|
|
import * as JsxRuntimeModule from '../../../../by-id/module-00033-JsxRuntime.js'; /* Metro dependency 33 */
|
|
import * as PlatformUtilsModule from '../../../../utils/PlatformUtils.tsx'; /* Metro dependency 477 */
|
|
import * as FluxModule from '../../../../external/discord_common/js/packages/flux/index.tsx'; /* Metro dependency 566 */
|
|
import * as ConstantsModule from '../../../../Constants.tsx'; /* Metro dependency 661 */
|
|
import * as BadgeConstantsModule from '../../BadgeConstants/native/BadgeConstants.tsx'; /* Metro dependency 1307 */
|
|
import * as CreateStylesModule from '../../../components/Styles/native/createStyles.tsx'; /* Metro dependency 4501 */
|
|
|
|
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
|
|
const env0_0 = require;
|
|
const Badge_976872 = Badge_97687;
|
|
const Object = global.Object;
|
|
Object.defineProperty(exports, '__esModule', {value: true});
|
|
const value = undefined;
|
|
const Fonts = (ConstantsModule).Fonts;
|
|
const BADGE_PADDING = BadgeConstantsModule.BADGE_PADDING;
|
|
const BADGE_SIZE = BadgeConstantsModule.BADGE_SIZE;
|
|
const createStyles = CreateStylesModule.createStyles;
|
|
object = {};
|
|
object.badgeMask = {position: 'absolute', bottom: -BADGE_PADDING, right: -BADGE_PADDING, padding: BADGE_PADDING,
|
|
zIndex: 1};
|
|
const object3 = {'paddingLeft': null, 'paddingRight': null, 'borderRadius': null, 'justifyContent': 'center',
|
|
'alignItems': 'center', 'overflow': 'hidden'};
|
|
object3.paddingLeft = BADGE_PADDING;
|
|
object3.paddingRight = BADGE_PADDING;
|
|
let space = (importDefault(697) /* metro dependency 697: native */).space;
|
|
const PX_8 = space.PX_8;
|
|
object3.borderRadius = PX_8;
|
|
const value4 = 'center';
|
|
object.badge = object3;
|
|
const object4 = {minWidth: BADGE_SIZE - 2 * BADGE_PADDING};
|
|
let WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE;
|
|
object4.color = WHITE;
|
|
object4.fontSize = 12;
|
|
const isAndroid2 = PlatformUtilsModule.isAndroid();
|
|
space = (importDefault(697) /* metro dependency 697: native */).space;
|
|
object4.lineHeight = isAndroid2 ? space.PX_12 : space.PX_16;
|
|
const PRIMARY_BOLD = Fonts.PRIMARY_BOLD;
|
|
object4.fontFamily = PRIMARY_BOLD;
|
|
object4.textAlign = value4;
|
|
object4.textAlignVertical = PlatformUtilsModule.isAndroid() ? value4 : value;
|
|
object.badgeText = object4;
|
|
WHITE = (importDefault(697) /* metro dependency 697: native */).colors.WHITE;
|
|
object.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;
|
|
object.unread = {backgroundColor: MOBILE_LEGACY_BUTTON_SECONDARY_BORDER_DEFAULT};
|
|
const BACKGROUND_FEEDBACK_NOTIFICATION = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_FEEDBACK_NOTIFICATION;
|
|
object.mention = {backgroundColor: BACKGROUND_FEEDBACK_NOTIFICATION};
|
|
let BACKGROUND_MOD_STRONG = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_MOD_STRONG;
|
|
object.lowImportanceMention = {backgroundColor: BACKGROUND_MOD_STRONG};
|
|
BACKGROUND_MOD_STRONG = (importDefault(697) /* metro dependency 697: native */).colors.BACKGROUND_MOD_STRONG;
|
|
object.eventsMentionBadge = {backgroundColor: BACKGROUND_MOD_STRONG};
|
|
const env0_11 = Reflect.apply(createStyles, CreateStylesModule, [object]);
|
|
(FileImportTrackerModule).fileFinishedImporting('design/void/Badge/native/Badge.tsx');
|
|
exports.default = Badge_976872;
|
|
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 eventsMentionBadge2 = eventsMentionBadge;
|
|
isMentionLowImportance = !(isMentionLowImportance === undefined) && isMentionLowImportance;
|
|
const styles = useStyles();
|
|
const useStateFromStores = FluxModule.useStateFromStores;
|
|
let object = [LocaleStore];
|
|
const locale = Reflect.apply(useStateFromStores, FluxModule, [object, function() {
|
|
return LocaleStore.locale;
|
|
}]);
|
|
const value10 = eventsMentionBadge2.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 _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];
|
|
}
|
|
|
|
}
|
|
|
|
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;
|
|
}
|
|
|
|
}
|
|
|
|
global.__d(_fun97686, 12810, [31, 27, 1949, 661, 1307, 33, 4501, 697, 477, 566, 8002, 1856,
|
|
2]) /* metro module 12810, dependencies: [31, 27, 1949, 661, 1307, 33, 4501, 697, 477, 566, 8002, 1856, 2] */;
|