You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

911 lines
25 KiB

1 month ago
import React, { useState, useEffect, useCallback } from "react";
import {
View,
Text,
Image,
StyleSheet,
ImageBackground,
TouchableOpacity,
1 month ago
ScrollView,
3 weeks ago
Platform,
StatusBar,
SafeAreaView,
Linking,
1 month ago
} from "react-native";
3 weeks ago
import { useTranslation } from "react-i18next";
1 month ago
import SettingsIcon from "../components/SettingsIcon";
import fontSize from "../utils/fontsizeUtils";
import { useNavigation } from "@react-navigation/native";
import { NativeStackNavigationProp } from "@react-navigation/native-stack";
1 month ago
import BookmarkIcon from "../components/BookmarkIcon";
import LeftArrowIcon from "../components/DownArrowIcon";
import { flagMap } from "../utils/flagMap";
import DocumentApprovedIcon from "../components/DocumentApprovedIcon";
import PdfDocumentIcon from "../components/PdfDocumentIcon";
import DocumentClockIcon from "../components/DocumentClockIcon";
import widthUtils from "../utils/widthUtils";
1 month ago
import { productStatus } from "../constants/productStatus";
1 month ago
import useUserStore from "../store/user";
1 month ago
type RootStackParamList = {
SettingList: undefined;
Home: undefined;
1 month ago
MyAccount: undefined;
Login: undefined;
Status: { status: number | null };
BrowseHistoryScreen: undefined;
AddressList: undefined;
Collection: undefined;
Balance: undefined;
MemberIntroduction: undefined;
1 month ago
};
export const ProfileScreen = () => {
2 weeks ago
1 month ago
const handleLogin = async () => {
1 month ago
navigation.navigate("Login");
1 month ago
};
2 weeks ago
1 month ago
const { user } = useUserStore();
3 weeks ago
const { t } = useTranslation();
1 month ago
const navigation =
useNavigation<NativeStackNavigationProp<RootStackParamList>>();
1 month ago
return (
3 weeks ago
<SafeAreaView style={styles.safeArea}>
<StatusBar barStyle="dark-content" backgroundColor="#fff" />
<View style={styles.safeAreaContent}>
<View style={styles.flexColumnContainer1}>
{user.user_id ? (
<ImageBackground
source={require("../../assets/img/image_b64646d0.png")}
style={styles.timecardWidget}
resizeMode="stretch"
>
<View style={styles.flexRowWithContent}>
1 month ago
<Image
3 weeks ago
source={flagMap.get(user?.country_en)}
style={styles.imageContainerWithText}
1 month ago
/>
3 weeks ago
<View style={styles.financialInfoContainer}>
<Text style={styles.whiteTextHeading}>{user?.currency}</Text>
1 month ago
<TouchableOpacity
3 weeks ago
onPress={() => navigation.navigate("SettingList")}
1 month ago
>
3 weeks ago
<View style={styles.svgContainer1}>
<SettingsIcon size={fontSize(24)} color="white" />
1 month ago
</View>
</TouchableOpacity>
</View>
1 month ago
</View>
1 month ago
3 weeks ago
<View style={styles.flexColumnContainer}>
<View style={styles.flexContainerWithImageAndText}>
<View style={styles.flexRowWithContent1}>
<Image
source={require("../../assets/img/image_94051480.jpeg")}
style={styles.profileImageCircle}
/>
<View style={styles.customerInfoPanel}>
<View>
<Text style={styles.uniqueHeaderTextStyle}>
{user?.username}
</Text>
<Text style={styles.elegantText}>
ID: {user?.user_id}
</Text>
1 month ago
</View>
{user.user_id && (
<TouchableOpacity
style={styles.transactionSummaryBox}
onPress={() => navigation.navigate("Balance")}
>
<View style={styles.svgContainer}>
<BookmarkIcon size={fontSize(24)} />
</View>
<Text style={styles.soldeTextDisplayStyle}></Text>
</TouchableOpacity>
)}
1 month ago
</View>
</View>
3 weeks ago
</View>
<View style={styles.gradientCardContainer}>
<ImageBackground
source={require("../../assets/img/image_7dbf30dc.png")}
style={styles.promoCardContainer2}
resizeMode="stretch"
>
<View style={styles.promoCardContainerVip}>
<View style={styles.VipCard}>
<View style={styles.Vip}>
<Text style={styles.goldenItalicHeading}>
VIP{user?.vip_level}
</Text>
<View style={styles.vipContainer}>
<Image
source={require("../../assets/img/折扣VIP1 (1).png")}
style={styles.VipImg}
/>
<Text style={styles.discountPercentageTextStyle}>
{((1 - user?.vip_discount) * 100).toFixed(0)}%
</Text>
</View>
3 weeks ago
</View>
<View style={styles.progressBar}>
<View style={styles.progressBarFill}>
<Text style={styles.progressBarText}>
40000/50000
</Text>
3 weeks ago
</View>
<View style={styles.progressBarLine}></View>
</View>
</View>
<View style={styles.vipExplanation}>
<View style={styles.vipExplanationText}>
<Text style={styles.vipExplanationText1}>
{t("profile.vip.next_level_info")}
3 weeks ago
</Text>
</View>
<TouchableOpacity
style={styles.vipExplanationButton}
onPress={() =>
navigation.navigate("MemberIntroduction")
}
3 weeks ago
>
<Text style={styles.vipExplanationButtonText}>
{t("profile.learn_more")}
3 weeks ago
</Text>
</TouchableOpacity>
</View>
1 month ago
</View>
3 weeks ago
</ImageBackground>
1 month ago
</View>
3 weeks ago
</View>
</ImageBackground>
) : (
<ImageBackground
source={require("../../assets/img/image_b64646d0.png")}
style={styles.timecardWidget}
resizeMode="stretch"
>
<View style={styles.flexRowWithContent}>
<View style={styles.financialInfoContainer}>
<TouchableOpacity
onPress={() => navigation.navigate("SettingList")}
>
<View style={styles.svgContainer1}>
<SettingsIcon size={fontSize(24)} color="white" />
</View>
</TouchableOpacity>
4 weeks ago
</View>
3 weeks ago
</View>
3 weeks ago
<View style={styles.notLoggedInContainer}>
<View style={styles.profileImageCircle}>
<Image
source={require("../../assets/img/brainnel-0000.jpg")}
style={styles.profileImage}
/>
</View>
<TouchableOpacity
style={styles.loginButton}
onPress={handleLogin}
>
3 weeks ago
<Text style={styles.loginButtonText}>{t("login.now")}</Text>
3 weeks ago
</TouchableOpacity>
</View>
</ImageBackground>
)}
3 weeks ago
{/* <View style={styles.verticalCenterImageGallery}>
3 weeks ago
<TouchableOpacity onPress={handleLogin}>
3 weeks ago
<Text>{t("login.button")}</Text>
<TouchableOpacity
style={styles.loginButton}
onPress={() =>
Linking.openURL("exp://192.168.0.101:8084/--/payment-success")
}
>
3 weeks ago
<Text style={styles.loginButtonText}>{t("test.payment.callback")}</Text>
</TouchableOpacity>
1 month ago
</TouchableOpacity>
3 weeks ago
</View> */}
1 month ago
3 weeks ago
<ScrollView
showsVerticalScrollIndicator={false}
style={{ flex: 1 }}
bounces={false}
overScrollMode="never"
>
<View style={styles.groupContainer}>
<View style={styles.groupItemList}>
<View style={styles.groupItemTitle}>
<Text style={styles.groupItemTitleText}>
{t("order.title")}
</Text>
3 weeks ago
<TouchableOpacity
style={styles.groupItemTitleTextTout}
onPress={() =>
navigation.navigate("Status", { status: null })
}
3 weeks ago
>
<Text style={styles.groupItemTitleTextTout1}>
{t("all")}
</Text>
3 weeks ago
<LeftArrowIcon size={fontSize(14)} color="#8f8684" />
</TouchableOpacity>
</View>
1 month ago
3 weeks ago
<View style={styles.groupItem}>
{productStatus.map((item, index) => (
<TouchableOpacity
key={index}
style={styles.groupItemContent}
onPress={() =>
item.status !== null
? navigation.navigate("Status", {
status: item.status,
})
3 weeks ago
: null
}
>
<View style={styles.groupItemContentIcon}>
<item.icon size={fontSize(38)} color="#707070" />
</View>
<Text style={styles.groupItemContentText}>
3 weeks ago
{t(item.textKey)}
</Text>
3 weeks ago
</TouchableOpacity>
))}
</View>
</View>
1 month ago
</View>
1 month ago
3 weeks ago
<View style={styles.groupContainer}>
<View style={styles.groupItemList}>
<View style={styles.groupItemTitle}>
<Text style={styles.groupItemTitleText}>
{t("tool.title")}
</Text>
3 weeks ago
</View>
1 month ago
3 weeks ago
<View style={styles.groupItem}>
<View style={styles.groupItemContent}>
<TouchableOpacity
style={styles.groupItemContentIcon}
onPress={() => navigation.navigate("BrowseHistoryScreen")}
>
<DocumentApprovedIcon
size={fontSize(38)}
color="#707070"
/>
3 weeks ago
</TouchableOpacity>
<Text style={styles.groupItemContentText}>
{t("browse.history")}
</Text>
3 weeks ago
</View>
1 month ago
3 weeks ago
<View style={styles.groupItemContent}>
<TouchableOpacity
style={styles.groupItemContentIcon}
onPress={() => navigation.navigate("Collection")}
>
<PdfDocumentIcon size={fontSize(38)} color="#707070" />
</TouchableOpacity>
<Text style={styles.groupItemContentText}>
{t("collection")}
</Text>
3 weeks ago
</View>
1 month ago
3 weeks ago
<TouchableOpacity
style={styles.groupItemContent}
onPress={() => navigation.navigate("AddressList")}
>
<View style={styles.groupItemContentIcon}>
<DocumentClockIcon size={fontSize(38)} color="#707070" />
</View>
<Text style={styles.groupItemContentText}>
{t("address.management")}
</Text>
3 weeks ago
</TouchableOpacity>
1 month ago
</View>
3 weeks ago
</View>
1 month ago
</View>
3 weeks ago
</ScrollView>
{/* Login Button at bottom of screen */}
<TouchableOpacity
style={styles.fixedLoginButton}
onPress={handleLogin}
>
<Text style={styles.loginButtonText}>{t("login.now")}</Text>
</TouchableOpacity>
1 month ago
</View>
3 weeks ago
</View>
</SafeAreaView>
);
};
const styles = StyleSheet.create({
3 weeks ago
safeArea: {
flex: 1,
backgroundColor: "#fff",
},
safeAreaContent: {
flex: 1,
paddingTop: Platform.OS === "android" ? 0 : 0,
3 weeks ago
},
1 month ago
flexColumnContainer1: {
1 month ago
flex: 1,
1 month ago
},
timecardWidget: {
flexDirection: "column",
alignItems: "stretch",
justifyContent: "flex-start",
1 month ago
width: "100%",
height: widthUtils(272, 272).height,
overflow: "hidden",
1 month ago
},
1 month ago
1 month ago
timeContainer1: {
display: "flex",
flexDirection: "column",
alignItems: "flex-start",
justifyContent: "flex-start",
1 month ago
height: widthUtils(43, 43).height,
1 month ago
paddingTop: 21,
},
timeContainer2: {
display: "flex",
flexDirection: "row",
alignItems: "center",
alignSelf: "stretch",
justifyContent: "space-between",
},
timeContainer: {
display: "flex",
flex: 1,
1 month ago
flexDirection: "row",
gap: 10,
alignItems: "center",
justifyContent: "center",
minWidth: 153,
paddingRight: 6,
paddingLeft: 16,
},
1 month ago
timeDisplayStyle: {
padding: 0,
margin: 0,
1 month ago
fontSize: fontSize(17),
1 month ago
fontWeight: "600",
fontFamily:
"SF Pro, -apple-system, system-ui, BlinkMacSystemFont, sans-serif",
color: "white",
},
1 month ago
timeDisplayContainer: {
1 month ago
width: widthUtils(10, 124).width,
height: widthUtils(10, 124).height,
},
1 month ago
timeDisplayContainer1: {
flex: 1,
1 month ago
width: widthUtils(13, 153).width,
height: widthUtils(13, 153).height,
1 month ago
},
flexColumnContainer: {
display: "flex",
flexDirection: "column",
alignItems: "stretch",
justifyContent: "flex-start",
paddingVertical: 12,
paddingHorizontal: 20,
paddingBottom: 3.5,
1 month ago
flex: 1,
1 month ago
},
flexContainerWithImageAndText: {
display: "flex",
flexDirection: "row",
gap: 8,
alignItems: "flex-start",
justifyContent: "space-between",
},
flexRowWithContent: {
1 month ago
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "flex-end",
paddingRight: 10,
paddingTop: 10,
},
flexRowWithContent1: {
1 month ago
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "flex-start",
},
profileImageCircle: {
1 month ago
width: widthUtils(100, 100).width,
height: widthUtils(100, 100).height,
1 month ago
borderWidth: 0,
backgroundColor: "#fff",
1 month ago
borderRadius: 50,
padding: 10,
},
profileImage: {
width: "100%",
height: "100%",
resizeMode: "contain",
1 month ago
},
customerInfoPanel: {
1 month ago
marginLeft: 20,
1 month ago
},
uniqueHeaderTextStyle: {
padding: 0,
margin: 0,
1 month ago
fontSize: fontSize(20),
1 month ago
fontWeight: "900",
1 month ago
fontFamily: "Archivo Black, sans-serif",
color: "white",
},
elegantText: {
padding: 0,
margin: 0,
marginTop: 6.75,
1 month ago
fontSize: fontSize(16),
1 month ago
fontWeight: "900",
1 month ago
fontFamily: "PingFang SC",
lineHeight: 22,
color: "white",
},
transactionSummaryBox: {
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "flex-start",
marginTop: 8,
},
svgContainer: {
display: "flex",
1 month ago
width: widthUtils(24, 24).width,
height: widthUtils(24, 24).height,
1 month ago
color: "#ffffff",
1 month ago
marginRight: 8,
1 month ago
},
soldeTextDisplayStyle: {
padding: 0,
margin: 0,
marginLeft: 3,
1 month ago
fontSize: fontSize(16),
1 month ago
fontWeight: "500",
fontFamily: "PingFang SC",
lineHeight: 22,
color: "white",
},
imageContainerWithText: {
1 month ago
width: widthUtils(16, 24).width,
height: widthUtils(16, 24).height,
1 month ago
borderWidth: 0,
resizeMode: "cover",
},
1 month ago
financialInfoContainer: {
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "flex-start",
marginLeft: 3,
},
1 month ago
whiteTextHeading: {
padding: 0,
margin: 0,
1 month ago
fontSize: fontSize(16),
1 month ago
fontWeight: "500",
fontFamily: "PingFang SC",
lineHeight: 22,
color: "white",
},
svgContainer1: {
1 month ago
width: widthUtils(24, 24).width,
height: widthUtils(24, 24).height,
1 month ago
marginLeft: 11,
color: "#ffffff",
},
gradientCardContainer: {
1 month ago
position: "absolute",
bottom: 0,
1 month ago
left: 19,
right: 19,
1 month ago
backgroundColor: "#3A3128",
borderRadius: 10,
marginBottom: Platform.OS === "ios" ? -18 : -15,
zIndex: 1,
1 month ago
},
promoCardContainer2: {
flexDirection: "column",
alignItems: "stretch",
justifyContent: "flex-start",
1 month ago
height: widthUtils(130, 130).height,
1 month ago
paddingRight: 9.5,
paddingBottom: 15,
paddingLeft: 9,
1 month ago
width: "100%",
},
promoCardContainerVip: {
width: "100%",
paddingTop: 5,
paddingBottom: 5,
paddingLeft: 10,
paddingRight: 10,
height: "100%",
},
VipCard: {
width: "100%",
height: "50%",
flexDirection: "row",
},
Vip: {
width: "35%",
flexDirection: "row",
alignItems: "center",
justifyContent: "center",
},
progressBar: {
width: "65%",
marginLeft: 10,
justifyContent: "center",
alignItems: "center",
},
progressBarFill: {
width: "100%",
height: "50%",
},
progressBarText: {
fontSize: fontSize(16),
fontWeight: "900",
fontFamily: "Segoe UI",
color: "#fcca80",
},
progressBarLine: {
width: "100%",
height: 3,
backgroundColor: "#d9d9d9",
},
vipExplanation: {
width: "100%",
height: "50%",
flexDirection: "row",
alignItems: "center",
},
vipExplanationText: {
width: "70%",
height: "100%",
},
vipExplanationText1: {
fontSize: fontSize(14),
padding: 5,
color: "#fff",
},
vipExplanationButton: {
width: "30%",
height: "100%",
backgroundColor: "#ffd89b",
borderRadius: 60,
alignItems: "center",
justifyContent: "center",
},
vipExplanationButtonText: {
fontSize: fontSize(14),
},
vipContainer: {
position: 'relative',
justifyContent: 'center',
alignItems: 'center',
marginLeft: 10,
},
1 month ago
VipImg: {
width: widthUtils(28, 28).width,
height: widthUtils(28, 28).height,
},
discountPercentageTextStyle: {
position: 'absolute',
fontSize: fontSize(12),
fontFamily: "Segoe UI",
fontWeight: "900",
fontStyle: "italic",
color: "#4e2000",
textAlign: 'center',
},
productInfoContainer: {
1 month ago
flexDirection: "row",
alignItems: "flex-start",
justifyContent: "flex-start",
},
imageWithTextRatio: {
1 month ago
width: widthUtils(23.5, 56).width,
height: widthUtils(23.5, 56).height,
1 month ago
},
goldenItalicHeading: {
1 month ago
fontSize: fontSize(34),
1 month ago
fontWeight: "900",
fontStyle: "italic",
color: "#f8cb7a",
},
discountSectionContainer: {
display: "flex",
flexDirection: "column",
alignItems: "stretch",
justifyContent: "flex-start",
marginLeft: 4,
},
discountAmountContainer: {
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "flex-start",
},
negativeMarginTopDiscountPercentage: {
marginTop: -22,
},
nestedContentContainer: {
marginTop: -25,
},
negativeMarginTop2: {
marginTop: -36,
},
imageContainer2: {
1 month ago
width: widthUtils(36, 36).width,
height: widthUtils(36, 36).height,
1 month ago
},
negativeMarginTop1: {
marginTop: -36,
},
imgStyleF62: {
width: "100%",
1 month ago
height: widthUtils(36, 36).height,
1 month ago
},
discountStatusContainer: {
paddingRight: 7,
paddingLeft: 7,
marginTop: -23,
},
discountStatusLabel: {
padding: 0,
margin: 0,
1 month ago
fontSize: fontSize(10),
1 month ago
fontWeight: "600",
fontStyle: "italic",
fontFamily: "Segoe UI",
color: "#4e2000",
},
productSummaryBlock: {
paddingTop: 4,
paddingBottom: 6.5,
marginLeft: 16,
},
goldenTextHeading: {
padding: 0,
margin: 0,
1 month ago
fontSize: fontSize(13),
1 month ago
fontWeight: "600",
fontFamily: "PingFang SC",
color: "#f8cb7a",
},
negativeMarginTop: {
marginTop: -0.5,
},
horizontalLineWidget: {
1 month ago
width: widthUtils(4, 235).width,
height: widthUtils(4, 235).height,
1 month ago
},
promoCardContainer: {
display: "flex",
flexDirection: "row",
alignItems: "stretch",
justifyContent: "flex-start",
1 month ago
height: widthUtils(34, 34).height,
1 month ago
marginTop: 6,
},
promoCardContainer1: {
display: "flex",
flexDirection: "column",
alignItems: "stretch",
justifyContent: "flex-end",
},
pingfangScTextWhite: {
padding: 0,
margin: 0,
1 month ago
fontSize: fontSize(11),
1 month ago
fontWeight: "400",
fontFamily: "PingFang SC",
lineHeight: 17,
color: "white",
textAlign: "left",
letterSpacing: -0.1,
},
promoDetailsContainer: {
display: "flex",
flexDirection: "row",
alignItems: "center",
justifyContent: "flex-start",
marginTop: -17,
},
goldenLabel: {
width: "30%",
padding: 0,
margin: 0,
1 month ago
fontSize: fontSize(12),
1 month ago
fontWeight: "900",
fontFamily: "MiSans",
lineHeight: 15,
color: "#f5c164",
},
goldenText: {
width: "70%",
padding: 0,
paddingRight: 24,
paddingLeft: 37,
margin: 0,
1 month ago
fontSize: fontSize(12),
1 month ago
fontWeight: "900",
fontFamily: "MiSans",
lineHeight: 15,
color: "#f5c164",
},
goldenGradientBox: {
display: "flex",
flexDirection: "column",
alignItems: "center",
justifyContent: "center",
paddingRight: 6,
paddingLeft: 6,
marginLeft: 11,
backgroundColor: "#F5C164",
borderRadius: 50,
},
featuredText: {
padding: 0,
margin: 0,
1 month ago
fontSize: fontSize(11),
1 month ago
fontWeight: "700",
fontFamily: "Source Han Sans CN",
color: "#473c30",
},
verticalCenterImageGallery: {
display: "flex",
flexDirection: "column",
alignItems: "stretch",
justifyContent: "center",
paddingTop: 21.5,
paddingRight: 20,
paddingLeft: 20,
1 month ago
backgroundColor: "#f0f0f0",
1 month ago
},
cardContainer1: {
display: "flex",
flexDirection: "column",
alignItems: "stretch",
justifyContent: "flex-start",
paddingTop: 14,
paddingRight: 9,
paddingBottom: 14,
paddingLeft: 10,
backgroundColor: "white",
borderRadius: 10,
},
imageContainer: {
1 month ago
height: widthUtils(212, 212).height,
1 month ago
borderWidth: 0,
resizeMode: "cover",
},
cardContainer: {
paddingTop: 15,
paddingRight: 11,
paddingBottom: 17,
paddingLeft: 11,
marginTop: 20,
backgroundColor: "white",
borderRadius: 10,
},
imageContainer1: {
width: "100%",
1 month ago
height: widthUtils(228, 228).height,
1 month ago
borderWidth: 0,
resizeMode: "cover",
},
1 month ago
groupContainer: {
padding: 20,
},
groupItemList: {
width: "100%",
alignItems: "center",
backgroundColor: "white",
padding: 15,
},
groupItemTitle: {
flexDirection: "row",
width: "100%",
justifyContent: "space-between",
alignItems: "center",
},
groupItemTitleText: {
fontSize: fontSize(18),
fontWeight: "600",
color: "#000",
},
groupItemTitleTextTout: {
fontSize: fontSize(16),
fontWeight: "400",
color: "#8f8684",
flexDirection: "row",
alignItems: "center",
},
groupItemTitleTextTout1: {
marginRight: 3,
fontSize: fontSize(16),
fontWeight: "400",
color: "#8f8684",
flexDirection: "row",
alignItems: "center",
},
groupItem: {
flexDirection: "row",
flexWrap: "wrap",
width: "100%",
1 month ago
marginTop: 25,
1 month ago
},
groupItemContent: {
width: "23%",
borderRadius: 8,
marginLeft: 5,
alignItems: "center",
justifyContent: "center",
flexDirection: "column",
1 month ago
marginBottom: 10,
1 month ago
},
groupItemContentText: {
fontSize: fontSize(12),
fontWeight: "400",
color: "#8f8684",
width: "100%",
textAlign: "center",
},
groupItemContentIcon: {
1 month ago
width: widthUtils(35, 40).width,
height: widthUtils(35, 40).height,
},
notLoggedInContainer: {
flex: 1,
alignItems: "center",
justifyContent: "center",
1 month ago
paddingBottom: 40,
},
loginButton: {
backgroundColor: "#ff701e",
1 month ago
paddingHorizontal: 30,
paddingVertical: 10,
borderRadius: 20,
marginTop: 20,
},
loginButtonText: {
color: "#fff",
1 month ago
fontSize: fontSize(16),
fontWeight: "600",
1 month ago
},
fixedLoginButton: {
backgroundColor: "#ff701e",
paddingHorizontal: 30,
paddingVertical: 10,
borderRadius: 20,
position: "absolute",
bottom: 20,
alignSelf: "center",
elevation: 5,
shadowColor: "#000",
shadowOffset: { width: 0, height: 2 },
shadowOpacity: 0.25,
shadowRadius: 3.84,
},
1 month ago
});