import React from 'react'; import { StyleSheet, TouchableOpacity, View, ActivityIndicator } from 'react-native'; import { useUtils, useLanguage, useOrder } from 'ordering-components/native' import { useTheme } from 'styled-components/native'; import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'; import { OIcon, OText } from '../shared'; import { convertHoursToMinutes } from '../../utils'; import { Card, BusinessContent, BusinessInfo, BusinessActions, Metadata, Reviews, BtnWrapper } from './styles' export const BusinessCart = (props: any) => { const { business, isLoading, isDisabled, isSkeleton, handleCartStoreClick } = props const [, t] = useLanguage() const theme = useTheme(); const [orderState] = useOrder() const [{ parsePrice, parseDistance, parseNumber }] = useUtils(); const styles = StyleSheet.create({ starIcon: { marginHorizontal: 2, marginTop: -5, }, bullet: { flexDirection: 'row', alignItems: 'center', justifyContent: 'flex-start', }, }); return ( {business?.name && ( {business?.name} )} {isSkeleton && ( )} {!!business?.address && ( {business?.address} )} {isSkeleton && ( )} {!isSkeleton ? ( {`${t('DELIVERY_FEE', 'Delivery fee')} ${parsePrice(business?.delivery_price) + ' \u2022 '}`} {`${convertHoursToMinutes( orderState?.options?.type === 1 ? business?.delivery_time : business?.pickup_time, )} \u2022 `} {parseDistance(business?.distance)} ) : ( )} {business?.reviews?.total > 0 && ( {parseNumber(business?.reviews?.total ?? 1, { separator: '.' })} )} {handleCartStoreClick && ( handleCartStoreClick && handleCartStoreClick(business?.id)} style={{ backgroundColor: isDisabled ? theme.colors.disabled : theme.colors.white, borderColor: isDisabled ? theme.colors.disabled : theme.colors.primary, justifyContent: 'center', position: 'relative', flexDirection: 'row', alignItems: 'center', paddingRight: 10, paddingLeft: 10, borderRadius: 7.6, borderWidth: 1, height: 30, }} > {isLoading ? ( ) : ( t('SELECT', 'Select') )} )} {isSkeleton && ( )} ) }