Skip to content

Commit efe27c2

Browse files
committed
Code optimization
1 parent 642a3fa commit efe27c2

3 files changed

Lines changed: 70 additions & 70 deletions

File tree

src/components/screens/profile/ProfileEditImage.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ import { isWeb } from '@baca/constants'
22
import { Box, Text, Button, Row, themeColors } from '@baca/design-system'
33
import * as ImagePicker from 'expo-image-picker'
44
import { t } from 'i18next'
5-
import React from 'react'
5+
import React, { useState, useCallback } from 'react'
66
import { Image, StyleSheet } from 'react-native'
77

88
export const ProfileEditImage: React.FC = () => {
9-
const [image, setImage] = React.useState<string | null>(null)
9+
const [image, setImage] = useState<string | null>(null)
1010

11-
const pickImage = async () => {
11+
const pickImage = useCallback(async () => {
1212
const result = await ImagePicker.launchImageLibraryAsync({
1313
mediaTypes: ImagePicker.MediaTypeOptions.Images,
1414
allowsEditing: true,
@@ -19,21 +19,21 @@ export const ProfileEditImage: React.FC = () => {
1919
if (!result.canceled && result.assets && result.assets.length > 0) {
2020
setImage(result.assets[0].uri)
2121
}
22-
}
22+
}, [])
2323

2424
return (
2525
<Box borderColor="border.secondary" borderTopWidth={1} py={6}>
26-
<Box style={s.marginBottom}>
26+
<Box style={styles.marginBottom}>
2727
<Text.SmBold color="text.primary">{t('profile_screen.your_photo')}</Text.SmBold>
2828
<Text.SmRegular color="text.secondary">
2929
{t('profile_screen.your_photo_description')}
3030
</Text.SmRegular>
3131
</Box>
32-
<Box style={s.imageContainer}>
32+
<Box style={styles.imageContainer}>
3333
{image ? (
34-
<Image source={{ uri: image }} style={s.image} />
34+
<Image source={{ uri: image }} style={styles.image} />
3535
) : (
36-
<Box style={s.placeholder}>
36+
<Box style={styles.placeholder}>
3737
<Text color="Gray modern.600">{t('profile_screen.photo_innerText')}</Text>
3838
</Box>
3939
)}
@@ -45,7 +45,7 @@ export const ProfileEditImage: React.FC = () => {
4545
)
4646
}
4747

48-
const s = StyleSheet.create({
48+
const styles = StyleSheet.create({
4949
image: {
5050
height: '100%',
5151
width: '100%',

src/i18n/translations/en.json

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,28 @@
1111
"title": "Your current session expired"
1212
}
1313
},
14+
"app_information": "Shake your device to open developer menu",
1415
"bottom_tabs": {
15-
"home": "Home",
1616
"categories": "Categories",
17+
"details": "Details",
1718
"example": "Example",
18-
"settings": "Settings",
19+
"home": "Home",
1920
"profile": "Profile",
20-
"details": "Details"
21+
"settings": "Settings"
2122
},
2223
"common": {
2324
"add": "Add",
2425
"back": "Back",
2526
"cancel": "Cancel",
27+
"change": "Change",
2628
"continue": "Continue",
2729
"go_back": "Go back",
2830
"remove": "Remove",
2931
"save": "Save",
30-
"change": "Change",
31-
"upload": "Upload",
3232
"search": "Search",
3333
"try_again_later": "Please try again later",
34-
"try_again": "Try again"
34+
"try_again": "Try again",
35+
"upload": "Upload"
3536
},
3637
"errors": {
3738
"invalid_email": "Niepoprawny adres e-mail",
@@ -58,19 +59,19 @@
5859
"email": "E-mail address",
5960
"first_name": "First name",
6061
"last_name": "Last name",
61-
"password": "Password",
62+
"new_password": "New password",
6263
"old_password": "Old password",
63-
"new_password": "New password"
64+
"password": "Password"
6465
},
6566
"placeholders": {
6667
"confirm_password": "Confirm password",
6768
"create_password": "Create a password",
6869
"email": "Enter your email",
6970
"first_name": "Enter your first name",
7071
"last_name": "Enter your last name",
71-
"password": "Password",
72+
"new_password": "Enter new password",
7273
"old_password": "Enter current password",
73-
"new_password": "Enter new password"
74+
"password": "Password"
7475
},
7576
"select": {},
7677
"validation": {
@@ -81,6 +82,7 @@
8182
"required": "This field is required"
8283
}
8384
},
85+
"hello": "Welcome",
8486
"navigation": {
8587
"screen_titles": {
8688
"application_info": "ApplicationInfo",
@@ -96,8 +98,8 @@
9698
"home": "Home",
9799
"main_tab": "MainTab",
98100
"not_found": "Not Found",
99-
"resetLinkSent": "Reset link sent",
100101
"profile": "Profile",
102+
"resetLinkSent": "Reset link sent",
101103
"settings": "Settings",
102104
"sign_in": "Sign in",
103105
"sign_up": "Sign up",
@@ -139,8 +141,8 @@
139141
"link_destructive": "Button link destructive",
140142
"link_gray": "Button link gray",
141143
"loading": "Button loading",
142-
"primary": "Button primary",
143144
"primary_destructive": "Button primary destructive",
145+
"primary": "Button primary",
144146
"secondary_color": "Button secondary color",
145147
"secondary_destructive": "Button secondary destructive",
146148
"secondary_gray": "Button secondary gray",
@@ -164,14 +166,14 @@
164166
"test_notification": "Test notification",
165167
"typography": {
166168
"label": "Typography",
167-
"xs": "xs",
168-
"sm": "sm",
169-
"md": "md",
170-
"lg": "lg",
171-
"xl": "xl",
172169
"2xl": "2xl",
173170
"3xl": "3xl",
174-
"4xl": "4xl"
171+
"4xl": "4xl",
172+
"lg": "lg",
173+
"md": "md",
174+
"sm": "sm",
175+
"xl": "xl",
176+
"xs": "xs"
175177
}
176178
},
177179
"confirm_email_screen": {
@@ -232,18 +234,18 @@
232234
"settings_screen": {
233235
"copy_push_token": "Copy push token",
234236
"current_theme": "Current theme: {{theme}}",
235-
"sign_out": "Sign out!",
236-
"selected": " - selected"
237+
"selected": " - selected",
238+
"sign_out": "Sign out!"
237239
},
238240
"profile_screen": {
239-
"profile": "Profile",
240-
"update_your_details": "Update your personal details here.",
241-
"remove_account": "Remove account",
242241
"are_you_sure": "Are you sure?",
242+
"photo_innerText": "No Image",
243+
"profile": "Profile",
243244
"remove_account_desc": "This action cannot be undone.\n\nYou will lose access to your account. If you have an active subscription you will lose access to it.\n\nPlease make sure you are certain about this action.",
244-
"your_photo": "Your photo",
245+
"remove_account": "Remove account",
246+
"update_your_details": "Update your personal details here.",
245247
"your_photo_description": "This will be displayed on your profile.",
246-
"photo_innerText": "No Image"
248+
"your_photo": "Your photo"
247249
},
248250
"sign_in_screen": {
249251
"do_not_have_an_account": "Don't have an account?",
@@ -308,11 +310,9 @@
308310
"surname_placeholder": "Surname",
309311
"which_music": "what kind of music do you listen ?"
310312
},
313+
"thanks": "Thank you for using the best template for expo apps",
311314
"typography_screen": {
312315
"display_font_size": "Display fontSize: ",
313316
"text_font_size": "Text fontSize: "
314-
},
315-
"hello": "Welcome",
316-
"thanks": "Thank you for using the best template for expo apps",
317-
"app_information": "Shake your device to open developer menu"
317+
}
318318
}

src/i18n/translations/pl.json

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,28 @@
1111
"title": "Twoja sesja wygasła"
1212
}
1313
},
14+
"app_information": "Potrząśnij swoim urządzeniem, by otworzyć menu dewelopera",
1415
"bottom_tabs": {
15-
"home": "Home",
1616
"categories": "Kategorie",
17+
"details": "Detale",
1718
"example": "Przykłady",
18-
"settings": "Ustawienia",
19+
"home": "Home",
1920
"profile": "Profil",
20-
"details": "Detale"
21+
"settings": "Ustawienia"
2122
},
2223
"common": {
2324
"add": "Dodaj",
2425
"back": "Cofnij",
2526
"cancel": "Anuluj",
27+
"change": "Zmień",
2628
"continue": "Kontynuuj",
2729
"go_back": "Cofnij",
2830
"remove": "Usuń",
2931
"save": "Zapisz",
30-
"change": "Zmień",
31-
"upload": "Prześlij",
3232
"search": "Szukaj",
3333
"try_again_later": "Proszę spróbuj ponownie później",
34-
"try_again": "Spróbuj ponownie"
34+
"try_again": "Spróbuj ponownie",
35+
"upload": "Prześlij"
3536
},
3637
"errors": {
3738
"invalid_email": "Niepoprawny adres e-mail",
@@ -58,19 +59,19 @@
5859
"email": "Adres e-mail",
5960
"first_name": "Imię",
6061
"last_name": "Nazwisko",
61-
"password": "Hasło",
62+
"new_password": "Nowe hasło",
6263
"old_password": "Stare hasło",
63-
"new_password": "Nowe hasło"
64+
"password": "Hasło"
6465
},
6566
"placeholders": {
6667
"confirm_password": "Potwierdź hasło",
6768
"create_password": "Utwórz nowe hasło",
6869
"email": "Podaj adres e-mail",
6970
"first_name": "Podaj swoje imię",
7071
"last_name": "Podaj swoje nazwisko",
71-
"password": "Hasło",
72+
"new_password": "Podaj nowe hasło",
7273
"old_password": "Podaj stare hasło",
73-
"new_password": "Podaj nowe hasło"
74+
"password": "Hasło"
7475
},
7576
"select": {},
7677
"validation": {
@@ -81,6 +82,7 @@
8182
"required": "Pole wymagane"
8283
}
8384
},
85+
"hello": "Witaj",
8486
"navigation": {
8587
"screen_titles": {
8688
"application_info": "ApplicationInfo",
@@ -96,8 +98,8 @@
9698
"home": "Home",
9799
"main_tab": "MainTab",
98100
"not_found": "NotFound",
99-
"resetLinkSent": "Link wysłany",
100101
"profile": "Profil użytkownika",
102+
"resetLinkSent": "Link wysłany",
101103
"settings": "Settings",
102104
"sign_in": "Sign in",
103105
"sign_up": "Sign up",
@@ -139,8 +141,8 @@
139141
"link_destructive": "Button link destructive",
140142
"link_gray": "Button link gray",
141143
"loading": "Button loading",
142-
"primary": "Button primary",
143144
"primary_destructive": "Button primary destructive",
145+
"primary": "Button primary",
144146
"secondary_color": "Button secondary color",
145147
"secondary_destructive": "Button secondary destructive",
146148
"secondary_gray": "Button secondary gray",
@@ -164,14 +166,14 @@
164166
"test_notification": "Test notification",
165167
"typography": {
166168
"label": "Typography",
167-
"xs": "xs",
168-
"sm": "sm",
169-
"md": "md",
170-
"lg": "lg",
171-
"xl": "xl",
172169
"2xl": "2xl",
173170
"3xl": "3xl",
174-
"4xl": "4xl"
171+
"4xl": "4xl",
172+
"lg": "lg",
173+
"md": "md",
174+
"sm": "sm",
175+
"xl": "xl",
176+
"xs": "xs"
175177
}
176178
},
177179
"confirm_email_screen": {
@@ -181,10 +183,10 @@
181183
"verification_succeed": "Adres e-mail został pomyślnie potwierdzony."
182184
},
183185
"details_screen": {
184-
"title": "To jest przykładowy widok",
186+
"awesome": "Wspaniale 🎉",
185187
"open_bottom_sheet": "Otwórz BottomSheetModal",
186188
"screen_params": "Parametry widoku: {{params}}",
187-
"awesome": "Wspaniale 🎉"
189+
"title": "To jest przykładowy widok"
188190
},
189191
"examples_screen": {
190192
"go_to_application_info": "Idź do ApplicationInfo",
@@ -208,10 +210,10 @@
208210
"details": "Detale"
209211
},
210212
"landing_screen": {
211-
"login_cta": "Zaloguj się",
212-
"sign_up": "Zarejestruj się",
213213
"go_to_blog": "Otwórz blog",
214-
"go_to_form": "Otwórz pełno ekranowy formularz full"
214+
"go_to_form": "Otwórz pełno ekranowy formularz full",
215+
"login_cta": "Zaloguj się",
216+
"sign_up": "Zarejestruj się"
215217
},
216218
"reset_password_complete": {
217219
"password_reset": "Reset hasła",
@@ -235,14 +237,14 @@
235237
"sign_out": "Wyloguj!"
236238
},
237239
"profile_screen": {
238-
"profile": "Profil",
239-
"update_your_details": "Zaktualizuj swoje dane osobowe tutaj.",
240-
"remove_account": "Usuń konto",
241240
"are_you_sure": "Jesteś pewny/a?",
241+
"photo_innerText": "Bez Zdjęcia",
242+
"profile": "Profil",
242243
"remove_account_desc": "Tej akcji nie można cofnąć.\n\nUtracisz dostęp do swojego konta. Jeśli masz aktywną subskrypcję, utracisz do niej dostęp.\n\nUpewnij się, że jesteś pewien tej akcji",
243-
"your_photo": "Twoje zdjęcie",
244+
"remove_account": "Usuń konto",
245+
"update_your_details": "Zaktualizuj swoje dane osobowe tutaj.",
244246
"your_photo_description": "To będzie wyświetlane na twoim profilu.",
245-
"photo_innerText": "Bez Zdjęcia"
247+
"your_photo": "Twoje zdjęcie"
246248
},
247249
"sign_in_screen": {
248250
"do_not_have_an_account": "Nie masz konta?",
@@ -307,11 +309,9 @@
307309
"surname_placeholder": "Nazwisko",
308310
"which_music": "Jakiej muzyki słuchasz ?"
309311
},
312+
"thanks": "Dzięki za używanie najlepszej templatki dla aplikacji expo",
310313
"typography_screen": {
311314
"display_font_size": "Display fontSize: ",
312315
"text_font_size": "Text fontSize: "
313-
},
314-
"hello": "Witaj",
315-
"thanks": "Dzięki za używanie najlepszej templatki dla aplikacji expo",
316-
"app_information": "Potrząśnij swoim urządzeniem, by otworzyć menu dewelopera"
316+
}
317317
}

0 commit comments

Comments
 (0)