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
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
import React, { useState, useEffect } from 'react'
|
|
2
|
-
import { useLanguage, useToast, ToastType, ReviewProduct as ReviewProductController } from 'ordering-components/native'
|
|
3
|
-
import { OText, OButton } from '../../shared'
|
|
4
|
-
import { ReviewProductParams } from '../../../types'
|
|
5
|
-
import { FloatingBottomContainer } from '../../../layouts/FloatingBottomContainer'
|
|
6
|
-
import { useTheme } from 'styled-components/native'
|
|
7
|
-
import { SingleProductReview } from '../../SingleProductReview'
|
|
8
|
-
|
|
9
|
-
import {
|
|
10
|
-
ReviewProductsContainer,
|
|
11
|
-
ActionContainer,
|
|
12
|
-
SkipButton
|
|
13
|
-
} from './styles'
|
|
14
|
-
|
|
15
|
-
const ReviewProductsUI = (props: ReviewProductParams) => {
|
|
16
|
-
const {
|
|
17
|
-
navigation,
|
|
18
|
-
order,
|
|
19
|
-
formState,
|
|
20
|
-
handleChangeFormState,
|
|
21
|
-
handleSendProductReview,
|
|
22
|
-
closeReviewProduct
|
|
23
|
-
} = props
|
|
24
|
-
|
|
25
|
-
const [, t] = useLanguage()
|
|
26
|
-
const theme = useTheme()
|
|
27
|
-
const [, { showToast }] = useToast()
|
|
28
|
-
|
|
29
|
-
const [isProductReviewed, setIsProductReviewed] = useState(false)
|
|
30
|
-
const [alertState, setAlertState] = useState<{ open: boolean, content: Array<any>, success?: boolean }>({ open: false, content: [], success: false })
|
|
31
|
-
|
|
32
|
-
const handleContinueClick = () => {
|
|
33
|
-
setAlertState({ ...alertState, success: true })
|
|
34
|
-
handleSendProductReview()
|
|
35
|
-
}
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
if (alertState.open) {
|
|
38
|
-
alertState.content && showToast(
|
|
39
|
-
ToastType.Error,
|
|
40
|
-
alertState.content
|
|
41
|
-
)
|
|
42
|
-
}
|
|
43
|
-
}, [alertState.content])
|
|
44
|
-
|
|
45
|
-
useEffect(() => {
|
|
46
|
-
if (!formState.loading && formState.result?.error) {
|
|
47
|
-
setAlertState({
|
|
48
|
-
open: true,
|
|
49
|
-
success: false,
|
|
50
|
-
content: formState.result?.result || [t('ERROR', 'Error')]
|
|
51
|
-
})
|
|
52
|
-
}
|
|
53
|
-
if (!formState.loading && !formState.result?.error && alertState.success) {
|
|
54
|
-
setIsProductReviewed && setIsProductReviewed(true)
|
|
55
|
-
closeReviewProduct && closeReviewProduct()
|
|
56
|
-
}
|
|
57
|
-
}, [formState])
|
|
58
|
-
|
|
59
|
-
return (
|
|
60
|
-
<>
|
|
61
|
-
<ReviewProductsContainer>
|
|
62
|
-
{order?.products?.map((product: any) => (
|
|
63
|
-
<SingleProductReview
|
|
64
|
-
key={product.id}
|
|
65
|
-
product={product}
|
|
66
|
-
formState={formState}
|
|
67
|
-
handleChangeFormState={handleChangeFormState}
|
|
68
|
-
/>
|
|
69
|
-
))}
|
|
70
|
-
</ReviewProductsContainer>
|
|
71
|
-
|
|
72
|
-
<FloatingBottomContainer>
|
|
73
|
-
<ActionContainer>
|
|
74
|
-
<SkipButton
|
|
75
|
-
onPress={() => closeReviewProduct && closeReviewProduct()}
|
|
76
|
-
>
|
|
77
|
-
<OText weight={700} size={18} color={theme.colors.textNormal}>{t('FRONT_VISUALS_SKIP', 'Skip')}</OText>
|
|
78
|
-
</SkipButton>
|
|
79
|
-
<OButton
|
|
80
|
-
textStyle={{ color: theme.colors.white, paddingRight: 10 }}
|
|
81
|
-
text={order?.driver && !order?.user_review ? t('CONTINUE', 'Continue') : t('SEND_REVIEW', 'Send Review')}
|
|
82
|
-
style={{ borderRadius: 8 }}
|
|
83
|
-
imgRightSrc={theme.images.general.arrow_right}
|
|
84
|
-
imgRightStyle={{ tintColor: theme.colors.white, right: 5, margin: 5 }}
|
|
85
|
-
isDisabled={formState.loading || formState?.changes?.length === 0}
|
|
86
|
-
onClick={() => handleContinueClick()}
|
|
87
|
-
/>
|
|
88
|
-
</ActionContainer>
|
|
89
|
-
</FloatingBottomContainer>
|
|
90
|
-
</>
|
|
91
|
-
)
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export const ReviewProducts = (props: any) => {
|
|
95
|
-
const reviewProductProps = {
|
|
96
|
-
...props,
|
|
97
|
-
UIComponent: ReviewProductsUI,
|
|
98
|
-
isToast: true
|
|
99
|
-
}
|
|
100
|
-
return <ReviewProductController {...reviewProductProps} />
|
|
101
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import styled from 'styled-components/native'
|
|
2
|
-
|
|
3
|
-
export const ReviewProductsContainer = styled.ScrollView`
|
|
4
|
-
padding: 20px 40px;
|
|
5
|
-
margin-bottom: 100px;
|
|
6
|
-
max-height: 400px;
|
|
7
|
-
`
|
|
8
|
-
|
|
9
|
-
export const ActionContainer = styled.View`
|
|
10
|
-
flex-direction: row;
|
|
11
|
-
align-items: center;
|
|
12
|
-
justify-content: space-between;
|
|
13
|
-
padding: 3px 30px;
|
|
14
|
-
`
|
|
15
|
-
|
|
16
|
-
export const SkipButton = styled.TouchableOpacity`
|
|
17
|
-
`
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { ReviewOrder as ReviewOrderModal } from './ReviewOrder';
|
|
2
|
-
import { ReviewProducts as ReviewProductsModal } from './ReviewProducts';
|
|
3
|
-
import { ReviewDriver as ReviewDriverModal } from './ReviewDriver';
|
|
4
|
-
|
|
5
|
-
export {
|
|
6
|
-
ReviewOrderModal,
|
|
7
|
-
ReviewProductsModal,
|
|
8
|
-
ReviewDriverModal
|
|
9
|
-
}
|