|
@@ -13,22 +13,26 @@ import app from '../../../../app.json';
|
|
|
import TextView from '../../../components/TextView';
|
|
import TextView from '../../../components/TextView';
|
|
|
import BottomModal from '../../../components/BottomModal';
|
|
import BottomModal from '../../../components/BottomModal';
|
|
|
import SiteLabelView from '../../../components/SiteLabelView';
|
|
import SiteLabelView from '../../../components/SiteLabelView';
|
|
|
|
|
+import VbeSkeleton from '../../../components/VbeSkeleton';
|
|
|
|
|
|
|
|
export const BottomSiteCard = ({
|
|
export const BottomSiteCard = ({
|
|
|
|
|
+ visible=false,
|
|
|
stationInfo = {},
|
|
stationInfo = {},
|
|
|
onFavorite,
|
|
onFavorite,
|
|
|
onClose
|
|
onClose
|
|
|
}) => {
|
|
}) => {
|
|
|
- const [visible, showDialog] = useState(false);
|
|
|
|
|
|
|
+ const [loading, showDialog] = useState(true);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
if (stationInfo.id) {
|
|
if (stationInfo.id) {
|
|
|
- showDialog(true)
|
|
|
|
|
- } else {
|
|
|
|
|
showDialog(false)
|
|
showDialog(false)
|
|
|
}
|
|
}
|
|
|
}, [stationInfo]);
|
|
}, [stationInfo]);
|
|
|
|
|
|
|
|
|
|
+ useEffect(() => {
|
|
|
|
|
+ showDialog(true);
|
|
|
|
|
+ }, [visible]);
|
|
|
|
|
+
|
|
|
const getAvailable = (type) => {
|
|
const getAvailable = (type) => {
|
|
|
const all = stationInfo.allConnector;
|
|
const all = stationInfo.allConnector;
|
|
|
if (all) {
|
|
if (all) {
|
|
@@ -63,6 +67,7 @@ export const BottomSiteCard = ({
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const toChargePage = () => {
|
|
const toChargePage = () => {
|
|
|
|
|
+ onClose();
|
|
|
if (stationInfo.upcoming) {
|
|
if (stationInfo.upcoming) {
|
|
|
toastShort($t("home.upcoming"))
|
|
toastShort($t("home.upcoming"))
|
|
|
} else {
|
|
} else {
|
|
@@ -79,133 +84,175 @@ export const BottomSiteCard = ({
|
|
|
}}
|
|
}}
|
|
|
backdropOpacity={0}
|
|
backdropOpacity={0}
|
|
|
contentStyle={styles.bottomModal}>
|
|
contentStyle={styles.bottomModal}>
|
|
|
- <View style={styles.stationBarView}>
|
|
|
|
|
- <View style={ui.flexc}>
|
|
|
|
|
- <TextView
|
|
|
|
|
- ellipsizeMode='tail'
|
|
|
|
|
- numberOfLines={1}
|
|
|
|
|
- style={styles.stationTitle}>{stationInfo.name}</TextView>
|
|
|
|
|
- <Pressable
|
|
|
|
|
- style={styles.closeIcon}
|
|
|
|
|
- android_ripple={rippleLess}
|
|
|
|
|
- onPress={onClose}>
|
|
|
|
|
- <MaterialCommunityIcons
|
|
|
|
|
- name="close"
|
|
|
|
|
- size={22}
|
|
|
|
|
- color={textSecondary}/>
|
|
|
|
|
- </Pressable>
|
|
|
|
|
- </View>
|
|
|
|
|
- <TextView
|
|
|
|
|
- style={styles.stationAddress}
|
|
|
|
|
- ellipsizeMode='tail'
|
|
|
|
|
- numberOfLines={3}>{stationInfo.address}</TextView>
|
|
|
|
|
- <View style={ui.flexc}>
|
|
|
|
|
- <TextView style={styles.siteTypes}>{stationInfo.siteType}</TextView>
|
|
|
|
|
- { (stationInfo.allConnector && stationInfo.allConnector.available > 0) &&
|
|
|
|
|
- <TextView style={styles.stationAvailable}>
|
|
|
|
|
- <MaterialCommunityIcons
|
|
|
|
|
- name="circle"
|
|
|
|
|
- size={10}
|
|
|
|
|
- color={colorAccent}/>
|
|
|
|
|
- <Text> </Text>
|
|
|
|
|
- {$t("charging.statusAvailable")}
|
|
|
|
|
- </TextView>
|
|
|
|
|
- }
|
|
|
|
|
- <ConnectTypeV2 {...stationInfo?.acConnector}/>
|
|
|
|
|
- <ConnectTypeV2 {...stationInfo?.dcConnector}/>
|
|
|
|
|
- </View>
|
|
|
|
|
- <View style={styles.infoDetailsView}>
|
|
|
|
|
- <View style={ui.flex1}>
|
|
|
|
|
- <TextView style={styles.infoTitle}>{$t("charging.operatingHours")}</TextView>
|
|
|
|
|
- <View style={styles.infoView}>
|
|
|
|
|
- <TextView style={styles.infoText}>{getOperatingHours()}</TextView>
|
|
|
|
|
- </View>
|
|
|
|
|
|
|
+ { loading
|
|
|
|
|
+ ? <View style={styles.stationBarView}>
|
|
|
|
|
+ <View style={ui.flex}>
|
|
|
|
|
+ <VbeSkeleton
|
|
|
|
|
+ style={ui.flex1}
|
|
|
|
|
+ layout={[
|
|
|
|
|
+ {width: '80%', height: 20},
|
|
|
|
|
+ {width: '100%', height: 15, marginTop: 16},
|
|
|
|
|
+ {width: '60%', height: 15, marginTop: 4}
|
|
|
|
|
+ ]}
|
|
|
|
|
+ animationDirection={"horizontalRight"}
|
|
|
|
|
+ />
|
|
|
</View>
|
|
</View>
|
|
|
- <View style={{width: 4}}></View>
|
|
|
|
|
- <View style={ui.flex1}>
|
|
|
|
|
- <TextView style={styles.infoTitle}>{$t("charging.parkingFees")}</TextView>
|
|
|
|
|
- <View style={styles.infoView}>
|
|
|
|
|
- <TextView style={styles.infoText}>{getParkingFee()}</TextView>
|
|
|
|
|
- </View>
|
|
|
|
|
|
|
+ <EndView/>
|
|
|
|
|
+ <View style={ui.flex}>
|
|
|
|
|
+ <VbeSkeleton
|
|
|
|
|
+ style={[ui.flexc, ui.flex1]}
|
|
|
|
|
+ viewStyle={ui.flex1}
|
|
|
|
|
+ layout={[
|
|
|
|
|
+ {width: '16%', height: 15, marginRight: 8, borderRadius: 30},
|
|
|
|
|
+ {width: '16%', height: 15, marginRight: 8, borderRadius: 30},
|
|
|
|
|
+ {width: '16%', height: 15, marginRight: 8, borderRadius: 30},
|
|
|
|
|
+ {width: '16%', height: 15, borderRadius: 30}
|
|
|
|
|
+ ]}
|
|
|
|
|
+ animationDirection={"horizontalRight"}
|
|
|
|
|
+ />
|
|
|
</View>
|
|
</View>
|
|
|
- <View style={{width: 4}}></View>
|
|
|
|
|
- <View style={ui.flex1}>
|
|
|
|
|
- <TextView style={styles.infoTitle}>{$t("charging.additionalInfo")}</TextView>
|
|
|
|
|
- <View style={styles.infoView}>
|
|
|
|
|
- <TextView style={styles.infoText}>{stationInfo?.additionalNotes}</TextView>
|
|
|
|
|
- </View>
|
|
|
|
|
|
|
+ <EndView/>
|
|
|
|
|
+ <View style={ui.flex}>
|
|
|
|
|
+ <VbeSkeleton
|
|
|
|
|
+ style={[ui.flexc, ui.flex1]}
|
|
|
|
|
+ viewStyle={ui.flex1}
|
|
|
|
|
+ layout={[
|
|
|
|
|
+ {width: '20%', height: 25, marginRight: 12, borderRadius: 30},
|
|
|
|
|
+ {width: '20%', height: 25, marginRight: 12, borderRadius: 30},
|
|
|
|
|
+ {width: '20%', height: 25, marginRight: 12, borderRadius: 30}
|
|
|
|
|
+ ]}
|
|
|
|
|
+ animationDirection={"horizontalRight"}
|
|
|
|
|
+ />
|
|
|
</View>
|
|
</View>
|
|
|
</View>
|
|
</View>
|
|
|
- <EndView half/>
|
|
|
|
|
- <View style={ui.flexc}>
|
|
|
|
|
- { stationInfo.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>
|
|
|
|
|
- : <>
|
|
|
|
|
|
|
+ : <View style={styles.stationBarView}>
|
|
|
|
|
+ <View style={ui.flexc}>
|
|
|
|
|
+ <TextView
|
|
|
|
|
+ ellipsizeMode='tail'
|
|
|
|
|
+ numberOfLines={1}
|
|
|
|
|
+ style={styles.stationTitle}>{stationInfo.name}</TextView>
|
|
|
<Pressable
|
|
<Pressable
|
|
|
- style={styles.directIconView}
|
|
|
|
|
- onPress={() => {
|
|
|
|
|
- utils.directMaps(stationInfo.latitude, stationInfo.longitude, stationInfo.address);
|
|
|
|
|
- }}>
|
|
|
|
|
|
|
+ style={styles.closeIcon}
|
|
|
|
|
+ android_ripple={rippleLess}
|
|
|
|
|
+ onPress={onClose}>
|
|
|
<MaterialCommunityIcons
|
|
<MaterialCommunityIcons
|
|
|
- name="directions"
|
|
|
|
|
- size={20}
|
|
|
|
|
- color={textPrimary}/>
|
|
|
|
|
- <TextView style={styles.directText}>Directions</TextView>
|
|
|
|
|
|
|
+ name="close"
|
|
|
|
|
+ size={22}
|
|
|
|
|
+ color={textSecondary}/>
|
|
|
</Pressable>
|
|
</Pressable>
|
|
|
- { app.modules.bookmarks &&
|
|
|
|
|
- <Pressable
|
|
|
|
|
- style={[styles.directIconView, stationInfo.favorite ? styles.bookmarked : {}]}
|
|
|
|
|
- onPress={onFavorite}>
|
|
|
|
|
|
|
+ </View>
|
|
|
|
|
+ <TextView
|
|
|
|
|
+ style={styles.stationAddress}
|
|
|
|
|
+ ellipsizeMode='tail'
|
|
|
|
|
+ numberOfLines={3}>{stationInfo.address}</TextView>
|
|
|
|
|
+ <View style={ui.flexc}>
|
|
|
|
|
+ <TextView style={styles.siteTypes}>{stationInfo.siteType}</TextView>
|
|
|
|
|
+ { (stationInfo.allConnector && stationInfo.allConnector.available > 0) &&
|
|
|
|
|
+ <TextView style={styles.stationAvailable}>
|
|
|
|
|
+ <MaterialCommunityIcons
|
|
|
|
|
+ name="circle"
|
|
|
|
|
+ size={10}
|
|
|
|
|
+ color={colorAccent}/>
|
|
|
|
|
+ <Text> </Text>
|
|
|
|
|
+ {$t("charging.statusAvailable")}
|
|
|
|
|
+ </TextView>
|
|
|
|
|
+ }
|
|
|
|
|
+ <ConnectTypeV2 {...stationInfo?.acConnector}/>
|
|
|
|
|
+ <ConnectTypeV2 {...stationInfo?.dcConnector}/>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ <View style={styles.infoDetailsView}>
|
|
|
|
|
+ <View style={ui.flex1}>
|
|
|
|
|
+ <TextView style={styles.infoTitle}>{$t("charging.operatingHours")}</TextView>
|
|
|
|
|
+ <View style={styles.infoView}>
|
|
|
|
|
+ <TextView style={styles.infoText}>{getOperatingHours()}</TextView>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ <View style={{width: 4}}></View>
|
|
|
|
|
+ <View style={ui.flex1}>
|
|
|
|
|
+ <TextView style={styles.infoTitle}>{$t("charging.parkingFees")}</TextView>
|
|
|
|
|
+ <View style={styles.infoView}>
|
|
|
|
|
+ <TextView style={styles.infoText}>{getParkingFee()}</TextView>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ <View style={{width: 4}}></View>
|
|
|
|
|
+ <View style={ui.flex1}>
|
|
|
|
|
+ <TextView style={styles.infoTitle}>{$t("charging.additionalInfo")}</TextView>
|
|
|
|
|
+ <View style={styles.infoView}>
|
|
|
|
|
+ <TextView style={styles.infoText}>{stationInfo?.additionalNotes}</TextView>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ <EndView half/>
|
|
|
|
|
+ <View style={ui.flexc}>
|
|
|
|
|
+ { stationInfo.upcoming
|
|
|
|
|
+ ? <View style={[ui.center, $margin(0, 8)]}>
|
|
|
<MaterialIcons
|
|
<MaterialIcons
|
|
|
- name="star"
|
|
|
|
|
|
|
+ name="upcoming"
|
|
|
|
|
+ size={42}
|
|
|
|
|
+ color={colorAccent}
|
|
|
|
|
+ style={styles.upcomingIcon} />
|
|
|
|
|
+ <TextView style={styles.upcomingText}>{$t("home.upcoming")}</TextView>
|
|
|
|
|
+ </View>
|
|
|
|
|
+ : <>
|
|
|
|
|
+ <Pressable
|
|
|
|
|
+ style={styles.directIconView}
|
|
|
|
|
+ onPress={() => {
|
|
|
|
|
+ utils.directMaps(stationInfo.latitude, stationInfo.longitude, stationInfo.address);
|
|
|
|
|
+ }}>
|
|
|
|
|
+ <MaterialCommunityIcons
|
|
|
|
|
+ name="directions"
|
|
|
size={20}
|
|
size={20}
|
|
|
- color={stationInfo.favorite ? textLight : textPrimary}/>
|
|
|
|
|
- <TextView style={[styles.directText, stationInfo.favorite ? styles.bookmarked : {}]}>
|
|
|
|
|
- {stationInfo.favorite ? "Saved" : "Save"}
|
|
|
|
|
- </TextView>
|
|
|
|
|
|
|
+ color={textPrimary}/>
|
|
|
|
|
+ <TextView style={styles.directText}>Directions</TextView>
|
|
|
</Pressable>
|
|
</Pressable>
|
|
|
- }
|
|
|
|
|
- {/* <Pressable
|
|
|
|
|
- style={styles.directIconView}
|
|
|
|
|
- onPress={() => {
|
|
|
|
|
- startPage(PageList.scanqr, {actionDetail: true});
|
|
|
|
|
- }}>
|
|
|
|
|
- <MaterialCommunityIcons
|
|
|
|
|
- name="qrcode-scan"
|
|
|
|
|
- size={12}
|
|
|
|
|
- color={textPrimary}
|
|
|
|
|
- style={$padding(3)}/>
|
|
|
|
|
- <TextView style={styles.directText}>Scan</TextView>
|
|
|
|
|
- </Pressable> */}
|
|
|
|
|
- <Pressable
|
|
|
|
|
- style={styles.directIconView}
|
|
|
|
|
- onPress={() => toChargePage()}>
|
|
|
|
|
- <MaterialCommunityIcons
|
|
|
|
|
- name="information-variant"
|
|
|
|
|
- size={20}
|
|
|
|
|
- color={textPrimary}/>
|
|
|
|
|
- <TextView style={styles.directText}>More Info</TextView>
|
|
|
|
|
- </Pressable>
|
|
|
|
|
- </> }
|
|
|
|
|
- </View>
|
|
|
|
|
- {/* stationInfo?.labels?.length > 0 &&
|
|
|
|
|
- <View style={styles.siteLabelsView}>
|
|
|
|
|
- <Image
|
|
|
|
|
- style={styles.labelIcon}
|
|
|
|
|
- source={require('../../../images/maps/ic_marker_additional.png')}/>
|
|
|
|
|
- { stationInfo.labels.map((item, index) =>
|
|
|
|
|
- <SiteLabelView key={index} {...item}/>
|
|
|
|
|
- )}
|
|
|
|
|
|
|
+ { app.modules.bookmarks &&
|
|
|
|
|
+ <Pressable
|
|
|
|
|
+ style={[styles.directIconView, stationInfo.favorite ? styles.bookmarked : {}]}
|
|
|
|
|
+ onPress={onFavorite}>
|
|
|
|
|
+ <MaterialIcons
|
|
|
|
|
+ name="star"
|
|
|
|
|
+ size={20}
|
|
|
|
|
+ color={stationInfo.favorite ? textLight : textPrimary}/>
|
|
|
|
|
+ <TextView style={[styles.directText, stationInfo.favorite ? styles.bookmarked : {}]}>
|
|
|
|
|
+ {stationInfo.favorite ? "Saved" : "Save"}
|
|
|
|
|
+ </TextView>
|
|
|
|
|
+ </Pressable>
|
|
|
|
|
+ }
|
|
|
|
|
+ {/* <Pressable
|
|
|
|
|
+ style={styles.directIconView}
|
|
|
|
|
+ onPress={() => {
|
|
|
|
|
+ startPage(PageList.scanqr, {actionDetail: true});
|
|
|
|
|
+ }}>
|
|
|
|
|
+ <MaterialCommunityIcons
|
|
|
|
|
+ name="qrcode-scan"
|
|
|
|
|
+ size={12}
|
|
|
|
|
+ color={textPrimary}
|
|
|
|
|
+ style={$padding(3)}/>
|
|
|
|
|
+ <TextView style={styles.directText}>Scan</TextView>
|
|
|
|
|
+ </Pressable> */}
|
|
|
|
|
+ <Pressable
|
|
|
|
|
+ style={styles.directIconView}
|
|
|
|
|
+ onPress={() => toChargePage()}>
|
|
|
|
|
+ <MaterialCommunityIcons
|
|
|
|
|
+ name="information-variant"
|
|
|
|
|
+ size={20}
|
|
|
|
|
+ color={textPrimary}/>
|
|
|
|
|
+ <TextView style={styles.directText}>More Info</TextView>
|
|
|
|
|
+ </Pressable>
|
|
|
|
|
+ </> }
|
|
|
</View>
|
|
</View>
|
|
|
- */}
|
|
|
|
|
- </View>
|
|
|
|
|
|
|
+ {/* stationInfo?.labels?.length > 0 &&
|
|
|
|
|
+ <View style={styles.siteLabelsView}>
|
|
|
|
|
+ <Image
|
|
|
|
|
+ style={styles.labelIcon}
|
|
|
|
|
+ source={require('../../../images/maps/ic_marker_additional.png')}/>
|
|
|
|
|
+ { stationInfo.labels.map((item, index) =>
|
|
|
|
|
+ <SiteLabelView key={index} {...item}/>
|
|
|
|
|
+ )}
|
|
|
|
|
+ </View>
|
|
|
|
|
+ */}
|
|
|
|
|
+ </View>
|
|
|
|
|
+ }
|
|
|
</BottomModal>
|
|
</BottomModal>
|
|
|
)
|
|
)
|
|
|
}
|
|
}
|