accountMainPageComponent.tsx 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. import { View, Text, ScrollView, Image, Switch, 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 { useColorScheme } from 'nativewind';
  6. import { useState, useEffect } from 'react';
  7. import {
  8. AccountSettingIconSvg,
  9. ActivitySvg,
  10. MyCarSvg,
  11. DarkModeSvg,
  12. QuestionMarkIconSvg,
  13. SettingIconSvg,
  14. VipCodeIcoonSvg,
  15. WalletSvg
  16. } from '../global/SVG';
  17. const AccountMainPageComponent = () => {
  18. const { user, logout } = useAuth();
  19. const { colorScheme, toggleColorScheme } = useColorScheme();
  20. const screenWidth = Dimensions.get('window').width;
  21. const imageWidth = screenWidth * 0.9; // 90% of screen width
  22. const aspectRatio = 210 / 375;
  23. return (
  24. <SafeAreaView className="flex-1 bg-white dark:bg-[#05181C]" edges={['top', 'left', 'right']}>
  25. <ScrollView className="flex-1 mx-[5%]" showsVerticalScrollIndicator={false}>
  26. <View style={{ marginTop: 25 }}>
  27. <Text style={{ fontSize: 48 }} className="text-black dark:text-white">
  28. {user?.nickname}
  29. </Text>
  30. </View>
  31. <View className="flex-row space-x-4 mt-4 ">
  32. <Pressable
  33. className="h-[114px] w-[30%] bg-[#e7f2f8] dark:bg-[#253336] items-center justify-center rounded-xl"
  34. onPress={() => router.push('/(account)/(wallet)/walletPage')}
  35. >
  36. <WalletSvg isDark={colorScheme == 'dark'} />
  37. <Text className="text-black dark:text-[#36DFFF]">錢包</Text>
  38. </Pressable>
  39. {/* <Pressable
  40. className="h-[114px] w-[30%] bg-[#e7f2f8] items-center justify-center rounded-xl"
  41. onPress={() => router.replace('myVehiclePage')}
  42. >
  43. <MyCarSvg />
  44. <Text>我的車輛</Text>
  45. </Pressable> */}
  46. <Pressable
  47. className="h-[114px] w-[30%] bg-[#e7f2f8] dark:bg-[#253336] items-center justify-center rounded-xl"
  48. onPress={() => router.replace('vipQrPage')}
  49. >
  50. <VipCodeIcoonSvg isDark={colorScheme == 'dark'} />
  51. <Text className="text-black dark:text-[#36DFFF]">VIP Code</Text>
  52. </Pressable>
  53. <Pressable
  54. className="h-[114px] w-[30%] bg-[#e7f2f8] dark:bg-[#253336] items-center justify-center rounded-xl"
  55. onPress={() => router.push('/activityRecordPage')}
  56. >
  57. <ActivitySvg isDark={colorScheme == 'dark'} />
  58. <Text className="text-black dark:text-[#36DFFF]">充電記錄</Text>
  59. </Pressable>
  60. </View>
  61. <View className="my-4 ">
  62. <Pressable onPress={() => router.push('uberVerificationPage')}>
  63. <Image
  64. resizeMode="contain"
  65. source={require('../../assets/uber20008.png')}
  66. style={{ width: imageWidth, height: imageWidth * aspectRatio, alignSelf: 'center' }}
  67. />
  68. </Pressable>
  69. </View>
  70. <View className="w-full h-1 bg-[#DBE4E8] dark:bg-[#253336]" />
  71. <View>
  72. <View className="py-4">
  73. <Pressable
  74. onPress={() => router.push('/accountSettingPage')}
  75. className="flex-row items-center"
  76. hitSlop={{
  77. top: 10,
  78. bottom: 10,
  79. left: 10,
  80. right: 10
  81. }}
  82. >
  83. <AccountSettingIconSvg isDark={colorScheme == 'dark'} />
  84. <Text className="text-lg pl-2 text-black dark:text-white">帳戶管理</Text>
  85. </Pressable>
  86. </View>
  87. <View className="h-0.5 bg-[#f4f4f4] dark:bg-[#5E6C70]" />
  88. <View className=" py-4 ">
  89. <Pressable
  90. onPress={() => router.push('/assistancePage')}
  91. className="flex-row items-center"
  92. hitSlop={{
  93. top: 10,
  94. bottom: 10,
  95. left: 10,
  96. right: 10
  97. }}
  98. >
  99. <QuestionMarkIconSvg isDark={colorScheme == 'dark'} />
  100. <Text className="text-lg pl-2 text-black dark:text-white">排除解難</Text>
  101. </Pressable>
  102. </View>
  103. {/* <View className="h-0.5 bg-[#f4f4f4] dark:bg-[#5E6C70]" />
  104. <View className=" py-4 ">
  105. <Pressable
  106. // onPress={() => router.push('/assistancePage')}
  107. className="flex-row items-center"
  108. hitSlop={{
  109. top: 10,
  110. bottom: 10,
  111. left: 10,
  112. right: 10
  113. }}
  114. >
  115. <View className="flex flex-row justify-between w-full">
  116. <View className="flex flex-row items-center">
  117. <DarkModeSvg isDark={colorScheme == 'dark'} />
  118. <Text className="text-lg pl-2 text-black dark:text-white">深色模式</Text>
  119. </View>
  120. <Switch value={colorScheme == 'dark'} onChange={toggleColorScheme} />
  121. </View>
  122. </Pressable>
  123. </View> */}
  124. <View className="h-0.5 bg-[#f4f4f4] dark:bg-[#5E6C70]" />
  125. <View className="py-4">
  126. <Pressable
  127. onPress={logout}
  128. className="flex-row items-center"
  129. hitSlop={{
  130. top: 10,
  131. bottom: 10,
  132. left: 10,
  133. right: 10
  134. }}
  135. >
  136. <SettingIconSvg isDark={colorScheme == 'dark'} />
  137. <Text className="text-lg pl-2 text-black dark:text-white">登出</Text>
  138. </Pressable>
  139. </View>
  140. <View className="h-0.5 bg-[#f4f4f4] dark:bg-[#5E6C70]" />
  141. </View>
  142. </ScrollView>
  143. </SafeAreaView>
  144. );
  145. };
  146. export default AccountMainPageComponent;