Files
discord-decomp/modules/collectibles/native/MobileShopButtonCoachmark.tsx
T
2026-11-01 12:12:55 +02:00

68 lines
2.3 KiB
TypeScript

// Metro module 15627 (f15628).
import { useRef, useCallback, useEffect, useMemo } from "react";
import { Image as Image2 } from "react-native";
import { ContentDismissActionType } from "../../dismissible_content/DismissibleContentConstants";
import { createStyles } from "../../../design/components/Styles/native/createStyles";
import Module712 from "../../../_bundle/Module712";
import { isYouNavFloating } from "../../main_tabs_v2/native/tabs/you/YouNavFloatingExperiment";
import { intl, t } from "../../../intl/index.native";
import { useCoachmark } from "../../../design/components/Coachmark/native/useCoachmark.native";
const useStyles = createStyles({
image: {
height: 80,
width: 80,
marginTop: Module712.space.PX_8,
marginBottom: -Module712.space.PX_16
}
});
export default function MobileShopButtonCoachmark({ marketing, shopButtonRef, navigateToShop, visible, onDismiss }) {
let callback2, ref2;
callback2 = void 0;
ref2 = void 0;
const styles = useStyles();
const assetLight = marketing.assetLight;
const ref = useRef(false);
const callback = useCallback(() => {
ref.current = true;
onDismiss(ContentDismissActionType.TAKE_ACTION);
navigateToShop();
}, [onDismiss, navigateToShop]);
callback2 = useCallback(() => {
ref.current = true;
onDismiss(ContentDismissActionType.USER_DISMISS);
}, [onDismiss]);
ref2 = useRef(onDismiss);
useEffect(() => {
ref2.current = onDismiss;
});
useEffect(() => () => {
if (!ref.current) {
ref2.current(ContentDismissActionType.AUTO_DISMISS);
}
}, []);
useCoachmark(shopButtonRef, useMemo(() => {
const r2 = {
title: marketing.title,
description: marketing.body,
visible,
position: isYouNavFloating() ? "top" : "bottom",
renderImgComponent: () => <Image2 style={styles.image} source={{
uri: assetLight
}} />,
buttonLabel: null,
buttonVariant: "secondary",
onButtonPress: null,
onDismiss: null
};
let buttonLabel = marketing.buttonLabel;
if (buttonLabel == null) {
buttonLabel = intl.string(t.fYfGgK);
}
r2.buttonLabel = buttonLabel;
r2.onButtonPress = callback;
r2.onDismiss = callback2;
return r2;
}, [marketing.title, marketing.body, marketing.buttonLabel, visible, assetLight, styles.image, callback, callback2]));
return null;
};