112 lines
4.4 KiB
TypeScript
112 lines
4.4 KiB
TypeScript
// Metro module 15823 (f15824).
|
|
import { useMemo, useCallback } from "react";
|
|
import { Pressable, StyleSheet, View } from "react-native";
|
|
import { FamilyCenterSubPages } from "../FamilyCenterConstants";
|
|
import { AnalyticEvents, UserSettingsSections, VerticalGradient } from "../../../Constants";
|
|
import Module712 from "../../../_bundle/Module712";
|
|
import { createStyles } from "../../../design/components/Styles/native/createStyles";
|
|
import useSafeAreaInsets_native from "../../safe_area/useSafeAreaInsets.native";
|
|
import { useParentalConsentWarning } from "../useParentalConsentWarning";
|
|
import { useIsParentalConsentBannerActive } from "../useIsParentalConsentBannerActive";
|
|
import { useIsOnMainSurface } from "../hooks/useIsOnMainSurface.native";
|
|
import { useGlobalStatusIndicatorState } from "../../connectivity/native/useGlobalStatusIndicatorState";
|
|
import { useToken } from "../../../design/tokens/native/useToken";
|
|
import tinycolor from "../../../_bundle/tinycolor";
|
|
import AnalyticsUtils from "../../../utils/AnalyticsUtils";
|
|
import FamilyCenterActionCreators from "../FamilyCenterActionCreators";
|
|
import { openUserSettings } from "../../user_settings/core/native/openUserSettings";
|
|
import { Text } from "../../../design/components/Text/native/Text";
|
|
import Module4611 from "../../../_bundle/Module4611";
|
|
import { intl } from "../../../intl/index.native";
|
|
import FamilyCenter_messages from "../FamilyCenter.messages";
|
|
const marginTop = 28 + Module712.space.PX_16;
|
|
const locations = [0.5875, 1];
|
|
const useStyles = createStyles({
|
|
strip: {
|
|
position: "absolute",
|
|
top: 0,
|
|
left: 0,
|
|
right: 0,
|
|
backgroundColor: Module712.colors.BACKGROUND_BASE_LOWEST
|
|
},
|
|
pressable: {
|
|
...StyleSheet.absoluteFillObject,
|
|
flexDirection: "row",
|
|
alignItems: "center",
|
|
justifyContent: "center",
|
|
paddingHorizontal: Module712.space.PX_12,
|
|
paddingBottom: Module712.space.PX_16
|
|
},
|
|
label: {
|
|
paddingRight: Module712.space.PX_8
|
|
},
|
|
link: {
|
|
textDecorationLine: "underline"
|
|
}
|
|
});
|
|
export default function ParentalConsentWarningBanner(props) {
|
|
let days_remaining;
|
|
const children = props.children;
|
|
days_remaining = void 0;
|
|
const styles = useStyles();
|
|
const safeAreaInsets_native = useSafeAreaInsets_native();
|
|
const parentalConsentWarning = useParentalConsentWarning();
|
|
const isParentalConsentBannerActive = useIsParentalConsentBannerActive();
|
|
let r38 = useIsOnMainSurface();
|
|
const isVisible = useGlobalStatusIndicatorState().isVisible;
|
|
const token = useToken(Module712.colors.BACKGROUND_FEEDBACK_WARNING);
|
|
const memo = useMemo(() => [token, tinycolor(token).setAlpha(0).toRgbString()], [token]);
|
|
let r25 = parentalConsentWarning?.daysRemaining;
|
|
if (r25 == null) {
|
|
r25 = null;
|
|
}
|
|
days_remaining = r25;
|
|
if (r38) {
|
|
r38 = isParentalConsentBannerActive;
|
|
}
|
|
if (r38) {
|
|
r38 = !isVisible;
|
|
}
|
|
if (r38) {
|
|
r38 = days_remaining != null;
|
|
}
|
|
if (r38) {
|
|
r38 = days_remaining >= 0;
|
|
}
|
|
const height = safeAreaInsets_native.top + marginTop;
|
|
const callback2 = useCallback(() => {
|
|
AnalyticsUtils.track(AnalyticEvents.PARENTAL_CONSENT_WARNING_BANNER_TAPPED, {
|
|
days_remaining
|
|
});
|
|
FamilyCenterActionCreators.selectTab(FamilyCenterSubPages.REQUESTS);
|
|
openUserSettings({
|
|
screen: UserSettingsSections.FAMILY_CENTER
|
|
});
|
|
}, [days_remaining]);
|
|
const callback = useCallback((a0, a1) => <Text key={a1} variant="text-sm/medium" color="text-strong" style={styles.link}>
|
|
{a0}
|
|
</Text>, [styles.link]);
|
|
const r72 = [<View style={[StyleSheet.absoluteFill, {
|
|
marginTop: r38 ? marginTop : 0
|
|
}]}>{children}</View>, ,];
|
|
const r73 = r38 ? days_remaining != null ? <View style={[styles.strip, {
|
|
height
|
|
}]} pointerEvents="box-none">
|
|
<Module4611 pointerEvents="none" style={StyleSheet.absoluteFill} colors={memo} locations={locations} start={VerticalGradient.START} end={VerticalGradient.END} />
|
|
<Pressable accessibilityRole="button" accessibilityHint={intl.string(FamilyCenter_messages.O2HKdA)} onPress={callback2} style={[styles.pressable, {
|
|
paddingTop: safeAreaInsets_native.top + 8
|
|
}]}>
|
|
<Text variant="text-sm/medium" color="text-strong" lineClamp={1} style={styles.label}>
|
|
{days_remaining === 0 ? intl.format(FamilyCenter_messages.Gfqlpa, {
|
|
connectHook: callback
|
|
}) : intl.format(FamilyCenter_messages.ZBK5mM, {
|
|
count: days_remaining,
|
|
connectHook: callback
|
|
})}
|
|
</Text>
|
|
</Pressable>
|
|
</View> : null : null;
|
|
r72[1] = r73;
|
|
return <>{r72}</>;
|
|
};
|