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

249 lines
14 KiB
TypeScript

/* Metro module 13560; source: modules/quests/native/BountyCard.tsx; dependencies: [57, 31, 27, 4502, 7092, 33, 4501, 697, 478, 566, 9495, 3860, 6239, 8011, 5475, 8707, 4573, 1244, 4578, 4073, 2] */
function _fun103013(global, require, importDefault, importAll, module, exports, dependencyMap) { // fn#103013, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13750:6, offset: 0x02253ab2, size: 370 bytes, params: 8, frame: 20
const env0_0 = require;
const Object = global.Object;
Object.defineProperty(exports, '__esModule', {value: true});
let value = 0;
const env0_3 = importDefault(dependencyMap[value]);
const value2 = importAll(31) /* metro dependency 31 */;
const value3 = require(27) /* metro dependency 27 */;
const env0_5 = value3.AppState;
const env0_6 = value3.StyleSheet;
const env0_7 = value3.View;
const accessibilityStore = importDefault(4502) /* metro dependency 4502: AccessibilityStore */;
const bountyStore = importDefault(7092) /* metro dependency 7092: BountyStore */;
const value4 = require(33) /* metro dependency 33 */;
const env0_10 = value4.jsx;
const env0_11 = value4.jsxs;
const env0_12 = (require(4501) /* metro dependency 4501: createStyles */).createStyles(_fun103014);
const platformUtilsModule = require(478) /* metro dependency 478: PlatformUtils */;
const env0_13 = platformUtilsModule.isAndroid() ? 150 : value;
const env0_14 = platformUtilsModule.isAndroid();
const env0_15 = platformUtilsModule.isAndroid();
value = value2.memo(_fun103015);
(require(2) /* metro dependency 2 */).fileFinishedImporting('modules/quests/native/BountyCard.tsx');
exports.default = value;
exports.CARD_WIDTH = 188;
}
function _fun103014() { // fn#103014, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13750:240, offset: 0x02253c24, size: 557 bytes, params: 1, frame: 17
const object2 = {};
let PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object2.tile = {gap: PX_12};
object2.card = {'width': 188, 'height': 313, 'overflow': 'hidden', 'padding': 0};
const object6 = {};
const value = copyDataProperties(object6, StyleSheet.absoluteFillObject, PX_12);
object2.cardImage = object6;
const object7 = {};
copyDataProperties(object7, StyleSheet.absoluteFillObject, value);
object2.previewVideo = object7;
const object9 = {position: 'absolute'};
PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object9.top = PX_12;
PX_12 = (importDefault(697) /* metro dependency 697: native */).space.PX_12;
object9.left = PX_12;
const CONTROL_OVERLAY_PRIMARY_BACKGROUND_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.CONTROL_OVERLAY_PRIMARY_BACKGROUND_DEFAULT;
object9.backgroundColor = CONTROL_OVERLAY_PRIMARY_BACKGROUND_DEFAULT;
object9.borderRadius = (importDefault(697) /* metro dependency 697: native */).radii.round;
let PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object9.paddingHorizontal = PX_8;
let PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
object9.paddingVertical = PX_4;
let CONTROL_OVERLAY_PRIMARY_TEXT_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.CONTROL_OVERLAY_PRIMARY_TEXT_DEFAULT;
object9.color = CONTROL_OVERLAY_PRIMARY_TEXT_DEFAULT;
object2.badge = object9;
PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
object2.badgeContent = {'flexDirection': 'row', 'alignItems': 'center', gap: PX_4};
CONTROL_OVERLAY_PRIMARY_TEXT_DEFAULT = (importDefault(697) /* metro dependency 697: native */).colors.CONTROL_OVERLAY_PRIMARY_TEXT_DEFAULT;
object2.badgeText = {textTransform: 'uppercase', color: CONTROL_OVERLAY_PRIMARY_TEXT_DEFAULT};
const object10 = {position: 'absolute'};
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object10.bottom = PX_8;
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object10.left = PX_8;
PX_8 = (importDefault(697) /* metro dependency 697: native */).space.PX_8;
object10.right = PX_8;
object2.startButton = object10;
object2.cardFooter = {'flexDirection': 'column', 'alignItems': 'flex-start', 'maxWidth': 188};
PX_4 = (importDefault(697) /* metro dependency 697: native */).space.PX_4;
object2.advertiserRow = {'flexDirection': 'row', 'gap': null, 'alignItems': 'center', gap: PX_4};
object2.advertiserName = {flexShrink: 1};
object2.advertiserIcon = {'flexShrink': 0, 'opacity': 0.7};
return object2;
}
function _fun103015({bounty, index, isActive, isModalVisible, onPress}) { // fn#103015, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13750:1310, offset: 0x02253e51, size: 1995 bytes, params: 2, frame: 39
const env0_3 = onPress;
let env0_4 = undefined;
const styles = useStyles();
const value3 = (require(566) /* metro dependency 566: flux */).useStateFromStores([BountyStore], function() {
return BountyStore.isBountyCompleted(bounty.id);
});
let binding = env0_4;
const value4 = binding.useCallback(function() {
onPress(bounty, index);
}, [onPress, bounty, index]);
const videoPreview = bounty.videoPreview;
let r12 = bounty.imagePreview != null ? (require(9495) /* metro dependency 9495: AssetUtils */).getScaledImageUrl({'assetUrl': null,
'width': 188, 'height': 313, assetUrl: bounty.imagePreview}) : null;
r12 = r12 == null && videoPreview != null ? (require(9495) /* metro dependency 9495: AssetUtils */).getScaledFirstFrameImageUrl({'assetUrl': null,
'width': 188, 'height': 313, assetUrl: videoPreview}) : r12;
binding = env0_4;
let useState = binding.useState;
const value10 = Reflect.apply(useState, binding, [false]);
const binding2 = env0_3;
const value11 = binding2(value10, 2);
const property = value11[0];
env0_4 = value11[1];
const value12 = binding.useCallback(_fun103018, []);
useState = binding.useState;
const value13 = binding2(Reflect.apply(useState, binding, [false]), 2);
const property2 = value13[0];
const property3 = value13[1];
useState = binding.useState;
const value14 = binding2(Reflect.apply(useState, binding, [false]), 2);
const property4 = value14[0];
const property5 = value14[1];
const useReducedMotion = (require(566) /* metro dependency 566: flux */).useStateFromStores([AccessibilityStore],
function() {
return AccessibilityStore.useReducedMotion;
});
const useTokenModule = require(3860) /* metro dependency 3860: useToken */;
const useToken = useTokenModule.useToken;
const BOUNTY_TILE_BORDER_RADIUS = (importDefault(697) /* metro dependency 697: native */).modules.mobile.BOUNTY_TILE_BORDER_RADIUS;
const value15 = Reflect.apply(useToken, useTokenModule, [BOUNTY_TILE_BORDER_RADIUS]);
const env0_8 = binding.useRef(null);
const value16 = binding.useCallback(_fun103020, []);
useState = binding.useState;
const value17 = binding2(Reflect.apply(useState, binding, [isActive]), 2);
if (isActive !== value17[0]) {
value17[1](isActive);
if (isActive) {
if (property2 && !property4) {
property3(false);
}
if (property4) {
property5(false);
}
} else if (env0_14) {
property5(true);
}
}
binding = env0_4;
const env0_9 = binding.useRef(null);
binding.useEffect(_fun103022, [property4]);
binding.useEffect(_fun103025, [isActive]);
binding.useEffect(function() {
return _fun103027;
}, []);
useState = binding.useState;
const value20 = env0_3(Reflect.apply(useState, binding, [AppState.currentState === 'active']), 2);
const property8 = value20[0];
const env0_10 = value20[1];
binding.useEffect(function() {
var env0_0 = AppState.addEventListener('change', _fun103029);
return _fun103030;
}, []);
let r7 = (isActive || property4) && videoPreview != null && property;
let r5 = env0_15 && isModalVisible;
r5 = !r5 && !(property4 && !isActive) && r7 && property2;
const value25 = env0_4.useMemo(_fun103031, [r5]);
const Card = (require(6239) /* metro dependency 6239: CardNative */).Card;
r7 = r7 && ((Component) => <Component accessible={false} importantForAccessibility="no-hide-descendants" accessibilityRole="none" onReadyForDisplay={value16} source={{uri: videoPreview}} style={styles.previewVideo} resizeMode="cover" repeat muted disableFocus paused={property8 ? useReducedMotion : !property8} />)(importDefault(8011) /* metro dependency 8011 */);
const items2 = [r7];
items2[1] = ((Component) => <Component style={[styles.cardImage,
value25]} onLoad={value12} source={{uri: r12 ?? undefined}} resizeMode="cover" />)(importDefault(5475) /* metro dependency 5475: FastImage */);
const r9 = value3 && ((CheckmarkSmallBoldIcon) => <CheckmarkSmallBoldIcon size="xxs" color={(importDefault(697) /* metro dependency 697: native */).colors.CONTROL_OVERLAY_PRIMARY_TEXT_DEFAULT} />)((require(8707) /* metro dependency 8707: CheckmarkSmallBoldIcon */).CheckmarkSmallBoldIcon);
const Text = (require(4573) /* metro dependency 4573: Text */).Text;
const intl = (require(1244) /* metro dependency 1244: indexNative */).intl;
let string = intl.string;
const t = (require(1244) /* metro dependency 1244: indexNative */).t;
items2[2] = <View style={styles.badge}><View style={styles.badgeContent}>{r9}<Text variant="text-xs/bold" style={styles.badgeText}>{Reflect.apply(string,
intl, [value3 ? t.vlGTLf : t['fFIJ/9']])}</Text></View></View>;
const Button = (require(4578) /* metro dependency 4578: ButtonNative */).Button;
string = intl.string;
items2[3] = <View style={styles.startButton}><Button variant="secondary-overlay" text={value3 ? Reflect.apply(string,
intl, [t['9UtZAY']]) : Reflect.apply(string, intl, [t.LhlgY9])} onPress={value4} /></View>;
const card = <Card style={styles.card} radius={value15} onPress={value4} android_ripple={{color: 'transparent'}}>{items2}</Card>;
const text = <Text variant="text-sm/medium" color="text-subtle" lineClamp={1} style={styles.advertiserName}>{bounty.advertiserName ?? ''}</Text>;
const CircleCheckIcon = (require(4073) /* metro dependency 4073: CircleCheckIcon */).CircleCheckIcon;
const ICON_SUBTLE = (importDefault(697) /* metro dependency 697: native */).colors.ICON_SUBTLE;
return (
<View style={styles.tile}>
{card}
<View style={styles.cardFooter}>
<View style={styles.advertiserRow}>
{text}
<CircleCheckIcon
size="xxs"
style={styles.advertiserIcon}
color={ICON_SUBTLE}
/>
</View>
<Text variant="text-sm/medium" color="text-muted">
{intl.string((require(1244) /* metro dependency 1244: indexNative */).t.o6FLcF)}
</Text>
</View>
</View>
);
}
function _fun103020() { // fn#103020, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13750:2026, offset: 0x0225464e, size: 86 bytes, params: 1, frame: 14
if (env0_8.current != null) {
global.clearTimeout(env0_8.current);
}
env0_8.current = global.setTimeout(_fun103021, env1_13);
}
function _fun103022() { // fn#103022, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13750:2238, offset: 0x022546a4, size: 57 bytes, params: 1, frame: 15
if (env0_6) {
env0_9.current = global.setTimeout(_fun103023, 150);
}
return _fun103024;
}
function _fun103025() { // fn#103025, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13750:2393, offset: 0x0225473c, size: 129 bytes, params: 1, frame: 12
if (isActive && env0_9.current != null) {
global.clearTimeout(env0_9.current);
env0_9.current = null;
}
if (!(isActive || env0_8.current == null)) {
global.clearTimeout(env0_8.current);
env0_8.current = null;
}
}
function _fun103026() { // fn#103026, offset: 0x022547bd, size: 11 bytes, params: 1, frame: 1
return _fun103027;
}
function _fun103028() { // fn#103028, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13750:2698, offset: 0x02254800, size: 45 bytes, params: 1, frame: 14
const env0_0 = AppState.addEventListener('change', _fun103029);
return _fun103030;
}
function _fun103031() { // fn#103031, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13750:2859, offset: 0x0225482d, size: 23 bytes, params: 1, frame: 3
return {opacity: env0_11 ? 0 : 1};
}
function _fun103023() { // fn#103023, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13750:2269, offset: 0x022546dd, size: 39 bytes, params: 1, frame: 12
env1_7(false);
env1_5(false);
env1_9.current = null;
}
function _fun103024() { // fn#103024, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13750:2309, offset: 0x02254704, size: 56 bytes, params: 1, frame: 13
if (env1_9.current != null) {
global.clearTimeout(env1_9.current);
env1_9.current = null;
}
}
function _fun103027() { // fn#103027, source: /ci/build/discord/discord/discord_android_rn/android/app/src/main/assets/index.android.bundle:13750:2544, offset: 0x022547c8, size: 56 bytes, params: 1, frame: 13
if (env1_8.current != null) {
global.clearTimeout(env1_8.current);
env1_8.current = null;
}
}