accountSettingPageComponent.tsx 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. import { View, Text, ScrollView, Pressable } from 'react-native';
  2. import React, { useContext } from 'react';
  3. import { SafeAreaView } from 'react-native-safe-area-context';
  4. import { router } from 'expo-router';
  5. import { CrossLogoSvg, RightArrowIconSvg } from '../global/SVG';
  6. import { AuthContext } from '../../context/AuthProvider';
  7. const AccountSettingPageComponent = () => {
  8. const { user } = useContext(AuthContext);
  9. console.log(user);
  10. const genderText =
  11. user?.gender === 'woman'
  12. ? '女'
  13. : user?.gender === 'man'
  14. ? '男'
  15. : user?.gender;
  16. return (
  17. <SafeAreaView
  18. className="flex-1 bg-white"
  19. edges={['top', 'right', 'left']}
  20. >
  21. <ScrollView
  22. className="flex-1 mx-[5%]"
  23. showsVerticalScrollIndicator={false}
  24. >
  25. <View style={{ marginTop: 25 }}>
  26. <Pressable
  27. onPress={() => {
  28. if (router.canGoBack()) {
  29. router.back();
  30. } else {
  31. router.replace('/accountMainPage');
  32. }
  33. }}
  34. >
  35. <CrossLogoSvg />
  36. </Pressable>
  37. <Text style={{ fontSize: 45, marginVertical: 25 }}>
  38. 帳戶管理
  39. </Text>
  40. </View>
  41. <View>
  42. <View className="flex-col">
  43. <Pressable onPress={() => console.log('abc')}>
  44. <View className="flex-row items-center justify-between">
  45. <View className="flex-col py-4">
  46. <Text className="text-lg pb-1">
  47. 電郵地址
  48. </Text>
  49. <Text style={{ color: '#555555' }}>
  50. {user?.email}
  51. </Text>
  52. </View>
  53. <RightArrowIconSvg />
  54. </View>
  55. </Pressable>
  56. <View className="h-0.5 bg-[#f4f4f4] " />
  57. </View>
  58. <View className="flex-col ">
  59. <Pressable
  60. onPress={() => router.push('changePasswordPage')}
  61. >
  62. <View className="flex-row items-center justify-between">
  63. <View className="flex-col py-4">
  64. <Text className="text-lg pb-1">
  65. 帳戶密碼
  66. </Text>
  67. <Text style={{ color: '#555555' }}>
  68. ********
  69. </Text>
  70. </View>
  71. <RightArrowIconSvg />
  72. </View>
  73. </Pressable>
  74. <View className="h-0.5 bg-[#f4f4f4] " />
  75. </View>
  76. <View className="flex-col ">
  77. <Pressable
  78. onPress={() => router.push('changeNamePage')}
  79. >
  80. <View className="flex-row items-center justify-between">
  81. <View className="flex-col py-4">
  82. <Text className="text-lg pb-1">暱稱</Text>
  83. <Text style={{ color: '#555555' }}>
  84. {user?.nickname}
  85. </Text>
  86. </View>
  87. <RightArrowIconSvg />
  88. </View>
  89. </Pressable>
  90. <View className="h-0.5 bg-[#f4f4f4]" />
  91. </View>
  92. <View className="flex-col ">
  93. <Pressable
  94. onPress={() => router.push('changeGenderPage')}
  95. >
  96. <View className="flex-row items-center justify-between">
  97. <View className="flex-col py-4">
  98. <Text className="text-lg pb-1">性別</Text>
  99. <Text style={{ color: '#555555' }}>
  100. {genderText}
  101. </Text>
  102. </View>
  103. <RightArrowIconSvg />
  104. </View>
  105. </Pressable>
  106. <View className="h-0.5 bg-[#f4f4f4]" />
  107. </View>
  108. <View className="flex-col ">
  109. <Pressable
  110. onPress={() => router.push('changePhonePage')}
  111. >
  112. <View className="flex-row items-center justify-between">
  113. <View className="flex-co py-4">
  114. <Text className="text-lg pb-1">
  115. 電話號碼
  116. </Text>
  117. <Text style={{ color: '#555555' }}>
  118. {user?.phone
  119. ? `+852 ${user.phone}`
  120. : 'No phone number provided'}
  121. </Text>
  122. </View>
  123. <RightArrowIconSvg />
  124. </View>
  125. </Pressable>
  126. <View className="h-0.5 bg-[#f4f4f4]" />
  127. </View>
  128. </View>
  129. </ScrollView>
  130. </SafeAreaView>
  131. );
  132. };
  133. export default AccountSettingPageComponent;