Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Enrollment text improvements, and reset config update #597

Merged
merged 4 commits into from
Oct 27, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/RemoteConfigContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ const RemoteConfigContextProvider: React.FC = ({children}) => {
}, []);

async function refresh() {
await remoteConfig().reset();
await remoteConfig().fetchAndActivate();
const currentConfig = await getConfig();
setConfig(currentConfig);
Expand Down
5 changes: 4 additions & 1 deletion src/components/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
StyleProp,
ViewStyle,
TouchableOpacity,
TextStyle,
} from 'react-native';
import React from 'react';
import {StyleSheet, Theme} from '../../theme';
Expand All @@ -13,6 +14,7 @@ type ButtonProps = {
onPress(): void;
mode?: 'primary' | 'destructive' | 'secondary';
textContainerStyle?: StyleProp<ViewStyle>;
textStyle?: StyleProp<TextStyle>;
IconComponent?: React.ElementType;
text: string;
} & TouchableOpacityProperties;
Expand All @@ -24,6 +26,7 @@ const Button: React.FC<ButtonProps> = ({
disabled,
style,
textContainerStyle,
textStyle,
...props
}) => {
const css = useButtonStyle();
Expand All @@ -50,7 +53,7 @@ const Button: React.FC<ButtonProps> = ({
</View>
)}
<View style={[css.textContainer, textContainerStyle]}>
<Text style={styleText}>{text}</Text>
<Text style={[styleText, textStyle]}>{text}</Text>
</View>
</TouchableOpacity>
</View>
Expand Down
10 changes: 6 additions & 4 deletions src/screens/Ticketing/Splash/InviteModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ export default forwardRef<Modalize, Props>(function InviteModal(
<ActivityIndicator style={styles.loading} />
) : (
<>
<Text style={styles.title}>Lukket beta for billettkjøp</Text>
<Text style={styles.title}>
Registrer deg som testpilot for billettkjøp
</Text>
<Text style={styles.text}>
Her kan du sende inn invitasjonskode du har fått tilsendt fra
AtB for å melde deg på beta for billettkjøp.
Send oss invitasjonskoden din og bli først ute med å teste
billettkjøp direkte fra reiseappen.
</Text>
<Input
label="Kode"
Expand All @@ -79,7 +81,7 @@ export default forwardRef<Modalize, Props>(function InviteModal(
{hasError && (
<MessageBox
type="warning"
message="Koden du prøvde å bruke er enten ugyldig eller utgått."
message="Du har sendt en ugyldig invitasjonskode. Prøv igjen, eller kontakt oss i appchat dersom den ikke fungerer."
containerStyle={styles.messageBox}
/>
)}
Expand Down
59 changes: 36 additions & 23 deletions src/screens/Ticketing/Splash/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,13 @@ import Header from '../../../ScreenHeader';
import useChatIcon from '../../../chat/use-chat-icon';
import colors from '../../../theme/colors';
import {ShinyTicketBanner} from '../../../assets/svg/illustrations';
import {StyleSheet} from '../../../theme';
import {StyleSheet, useStyle} from '../../../theme';
import LogoOutline from '../../../ScreenHeader/LogoOutline';
import {useNavigateHome} from '../../../utils/navigation';
import InviteModal from './InviteModal';
import {Modalize} from 'react-native-modalize';
import {useRemoteConfig} from '../../../RemoteConfigContext';
import Button from '../../../components/button';

function openOtherTicketingApp() {
const url =
Expand All @@ -23,6 +24,7 @@ function openOtherTicketingApp() {
}

export default function Splash() {
const styles = useStyles();
const {refresh} = useRemoteConfig();
const chatIcon = useChatIcon();
const {width: windowWidth} = useWindowDimensions();
Expand All @@ -44,6 +46,12 @@ export default function Splash() {
accessibilityLabel: 'Gå til startskjerm',
}}
/>
<View style={styles.bannerContainer}>
<ShinyTicketBanner
width={windowWidth}
height={windowWidth / 2}
></ShinyTicketBanner>
</View>
<View style={styles.textContainer}>
<Text style={[styles.text, styles.bold]}>
Billettkjøp i app kommer snart!
Expand All @@ -57,41 +65,46 @@ export default function Splash() {
AtB Mobillett
</Text>
</Text>
<Text style={styles.text}>
Hvis du har en kode for å melde deg inn i beta for billettkjøp -{' '}
<Text
<View style={styles.buttonContainer}>
<Button
onPress={() => modalRef.current?.open()}
style={styles.underline}
>
trykk her
</Text>
</Text>
</View>
<View style={styles.bannerContainer}>
<ShinyTicketBanner
width={windowWidth}
height={windowWidth / 2}
></ShinyTicketBanner>
text="Jeg har kode til beta for billettkjøp"
mode="secondary"
style={styles.button}
textStyle={styles.buttonText}
/>
</View>
</View>
<InviteModal ref={modalRef} onEnrolled={onEnrolled} />
</SafeAreaView>
);
}

const styles = StyleSheet.create({
const useStyles = StyleSheet.createThemeHook((theme) => ({
container: {flex: 1, backgroundColor: colors.secondary.cyan},
textContainer: {
paddingHorizontal: 20,
paddingVertical: 40,
paddingHorizontal: theme.spacings.large,
paddingVertical: theme.spacings.xLarge,
alignItems: 'center',
flex: 1,
},
text: {
fontSize: theme.text.sizes.body,
lineHeight: 20,
textAlign: 'center',
marginBottom: theme.spacings.large,
},
text: {fontSize: 16, lineHeight: 20, textAlign: 'center', marginBottom: 20},
bold: {fontWeight: 'bold'},
bannerContainer: {
position: 'absolute',
bottom: 20,
left: 0,
right: 0,
bottom: theme.spacings.large,
},
underline: {textDecorationLine: 'underline'},
});
buttonContainer: {
position: 'absolute',
bottom: theme.spacings.medium,
width: '100%',
},
button: {backgroundColor: colors.secondary.blue},
buttonText: {color: colors.general.white},
}));