import React, { useState } from 'react'
import FontAwesome from 'react-native-vector-icons/FontAwesome';
import { useLanguage, useUtils } from 'ordering-components/native'
import {
ReviewOrderContainer,
BusinessLogo,
FormReviews,
ActionContainer,
RatingStarContainer,
PlacedDate,
MultiLogosContainer
} from './styles'
import { OButton, OIcon, OText } from '../shared'
import { StyleSheet, View, I18nManager } from 'react-native';
import { FloatingBottomContainer } from '../../layouts/FloatingBottomContainer'
import { useTheme } from 'styled-components/native'
export const ReviewTrigger = (props: any) => {
const {
order,
handleOpenOrderReview
} = props
const theme = useTheme()
const styles = StyleSheet.create({
logoWrapper: {
shadowColor: theme.colors.black,
shadowRadius: 3,
shadowOffset: { width: 1, height: 4 },
elevation: 3,
borderRadius: 8,
shadowOpacity: 0.1,
overflow: 'hidden'
},
inputTextArea: {
borderColor: theme.colors.lightGray,
borderRadius: 8,
marginTop: 10,
marginBottom: 40,
height: 100,
alignItems: 'flex-start'
},
statusBar: {
transform: [{ scaleX: I18nManager.isRTL ? -1 : 1 }],
height: 10,
borderRadius: 5,
marginTop: 5
},
ratingItemContainer: {
position: 'absolute',
top: -20
},
ratingItem: {
left: '-50%',
flexDirection: 'column',
alignItems: 'center'
},
ratingLineStyle: {
height: 10,
width: 1,
marginBottom: 10,
backgroundColor: theme.colors.dusk
},
reviewedStyle: {
flexDirection: 'row',
justifyContent: 'center',
marginVertical: 20
},
})
const [, t] = useLanguage()
const [{ parseDate }] = useUtils()
const placedOnDate = parseDate(order?.delivery_datetime, { utc: true, outputFormat: 'dddd MMMM DD, YYYY' })
const [star, setStar] = useState(5)
return (
<>
{typeof order?.logo === 'string' || !order?.logo ? (
) : (
{order?.logo?.map((logo: string, i: number) => (
))}
)}
{!!order?.business_name && {order?.business_name}}
{[...Array(5).keys()].map((index: number) => ( setStar(index + 1)} color={theme?.colors?.primary} />)
)}
{t('DONOT_FORGET_RATE_YOUR_ORDER', 'Do not forget to rate your order placed on ')}
{placedOnDate}
handleOpenOrderReview(star)}
/>
>
)
}