homePage.tsx 4.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. import { View, Text, ScrollView, FlatList } from 'react-native';
  2. import NormalButton from '../global/normal_button';
  3. import NormalInput from '../global/normal_input';
  4. import { SafeAreaView } from 'react-native-safe-area-context';
  5. import { router } from 'expo-router';
  6. import RecentlyBookedScrollView from '../global/recentlyBookedScrollView';
  7. import { BellIconSvg, HomeIconSvg } from '../global/SVG';
  8. import { AuthContext } from '../../context/AuthProvider';
  9. import { useContext, useEffect } from 'react';
  10. interface HomePageProps {}
  11. const HomePage: React.FC<HomePageProps> = () => {
  12. const { user } = useContext(AuthContext);
  13. return (
  14. <SafeAreaView
  15. edges={['top', 'left', 'right']}
  16. className="flex-1 bg-white"
  17. >
  18. <ScrollView
  19. showsVerticalScrollIndicator={false}
  20. className="flex-1 mx-[5%] mt-8 "
  21. >
  22. <View className="">
  23. <View className="flex-row items-center pb-4">
  24. <HomeIconSvg />
  25. <View className="pl-2 flex-1 flex-column ">
  26. <View className="flex-row justify-between">
  27. <Text className="text-lg pb-1">你好!</Text>
  28. <BellIconSvg />
  29. </View>
  30. <Text className="text-4xl font-light ">
  31. {user?.nickname}
  32. </Text>
  33. </View>
  34. </View>
  35. <NormalInput
  36. placeholder="搜尋充電站或地區"
  37. onChangeText={() => console.log('abc')}
  38. />
  39. </View>
  40. {/* ************************近期預約過************************ */}
  41. <RecentlyBookedScrollView />
  42. {/* ************************Bottom Button Groups************************ */}
  43. <View className="">
  44. <View className=" mb-4">
  45. <NormalButton
  46. onPress={() => console.log('掃瞄及充電')}
  47. title={
  48. <Text className="text-white font-bold text-lg">
  49. 掃瞄及充電
  50. </Text>
  51. }
  52. extendedStyle={{
  53. alignItems: 'flex-start',
  54. padding: 24
  55. }}
  56. />
  57. </View>
  58. <View className="flex-1 flex-row justify-between gap-6">
  59. <View className="flex-1">
  60. <NormalButton
  61. onPress={() => router.push('bookingMenuPage')}
  62. title={
  63. <Text className="text-white font-bold text-lg">
  64. 我的預約
  65. </Text>
  66. }
  67. extendedStyle={{
  68. alignItems: 'flex-start',
  69. padding: 24
  70. }}
  71. />
  72. </View>
  73. <View className="flex-1">
  74. <NormalButton
  75. onPress={() => router.push('/k')}
  76. title={
  77. <Text className="text-white font-bold text-lg">
  78. 我的車輛
  79. </Text>
  80. }
  81. extendedStyle={{
  82. alignItems: 'flex-start',
  83. padding: 24
  84. }}
  85. />
  86. </View>
  87. </View>
  88. </View>
  89. </ScrollView>
  90. </SafeAreaView>
  91. );
  92. };
  93. export default HomePage;