93 lines
3.8 KiB
TypeScript
93 lines
3.8 KiB
TypeScript
// Metro module 14188 (f14189).
|
|
import { useMemo } from "react";
|
|
import { View, StyleSheet } from "react-native";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import { useTheme } from "../../../hooks/useTheme";
|
|
import * as _themes from "../../../design/utils/shared/themes";
|
|
import { useToken } from "../../../design/tokens/native/useToken";
|
|
import { hexOpacityToRgba } from "../../../utils/ColorUtils";
|
|
import { useQuestOrbRewardMultiplier } from "../hooks/QuestHooks";
|
|
import * as _QuestOrbMultiplierUtils from "../utils/QuestOrbMultiplierUtils";
|
|
import { QuestOrbMultiplierEligibilityType } from "../utils/QuestOrbMultiplierUtils";
|
|
import { intl, t } from "../../../intl/index.native";
|
|
import { NitroWheelIcon } from "../../../design/components/Icon/native/redesign/generated/NitroWheelIcon";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import { PressableOpacity } from "../../../design/void/Pressables/native/Pressables";
|
|
import openQuestOrbMultiplierPerkInfoActionSheet from "./openQuestOrbMultiplierPerkInfoActionSheet";
|
|
import Module4611 from "../../../_bundle/Module4611";
|
|
const start = {
|
|
x: 0,
|
|
y: 0
|
|
};
|
|
const end = {
|
|
x: 1,
|
|
y: 0
|
|
};
|
|
const useStyles = createStyles({
|
|
fullGradientContainer: {
|
|
borderRadius: Module712.radii.round,
|
|
overflow: "hidden",
|
|
height: 19,
|
|
backgroundColor: "transparent"
|
|
},
|
|
fullGradient: {
|
|
...StyleSheet.absoluteFillObject,
|
|
borderRadius: Module712.radii.round
|
|
},
|
|
fullGradientContent: {
|
|
flexDirection: "row",
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
paddingHorizontal: Module712.space.PX_8,
|
|
gap: 4,
|
|
height: 19
|
|
}
|
|
});
|
|
export function QuestOrbMultiplierPerkPill(props) {
|
|
const { onPress: onPress2, questId, orbMultiplierEligibility } = props;
|
|
const styles = useStyles();
|
|
const isThemeDark = _themes.isThemeDark(useTheme());
|
|
const token3 = useToken(Module712.colors.EXPRESSIVE_GRADIENT_PINK_START, "dark");
|
|
const token4 = useToken(Module712.colors.EXPRESSIVE_GRADIENT_TENURE_BADGE_DIAMOND_END, "dark");
|
|
const token = useToken(Module712.colors.BACKGROUND_BASE_LOWEST, "dark");
|
|
const colors = [hexOpacityToRgba(token3, 1), hexOpacityToRgba(token4, 0.5)];
|
|
const token2 = useToken(Module712.colors.BACKGROUND_BRAND);
|
|
const questOrbRewardMultiplier = useQuestOrbRewardMultiplier(questId);
|
|
const shouldReceiveQuestOrbMultiplier = _QuestOrbMultiplierUtils.shouldReceiveQuestOrbMultiplier(orbMultiplierEligibility);
|
|
const r2 = orbMultiplierEligibility === QuestOrbMultiplierEligibilityType.CREPE;
|
|
let c21022_6 = r2;
|
|
const memo = useMemo(() => c21022_6 ? token2 : isThemeDark ? "transparent" : token, [r2, token, token2, isThemeDark]);
|
|
if (questOrbRewardMultiplier == null) {
|
|
return null;
|
|
}
|
|
const accessibilityLabel = shouldReceiveQuestOrbMultiplier ? intl.formatToPlainString(t.l2UfLG, {
|
|
bonusOrbMultiplier: questOrbRewardMultiplier
|
|
}) : intl.formatToPlainString(t["G+mKoo"], {
|
|
bonusOrbMultiplier: questOrbRewardMultiplier
|
|
});
|
|
let r98 = !r2;
|
|
const r112 = <>
|
|
{r2 ? r98 : <NitroWheelIcon size="xs" color="white" />}
|
|
<Text variant="text-xs/semibold" color="text-overlay-light">{accessibilityLabel}</Text>
|
|
</>;
|
|
if (!r2) {
|
|
r98 = <Module4611 style={styles.fullGradient} colors={colors} start={start} end={end} />;
|
|
}
|
|
return <PressableOpacity onPress={function onPress() {
|
|
if (questOrbRewardMultiplier != null) {
|
|
openQuestOrbMultiplierPerkInfoActionSheet(questOrbRewardMultiplier, orbMultiplierEligibility);
|
|
if (onPress2 != null) {
|
|
onPress2();
|
|
}
|
|
}
|
|
}} activeOpacity={0.8} accessibilityRole="button" accessibilityLabel={accessibilityLabel}>
|
|
<View style={[styles.fullGradientContainer, {
|
|
backgroundColor: memo
|
|
}]}>
|
|
{r98}
|
|
<View style={styles.fullGradientContent}>{r112}</View>
|
|
</View>
|
|
</PressableOpacity>;
|
|
}
|