chargingDetailPage.tsx 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. // app/(auth)/(tabs)/(home)/chargingDetailPage.tsx
  2. import {
  3. View,
  4. Text,
  5. Pressable,
  6. Image,
  7. ScrollView,
  8. Alert,
  9. ImageBackground,
  10. ActivityIndicator,
  11. Dimensions
  12. } from 'react-native';
  13. import { SafeAreaView } from 'react-native-safe-area-context';
  14. import { router, useLocalSearchParams } from 'expo-router';
  15. import { CrossLogoSvg, PreviousPageBlackSvg } from '../../../../component/global/SVG';
  16. import { useEffect, useState } from 'react';
  17. import DisplayedOnlyCouponTabView from '../../../../component/global/displayedOnlyCouponTabView';
  18. import NotificationTabView from '../../../../component/global/notificationTabViewComponent';
  19. import { chargeStationService } from '../../../../service/chargeStationService';
  20. import { formatToChineseDateTime } from '../../../../util/lib';
  21. import { useTranslation } from '../../../../util/hooks/useTranslation';
  22. const ChargingDetailPage = () => {
  23. const { t } = useTranslation();
  24. const screenHeight = Dimensions.get('window').height;
  25. const { promotion } = useLocalSearchParams();
  26. const promotionObj = JSON.parse(promotion as string);
  27. const [loading, setLoading] = useState(false);
  28. return (
  29. <SafeAreaView className="flex-1 bg-white" edges={['top', 'right', 'left']}>
  30. <ScrollView>
  31. {loading ? (
  32. <View className="items-center justify-center">
  33. <ActivityIndicator />
  34. </View>
  35. ) : (
  36. <View style={{ minHeight: screenHeight, flex: 1 }} className="mx-[5%]">
  37. <View style={{ marginTop: 25 }}>
  38. <Pressable
  39. onPress={() => {
  40. if (router.canGoBack()) {
  41. router.back();
  42. } else {
  43. router.replace('/notificationPage');
  44. }
  45. }}
  46. hitSlop={{ top: 20, bottom: 20, left: 20, right: 20 }}
  47. >
  48. <CrossLogoSvg />
  49. </Pressable>
  50. <Text style={{ fontSize: 45, marginVertical: 25 }}>{t('notifications.charging_detail.title')}</Text>
  51. </View>
  52. <View className="space-y-2 ">
  53. <Text className="text-base lg:text-lg">{t('notifications.charging_detail.charging_completed')}</Text>
  54. <Text className="text-sm">{t('notifications.charging_detail.charging_completed_message')}</Text>
  55. <Text className="text-xs text-gray-500 pt-8 pb-4">
  56. {t('notifications.charging_detail.last_updated')}: {formatToChineseDateTime(promotionObj.updatedAt)}
  57. </Text>
  58. </View>
  59. </View>
  60. )}
  61. </ScrollView>
  62. </SafeAreaView>
  63. );
  64. };
  65. export default ChargingDetailPage;