import React from 'react'; import { BusinessList as BusinessesListingController, useLanguage, useOrder } from 'ordering-components/native'; import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'; import { View, ScrollView, Platform, Dimensions } from 'react-native'; import { OText } from '../shared'; import { HighestRatedBusinessesParams } from '../../types'; import { BusinessController } from '../BusinessController' import { NotFoundSource } from '../NotFoundSource' import { ListWrapper } from './styles' const HighestRatedBusinessesUI = (props: HighestRatedBusinessesParams) => { const { businessesList, onBusinessClick } = props; const [, t] = useLanguage() const [orderState] = useOrder(); const windowWidth = Dimensions.get('window').width; return ( <> {t('HIGHEST_RATED', 'Highest rated')} {t('TOP_RATINGS_AND_GREAT_SERVICE', 'Top ratings and great service')} {businessesList.loading ? ( <> {[ ...Array(10).keys() ].map((item, i) => ( ))} ) : ( <> {businessesList.businesses.length > 0 ? ( businessesList.businesses?.map( (business: any) => ( ) ) ) : ( )} )} ) } export const HighestRatedBusinesses = (props: any) => { const highestRatedBusinessesProps = { ...props, UIComponent: HighestRatedBusinessesUI, initialOrderByValue: 'rating', propsToFetch: ['id', 'name', 'header', 'logo', 'location', 'schedule', 'open', 'delivery_price', 'distance', 'delivery_time', 'pickup_time', 'reviews', 'featured', 'offers', 'food', 'laundry', 'alcohol', 'groceries', 'slug'], }; return ; };