chargingPage.tsx 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221
  1. import { View, Text, ScrollView, StyleSheet, Image } from 'react-native';
  2. import { SafeAreaView } from 'react-native-safe-area-context';
  3. import Svg, { Path } from 'react-native-svg';
  4. import RippleEffectBatteryIcon from '../global/rippleEffectBatteryIcon';
  5. import LoadingDots from '../global/loadingDots';
  6. import NormalButton from '../global/normal_button';
  7. const LightingLogoSvg = () => (
  8. <Svg width="21" height="30" viewBox="0 0 21 30" fill="none">
  9. <Path
  10. d="M5.75631 29.8077L7.42297 18.3333H0.3396L12.8076 0.352539H13.5768L11.9422 13.3333H20.2756L6.52552 29.8077H5.75631Z"
  11. fill="#02677D"
  12. />
  13. </Svg>
  14. );
  15. const BatteryIconSvg = () => (
  16. <Svg width="20" height="31" viewBox="0 0 20 31" fill="none">
  17. <Path
  18. d="M15.1282 30.8013V26.4103H12.5641L16.5384 19.1987V23.5898H19.1026L15.1282 30.8013ZM1.98716 30C1.60574 30 1.28603 29.871 1.02803 29.613C0.770005 29.355 0.640991 29.0353 0.640991 28.6539V3.81408C0.640991 3.4327 0.770005 3.11299 1.02803 2.85496C1.28603 2.59696 1.60574 2.46796 1.98716 2.46796H4.67949V0H10.3205V2.46796H13.0194C13.4018 2.46796 13.7206 2.59696 13.9759 2.85496C14.2313 3.11299 14.359 3.4327 14.359 3.81408V15.3205C11.9872 15.6261 9.99466 16.68 8.38141 18.4824C6.76816 20.2847 5.96153 22.4252 5.96153 24.9038C5.96153 25.8398 6.0876 26.7383 6.33974 27.5994C6.59188 28.4605 6.96046 29.2607 7.44549 30H1.98716Z"
  19. fill="#02677D"
  20. />
  21. </Svg>
  22. );
  23. const TemperatureIconSvg = () => (
  24. <Svg width="15" height="30" viewBox="0 0 15 30" fill="none">
  25. <Path
  26. d="M7.50004 30C5.64321 30 4.06789 29.3531 2.77408 28.0593C1.48028 26.7655 0.833374 25.1902 0.833374 23.3333C0.833374 22.1282 1.13037 21.0187 1.72437 20.0048C2.3184 18.9909 3.13251 18.1773 4.16671 17.5641V3.33333C4.16671 2.39317 4.48722 1.60257 5.12825 0.961543C5.76928 0.320515 6.55987 0 7.50004 0C8.44021 0 9.2308 0.320515 9.87183 0.961543C10.5129 1.60257 10.8334 2.39317 10.8334 3.33333V17.5641C11.8676 18.1773 12.6817 18.9909 13.2757 20.0048C13.8697 21.0187 14.1667 22.1282 14.1667 23.3333C14.1667 25.1902 13.5198 26.7655 12.226 28.0593C10.9322 29.3531 9.35687 30 7.50004 30ZM5.83337 13.9744H9.16671V11.4744H7.50004V10.1923H9.16671V6.47438H7.50004V5.19229H9.16671V3.33333C9.16671 2.86111 9.00698 2.46528 8.68754 2.14583C8.3681 1.82639 7.97226 1.66667 7.50004 1.66667C7.02782 1.66667 6.63198 1.82639 6.31254 2.14583C5.9931 2.46528 5.83337 2.86111 5.83337 3.33333V13.9744Z"
  27. fill="#02677D"
  28. />
  29. </Svg>
  30. );
  31. const ChargingPage = () => {
  32. return (
  33. <SafeAreaView
  34. style={{ flex: 1, backgroundColor: 'white' }}
  35. edges={['top', 'left', 'right']}
  36. >
  37. <ScrollView className="flex-1">
  38. <View className="h-[130vh] mx-[5%] space-y-4">
  39. <View className="items-center">
  40. <View className="mt-6 mb-4">
  41. <Text className="text-lg ">現正充電中:</Text>
  42. </View>
  43. <Text className="text-4xl font-light">
  44. TESLA Model 3
  45. </Text>
  46. </View>
  47. <View className="items-center">
  48. <Text className="text-lg" style={styles.grayColor}>
  49. 充電中
  50. </Text>
  51. <View className="flex-row space-x-4 p-4 pr-8 items-center">
  52. <RippleEffectBatteryIcon />
  53. <Text
  54. style={{
  55. color: '#02677D',
  56. fontSize: 60,
  57. fontWeight: 300
  58. }}
  59. >
  60. 55%
  61. <LoadingDots />
  62. </Text>
  63. </View>
  64. <Text className="text-lg mb-6" style={styles.grayColor}>
  65. 尚餘時間 ~48 mins
  66. </Text>
  67. <View className="mb-[-10] items-center justify-center ">
  68. <Image
  69. source={require('../../assets/car1.png')}
  70. style={{ width: 430, height: 200 }}
  71. resizeMode="contain"
  72. />
  73. </View>
  74. </View>
  75. <View
  76. className="h-[220px] min-h-[20px] border-slate-300 rounded-2xl flex-column"
  77. style={{ borderWidth: 1 }}
  78. >
  79. {/* Top */}
  80. <View className="h-[65%] flex-row justify-evenly items-center">
  81. <View className="flex-1 flex-column items-center space-y-2">
  82. <LightingLogoSvg />
  83. <Text
  84. style={styles.grayColor}
  85. className="text-base"
  86. >
  87. 充電功率
  88. </Text>
  89. <Text
  90. style={styles.greenColor}
  91. className="font-bold text-base"
  92. >
  93. 22.1kW
  94. </Text>
  95. </View>
  96. <View className="flex-1 flex-column items-center space-y-2">
  97. <BatteryIconSvg />
  98. <Text
  99. style={styles.grayColor}
  100. className="text-base"
  101. >
  102. 實際功率
  103. </Text>
  104. <Text
  105. style={styles.greenColor}
  106. className="font-bold text-base"
  107. >
  108. 30.0kW
  109. </Text>
  110. </View>
  111. <View className="flex-1 flex-column items-center space-y-2">
  112. <TemperatureIconSvg />
  113. <Text
  114. style={styles.grayColor}
  115. className="text-base"
  116. >
  117. 溫度
  118. </Text>
  119. <Text
  120. style={styles.greenColor}
  121. className="font-bold text-base"
  122. >
  123. 36°c
  124. </Text>
  125. </View>
  126. </View>
  127. <View className="mx-[5%]">
  128. <View className="h-[1px] w-[100%] bg-[#CCCCCC]" />
  129. </View>
  130. {/* bottom container */}
  131. <View className="h-[35%] mx-[5%] justify-center ">
  132. <Text
  133. style={styles.grayColor}
  134. className="text-base"
  135. >
  136. 充電歷時 ~12mins
  137. </Text>
  138. </View>
  139. </View>
  140. <View
  141. className="h-[8%] min-h-[20px] border-slate-300 rounded-2xl justify-center"
  142. style={{ borderWidth: 1 }}
  143. >
  144. <View className="mx-[5%] flex-row items-center justify-between">
  145. <View>
  146. <Text className="text-lg">預計充電費用</Text>
  147. <Text
  148. className="text-base"
  149. style={styles.grayColor}
  150. >
  151. 按每度電結算: 50 kWh
  152. </Text>
  153. </View>
  154. <Text className="text-3xl">HK$ 175</Text>
  155. </View>
  156. </View>
  157. <View
  158. className="h-[10%] border-slate-300 rounded-2xl justify-center pl-4"
  159. style={{ borderWidth: 1 }}
  160. >
  161. <Text className="text-lg ">其他資訊</Text>
  162. <View className="flex-row">
  163. <View className="flex-1 flex-column">
  164. <Text
  165. className="text-base"
  166. style={styles.grayColor}
  167. >
  168. 開始時間
  169. </Text>
  170. <Text className="text-base">16:33:04</Text>
  171. </View>
  172. <View className="flex-1 flex-column">
  173. <Text
  174. className="text-base"
  175. style={styles.grayColor}
  176. >
  177. 充電座
  178. </Text>
  179. <Text className="text-base">A104</Text>
  180. </View>
  181. </View>
  182. </View>
  183. <View className="w-full ">
  184. <NormalButton
  185. onPress={() => {
  186. console.log('完成充電');
  187. }}
  188. title={
  189. <Text
  190. className="text-xl text-white"
  191. style={{ fontWeight: 900 }}
  192. >
  193. 完成充電
  194. </Text>
  195. }
  196. />
  197. </View>
  198. </View>
  199. </ScrollView>
  200. </SafeAreaView>
  201. );
  202. };
  203. export default ChargingPage;
  204. const styles = StyleSheet.create({
  205. grayColor: {
  206. color: '#888888'
  207. },
  208. greenColor: {
  209. color: '#02677D'
  210. },
  211. text: {
  212. fontWeight: 300,
  213. color: '#000000'
  214. }
  215. });