chargingPenaltyComponent.tsx 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. import { View, Text, ScrollView, StyleSheet, Image } from 'react-native';
  2. import React from 'react';
  3. import { SafeAreaView } from 'react-native-safe-area-context';
  4. import NormalButton from '../global/normal_button';
  5. import ExpectedFeeBox from '../global/expectedFeeBox';
  6. import OtherInformationBox from '../global/otherInformationBox';
  7. import {
  8. BatteryLogoSvg,
  9. TimeClockLogoSvg,
  10. WarningTriangleLogoSvg
  11. } from '../global/SVG';
  12. import { router } from 'expo-router';
  13. const IdlingGreyBox = () => {
  14. return (
  15. <View className="flex-1 ">
  16. <View className="p-4 bg-[#5a5c7c] w-full rounded-t-xl flex-row items-center ">
  17. <WarningTriangleLogoSvg />
  18. <Text className="text-white font-black text-xl pl-4">
  19. 待機中..
  20. </Text>
  21. </View>
  22. <View className="bg-[#555776] rounded-b-xl p-6 space-y-1">
  23. <View className="flex-row items-center">
  24. <View className="w-[40%] ">
  25. <Text className="text-base text-white">
  26. 剩餘待機時間:
  27. </Text>
  28. </View>
  29. <View className="w-[60%]">
  30. <Text style={styles.warningBoldText}>01:55</Text>
  31. </View>
  32. </View>
  33. <View className="flex-row items-center ">
  34. <View>
  35. <Text className="text-sm text-white">
  36. 請於下方確認完成充電以免進入罰款時間
  37. </Text>
  38. </View>
  39. </View>
  40. </View>
  41. </View>
  42. );
  43. };
  44. const PenaltyRedBox = () => {
  45. return (
  46. <>
  47. <View className="bg-[#bb2d12] flex-1 p-4 rounded-t-xl flex-row items-center px-[5%]">
  48. <WarningTriangleLogoSvg />
  49. <Text className="text-white font-black text-xl pl-4">
  50. 罰款中
  51. </Text>
  52. </View>
  53. <View className="bg-[#b12a11] flex-column rounded-b-xl p-6">
  54. <View className="flex-1 flex-row items-center pb-2">
  55. <View className="w-[40%]">
  56. <Text style={styles.warningLightText}>
  57. 罰款時間歷時:
  58. </Text>
  59. </View>
  60. <View className="w-[60%]">
  61. <Text style={styles.warningBoldText}>01:55</Text>
  62. </View>
  63. </View>
  64. <View className="flex-1 flex-row items-center pb-2">
  65. <View className="w-[40%]">
  66. <Text style={styles.warningLightText}>累積:</Text>
  67. </View>
  68. <View className="w-[60%]">
  69. <Text style={styles.warningBoldText}>01:55</Text>
  70. </View>
  71. </View>
  72. <View className="flex-1 flex-row items-center pb-2">
  73. <View>
  74. <Text style={styles.warningLightText}>
  75. 請於下方確認完成充電以解鎖
  76. </Text>
  77. </View>
  78. </View>
  79. </View>
  80. </>
  81. );
  82. };
  83. const ChargingPenaltyPageComponent = () => {
  84. const [isIdling, setIsIdling] = React.useState<boolean>(false);
  85. return (
  86. <SafeAreaView
  87. className="flex-1 bg-white"
  88. edges={['top', 'left', 'right']}
  89. >
  90. <ScrollView className="flex-1" showsVerticalScrollIndicator={false}>
  91. <View className="mx-[5%]">
  92. <View className="my-4">
  93. <Text className="text-xl" style={styles.greenColor}>
  94. 已完成充電
  95. </Text>
  96. <Text className="text-2xl">TESLA Model 3</Text>
  97. </View>
  98. <View className="flex-row items-center ">
  99. <View className="w-[50%] items-center justify-center">
  100. <Image
  101. source={require('../../assets/car.png')}
  102. resizeMode="contain"
  103. style={{ height: 127, width: 220 }}
  104. />
  105. </View>
  106. <View className="w-[50%] flex-column items-center ">
  107. <View className="flex-row items-center space-x-4">
  108. <View>
  109. <BatteryLogoSvg />
  110. </View>
  111. <View className="flex-column">
  112. <Text
  113. className="text-sm"
  114. style={styles.grayColor}
  115. >
  116. 已充電
  117. </Text>
  118. <Text
  119. style={styles.greenColor}
  120. className="text-4xl font-light"
  121. >
  122. 95%
  123. </Text>
  124. </View>
  125. </View>
  126. <View className="flex-row items-center space-x-4">
  127. <View>
  128. <TimeClockLogoSvg />
  129. </View>
  130. <View className="flex-column">
  131. <Text
  132. className="text-sm"
  133. style={styles.grayColor}
  134. >
  135. 充電歷時
  136. </Text>
  137. <View className="flex-row items-end">
  138. <Text
  139. style={styles.greenColor}
  140. className="text-4xl font-light"
  141. >
  142. 39
  143. </Text>
  144. <Text
  145. style={styles.greenColor}
  146. className="text-sm font-light"
  147. >
  148. mins
  149. </Text>
  150. </View>
  151. </View>
  152. </View>
  153. </View>
  154. </View>
  155. {isIdling ? (
  156. <View className=" flex-column py-3">
  157. <IdlingGreyBox />
  158. </View>
  159. ) : (
  160. <View className="flex-column py-3">
  161. <PenaltyRedBox />
  162. </View>
  163. )}
  164. <View>
  165. <NormalButton
  166. onPress={() => {
  167. router.push('paymentSummaryPage');
  168. }}
  169. title={
  170. <Text
  171. className="text-xl text-white "
  172. style={{ fontWeight: 900 }}
  173. >
  174. 完成充電
  175. </Text>
  176. }
  177. />
  178. </View>
  179. <ExpectedFeeBox
  180. extendedStyle={{ marginTop: 12, padding: 12 }}
  181. />
  182. <OtherInformationBox
  183. extendedStyle={{ marginTop: 12, padding: 12 }}
  184. />
  185. <View className="mt-2">
  186. <NormalButton
  187. title={
  188. <Text className="text-white text-3xl">
  189. SET IDLING
  190. </Text>
  191. }
  192. onPress={() =>
  193. setIsIdling((prevState) => !prevState)
  194. }
  195. />
  196. </View>
  197. </View>
  198. </ScrollView>
  199. </SafeAreaView>
  200. );
  201. };
  202. export default ChargingPenaltyPageComponent;
  203. const styles = StyleSheet.create({
  204. grayColor: {
  205. color: '#888888'
  206. },
  207. greenColor: {
  208. color: '#02677D'
  209. },
  210. text: {
  211. fontWeight: '300',
  212. color: '#000000'
  213. },
  214. warningLightText: {
  215. color: 'white',
  216. fontSize: 15,
  217. fontWeight: '400'
  218. },
  219. warningBoldText: {
  220. color: 'white',
  221. fontSize: 20,
  222. fontWeight: '700'
  223. }
  224. });