Skip to content

Commit

Permalink
feat: add profile item
Browse files Browse the repository at this point in the history
Signed-off-by: Prakhar Agarwal <[email protected]>
  • Loading branch information
Prakhar-Agarwal-byte committed Jun 24, 2024
1 parent f01e1e5 commit 1fd9781
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 13 deletions.
6 changes: 5 additions & 1 deletion app/i18n/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2424,6 +2424,10 @@ const en: BaseTranslation = {
accountId: "Account ID",
copy: "Copy"
},
ProfileScreen: {
addNew : "Add new",
logout: "Logout",
},
TotpRegistrationInitiateScreen: {
title: "Two-factor authentication",
content:
Expand Down Expand Up @@ -2682,7 +2686,7 @@ const en: BaseTranslation = {
phone: "Phone",
phoneNumber: "Phone Number",
preimageProofOfPayment: "Preimage / Proof of Payment",
profile: "Profile",
profile: "Profiles",
rate: "Rate",
reauth: "Your session has expired. Please log in again.",
restart: "Restart",
Expand Down
24 changes: 22 additions & 2 deletions app/i18n/i18n-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7581,6 +7581,16 @@ type RootTranslation = {
*/
copy: string
}
ProfileScreen: {
/**
* A​d​d​ ​n​e​w
*/
addNew: string
/**
* L​o​g​o​u​t
*/
logout: string
}
TotpRegistrationInitiateScreen: {
/**
* T​w​o​-​f​a​c​t​o​r​ ​a​u​t​h​e​n​t​i​c​a​t​i​o​n
Expand Down Expand Up @@ -8400,7 +8410,7 @@ type RootTranslation = {
*/
preimageProofOfPayment: string
/**
* P​r​o​f​i​l​e
* P​r​o​f​i​l​e​s
*/
profile: string
/**
Expand Down Expand Up @@ -16594,6 +16604,16 @@ export type TranslationFunctions = {
*/
copy: () => LocalizedString
}
ProfileScreen: {
/**
* Add new
*/
addNew: () => LocalizedString
/**
* Logout
*/
logout: () => LocalizedString
}
TotpRegistrationInitiateScreen: {
/**
* Two-factor authentication
Expand Down Expand Up @@ -17398,7 +17418,7 @@ export type TranslationFunctions = {
*/
preimageProofOfPayment: () => LocalizedString
/**
* Profile
* Profiles
*/
profile: () => LocalizedString
/**
Expand Down
6 changes: 5 additions & 1 deletion app/i18n/raw-i18n/source/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -2343,6 +2343,10 @@
"accountId": "Account ID",
"copy": "Copy"
},
"ProfileScreen": {
"addNew": "Add new",
"logout": "Logout"
},
"TotpRegistrationInitiateScreen": {
"title": "Two-factor authentication",
"content": "Scan this QR code with your authenticator app. Alternatively, you can manually copy/paste the secret into your authenticator app."
Expand Down Expand Up @@ -2579,7 +2583,7 @@
"phone": "Phone",
"phoneNumber": "Phone Number",
"preimageProofOfPayment": "Preimage / Proof of Payment",
"profile": "Profile",
"profile": "Profiles",
"rate": "Rate",
"reauth": "Your session has expired. Please log in again.",
"restart": "Restart",
Expand Down
4 changes: 0 additions & 4 deletions app/screens/settings-screen/account/banner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ import { RootStackParamList } from "@app/navigation/stack-param-lists"
import { useNavigation } from "@react-navigation/native"
import { StackNavigationProp } from "@react-navigation/stack"
import { Text, makeStyles, useTheme, Skeleton } from "@rneui/themed"
import {
GaloyIconButton,
GaloyIconButtonProps,
} from "@app/components/atomic/galoy-icon-button"

export const AccountBanner = () => {
const styles = useStyles()
Expand Down
102 changes: 97 additions & 5 deletions app/screens/settings-screen/account/profile.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,117 @@
import { ScrollView } from "react-native-gesture-handler"

import { Screen } from "@app/components/screen"
import { makeStyles } from "@rneui/themed"
import { GaloyPrimaryButton } from "@app/components/atomic/galoy-primary-button"
import { useI18nContext } from "@app/i18n/i18n-react"
import { TouchableOpacity, View } from "react-native"
import { GaloyIcon } from "@app/components/atomic/galoy-icon"
import { makeStyles, Text } from "@rneui/themed"

export const ProfileScreen: React.FC = () => {
const styles = useStyles()
const { LL } = useI18nContext()

const data = [
{
username: "User 1",
selected: true,
},
{
username: "User 2",
selected: false,
},
{
username: "User 3",
selected: false,
},
]

return (
<Screen keyboardShouldPersistTaps="handled">
<ScrollView contentContainerStyle={styles.outer}></ScrollView>
<ScrollView contentContainerStyle={styles.outer}>
{data.map((profile, index) => {
return <Profile key={index} {...profile} />
})}
<GaloyPrimaryButton onPress={() => {}} containerStyle={styles.addNewButton}>
<GaloyIcon name="user" size={30} style={styles.icon} />
<Text>{LL.ProfileScreen.addNew()}</Text>
</GaloyPrimaryButton>
</ScrollView>
</Screen>
)
}

const useStyles = makeStyles(() => ({
const Profile: React.FC<{ username: string; selected?: boolean }> = ({
username,
selected,
}) => {
const styles = useStyles()
const { LL } = useI18nContext()

return (
<TouchableOpacity>
<View style={styles.profile}>
<View style={styles.iconContainer}>
{selected && (
<GaloyIcon name="check-circle" size={30} style={styles.checkIcon} />
)}
</View>
<Text>{username}</Text>
{!selected && (
<TouchableOpacity style={styles.logoutButton} onPress={() => {}}>
<Text style={styles.logoutButtonText}>{LL.ProfileScreen.logout()}</Text>
</TouchableOpacity>
)}
</View>
<View style={styles.divider}></View>
</TouchableOpacity>
)
}

const useStyles = makeStyles(({ colors }) => ({
outer: {
marginTop: 4,
paddingHorizontal: 12,
paddingBottom: 20,
display: "flex",
flexDirection: "column",
rowGap: 12,
},
iconContainer: {
height: 30,
width: 30,
marginRight: 10,
justifyContent: "center",
alignItems: "center",
},
icon: {
marginRight: 10,
},
addNewButton: {
marginVertical: 20,
marginHorizontal: "auto",
width: 150,
},
divider: {
borderWidth: 1,
borderColor: colors.grey4,
},
profile: {
display: "flex",
flexDirection: "row",
alignItems: "center",
marginBottom: 10,
marginHorizontal: 10,
},
checkIcon: {
color: colors._green,
margin: 10,
},
logoutButton: {
marginLeft: "auto",
marginRight: 10,
},
logoutButtonText: {
color: colors.primary,
fontSize: 20,
fontWeight: "bold",
},
}))

0 comments on commit 1fd9781

Please sign in to comment.