Skip to content

Commit f1abef6

Browse files
authored
Merge pull request #6 from AgustinOberg/development
Deploy
2 parents 04ef8a9 + f31a7e4 commit f1abef6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1284
-149
lines changed

app.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default {
1616
ios: {
1717
supportsTablet: false,
1818
bundleIdentifier: 'com.agustinoberg.nebulai',
19+
usesAppleSignIn: true,
1920
},
2021
android: {
2122
adaptiveIcon: {
@@ -44,6 +45,8 @@ export default {
4445
organization: 'nebulai',
4546
},
4647
],
48+
'expo-localization',
49+
'expo-apple-authentication',
4750
],
4851
experiments: {
4952
typedRoutes: true,

app/(app)/(challenge)/attempt/results.tsx

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ import Button from '@/components/ui/button';
1010
import Text from '@/components/ui/text';
1111
import { useAttempt } from '@/hooks/attempt/useAttempt';
1212
import { useAttemptCarousel } from '@/hooks/attempt/useAttemptCarousel';
13+
import { useLang } from '@/language/useLang';
1314
import { getResults } from '@/utils/challenge.utils';
1415

1516
const Results = () => {
1617
const { styles } = useStyles(stylesheet);
17-
const { answers, questions, seeResults } = useAttempt();
18+
const { answers, questions, seeResults, challenge } = useAttempt();
1819
const { reset: resetCarousel } = useAttemptCarousel();
20+
const { t } = useLang();
1921
const results = useMemo(
2022
() => getResults(questions, answers),
2123
[questions, answers],
@@ -27,7 +29,7 @@ const Results = () => {
2729

2830
const goToResponses = () => {
2931
resetCarousel();
30-
seeResults();
32+
seeResults(challenge, answers);
3133
};
3234

3335
return (
@@ -40,7 +42,9 @@ const Results = () => {
4042
animate={{ opacity: 1, translateY: 0 }}
4143
transition={{ type: 'timing', duration: 500, delay: 200 }}
4244
>
43-
<Text size={16}>Tu resultado es...</Text>
45+
<Text size={16} translate>
46+
yourResults
47+
</Text>
4448
</MotiView>
4549
<MotiView
4650
from={{ opacity: 0, translateY: -50, scale: 0.8 }}
@@ -58,9 +62,11 @@ const Results = () => {
5862
>
5963
<>
6064
<Text size={16} align="center">
61-
Contestaste correctamente{' '}
62-
<Text weight="800">{results.correctAnswers}</Text> de las{' '}
63-
<Text weight="800">{results.totalQuestions}</Text> preguntas
65+
{t('resultsDescription.answeredCorrectly')}{' '}
66+
<Text weight="800">{results.correctAnswers}</Text>{' '}
67+
{t('resultsDescription.outOf')}{' '}
68+
<Text weight="800">{results.totalQuestions}</Text>{' '}
69+
{t('resultsDescription.questions')}
6470
</Text>
6571
</>
6672
</MotiView>
@@ -76,11 +82,17 @@ const Results = () => {
7682
variant="tertiary"
7783
onPress={goToResponses}
7884
eventName="go_to_responses"
85+
translate
7986
>
80-
Ver respuestas
87+
viewResponses
8188
</Button>
82-
<Button variant="text" onPress={goToHome} eventName="finish_challenge">
83-
Finalizar
89+
<Button
90+
variant="text"
91+
onPress={goToHome}
92+
eventName="finish_challenge"
93+
translate
94+
>
95+
finish
8496
</Button>
8597
</MotiView>
8698
</View>

app/(app)/(challenge)/creation/choose-difficulty.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,16 @@ import Star from '@/animations/components/star';
1010
import CloseTab from '@/components/shared/close-tab';
1111
import Button from '@/components/ui/button';
1212
import Text from '@/components/ui/text';
13+
import { useUserProfile } from '@/data/fetchers/auth.fetcher';
1314
import { useChallengeState } from '@/data/state/challenge.context';
15+
import { isOldUser } from '@/utils/user.utils';
1416

1517
const ANIMATION_HEIGHT = 400;
1618

1719
const ChooseDifficulty = () => {
1820
const { styles } = useStyles(stylesheet);
1921
const { setDifficulty, difficulty, file } = useChallengeState();
20-
22+
const { data: user } = useUserProfile();
2123
const onSelectStar = (star: number) => {
2224
Analytics.trackEvent(Prefix.Actions.Press + 'select_difficulty', {
2325
difficulty: star,
@@ -30,7 +32,7 @@ const ChooseDifficulty = () => {
3032
};
3133
return (
3234
<>
33-
<CloseTab />
35+
{isOldUser(user) && <CloseTab />}
3436
<View style={styles.animationContainer}>
3537
<SpaceRide />
3638
</View>
@@ -42,8 +44,9 @@ const ChooseDifficulty = () => {
4244
size={30}
4345
style={styles.text}
4446
align="center"
47+
translate
4548
>
46-
¿Qué tan difícil quieres el reto?
49+
chooseDifficulty
4750
</Text>
4851
</View>
4952
<FlatList
@@ -71,8 +74,9 @@ const ChooseDifficulty = () => {
7174
mode="gradient"
7275
onPress={goToNext}
7376
eventName="go_to_next_step"
77+
translate
7478
>
75-
Siguiente
79+
next
7680
</Button>
7781
</View>
7882
</View>

app/(app)/(challenge)/creation/index.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@ const AttemptCreationScreen = () => {
1818
const { setDifficulty } = useChallengeState();
1919

2020
const handleSelect = useCallback(async () => {
21-
await selectFile();
22-
setDifficulty(0);
23-
router.replace('/(app)/(challenge)/creation/choose-difficulty');
21+
try {
22+
await selectFile();
23+
setDifficulty(0);
24+
router.replace('/(app)/(challenge)/creation/choose-difficulty');
25+
} catch (error) {}
2426
}, [selectFile, setDifficulty]);
2527

2628
return (
@@ -41,12 +43,13 @@ const AttemptCreationScreen = () => {
4143
mode="gradient"
4244
onPress={handleSelect}
4345
eventName="attempt_creation_select_file"
46+
translate
4447
>
45-
Elegir Archivo
48+
chooseFile
4649
</Button>
4750
</MotiView>
48-
<Text align="center" size={13} color="disabled">
49-
*Solo se aceptan archivos con extensión .pdf
51+
<Text align="center" size={13} color="disabled" translate>
52+
fileWarning
5053
</Text>
5154
</View>
5255
</View>

app/(app)/(challenge)/creation/preparing.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,7 @@ import Text from '@/components/ui/text';
99
import { useAttempt } from '@/hooks/attempt/useAttempt';
1010
import { useAutoChallengeCreation } from '@/hooks/useAutoChallengeCreation';
1111

12-
const LOADING_TEXTS = [
13-
'🚀 Encendiendo los motores...',
14-
'🌌Despegando hacia el conocimiento...',
15-
'🔭 Explorando nuevas galaxias de preguntas...',
16-
];
12+
const LOADING_TEXTS = ['loading0', 'loading1', 'loading2'];
1713

1814
const PreparingScreen = () => {
1915
const { styles } = useStyles(stylesheet);
@@ -30,8 +26,14 @@ const PreparingScreen = () => {
3026
</View>
3127
<View style={styles.screenContainer}>
3228
<View>
33-
<Text color="secondary" size={30} weight="700" align="center">
34-
Preparando tu Misión
29+
<Text
30+
color="secondary"
31+
size={30}
32+
weight="700"
33+
align="center"
34+
translate
35+
>
36+
preparingMission
3537
</Text>
3638

3739
<FlatList
@@ -44,7 +46,7 @@ const PreparingScreen = () => {
4446
delay={(index + 0.5) * 2500}
4547
style={styles.item}
4648
>
47-
<Text color="secondary" size={20} numberOfLines={2}>
49+
<Text color="secondary" size={20} numberOfLines={2} translate>
4850
{item}
4951
</Text>
5052
</MotiView>
@@ -61,7 +63,9 @@ const PreparingScreen = () => {
6163
}}
6264
>
6365
<Spinner size="small" />
64-
<Text color="secondary">Creando tu desafío...</Text>
66+
<Text color="secondary" translate>
67+
loadingMore
68+
</Text>
6569
</MotiView>
6670
</View>
6771
</View>

app/(app)/(tabs)/_layout.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { isNewUser } from '@/utils/user.utils';
1010
const _layout = () => {
1111
const { styles } = useStyles(stylesheet);
1212
const { data: user } = useUserProfile();
13-
1413
if (isNewUser(user)) {
1514
return <Redirect href="/(app)/(challenge)/creation" />;
1615
}

app/(app)/(tabs)/profile.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,11 @@ const ProfileScreen = () => {
1515
return (
1616
<View style={styles.container}>
1717
<ScreenBackground />
18-
1918
<ProfileHeader />
2019
<ProfileOptions />
2120
<View style={styles.footer}>
22-
<Button variant="text" onPress={logout}>
23-
Cerrar sesión
21+
<Button variant="text" onPress={logout} translate>
22+
logout
2423
</Button>
2524
</View>
2625
<Feather

app/(app)/_layout.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const _layout = () => {
1414
<Stack screenOptions={{ headerShown: false }}>
1515
<Stack.Screen name="(tabs)" />
1616
<Stack.Screen name="(challenge)" />
17+
<Stack.Screen name="language" />
1718
<Stack.Screen
1819
name="about"
1920
options={{ presentation: 'transparentModal', animation: 'fade' }}

app/(app)/language.tsx

Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
import { useCallback } from 'react';
2+
import { FlatList, Pressable, View } from 'react-native';
3+
import { createStyleSheet, useStyles } from 'react-native-unistyles';
4+
5+
import HeaderWithBack from '@/components/shared/header-with-back';
6+
import ScreenBackground from '@/components/shared/screen-background';
7+
import Text from '@/components/ui/text';
8+
import { useChangeLangOnUnmount } from '@/language/useChangeLangOnUnmount';
9+
import { useLang } from '@/language/useLang';
10+
import { hex2rgba } from '@/utils/ui.utils';
11+
12+
interface Option {
13+
key: string;
14+
label: string;
15+
}
16+
17+
const options: Option[] = [
18+
{ key: 'es', label: 'Español' },
19+
{ key: 'en', label: 'English' },
20+
{ key: 'pt', label: 'Português' },
21+
{ key: 'fr', label: 'Français' },
22+
{ key: 'it', label: 'Italiano' },
23+
];
24+
25+
const LanguageScreen = () => {
26+
const { styles } = useStyles(stylesheet);
27+
useChangeLangOnUnmount();
28+
const { changeLanguage, currentLanguage, t } = useLang();
29+
const renderItem = useCallback(
30+
({ item }: { item: Option }) => (
31+
<Pressable
32+
onPress={() => changeLanguage(item.key)}
33+
style={styles.option}
34+
disabled={currentLanguage === item.key}
35+
>
36+
<Text size={17}>{`${item.label} ${
37+
currentLanguage === item.key ? `(${t('current')})` : ''
38+
}`}</Text>
39+
</Pressable>
40+
),
41+
[styles, changeLanguage, currentLanguage, t],
42+
);
43+
const spacer = useCallback(
44+
() => <View style={styles.spacer} />,
45+
[styles.spacer],
46+
);
47+
48+
return (
49+
<>
50+
<View style={styles.container}>
51+
<HeaderWithBack title={'language'} />
52+
<ScreenBackground />
53+
<FlatList
54+
data={options}
55+
ItemSeparatorComponent={spacer}
56+
renderItem={renderItem}
57+
contentContainerStyle={styles.content}
58+
/>
59+
</View>
60+
</>
61+
);
62+
};
63+
64+
export default LanguageScreen;
65+
66+
const stylesheet = createStyleSheet((theme) => ({
67+
container: {
68+
flex: 1,
69+
backgroundColor: '#2A3164',
70+
gap: 20,
71+
},
72+
content: {
73+
backgroundColor: hex2rgba('#191E47', 0.8),
74+
padding: 20,
75+
borderRadius: 20,
76+
marginHorizontal: theme.sizes.screenPadding,
77+
},
78+
option: {
79+
flexDirection: 'row',
80+
gap: 12,
81+
alignItems: 'center',
82+
},
83+
spacer: {
84+
height: 2,
85+
width: '100%',
86+
marginVertical: 16,
87+
backgroundColor: '#2A3164',
88+
opacity: 0.34,
89+
},
90+
}));

0 commit comments

Comments
 (0)