ordering-ui-react-native 0.15.37 → 0.15.38
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/src/components/BusinessController/index.tsx +5 -3
- package/themes/original/src/components/BusinessListingSearch/index.tsx +4 -0
- package/themes/original/src/components/BusinessMenuList/index.tsx +11 -4
- package/themes/original/src/components/BusinessPreorder/index.tsx +76 -73
package/package.json
CHANGED
|
@@ -192,9 +192,11 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
|
|
|
192
192
|
</View>
|
|
193
193
|
) : (
|
|
194
194
|
<View style={styles.bullet}>
|
|
195
|
-
|
|
196
|
-
{
|
|
197
|
-
|
|
195
|
+
{orderState?.options?.type === 1 && (
|
|
196
|
+
<OText size={10} color={theme.colors.textSecondary}>
|
|
197
|
+
{`${t('DELIVERY_FEE', 'Delivery fee')} ${parsePrice(businessDeliveryPrice ?? business?.delivery_price) + ' \u2022 '}`}
|
|
198
|
+
</OText>
|
|
199
|
+
)}
|
|
198
200
|
<OText size={10} color={theme.colors.textSecondary}>{`${convertHoursToMinutes(
|
|
199
201
|
orderState?.options?.type === 1
|
|
200
202
|
? (businessDeliveryTime ?? business?.delivery_time)
|
|
@@ -137,6 +137,10 @@ export const BusinessListingSearchUI = (props : BusinessSearchParams) => {
|
|
|
137
137
|
}
|
|
138
138
|
}, [filters, openFilters])
|
|
139
139
|
|
|
140
|
+
useEffect(() => {
|
|
141
|
+
handleSearchbusinessAndProducts(true)
|
|
142
|
+
}, [])
|
|
143
|
+
|
|
140
144
|
const MaxSectionItem = ({ title, options, filter }: any) => {
|
|
141
145
|
const parseValue = (option: number) => {
|
|
142
146
|
return filter === 'max_distance'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from 'react'
|
|
1
|
+
import React, { useEffect } from 'react'
|
|
2
2
|
import { useLanguage, BusinessMenuListing } from 'ordering-components/native'
|
|
3
3
|
import { OText } from '../shared'
|
|
4
4
|
import { BusinessMenuListParams } from '../../types'
|
|
@@ -19,7 +19,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
|
|
|
19
19
|
|
|
20
20
|
const [, t] = useLanguage()
|
|
21
21
|
const theme = useTheme()
|
|
22
|
-
const {top} = useSafeAreaInsets()
|
|
22
|
+
const { top } = useSafeAreaInsets()
|
|
23
23
|
|
|
24
24
|
const styles = StyleSheet.create({
|
|
25
25
|
container: {
|
|
@@ -36,7 +36,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
|
|
|
36
36
|
height: 44,
|
|
37
37
|
width: '100%'
|
|
38
38
|
}
|
|
39
|
-
|
|
39
|
+
})
|
|
40
40
|
|
|
41
41
|
const dropDownIcon = () => {
|
|
42
42
|
return (
|
|
@@ -48,12 +48,18 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
|
|
|
48
48
|
)
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
if (!businessMenuList?.loading && businessMenuList?.menus?.length === 1){
|
|
53
|
+
setMenu(businessMenuList?.menus[0])
|
|
54
|
+
}
|
|
55
|
+
}, [businessMenuList?.menus])
|
|
56
|
+
|
|
51
57
|
return (
|
|
52
58
|
<>
|
|
53
59
|
{businessMenuList.loading ? (
|
|
54
60
|
<Placeholder Animation={Fade}>
|
|
55
61
|
<View>
|
|
56
|
-
<PlaceholderLine height={44}/>
|
|
62
|
+
<PlaceholderLine height={44} />
|
|
57
63
|
</View>
|
|
58
64
|
</Placeholder>
|
|
59
65
|
) : (
|
|
@@ -67,6 +73,7 @@ const BusinessMenuListUI = (props: BusinessMenuListParams) => {
|
|
|
67
73
|
onSelect={(selectedItem, index) => {
|
|
68
74
|
setMenu(selectedItem)
|
|
69
75
|
}}
|
|
76
|
+
defaultValue={businessMenuList?.menus?.length === 1 && businessMenuList?.menus[0]}
|
|
70
77
|
buttonTextAfterSelection={(selectedItem, index) => {
|
|
71
78
|
return selectedItem.name
|
|
72
79
|
}}
|
|
@@ -51,7 +51,8 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
51
51
|
const [selectDate, setSelectedDate] = useState<any>(null)
|
|
52
52
|
const [datesWhitelist, setDateWhitelist] = useState<any>([{ start: null, end: null }])
|
|
53
53
|
const [isEnabled, setIsEnabled] = useState(false)
|
|
54
|
-
const {top} = useSafeAreaInsets()
|
|
54
|
+
const { top } = useSafeAreaInsets()
|
|
55
|
+
const showOrderTime = (selectedPreorderType === 1 && Object.keys(menu)?.length > 0) || selectedPreorderType === 0
|
|
55
56
|
const styles = StyleSheet.create({
|
|
56
57
|
container: {
|
|
57
58
|
height: windowHeight,
|
|
@@ -373,78 +374,80 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
|
|
|
373
374
|
/>
|
|
374
375
|
</MenuWrapper>
|
|
375
376
|
)}
|
|
376
|
-
|
|
377
|
-
<
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
{
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
{
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
<
|
|
419
|
-
<
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
377
|
+
{showOrderTime && (
|
|
378
|
+
<OrderTimeWrapper>
|
|
379
|
+
<OText
|
|
380
|
+
size={16}
|
|
381
|
+
style={{
|
|
382
|
+
fontWeight: '600',
|
|
383
|
+
lineHeight: 24
|
|
384
|
+
}}
|
|
385
|
+
>
|
|
386
|
+
{t('ORDER_TIME', 'Order time')}
|
|
387
|
+
</OText>
|
|
388
|
+
<View style={{ flex: 1 }}>
|
|
389
|
+
{selectDate && datesWhitelist[0]?.start !== null && (
|
|
390
|
+
<CalendarStrip
|
|
391
|
+
scrollable
|
|
392
|
+
style={styles.calendar}
|
|
393
|
+
calendarHeaderContainerStyle={styles.calendarHeaderContainer}
|
|
394
|
+
calendarHeaderStyle={styles.calendarHeader}
|
|
395
|
+
dateNumberStyle={styles.dateNumber}
|
|
396
|
+
dateNameStyle={styles.dateName}
|
|
397
|
+
iconContainer={{ flex: 0.1 }}
|
|
398
|
+
highlightDateNameStyle={styles.highlightDateName}
|
|
399
|
+
highlightDateNumberStyle={styles.highlightDateNumber}
|
|
400
|
+
dayContainerStyle={{ height: '100%' }}
|
|
401
|
+
highlightDateContainerStyle={{ height: '100%' }}
|
|
402
|
+
calendarHeaderFormat='MMMM, YYYY'
|
|
403
|
+
iconStyle={{ borderWidth: 1 }}
|
|
404
|
+
selectedDate={selectDate}
|
|
405
|
+
datesWhitelist={datesWhitelist}
|
|
406
|
+
disabledDateNameStyle={styles.disabledDateName}
|
|
407
|
+
disabledDateNumberStyle={styles.disabledDateNumber}
|
|
408
|
+
disabledDateOpacity={0.6}
|
|
409
|
+
onDateSelected={(date) => onSelectDate(date)}
|
|
410
|
+
leftSelector={<LeftSelector />}
|
|
411
|
+
rightSelector={<RightSelector />}
|
|
412
|
+
/>
|
|
413
|
+
)}
|
|
414
|
+
</View>
|
|
415
|
+
<TimeListWrapper nestedScrollEnabled={true}>
|
|
416
|
+
{(isEnabled && timeList?.length > 0) ? (
|
|
417
|
+
<TimeContentWrapper>
|
|
418
|
+
{timeList.map((time: any, i: number) => (
|
|
419
|
+
<TouchableOpacity key={i} onPress={() => handleChangeTime(time.value)}>
|
|
420
|
+
<TimeItem active={timeSelected === time.value}>
|
|
421
|
+
<OText
|
|
422
|
+
size={14}
|
|
423
|
+
color={timeSelected === time.value ? theme.colors.primary : theme.colors.textNormal}
|
|
424
|
+
style={{
|
|
425
|
+
lineHeight: 24
|
|
426
|
+
}}
|
|
427
|
+
>{time.text}</OText>
|
|
428
|
+
</TimeItem>
|
|
429
|
+
</TouchableOpacity>
|
|
430
|
+
))}
|
|
431
|
+
{timeList.length % 3 === 2 && (
|
|
432
|
+
<TimeItem style={{ backgroundColor: 'transparent' }} />
|
|
433
|
+
)}
|
|
434
|
+
</TimeContentWrapper>
|
|
435
|
+
) : (
|
|
436
|
+
<OText
|
|
437
|
+
size={16}
|
|
438
|
+
style={{
|
|
439
|
+
fontWeight: '600',
|
|
440
|
+
lineHeight: 24,
|
|
441
|
+
marginBottom: 12,
|
|
442
|
+
textAlign: 'center'
|
|
443
|
+
}}
|
|
444
|
+
>
|
|
445
|
+
{t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
|
|
446
|
+
</OText>
|
|
447
|
+
)}
|
|
448
|
+
</TimeListWrapper>
|
|
449
|
+
</OrderTimeWrapper>
|
|
450
|
+
)}
|
|
448
451
|
<OButton
|
|
449
452
|
text={t('GO_TO_MENU', 'Go to menu')}
|
|
450
453
|
textStyle={{ color: 'white' }}
|