chargingDetailPage.tsx 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. import {
  2. View,
  3. Text,
  4. Pressable,
  5. Image,
  6. ScrollView,
  7. Alert,
  8. ImageBackground,
  9. ActivityIndicator,
  10. Dimensions
  11. } from 'react-native';
  12. import { SafeAreaView } from 'react-native-safe-area-context';
  13. import { router, useLocalSearchParams } from 'expo-router';
  14. import { CrossLogoSvg, PreviousPageBlackSvg } from '../../../../component/global/SVG';
  15. import { useEffect, useState } from 'react';
  16. import DisplayedOnlyCouponTabView from '../../../../component/global/displayedOnlyCouponTabView';
  17. import NotificationTabView from '../../../../component/global/notificationTabViewComponent';
  18. import { chargeStationService } from '../../../../service/chargeStationService';
  19. import { formatToChineseDateTime } from '../../../../util/lib';
  20. const ChargingDetailPage = () => {
  21. const screenHeight = Dimensions.get('window').height;
  22. const { promotion } = useLocalSearchParams();
  23. const promotionObj = JSON.parse(promotion as string);
  24. const [loading, setLoading] = useState(false);
  25. return (
  26. <SafeAreaView className="flex-1 bg-white" edges={['top', 'right', 'left']}>
  27. <ScrollView>
  28. {loading ? (
  29. <View className="items-center justify-center">
  30. <ActivityIndicator />
  31. </View>
  32. ) : (
  33. <View style={{ minHeight: screenHeight, flex: 1 }} className="mx-[5%]">
  34. <View style={{ marginTop: 25 }}>
  35. <Pressable
  36. onPress={() => {
  37. if (router.canGoBack()) {
  38. router.back();
  39. } else {
  40. router.replace('/notificationPage');
  41. }
  42. }}
  43. hitSlop={{ top: 20, bottom: 20, left: 20, right: 20 }}
  44. >
  45. <CrossLogoSvg />
  46. </Pressable>
  47. <Text style={{ fontSize: 45, marginVertical: 25 }}>詳情</Text>
  48. </View>
  49. <View className="space-y-2 ">
  50. <Text className="text-base lg:text-lg">充電完成</Text>
  51. <Text className="text-sm">親愛的用戶,您的愛車已充滿電完成!請盡快駛離充電站,以便其他車輛使用。感謝您的配合!</Text>
  52. <Text className="text-xs text-gray-500 pt-8 pb-4">
  53. 最新更新日期:{formatToChineseDateTime(promotionObj.updatedAt)}
  54. </Text>
  55. </View>
  56. </View>
  57. )}
  58. </ScrollView>
  59. </SafeAreaView>
  60. );
  61. };
  62. export default ChargingDetailPage;