56 lines
2.8 KiB
TypeScript
56 lines
2.8 KiB
TypeScript
// Metro module 12294 (f12295).
|
|
import { ScrollView, View } from "react-native";
|
|
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../../_bundle/Module712";
|
|
import { useModalState } from "../../SharedStateUtils";
|
|
import { AlertModal, AlertActionButton } from "../../../../design/components/AlertModal/native/AlertModal.native";
|
|
import { intl, t } from "../../../../intl/index.native";
|
|
import { AlertActions } from "../../../../design/components/AlertModal/native/AlertModal.native";
|
|
import { Stack } from "../../../../design/components/Stack/native/Stack.native";
|
|
import { FormRow, FormCheckboxRow } from "../../../../design/void/Form/native/index";
|
|
import { Text } from "../../../../design/components/Text/native/Text";
|
|
const useStyles = createStyles({
|
|
linkCalloutContainer: {
|
|
maxHeight: 250
|
|
},
|
|
emphasis: {
|
|
borderRadius: Module712.radii.sm,
|
|
backgroundColor: Module712.colors.BACKGROUND_SURFACE_HIGH
|
|
}
|
|
});
|
|
export default function MaskedLinkModal(props) {
|
|
const { url, trustUrl, isProtocol, onConfirm, onCancel } = props;
|
|
const styles = useStyles();
|
|
const modalState = useModalState({
|
|
url,
|
|
trustUrl,
|
|
onConfirm,
|
|
onCancel
|
|
});
|
|
const { protocol, authorityPrefix, hostname, theRestOfTheUrl, shouldTrustUrl, setShouldTrustUrl, handleConfirm, handleCancel } = modalState;
|
|
return <AlertModal title={intl.string(t["3w1QGl"])} content={isProtocol ? intl.format(t.aCYv1z, {}) : intl.string(t.soRxRe)} actions={<AlertActions>
|
|
<AlertActionButton key="confirm" variant="primary" onPress={handleConfirm} text={isProtocol ? intl.string(t.COq6kk) : intl.string(t.NcJfJG)} />
|
|
<AlertActionButton key="cancel" onPress={handleCancel} variant="secondary" text={intl.string(t["/g10LC"])} />
|
|
</AlertActions>} extraContent={<Stack spacing={16}>
|
|
<View style={styles.emphasis}>
|
|
<FormRow start end label={<ScrollView style={styles.linkCalloutContainer}>
|
|
<Text variant="text-md/normal">
|
|
<Text variant={isProtocol ? "text-md/semibold" : "text-md/normal"} color={isProtocol ? "text-default" : "text-muted"}>
|
|
{protocol}
|
|
{authorityPrefix}
|
|
</Text>
|
|
<Text variant={isProtocol ? "text-md/normal" : "text-md/semibold"} color={isProtocol ? "text-muted" : "text-default"}>{hostname}</Text>
|
|
<Text variant="text-md/normal" color="text-muted">{theRestOfTheUrl}</Text>
|
|
</Text>
|
|
</ScrollView>} />
|
|
</View>
|
|
<FormCheckboxRow start end selected={shouldTrustUrl} onPress={() => setShouldTrustUrl(!shouldTrustUrl)} label={<Text variant="text-md/medium">
|
|
{isProtocol ? intl.format(t["haA+Xw"], {
|
|
protocol: protocol.replace(":", "")
|
|
}) : intl.format(t.ZgXDsI, {
|
|
domain: hostname
|
|
})}
|
|
</Text>} />
|
|
</Stack>} />;
|
|
};
|