170 lines
5.6 KiB
TypeScript
170 lines
5.6 KiB
TypeScript
// Metro module 11838 (f11839).
|
|
import { useState, useRef } from "react";
|
|
import { ScrollView, View } from "react-native";
|
|
import { HubEmailConnectionSteps } from "../../HubConstants";
|
|
import { Fonts } from "../../../../Constants";
|
|
import { createStyles } from "../../../../design/components/Styles/native/createStyles";
|
|
import Module712 from "../../../../_bundle/Module712";
|
|
import { useNavigation } from "../../../../design/components/Navigator/native/useNavigation.native";
|
|
import useSafeAreaInsetsKeyboardAware_native from "../../../safe_area/useSafeAreaInsetsKeyboardAware.native";
|
|
import HubActionCreators from "../../../../actions/HubActionCreators";
|
|
import { APIError } from "../../../../errors/index";
|
|
import { HubEmailConnectionScreen } from "./HubEmailConnectionModal";
|
|
import { LegacyText, ClearButtonVisibility } from "../../../../design/void/native";
|
|
import { intl, t } from "../../../../intl/index.native";
|
|
import { Text } from "../../../../design/components/Text/native/Text";
|
|
import FreeFormInputGroup from "../../../../design/void/Form/native/FreeFormInputGroup";
|
|
import { Button } from "../../../../design/components/Button/native/Button.native";
|
|
const useStyles = createStyles({
|
|
container: {
|
|
paddingHorizontal: 16
|
|
},
|
|
title: {
|
|
fontFamily: Fonts.PRIMARY_BOLD,
|
|
color: Module712.colors.MOBILE_TEXT_HEADING_PRIMARY,
|
|
fontSize: 24,
|
|
textAlign: "center",
|
|
marginBottom: 8
|
|
},
|
|
description: {
|
|
textAlign: "center",
|
|
marginBottom: 24
|
|
},
|
|
scrollViewContainer: {
|
|
flexGrow: 2
|
|
},
|
|
input: {
|
|
marginBottom: 8
|
|
},
|
|
redesignTextInput: {
|
|
borderRadius: Module712.radii.lg
|
|
},
|
|
redesignGrowSpacing: {
|
|
flexGrow: 2,
|
|
minHeight: Module712.space.PX_24
|
|
},
|
|
redesignSubmit: {
|
|
paddingHorizontal: Module712.space.PX_16
|
|
}
|
|
});
|
|
export default function HubEmailConnectionSubmitSchool(props) {
|
|
let navigation, setState, setState2, ref, state;
|
|
const { onClose, email } = props;
|
|
navigation = void 0;
|
|
setState = void 0;
|
|
setState2 = void 0;
|
|
ref = void 0;
|
|
state = void 0;
|
|
let _submitWaitlist2 = function _submitWaitlist() {
|
|
const r9 = async () => {
|
|
let c30464_2;
|
|
let c30464_3 = 0;
|
|
let c31644_0;
|
|
L10: {
|
|
try {
|
|
setState2(null);
|
|
c30464_3 = 2;
|
|
setState(true);
|
|
await HubActionCreators.signup(email, state);
|
|
navigation.push(HubEmailConnectionSteps.EMAIL_WAITLIST, {
|
|
school: state,
|
|
onClose
|
|
});
|
|
c30464_3 = 1;
|
|
c30464_3 = 0;
|
|
(0, setState)(false);
|
|
} catch ($e) {
|
|
const r30 = $e;
|
|
let r7 = r30;
|
|
c30464_2 = r30;
|
|
let r31 = c30464_3;
|
|
if (r31 !== 0) {
|
|
while (true) {
|
|
if (r31 === 1) {
|
|
try {
|
|
const r100 = c30464_2;
|
|
c30464_3 = 0;
|
|
(0, setState)(false);
|
|
throw r100;
|
|
} catch (r98) {
|
|
r7 = r98;
|
|
c30464_2 = r98;
|
|
r31 = c30464_3;
|
|
if (r31 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
} else {
|
|
try {
|
|
const r79 = c30464_2;
|
|
c30464_3 = 1;
|
|
c31644_0 = r79;
|
|
setState2(new APIError(c31644_0));
|
|
c30464_3 = 0;
|
|
(0, setState)(false);
|
|
break L10;
|
|
} catch (r76) {
|
|
r7 = r76;
|
|
c30464_2 = r76;
|
|
r31 = c30464_3;
|
|
if (r31 === 0) {
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
throw r7;
|
|
}
|
|
}
|
|
};
|
|
_submitWaitlist2 = r9;
|
|
return r9.apply(this, arguments);
|
|
};
|
|
const styles = useStyles();
|
|
navigation = useNavigation();
|
|
let loading;
|
|
[loading, setState] = useState(false);
|
|
let state2;
|
|
[state2, setState2] = useState(null);
|
|
const insets = useSafeAreaInsetsKeyboardAware_native().insets;
|
|
ref = useRef(null);
|
|
let onChangeText;
|
|
[state, onChangeText] = useState("");
|
|
return <HubEmailConnectionScreen>
|
|
<ScrollView ref={ref} contentContainerStyle={[styles.scrollViewContainer, {
|
|
paddingBottom: insets.bottom + Module712.space.PX_16
|
|
}]}>
|
|
<View style={styles.container}>
|
|
<LegacyText style={styles.title} accessibilityRole="header">
|
|
{intl.string(t["2FNWBG"])}
|
|
</LegacyText>
|
|
<Text style={styles.description} variant="text-sm/medium" color="text-default">
|
|
{intl.string(t["/4y6ox"])}
|
|
</Text>
|
|
<FreeFormInputGroup label={intl.string(t["L+AfJr"])} placeholder={intl.string(t.Y1btJd)} value={state} onChangeText={onChangeText} style={styles.input} textStyle={styles.redesignTextInput} clearButtonVisibility={ClearButtonVisibility.WITH_CONTENT} error={state2 == null ? void 0 : state2.getAnyErrorMessage()} onFocus={() => {
|
|
setTimeout(() => {
|
|
const current = ref.current;
|
|
if (current != null) {
|
|
current.scrollToEnd();
|
|
}
|
|
}, 100);
|
|
}} onBlur={() => {
|
|
setTimeout(() => {
|
|
const current = ref.current;
|
|
if (current != null) {
|
|
current.scrollToEnd();
|
|
}
|
|
}, 100);
|
|
}} />
|
|
</View>
|
|
<View style={styles.redesignGrowSpacing} />
|
|
<View style={styles.redesignSubmit}>
|
|
<Button size="lg" loading={loading} text={intl.string(t.PDsYAo)} onPress={function submitWaitlist() {
|
|
return _submitWaitlist2.apply(this, arguments);
|
|
}} />
|
|
</View>
|
|
</ScrollView>
|
|
</HubEmailConnectionScreen>;
|
|
};
|