|
@@ -3,10 +3,9 @@
|
|
|
* @邠心vbe on 2023/02/03
|
|
* @邠心vbe on 2023/02/03
|
|
|
*/
|
|
*/
|
|
|
import React from 'react';
|
|
import React from 'react';
|
|
|
-import { Pressable, StyleSheet, Text, View } from 'react-native';
|
|
|
|
|
|
|
+import { Pressable, StyleSheet, View } from 'react-native';
|
|
|
import TextView from '../../components/TextView';
|
|
import TextView from '../../components/TextView';
|
|
|
import utils from '../../utils/utils';
|
|
import utils from '../../utils/utils';
|
|
|
-import Provider from '../charge/Provider';
|
|
|
|
|
import ConnectType from './ConnectType';
|
|
import ConnectType from './ConnectType';
|
|
|
import app from '../../../app.json';
|
|
import app from '../../../app.json';
|
|
|
import Button from '../../components/Button';
|
|
import Button from '../../components/Button';
|
|
@@ -35,48 +34,64 @@ export default ListViewV2 = ({item, index, separators, onPress, onFavorite}) =>
|
|
|
<ConnectType color={textCancel} {...item.acConnector}/>
|
|
<ConnectType color={textCancel} {...item.acConnector}/>
|
|
|
<ConnectType color={textCancel} {...item.dcConnector}/>
|
|
<ConnectType color={textCancel} {...item.dcConnector}/>
|
|
|
</View>
|
|
</View>
|
|
|
- <View style={ui.flexc}>
|
|
|
|
|
- <TextView style={[styles.infoStatus, styles.available]}>{item.distance}</TextView>
|
|
|
|
|
- {item.allConnector && item.allConnector.available > 0 &&
|
|
|
|
|
- <TextView style={[styles.infoStatus, styles.available]}>{$t('charging.statusAvailable')}</TextView>
|
|
|
|
|
- }
|
|
|
|
|
- {item.siteType == "Private" &&
|
|
|
|
|
- <TextView style={[styles.infoStatus, styles.private]}>{$t('home.statusPrivate')}</TextView>
|
|
|
|
|
- }
|
|
|
|
|
- </View>
|
|
|
|
|
</View>
|
|
</View>
|
|
|
- { app.modules.bookmarks &&
|
|
|
|
|
|
|
+ { item.upcoming
|
|
|
|
|
+ ? <View style={[ui.center, $margin(0, 8)]}>
|
|
|
|
|
+ <MaterialIcons
|
|
|
|
|
+ name="upcoming"
|
|
|
|
|
+ size={42}
|
|
|
|
|
+ color={colorAccent}
|
|
|
|
|
+ style={styles.upcomingIcon} />
|
|
|
|
|
+ <TextView style={styles.upcomingText}>{$t("home.upcoming")}</TextView>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ : <>
|
|
|
|
|
+ { app.modules.bookmarks &&
|
|
|
|
|
+ <Pressable
|
|
|
|
|
+ style={[styles.directIconView, {backgroundColor: item.favorite ? colorPrimary : colorCancel}]}
|
|
|
|
|
+ android_ripple={rippleLess}
|
|
|
|
|
+ onPress={onFavorite}>
|
|
|
|
|
+ <MaterialIcons
|
|
|
|
|
+ name="star"
|
|
|
|
|
+ size={22}
|
|
|
|
|
+ color={colorLight}/>
|
|
|
|
|
+ </Pressable>
|
|
|
|
|
+ }
|
|
|
<Pressable
|
|
<Pressable
|
|
|
- style={[styles.directIconView, {backgroundColor: item.favorite ? colorPrimary : colorCancel}]}
|
|
|
|
|
|
|
+ style={styles.directIconView}
|
|
|
android_ripple={rippleLess}
|
|
android_ripple={rippleLess}
|
|
|
- onPress={onFavorite}>
|
|
|
|
|
- <MaterialIcons
|
|
|
|
|
- name="star"
|
|
|
|
|
|
|
+ onPress={() => {
|
|
|
|
|
+ utils.directMaps(item.latitude, item.longitude, item.address);
|
|
|
|
|
+ }}>
|
|
|
|
|
+ <MaterialCommunityIcons
|
|
|
|
|
+ name="navigation-variant"
|
|
|
size={22}
|
|
size={22}
|
|
|
color={colorLight}/>
|
|
color={colorLight}/>
|
|
|
</Pressable>
|
|
</Pressable>
|
|
|
|
|
+ {/* <Pressable
|
|
|
|
|
+ style={styles.directView}
|
|
|
|
|
+ onPress={() => {
|
|
|
|
|
+ utils.directMaps(item.latitude, item.longitude, item.address);
|
|
|
|
|
+ }}>
|
|
|
|
|
+ <MaterialIcons
|
|
|
|
|
+ name='directions'
|
|
|
|
|
+ size={32}
|
|
|
|
|
+ color={colorAccent}/>
|
|
|
|
|
+ </Pressable> */}
|
|
|
|
|
+ </> }
|
|
|
|
|
+ </View>
|
|
|
|
|
+ <View style={styles.labelRows}>
|
|
|
|
|
+ <TextView style={[styles.infoStatus, styles.distance]}>{item.distance}</TextView>
|
|
|
|
|
+ {item.allConnector && item.allConnector.available > 0 &&
|
|
|
|
|
+ <TextView style={[styles.infoStatus, styles.available]}>{$t('charging.statusAvailable')}</TextView>
|
|
|
|
|
+ }
|
|
|
|
|
+ {item.siteType == "Private" &&
|
|
|
|
|
+ <TextView style={[styles.infoStatus, styles.private]}>{$t('home.statusPrivate')}</TextView>
|
|
|
|
|
+ }
|
|
|
|
|
+ { utils.isNotEmpty(item?.labels) &&
|
|
|
|
|
+ item?.labels.map((label, idx) =>
|
|
|
|
|
+ <TextView key={idx} style={[styles.infoStatus, styles.labels]}>{label}</TextView>
|
|
|
|
|
+ )
|
|
|
}
|
|
}
|
|
|
- <Pressable
|
|
|
|
|
- style={styles.directIconView}
|
|
|
|
|
- android_ripple={rippleLess}
|
|
|
|
|
- onPress={() => {
|
|
|
|
|
- utils.directMaps(item.latitude, item.longitude, item.address);
|
|
|
|
|
- }}>
|
|
|
|
|
- <MaterialCommunityIcons
|
|
|
|
|
- name="navigation-variant"
|
|
|
|
|
- size={22}
|
|
|
|
|
- color={colorLight}/>
|
|
|
|
|
- </Pressable>
|
|
|
|
|
- {/* <Pressable
|
|
|
|
|
- style={styles.directView}
|
|
|
|
|
- onPress={() => {
|
|
|
|
|
- utils.directMaps(item.latitude, item.longitude, item.address);
|
|
|
|
|
- }}>
|
|
|
|
|
- <MaterialIcons
|
|
|
|
|
- name='directions'
|
|
|
|
|
- size={32}
|
|
|
|
|
- color={colorAccent}/>
|
|
|
|
|
- </Pressable> */}
|
|
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
</Button>
|
|
</Button>
|
|
@@ -119,17 +134,28 @@ const styles = StyleSheet.create({
|
|
|
paddingTop: 4,
|
|
paddingTop: 4,
|
|
|
paddingBottom: 4
|
|
paddingBottom: 4
|
|
|
},
|
|
},
|
|
|
|
|
+ labelRows: {
|
|
|
|
|
+ flexWrap: 'wrap',
|
|
|
|
|
+ alignItems: 'center',
|
|
|
|
|
+ flexDirection: 'row'
|
|
|
|
|
+ },
|
|
|
infoStatus: {
|
|
infoStatus: {
|
|
|
|
|
+ height: 22,
|
|
|
fontSize: 12,
|
|
fontSize: 12,
|
|
|
borderRadius: 3,
|
|
borderRadius: 3,
|
|
|
marginRight: 5,
|
|
marginRight: 5,
|
|
|
|
|
+ marginBottom: 5,
|
|
|
borderWidth: 1,
|
|
borderWidth: 1,
|
|
|
- ...$padding(3, 8, 2)
|
|
|
|
|
|
|
+ ...$padding(0, 8)
|
|
|
},
|
|
},
|
|
|
selected: {
|
|
selected: {
|
|
|
color: textPrimary,
|
|
color: textPrimary,
|
|
|
borderColor: colorAccent
|
|
borderColor: colorAccent
|
|
|
},
|
|
},
|
|
|
|
|
+ distance: {
|
|
|
|
|
+ color: '#90DB0A',
|
|
|
|
|
+ borderColor: '#90DB0A'
|
|
|
|
|
+ },
|
|
|
available: {
|
|
available: {
|
|
|
color: '#90DB0A',
|
|
color: '#90DB0A',
|
|
|
borderColor: '#90DB0A'
|
|
borderColor: '#90DB0A'
|
|
@@ -147,6 +173,11 @@ const styles = StyleSheet.create({
|
|
|
color: '#FDB702',
|
|
color: '#FDB702',
|
|
|
borderColor: '#FDB702'
|
|
borderColor: '#FDB702'
|
|
|
},
|
|
},
|
|
|
|
|
+ labels: {
|
|
|
|
|
+ color: colorLight,
|
|
|
|
|
+ borderColor: colorPrimary,
|
|
|
|
|
+ backgroundColor: colorPrimary
|
|
|
|
|
+ },
|
|
|
connectView: {
|
|
connectView: {
|
|
|
paddingTop: 4,
|
|
paddingTop: 4,
|
|
|
paddingBottom: 8,
|
|
paddingBottom: 8,
|
|
@@ -185,4 +216,15 @@ const styles = StyleSheet.create({
|
|
|
justifyContent: 'center',
|
|
justifyContent: 'center',
|
|
|
backgroundColor: colorAccent
|
|
backgroundColor: colorAccent
|
|
|
},
|
|
},
|
|
|
|
|
+ upcomingIcon: {
|
|
|
|
|
+ marginLeft: 8,
|
|
|
|
|
+ opacity: .3
|
|
|
|
|
+ },
|
|
|
|
|
+ upcomingText: {
|
|
|
|
|
+ color: colorAccent,
|
|
|
|
|
+ fontSize: 10,
|
|
|
|
|
+ opacity: .3,
|
|
|
|
|
+ marginLeft: 8,
|
|
|
|
|
+ marginTop: -3
|
|
|
|
|
+ }
|
|
|
})
|
|
})
|