accountMainPageComponent.tsx 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. import { View, Text, ScrollView, Image, Pressable, Dimensions } from 'react-native';
  2. import { SafeAreaView } from 'react-native-safe-area-context';
  3. import { router } from 'expo-router';
  4. import { useAuth } from '../../context/AuthProvider';
  5. import {
  6. AccountSettingIconSvg,
  7. ActivitySvg,
  8. MyCarSvg,
  9. QuestionMarkIconSvg,
  10. SettingIconSvg,
  11. WalletSvg
  12. } from '../global/SVG';
  13. const AccountMainPageComponent = () => {
  14. const { user, logout } = useAuth();
  15. const screenWidth = Dimensions.get('window').width;
  16. const imageWidth = screenWidth * 0.9; // 90% of screen width
  17. const aspectRatio = 210 / 375;
  18. return (
  19. <SafeAreaView className="flex-1 bg-white" edges={['top', 'left', 'right']}>
  20. <ScrollView className="flex-1 mx-[5%]" showsVerticalScrollIndicator={false}>
  21. <View style={{ marginTop: 25 }}>
  22. <Text style={{ fontSize: 48 }}>{user?.nickname}</Text>
  23. </View>
  24. <View className="flex-row space-x-4 mt-4">
  25. <Pressable
  26. className="h-[114px] w-[30%] bg-[#e7f2f8] items-center justify-center rounded-xl"
  27. onPress={() => router.push('/(account)/(wallet)/walletPage')}
  28. >
  29. <WalletSvg />
  30. <Text>錢包</Text>
  31. </Pressable>
  32. <Pressable
  33. className="h-[114px] w-[30%] bg-[#e7f2f8] items-center justify-center rounded-xl"
  34. onPress={() => router.replace('myVehiclePage')}
  35. >
  36. <MyCarSvg />
  37. <Text>我的車輛</Text>
  38. </Pressable>
  39. <Pressable
  40. className="h-[114px] w-[30%] bg-[#e7f2f8] items-center justify-center rounded-xl"
  41. onPress={() => router.push('/activityRecordPage')}
  42. >
  43. <ActivitySvg />
  44. <Text>活動記錄</Text>
  45. </Pressable>
  46. </View>
  47. <View className="my-4 ">
  48. <Pressable onPress={() => router.push('uberVerificationPage')}>
  49. <Image
  50. resizeMode="contain"
  51. source={require('../../assets/uber208.png')}
  52. style={{ width: imageWidth, height: imageWidth * aspectRatio, alignSelf: 'center' }}
  53. />
  54. </Pressable>
  55. </View>
  56. <View className="w-full h-1 bg-[#DBE4E8]" />
  57. <View>
  58. <View className="py-4">
  59. <Pressable
  60. onPress={() => router.push('/accountSettingPage')}
  61. className="flex-row items-center"
  62. hitSlop={{
  63. top: 10,
  64. bottom: 10,
  65. left: 10,
  66. right: 10
  67. }}
  68. >
  69. <AccountSettingIconSvg />
  70. <Text className="text-lg pl-2">帳戶管理</Text>
  71. </Pressable>
  72. </View>
  73. <View className="h-0.5 bg-[#f4f4f4]" />
  74. <View className=" py-4 ">
  75. <Pressable
  76. onPress={() => router.push('/assistancePage')}
  77. className="flex-row items-center"
  78. hitSlop={{
  79. top: 10,
  80. bottom: 10,
  81. left: 10,
  82. right: 10
  83. }}
  84. >
  85. <QuestionMarkIconSvg />
  86. <Text className="text-lg pl-2">排除解難</Text>
  87. </Pressable>
  88. </View>
  89. <View className="h-0.5 bg-[#f4f4f4]" />
  90. <View className="py-4">
  91. <Pressable
  92. onPress={logout}
  93. className="flex-row items-center"
  94. hitSlop={{
  95. top: 10,
  96. bottom: 10,
  97. left: 10,
  98. right: 10
  99. }}
  100. >
  101. <SettingIconSvg />
  102. <Text className="text-lg pl-2">登出</Text>
  103. </Pressable>
  104. </View>
  105. <View className="h-0.5 bg-[#f4f4f4]" />
  106. </View>
  107. </ScrollView>
  108. </SafeAreaView>
  109. );
  110. };
  111. export default AccountMainPageComponent;