ordering-ui-react-native 0.16.53 → 0.16.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/themes/original/index.tsx +0 -6
- package/themes/original/src/components/BusinessesListing/Layout/Original/index.tsx +37 -32
- package/themes/original/src/components/BusinessesListing/index.tsx +35 -62
- package/themes/original/src/components/OrderDetails/index.tsx +32 -34
- package/themes/original/src/components/ReviewOrder/index.tsx +79 -99
- package/themes/original/src/components/ReviewOrder/styles.tsx +0 -9
- package/themes/original/src/components/ReviewTrigger/index.tsx +118 -0
- package/themes/original/src/components/{Reviews/ReviewOrder → ReviewTrigger}/styles.tsx +2 -21
- package/themes/original/src/components/SingleProductCard/index.tsx +118 -110
- package/themes/original/src/components/shared/OBottomPopup.tsx +5 -2
- package/themes/original/src/types/index.tsx +2 -5
- package/themes/original/src/components/Reviews/ReviewDriver/index.tsx +0 -301
- package/themes/original/src/components/Reviews/ReviewDriver/styles.tsx +0 -39
- package/themes/original/src/components/Reviews/ReviewOrder/index.tsx +0 -326
- package/themes/original/src/components/Reviews/ReviewProducts/index.tsx +0 -101
- package/themes/original/src/components/Reviews/ReviewProducts/styles.tsx +0 -17
- package/themes/original/src/components/Reviews/index.tsx +0 -9
package/package.json
CHANGED
|
@@ -29,9 +29,6 @@ import { UserProfileForm } from './src/components/UserProfileForm';
|
|
|
29
29
|
import { ReviewOrder } from './src/components/ReviewOrder';
|
|
30
30
|
import { ReviewProducts } from './src/components/ReviewProducts';
|
|
31
31
|
import { ReviewDriver } from './src/components/ReviewDriver';
|
|
32
|
-
import { ReviewOrder as ReviewOrderModal } from './src/components/Reviews/ReviewOrder';
|
|
33
|
-
import { ReviewProducts as ReviewProductsModal } from './src/components/Reviews/ReviewProducts';
|
|
34
|
-
import { ReviewDriver as ReviewDriverModal } from './src/components/Reviews/ReviewDriver';
|
|
35
32
|
import { UserProfile } from './src/components/UserProfile';
|
|
36
33
|
import { MessageListing } from './src/components/MessageListing';
|
|
37
34
|
import { Messages } from './src/components/Messages';
|
|
@@ -189,9 +186,6 @@ export {
|
|
|
189
186
|
ReviewOrder,
|
|
190
187
|
ReviewProducts,
|
|
191
188
|
ReviewDriver,
|
|
192
|
-
ReviewOrderModal,
|
|
193
|
-
ReviewProductsModal,
|
|
194
|
-
ReviewDriverModal,
|
|
195
189
|
BusinessMenuList,
|
|
196
190
|
UserProfile,
|
|
197
191
|
MessageListing,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useCallback, useEffect, useRef, useState } from 'react';
|
|
2
2
|
import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder';
|
|
3
3
|
import Geolocation from '@react-native-community/geolocation'
|
|
4
|
+
import { IOScrollView } from 'react-native-intersection-observer'
|
|
4
5
|
import { getTrackingStatus, requestTrackingPermission } from 'react-native-tracking-transparency'
|
|
5
6
|
import {
|
|
6
7
|
View,
|
|
@@ -201,7 +202,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
201
202
|
}
|
|
202
203
|
|
|
203
204
|
const resetInactivityTimeout = () => {
|
|
204
|
-
if(!logosLayout){
|
|
205
|
+
if (!logosLayout) {
|
|
205
206
|
clearTimeout(timerId.current)
|
|
206
207
|
timerId.current = setInterval(() => {
|
|
207
208
|
getBusinesses(true)
|
|
@@ -247,7 +248,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
247
248
|
}
|
|
248
249
|
|
|
249
250
|
useEffect(() => {
|
|
250
|
-
if(!logosLayout){
|
|
251
|
+
if (!logosLayout) {
|
|
251
252
|
checkUserLocation()
|
|
252
253
|
}
|
|
253
254
|
}, [orderState?.options?.address?.location])
|
|
@@ -284,11 +285,11 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
284
285
|
return (
|
|
285
286
|
<BusinessLogosContainer horizontal>
|
|
286
287
|
{businessesList?.loading ? (
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
288
|
+
<Placeholder Animation={Fade}>
|
|
289
|
+
{[...Array(10).keys()].map(item => (
|
|
290
|
+
<PlaceholderLine key={item} width={56} height={56} />
|
|
291
|
+
))}
|
|
292
|
+
</Placeholder>
|
|
292
293
|
) : (
|
|
293
294
|
<>
|
|
294
295
|
{businessesList.businesses
|
|
@@ -478,7 +479,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
478
479
|
<View style={{ marginTop: 10 }}>
|
|
479
480
|
<OButton
|
|
480
481
|
onClick={() => setIsOpenCities(true)}
|
|
481
|
-
text={citiesState?.cities?.find((city
|
|
482
|
+
text={citiesState?.cities?.find((city: any) => city?.id === orderState?.options?.city_id)?.name || t('FILTER_BY_CITY', 'Filter by city')}
|
|
482
483
|
style={styles?.buttonCityStyle}
|
|
483
484
|
textStyle={{ color: theme.colors.backgroundGray, fontWeight: 'bold', fontSize: 18 }}
|
|
484
485
|
/>
|
|
@@ -552,29 +553,33 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
552
553
|
)}
|
|
553
554
|
/>
|
|
554
555
|
)}
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
556
|
+
<IOScrollView>
|
|
557
|
+
|
|
558
|
+
{businessesList.businesses?.map(
|
|
559
|
+
(business: any, i: number) => (
|
|
560
|
+
<BusinessController
|
|
561
|
+
key={`${business.id}_` + i}
|
|
562
|
+
enableIntersection
|
|
563
|
+
business={business}
|
|
564
|
+
isBusinessOpen={business.open}
|
|
565
|
+
handleCustomClick={handleBusinessClick}
|
|
566
|
+
orderType={orderState?.options?.type}
|
|
567
|
+
navigation={navigation}
|
|
568
|
+
businessHeader={business?.header}
|
|
569
|
+
businessFeatured={business?.featured}
|
|
570
|
+
businessLogo={business?.logo}
|
|
571
|
+
businessReviews={business?.reviews}
|
|
572
|
+
businessDeliveryPrice={business?.delivery_price}
|
|
573
|
+
businessDeliveryTime={business?.delivery_time}
|
|
574
|
+
businessPickupTime={business?.pickup_time}
|
|
575
|
+
businessDistance={business?.distance}
|
|
576
|
+
handleUpdateBusinessList={handleUpdateBusinessList}
|
|
577
|
+
favoriteIds={favoriteIds}
|
|
578
|
+
setFavoriteIds={setFavoriteIds}
|
|
579
|
+
/>
|
|
580
|
+
)
|
|
581
|
+
)}
|
|
582
|
+
</IOScrollView>
|
|
578
583
|
{businessesList.loading && (
|
|
579
584
|
<>
|
|
580
585
|
{[
|
|
@@ -633,7 +638,7 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
|
|
|
633
638
|
title={t('SELECT_A_CITY', 'Select a city')}
|
|
634
639
|
>
|
|
635
640
|
<View style={{ padding: 40, width: '100%' }}>
|
|
636
|
-
{citiesState?.cities?.map((city
|
|
641
|
+
{citiesState?.cities?.map((city: any) => (
|
|
637
642
|
<TouchableOpacity
|
|
638
643
|
key={city?.id}
|
|
639
644
|
style={{
|
|
@@ -6,84 +6,68 @@ import { useTheme } from 'styled-components/native'
|
|
|
6
6
|
import { BusinessesListing as OriginalBusinessListing } from './Layout/Original'
|
|
7
7
|
import { BusinessesListing as AppointmentBusinessListing } from './Layout/Appointment'
|
|
8
8
|
import { OBottomPopup } from '../shared';
|
|
9
|
-
import {
|
|
9
|
+
import { ReviewTrigger } from '../ReviewTrigger';
|
|
10
10
|
|
|
11
11
|
export const BusinessesListing = (props: any) => {
|
|
12
12
|
const theme = useTheme()
|
|
13
|
-
|
|
13
|
+
const layout = theme?.layouts?.business_listing_view?.components?.layout?.type || 'original'
|
|
14
14
|
const [, t] = useLanguage();
|
|
15
15
|
const [{ auth }] = useSession()
|
|
16
16
|
const [, { getLastOrderHasNoReview }] = useOrder();
|
|
17
17
|
|
|
18
|
+
const [, setIsReviewed] = useState()
|
|
19
|
+
const defaultOrder = {
|
|
20
|
+
id: 0,
|
|
21
|
+
business_id: 0,
|
|
22
|
+
business_name: '',
|
|
23
|
+
logo: '',
|
|
24
|
+
driver: {},
|
|
25
|
+
products: [],
|
|
26
|
+
review: {},
|
|
27
|
+
user_review: {},
|
|
28
|
+
delivery_datetime: ''
|
|
29
|
+
}
|
|
18
30
|
const [lastOrderReview, setLastOrderReview] = useState({
|
|
19
31
|
isReviewOpen: false,
|
|
20
|
-
order:
|
|
21
|
-
|
|
22
|
-
business_id: 0,
|
|
23
|
-
business_name: '',
|
|
24
|
-
delivery_datetime: '',
|
|
25
|
-
logo: '',
|
|
26
|
-
driver: null,
|
|
27
|
-
products: [],
|
|
28
|
-
review: null,
|
|
29
|
-
user_review: null
|
|
30
|
-
},
|
|
31
|
-
reviewStatus: { order: false, product: false, driver: false },
|
|
32
|
-
reviewed: { isOrderReviewed: false, isProductReviewed: false, isDriverReviewed: false }
|
|
32
|
+
order: defaultOrder,
|
|
33
|
+
defaultStar: 5,
|
|
33
34
|
})
|
|
34
35
|
|
|
35
36
|
const _getLastOrderHasNoReview = async () => {
|
|
36
37
|
const lastOrderHasNoReview = await getLastOrderHasNoReview()
|
|
37
|
-
lastOrderHasNoReview &&
|
|
38
|
+
lastOrderHasNoReview && OrderReviewRequired(lastOrderHasNoReview)
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
const
|
|
41
|
+
const OrderReviewRequired = (order: any) => {
|
|
41
42
|
setLastOrderReview({
|
|
42
43
|
isReviewOpen: true,
|
|
43
44
|
order: {
|
|
44
45
|
id: order?.id,
|
|
45
46
|
business_id: order?.business_id,
|
|
46
47
|
business_name: order?.business?.name,
|
|
47
|
-
delivery_datetime: order?.delivery_datetime,
|
|
48
48
|
logo: order.business?.logo,
|
|
49
49
|
driver: order?.driver,
|
|
50
50
|
products: order?.products,
|
|
51
51
|
review: order?.review,
|
|
52
|
-
user_review: order?.user_review
|
|
52
|
+
user_review: order?.user_review,
|
|
53
|
+
delivery_datetime: order?.delivery_datetime_utc
|
|
53
54
|
},
|
|
54
|
-
|
|
55
|
-
reviewed: { isOrderReviewed: false, isProductReviewed: false, isDriverReviewed: false }
|
|
56
|
-
})
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const handleCloseReivew = () => {
|
|
60
|
-
setLastOrderReview({
|
|
61
|
-
...lastOrderReview,
|
|
62
|
-
isReviewOpen: false,
|
|
63
|
-
reviewStatus: { order: false, product: false, driver: false }
|
|
55
|
+
defaultStar: 5
|
|
64
56
|
})
|
|
65
57
|
}
|
|
66
58
|
|
|
67
|
-
const
|
|
68
|
-
const _reviewStatus = { ...lastOrderReview?.reviewed }
|
|
59
|
+
const handleOpenOrderReview = (star: number) => {
|
|
69
60
|
setLastOrderReview({
|
|
70
|
-
...lastOrderReview,
|
|
71
|
-
reviewed: { ..._reviewStatus, [reviewType]: true }
|
|
61
|
+
...lastOrderReview, isReviewOpen: false, order: defaultOrder
|
|
72
62
|
})
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
const closeReviewProduct = () => {
|
|
82
|
-
if (lastOrderReview?.order?.driver && !lastOrderReview?.order?.user_review && !lastOrderReview?.reviewed?.isDriverReviewed) setLastOrderReview({ ...lastOrderReview, reviewStatus: { order: false, product: false, driver: true } })
|
|
83
|
-
else {
|
|
84
|
-
setIsReviewed('isDriverReviewed')
|
|
85
|
-
handleCloseReivew()
|
|
86
|
-
}
|
|
63
|
+
props?.navigation && props.navigation.navigate(
|
|
64
|
+
'ReviewOrder',
|
|
65
|
+
{
|
|
66
|
+
order: lastOrderReview.order,
|
|
67
|
+
defaultStar: star || 5,
|
|
68
|
+
setIsReviewed
|
|
69
|
+
}
|
|
70
|
+
)
|
|
87
71
|
}
|
|
88
72
|
|
|
89
73
|
useEffect(() => {
|
|
@@ -98,25 +82,14 @@ export const BusinessesListing = (props: any) => {
|
|
|
98
82
|
{lastOrderReview?.isReviewOpen && (
|
|
99
83
|
<OBottomPopup
|
|
100
84
|
open={lastOrderReview?.isReviewOpen}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
? t('HEY', 'Hey! ') + t('HOW_WAS_YOUR_ORDER', 'How was your order?')
|
|
105
|
-
: (lastOrderReview?.reviewStatus?.product
|
|
106
|
-
? t('REVIEW_PRODUCT', 'Review Product')
|
|
107
|
-
: t('REVIEW_DRIVER', 'Review Driver')))
|
|
108
|
-
: t('LOADING', 'Loading...')}
|
|
85
|
+
transparent={true}
|
|
86
|
+
onClose={() => setLastOrderReview({ ...lastOrderReview, isReviewOpen: false, order: defaultOrder })}
|
|
87
|
+
title={t('HEY', 'Hey! ') + t('HOW_WAS_YOUR_ORDER', 'How was your order?')}
|
|
109
88
|
bottomContainerStyle={{ height: 'auto' }}
|
|
110
89
|
titleStyle={{ textAlign: 'center' }}
|
|
111
90
|
closeIcon={theme.images.general.close}
|
|
112
91
|
>
|
|
113
|
-
{
|
|
114
|
-
lastOrderReview?.reviewStatus?.order
|
|
115
|
-
? <ReviewOrderModal order={lastOrderReview?.order} closeReviewOrder={closeReviewOrder} skipReview={handleCloseReivew} setIsReviewed={() => setIsReviewed('isOrderReviewed')} />
|
|
116
|
-
: (lastOrderReview?.reviewStatus?.product
|
|
117
|
-
? <ReviewProductsModal order={lastOrderReview?.order} closeReviewProduct={closeReviewProduct} setIsProductReviewed={() => setIsReviewed('isProductReviewed')} />
|
|
118
|
-
: <ReviewDriverModal order={lastOrderReview?.order} closeReviewDriver={handleCloseReivew} setIsDriverReviewed={() => setIsReviewed('isDriverReviewed')} />)
|
|
119
|
-
}
|
|
92
|
+
{lastOrderReview?.order && <ReviewTrigger order={lastOrderReview?.order} handleOpenOrderReview={handleOpenOrderReview} />}
|
|
120
93
|
|
|
121
94
|
</OBottomPopup>
|
|
122
95
|
)}
|
|
@@ -361,8 +361,6 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
361
361
|
id: order?.id,
|
|
362
362
|
business_id: order?.business_id,
|
|
363
363
|
logo: order.business?.logo,
|
|
364
|
-
business_name: order?.business?.name,
|
|
365
|
-
delivery_datetime: order?.delivery_datetime,
|
|
366
364
|
driver: order?.driver,
|
|
367
365
|
products: order?.products,
|
|
368
366
|
review: order?.review,
|
|
@@ -524,41 +522,41 @@ export const OrderDetailsUI = (props: OrderDetailsParams) => {
|
|
|
524
522
|
<OrderData>
|
|
525
523
|
<View style={styles.linkWrapper}>
|
|
526
524
|
{
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
>
|
|
537
|
-
<OText
|
|
538
|
-
size={10}
|
|
539
|
-
lineHeight={15}
|
|
540
|
-
color={theme.colors.primary}
|
|
541
|
-
style={{ textDecorationLine: 'underline' }}
|
|
525
|
+
(
|
|
526
|
+
parseInt(order?.status) === 1 ||
|
|
527
|
+
parseInt(order?.status) === 11 ||
|
|
528
|
+
parseInt(order?.status) === 15
|
|
529
|
+
) && !order.review && !isReviewed && (
|
|
530
|
+
<TouchableOpacity
|
|
531
|
+
activeOpacity={0.7}
|
|
532
|
+
style={{ marginTop: 6, marginRight: 10 }}
|
|
533
|
+
onPress={() => handleClickOrderReview(order)}
|
|
542
534
|
>
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
535
|
+
<OText
|
|
536
|
+
size={10}
|
|
537
|
+
lineHeight={15}
|
|
538
|
+
color={theme.colors.primary}
|
|
539
|
+
style={{ textDecorationLine: 'underline' }}
|
|
540
|
+
>
|
|
541
|
+
{t('REVIEW_YOUR_ORDER', 'Review your order')}
|
|
542
|
+
</OText>
|
|
543
|
+
</TouchableOpacity>
|
|
544
|
+
)}
|
|
545
|
+
<TouchableOpacity
|
|
546
|
+
activeOpacity={0.7}
|
|
547
|
+
style={{ marginTop: 6 }}
|
|
548
|
+
onPress={() => setIsOrderHistory(true)}
|
|
551
549
|
|
|
550
|
+
>
|
|
551
|
+
<OText
|
|
552
|
+
size={10}
|
|
553
|
+
lineHeight={15}
|
|
554
|
+
color={theme.colors.primary}
|
|
555
|
+
style={{ textDecorationLine: 'underline', textTransform: 'capitalize' }}
|
|
552
556
|
>
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
color={theme.colors.primary}
|
|
557
|
-
style={{ textDecorationLine: 'underline', textTransform: 'capitalize' }}
|
|
558
|
-
>
|
|
559
|
-
{t('VIEW_DETAILS', 'View Details')}
|
|
560
|
-
</OText>
|
|
561
|
-
</TouchableOpacity>
|
|
557
|
+
{t('VIEW_DETAILS', 'View Details')}
|
|
558
|
+
</OText>
|
|
559
|
+
</TouchableOpacity>
|
|
562
560
|
</View>
|
|
563
561
|
|
|
564
562
|
<StaturBar>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import
|
|
3
|
-
import { OrderReview as ReviewOrderController, useLanguage, useToast, ToastType, useUtils } from 'ordering-components/native'
|
|
2
|
+
import { OrderReview as ReviewOrderController, useLanguage, useToast, ToastType } from 'ordering-components/native'
|
|
4
3
|
import { useForm, Controller } from 'react-hook-form'
|
|
5
4
|
import LinearGradient from 'react-native-linear-gradient'
|
|
6
5
|
|
|
@@ -12,9 +11,7 @@ import {
|
|
|
12
11
|
ActionContainer,
|
|
13
12
|
SkipButton,
|
|
14
13
|
RatingBarContainer,
|
|
15
|
-
RatingTextContainer
|
|
16
|
-
RatingStarContainer,
|
|
17
|
-
PlacedDate
|
|
14
|
+
RatingTextContainer
|
|
18
15
|
} from './styles'
|
|
19
16
|
import { OButton, OIcon, OInput, OText } from '../shared'
|
|
20
17
|
import { TouchableOpacity, StyleSheet, View, I18nManager } from 'react-native';
|
|
@@ -91,11 +88,10 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
91
88
|
const [, t] = useLanguage()
|
|
92
89
|
const [, { showToast }] = useToast()
|
|
93
90
|
const { handleSubmit, control, errors } = useForm()
|
|
94
|
-
|
|
91
|
+
|
|
95
92
|
const [alertState, setAlertState] = useState<{ open: boolean, content: Array<any>, success?: boolean }>({ open: false, content: [], success: false })
|
|
96
93
|
const [comments, setComments] = useState<Array<any>>([])
|
|
97
94
|
const [extraComment, setExtraComment] = useState('')
|
|
98
|
-
const placedOnDate = parseDate(order?.delivery_datetime, { outputFormat: 'dddd MMMM DD, YYYY' })
|
|
99
95
|
|
|
100
96
|
const onSubmit = () => {
|
|
101
97
|
if (Object.values(stars).some((value: any) => value === 0)) {
|
|
@@ -195,15 +191,14 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
195
191
|
<>
|
|
196
192
|
<ReviewOrderContainer>
|
|
197
193
|
<NavBar
|
|
198
|
-
title={t('
|
|
194
|
+
title={t('REVIEW_ORDER', 'Review your Order')}
|
|
199
195
|
titleAlign={'center'}
|
|
200
|
-
leftImg={theme.images.general.close}
|
|
201
196
|
onActionLeft={() => navigation?.canGoBack() && navigation.goBack()}
|
|
202
197
|
showCall={false}
|
|
203
198
|
btnStyle={{ paddingLeft: 0 }}
|
|
204
|
-
style={{ flexDirection: 'column', alignItems: 'flex-start'
|
|
205
|
-
titleWrapStyle={{ paddingHorizontal: 0
|
|
206
|
-
titleStyle={{
|
|
199
|
+
style={{ flexDirection: 'column', alignItems: 'flex-start' }}
|
|
200
|
+
titleWrapStyle={{ paddingHorizontal: 0 }}
|
|
201
|
+
titleStyle={{ marginRight: 0, marginLeft: 0 }}
|
|
207
202
|
/>
|
|
208
203
|
<BusinessLogo>
|
|
209
204
|
<View style={styles.logoWrapper}>
|
|
@@ -214,7 +209,6 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
214
209
|
/>
|
|
215
210
|
</View>
|
|
216
211
|
</BusinessLogo>
|
|
217
|
-
{!!order?.business_name && <OText style={{ textAlign: 'center', marginTop: 15 }} color={theme.colors.textNormal}>{order?.business_name}</OText>}
|
|
218
212
|
{order?.review ? (
|
|
219
213
|
<View style={styles.reviewedStyle}>
|
|
220
214
|
<OText color={theme.colors.primary}>{t('ORDER_REVIEWED', 'This order has been already reviewed')}</OText>
|
|
@@ -222,92 +216,78 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
222
216
|
) : (
|
|
223
217
|
<View style={{ flex: 1, justifyContent: 'flex-end' }}>
|
|
224
218
|
<FormReviews>
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
<
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
219
|
+
<OText mBottom={13} color={theme.colors.textNormal}>{t('HOW_WAS_YOUR_ORDER', 'How was your order?')}</OText>
|
|
220
|
+
<RatingBarContainer>
|
|
221
|
+
<LinearGradient
|
|
222
|
+
start={{ x: 0.0, y: 0.0 }}
|
|
223
|
+
end={{ x: qualificationList[stars.quality - 1]?.percent || 0, y: 0 }}
|
|
224
|
+
locations={[.9999, .9999]}
|
|
225
|
+
colors={[theme.colors.primary, theme.colors.backgroundGray200]}
|
|
226
|
+
style={styles.statusBar}
|
|
227
|
+
/>
|
|
228
|
+
<RatingTextContainer>
|
|
229
|
+
{qualificationList.map((qualification: any) => (
|
|
230
|
+
<View
|
|
231
|
+
key={qualification.key}
|
|
232
|
+
style={{ ...qualification.parentStyle, ...styles.ratingItemContainer }}
|
|
233
|
+
>
|
|
234
|
+
<TouchableOpacity
|
|
235
|
+
style={qualification.isInnerStyle && styles.ratingItem}
|
|
236
|
+
onPress={() => handleChangeStars(qualification.key)}
|
|
240
237
|
>
|
|
241
|
-
<
|
|
242
|
-
style={
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
238
|
+
<View
|
|
239
|
+
style={{
|
|
240
|
+
...styles.ratingLineStyle,
|
|
241
|
+
backgroundColor: (qualification.pointerColor && !(stars.quality >= qualification.key)) ? theme.colors.dusk : 'transparent'
|
|
242
|
+
}}
|
|
243
|
+
/>
|
|
244
|
+
<OText size={12} color={stars.quality === qualification.key ? theme.colors.black : theme.colors.backgroundGray200}>{qualification.text}</OText>
|
|
245
|
+
</TouchableOpacity>
|
|
246
|
+
</View>
|
|
247
|
+
))}
|
|
248
|
+
</RatingTextContainer>
|
|
249
|
+
</RatingBarContainer>
|
|
250
|
+
|
|
251
|
+
<OText style={{ marginTop: 30 }} color={theme.colors.textNormal}>
|
|
252
|
+
{commentsList[stars?.quality || 1]?.title}
|
|
253
|
+
</OText>
|
|
254
|
+
<CommentsButtonGroup>
|
|
255
|
+
{commentsList[stars?.quality || 1]?.list?.map(commentItem => (
|
|
256
|
+
<OButton
|
|
257
|
+
key={commentItem.key}
|
|
258
|
+
text={commentItem.content}
|
|
259
|
+
bgColor={isSelectedComment(commentItem.key) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
260
|
+
borderColor={isSelectedComment(commentItem.key) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
261
|
+
textStyle={{
|
|
262
|
+
color: isSelectedComment(commentItem.key) ? theme.colors.white : theme.colors.black,
|
|
263
|
+
fontSize: 13,
|
|
264
|
+
paddingRight: isSelectedComment(commentItem.key) ? 15 : 0
|
|
265
|
+
}}
|
|
266
|
+
style={{ height: 35, paddingLeft: 5, paddingRight: 5, marginHorizontal: 3, marginVertical: 10 }}
|
|
267
|
+
imgRightSrc={isSelectedComment(commentItem.key) ? theme.images.general.close : null}
|
|
268
|
+
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
269
|
+
onClick={() => handleChangeComment(commentItem)}
|
|
270
|
+
/>
|
|
271
|
+
))}
|
|
272
|
+
</CommentsButtonGroup>
|
|
273
|
+
|
|
274
|
+
<OText style={{ marginTop: 30 }} color={theme.colors.textNormal}>{t('REVIEW_COMMENT_QUESTION', 'Do you want to add something?')}</OText>
|
|
275
|
+
<Controller
|
|
276
|
+
control={control}
|
|
277
|
+
defaultValue=''
|
|
278
|
+
name='comments'
|
|
279
|
+
render={({ onChange }: any) => (
|
|
280
|
+
<OInput
|
|
281
|
+
name='comments'
|
|
282
|
+
onChange={(val: any) => {
|
|
283
|
+
onChange(val)
|
|
284
|
+
setExtraComment(val.target.value)
|
|
285
|
+
}}
|
|
286
|
+
style={styles.inputTextArea}
|
|
287
|
+
multiline
|
|
288
|
+
/>
|
|
260
289
|
)}
|
|
261
|
-
|
|
262
|
-
<PlacedDate>
|
|
263
|
-
<OText color={theme.colors.textNormal}>{t('DONOT_FORGET_RATE_YOUR_ORDER', 'Do not forget to rate your order placed on ')}</OText>
|
|
264
|
-
<OText color={theme.colors.textNormal} style={{ fontWeight: "bold" }}>{placedOnDate}</OText>
|
|
265
|
-
</PlacedDate>
|
|
266
|
-
{false && (
|
|
267
|
-
<>
|
|
268
|
-
<OText style={{ marginTop: 30 }} color={theme.colors.textNormal}>
|
|
269
|
-
{commentsList[stars?.quality || 1]?.title}
|
|
270
|
-
</OText>
|
|
271
|
-
<CommentsButtonGroup>
|
|
272
|
-
{commentsList[stars?.quality || 1]?.list?.map((commentItem: any) => (
|
|
273
|
-
<OButton
|
|
274
|
-
key={commentItem.key}
|
|
275
|
-
text={commentItem.content}
|
|
276
|
-
bgColor={isSelectedComment(commentItem.key) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
277
|
-
borderColor={isSelectedComment(commentItem.key) ? theme.colors.primary : theme.colors.backgroundGray200}
|
|
278
|
-
textStyle={{
|
|
279
|
-
color: isSelectedComment(commentItem.key) ? theme.colors.white : theme.colors.black,
|
|
280
|
-
fontSize: 13,
|
|
281
|
-
paddingRight: isSelectedComment(commentItem.key) ? 15 : 0
|
|
282
|
-
}}
|
|
283
|
-
style={{ height: 35, paddingLeft: 5, paddingRight: 5, marginHorizontal: 3, marginVertical: 10 }}
|
|
284
|
-
imgRightSrc={isSelectedComment(commentItem.key) ? theme.images.general.close : null}
|
|
285
|
-
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
286
|
-
onClick={() => handleChangeComment(commentItem)}
|
|
287
|
-
/>
|
|
288
|
-
))}
|
|
289
|
-
</CommentsButtonGroup>
|
|
290
|
-
</>
|
|
291
|
-
)}
|
|
292
|
-
{/* <OText style={{ marginTop: 30 }} color={theme.colors.textNormal}>{t('REVIEW_COMMENT_QUESTION', 'Do you want to add something?')}</OText> */}
|
|
293
|
-
{false && (
|
|
294
|
-
<Controller
|
|
295
|
-
control={control}
|
|
296
|
-
defaultValue=''
|
|
297
|
-
name='comments'
|
|
298
|
-
render={({ onChange }: any) => (
|
|
299
|
-
<OInput
|
|
300
|
-
name='comments'
|
|
301
|
-
onChange={(val: any) => {
|
|
302
|
-
onChange(val)
|
|
303
|
-
setExtraComment(val.target.value)
|
|
304
|
-
}}
|
|
305
|
-
style={styles.inputTextArea}
|
|
306
|
-
multiline
|
|
307
|
-
/>
|
|
308
|
-
)}
|
|
309
|
-
/>
|
|
310
|
-
)}
|
|
290
|
+
/>
|
|
311
291
|
</FormReviews>
|
|
312
292
|
</View>
|
|
313
293
|
)}
|
|
@@ -322,7 +302,7 @@ export const ReviewOrderUI = (props: ReviewOrderParams) => {
|
|
|
322
302
|
</SkipButton>
|
|
323
303
|
<OButton
|
|
324
304
|
textStyle={{ color: theme.colors.white, paddingRight: 10 }}
|
|
325
|
-
text={t('
|
|
305
|
+
text={t('CONTINUE', 'Continue')}
|
|
326
306
|
style={{ borderRadius: 8 }}
|
|
327
307
|
imgRightSrc={theme.images.general.arrow_right}
|
|
328
308
|
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
@@ -338,7 +318,7 @@ export const ReviewOrder = (props: ReviewOrderParams) => {
|
|
|
338
318
|
const reviewOrderProps = {
|
|
339
319
|
...props,
|
|
340
320
|
UIComponent: ReviewOrderUI,
|
|
341
|
-
defaultStar: 5
|
|
321
|
+
defaultStar: props?.defaultStar || 5
|
|
342
322
|
}
|
|
343
323
|
return <ReviewOrderController {...reviewOrderProps} />
|
|
344
324
|
}
|
|
@@ -42,12 +42,3 @@ export const RatingTextContainer = styled.View`
|
|
|
42
42
|
justify-content: space-between;
|
|
43
43
|
margin-top: 10px;
|
|
44
44
|
`
|
|
45
|
-
export const RatingStarContainer = styled.View`
|
|
46
|
-
flex-direction: row;
|
|
47
|
-
align-items: center;
|
|
48
|
-
justify-content: space-between;
|
|
49
|
-
margin-top: 10px;
|
|
50
|
-
`
|
|
51
|
-
export const PlacedDate = styled.View`
|
|
52
|
-
margin-top: 30px;
|
|
53
|
-
`
|