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 14, 2024
1 parent 2751deb commit 0bdf3e2
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 13 deletions.
5 changes: 4 additions & 1 deletion app/i18n/en/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2424,6 +2424,9 @@ const en: BaseTranslation = {
accountId: "Account ID",
copy: "Copy"
},
ProfileScreen: {
addNew : "Add new",
},
TotpRegistrationInitiateScreen: {
title: "Two-factor authentication",
content:
Expand Down Expand Up @@ -2682,7 +2685,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
16 changes: 14 additions & 2 deletions app/i18n/i18n-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7581,6 +7581,12 @@ type RootTranslation = {
*/
copy: string
}
ProfileScreen: {
/**
* A​d​d​ ​n​e​w
*/
addNew: 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 +8406,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 +16600,12 @@ export type TranslationFunctions = {
*/
copy: () => LocalizedString
}
ProfileScreen: {
/**
* Add new
*/
addNew: () => LocalizedString
}
TotpRegistrationInitiateScreen: {
/**
* Two-factor authentication
Expand Down Expand Up @@ -17398,7 +17410,7 @@ export type TranslationFunctions = {
*/
preimageProofOfPayment: () => LocalizedString
/**
* Profile
* Profiles
*/
profile: () => LocalizedString
/**
Expand Down
5 changes: 4 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,9 @@
"accountId": "Account ID",
"copy": "Copy"
},
"ProfileScreen": {
"addNew": "Add new"
},
"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 +2582,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
100 changes: 95 additions & 5 deletions app/screens/settings-screen/account/profile.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,115 @@
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()
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}>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 0bdf3e2

Please sign in to comment.