accountSettingPageComponent.tsx 4.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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 = user?.gender === 'woman' ? '女' : user?.gender === 'man' ? '男' : user?.gender;
  11. return (
  12. <SafeAreaView className="flex-1 bg-white" edges={['top', 'right', 'left']}>
  13. <ScrollView className="flex-1 mx-[5%]" showsVerticalScrollIndicator={false}>
  14. <View style={{ marginTop: 25 }}>
  15. <Pressable
  16. onPress={() => {
  17. router.replace('/accountMainPage');
  18. }}
  19. >
  20. <CrossLogoSvg />
  21. </Pressable>
  22. <Text style={{ fontSize: 45, marginVertical: 25 }}>帳戶管理</Text>
  23. </View>
  24. <View>
  25. <View className="flex-col">
  26. <Pressable onPress={() => console.log('abc')}>
  27. <View className="flex-row items-center justify-between">
  28. <View className="flex-col py-4">
  29. <Text className="text-lg pb-1">電郵地址</Text>
  30. <Text style={{ color: '#555555' }}>{user?.email}</Text>
  31. </View>
  32. <RightArrowIconSvg />
  33. </View>
  34. </Pressable>
  35. <View className="h-0.5 bg-[#f4f4f4] " />
  36. </View>
  37. <View className="flex-col ">
  38. <Pressable onPress={() => router.push('changePasswordPage')}>
  39. <View className="flex-row items-center justify-between">
  40. <View className="flex-col py-4">
  41. <Text className="text-lg pb-1">帳戶密碼</Text>
  42. <Text style={{ color: '#555555' }}>********</Text>
  43. </View>
  44. <RightArrowIconSvg />
  45. </View>
  46. </Pressable>
  47. <View className="h-0.5 bg-[#f4f4f4] " />
  48. </View>
  49. <View className="flex-col ">
  50. <Pressable onPress={() => router.push('changeNamePage')}>
  51. <View className="flex-row items-center justify-between">
  52. <View className="flex-col py-4">
  53. <Text className="text-lg pb-1">暱稱</Text>
  54. <Text style={{ color: '#555555' }}>{user?.nickname}</Text>
  55. </View>
  56. <RightArrowIconSvg />
  57. </View>
  58. </Pressable>
  59. <View className="h-0.5 bg-[#f4f4f4]" />
  60. </View>
  61. <View className="flex-col ">
  62. <Pressable onPress={() => router.push('changeGenderPage')}>
  63. <View className="flex-row items-center justify-between">
  64. <View className="flex-col py-4">
  65. <Text className="text-lg pb-1">性別</Text>
  66. <Text style={{ color: '#555555' }}>{genderText}</Text>
  67. </View>
  68. <RightArrowIconSvg />
  69. </View>
  70. </Pressable>
  71. <View className="h-0.5 bg-[#f4f4f4]" />
  72. </View>
  73. <View className="flex-col ">
  74. <Pressable onPress={() => router.push('changePhonePage')}>
  75. <View className="flex-row items-center justify-between">
  76. <View className="flex-co py-4">
  77. <Text className="text-lg pb-1">電話號碼</Text>
  78. <Text style={{ color: '#555555' }}>
  79. {user?.phone ? `+852 ${user.phone}` : 'No phone number provided'}
  80. </Text>
  81. </View>
  82. <RightArrowIconSvg />
  83. </View>
  84. </Pressable>
  85. <View className="h-0.5 bg-[#f4f4f4]" />
  86. </View>
  87. </View>
  88. </ScrollView>
  89. </SafeAreaView>
  90. );
  91. };
  92. export default AccountSettingPageComponent;