ordering-ui-react-native 0.15.38 → 0.15.41

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ordering-ui-react-native",
3
- "version": "0.15.38",
3
+ "version": "0.15.41",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -60,6 +60,7 @@ import {
60
60
  OAlert,
61
61
  OModal,
62
62
  OBottomPopup,
63
+ HeaderTitle
63
64
  } from './src/components/shared';
64
65
 
65
66
  import { Container } from './src/layouts/Container';
@@ -134,6 +135,7 @@ export {
134
135
  OAlert,
135
136
  OModal,
136
137
  OBottomPopup,
138
+ HeaderTitle,
137
139
 
138
140
  // layout
139
141
  Container,
@@ -108,6 +108,9 @@ const AddressFormUI = (props: AddressFormParams) => {
108
108
  top: 12,
109
109
  zIndex: 1002,
110
110
  },
111
+ wrapperNavbar: Platform.OS === 'ios'
112
+ ? { paddingVertical: 0, paddingHorizontal: 40 }
113
+ : { paddingVertical: 20, paddingHorizontal: 40 }
111
114
  });
112
115
 
113
116
  const [, t] = useLanguage();
@@ -500,16 +503,18 @@ const AddressFormUI = (props: AddressFormParams) => {
500
503
  keyboardShouldPersistTaps='always'
501
504
  listViewDisplayed={false}
502
505
  >
503
- <NavBar
504
- title={t('WHERE_DO_WE_DELIVERY', 'Where do we delivery?')}
505
- titleAlign={'center'}
506
- onActionLeft={goToBack}
507
- showCall={false}
508
- paddingTop={20}
509
- btnStyle={{ paddingLeft: 40 }}
510
- titleStyle={{ fontSize: 14 }}
511
- titleWrapStyle={{ paddingHorizontal: 0 }}
512
- />
506
+ <View style={styles.wrapperNavbar}>
507
+ <NavBar
508
+ title={t('WHERE_DO_WE_DELIVERY', 'Where do we delivery?')}
509
+ titleAlign={'center'}
510
+ onActionLeft={goToBack}
511
+ showCall={false}
512
+ btnStyle={{ paddingLeft: 0 }}
513
+ style={{ flexDirection: 'column', alignItems: 'flex-start' }}
514
+ titleWrapStyle={{ paddingHorizontal: 0 }}
515
+ titleStyle={{ marginRight: 0, marginLeft: 0 }}
516
+ />
517
+ </View>
513
518
  <TouchableWithoutFeedback onPress={Keyboard.dismiss}>
514
519
  <AddressFormContainer style={{ height: 600, overflow: 'scroll' }}>
515
520
  <View>
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect } from 'react'
2
2
  import { AddressList as AddressListController, useLanguage, useOrder, useSession } from 'ordering-components/native'
3
3
  import { AddressListContainer, AddressItem } from './styles'
4
- import { StyleSheet, View } from 'react-native'
4
+ import { Platform, StyleSheet, View } from 'react-native'
5
5
  import { OButton, OText, OAlert, OModal, OIcon } from '../shared'
6
6
  import { Container } from '../../layouts/Container'
7
7
  import { AddressListParams } from '../../types'
@@ -261,6 +261,32 @@ const AddressListUI = (props: AddressListParams) => {
261
261
  )}
262
262
  {!addressList.loading && !addressList.error && (
263
263
  <>
264
+ {addressList?.addresses?.length === 0 && (
265
+ <View
266
+ style={{
267
+ flexDirection: 'column',
268
+ paddingHorizontal: 10,
269
+ paddingTop: 20
270
+ }}
271
+ >
272
+ <OText
273
+ size={24}
274
+ lineHeight={36}
275
+ weight={Platform.OS === 'ios' ? '600' : 'bold'}
276
+ style={{
277
+ textAlign: 'center',
278
+ marginRight: 40,
279
+ color: theme.colors.textNormal,
280
+ paddingHorizontal: 0,
281
+ width: '100%',
282
+ marginLeft: 0
283
+ }}
284
+ >
285
+ {t('ADDRESS_LIST', 'Address List')}
286
+ </OText>
287
+ </View>
288
+ )}
289
+
264
290
  <OButton
265
291
  text={t('ADD_NEW_ADDRESS', 'Add new Address')}
266
292
  imgRightSrc=''
@@ -45,9 +45,6 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
45
45
  const [orderState] = useOrder();
46
46
  const [, t] = useLanguage();
47
47
  const theme = useTheme()
48
- const [{ configs }] = useConfig();
49
- const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
50
-
51
48
  const styles = StyleSheet.create({
52
49
  headerStyle: {
53
50
  borderTopLeftRadius: 7.6,
@@ -115,7 +112,7 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
115
112
  };
116
113
 
117
114
  const handleBusinessClick = (selectedBusiness: any) => {
118
- if (business?.open || !isPreOrderSetting) handleClick && handleClick(selectedBusiness)
115
+ if (business?.open) handleClick && handleClick(selectedBusiness)
119
116
  else {
120
117
  navigation.navigate('BusinessPreorder', { business: selectedBusiness, handleBusinessClick: handleClick })
121
118
  }
@@ -53,6 +53,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
53
53
  const [isEnabled, setIsEnabled] = useState(false)
54
54
  const { top } = useSafeAreaInsets()
55
55
  const showOrderTime = (selectedPreorderType === 1 && Object.keys(menu)?.length > 0) || selectedPreorderType === 0
56
+ const isPreOrderSetting = configs?.preorder_status_enabled?.value === '1'
56
57
  const styles = StyleSheet.create({
57
58
  container: {
58
59
  height: windowHeight,
@@ -301,60 +302,62 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
301
302
  />
302
303
  </View>
303
304
  </BusinessInfoWrapper>
304
- <PreorderTypeWrapper>
305
- <OText
306
- size={16}
307
- style={{
308
- fontWeight: '600',
309
- lineHeight: 24,
310
- marginBottom: 12
311
- }}
312
- >
313
- {t('PREORDER_TYPE', 'Preorder type')}
314
- </OText>
315
- <SelectDropdown
316
- defaultValueByIndex={selectedPreorderType}
317
- data={preorderTypeList}
318
- // disabled={orderState.loading}
319
- onSelect={(selectedItem, index) => {
320
- setSelectedPreorderType(index)
321
- }}
322
- buttonTextAfterSelection={(selectedItem, index) => {
323
- return selectedItem.name
324
- }}
325
- rowTextForSelection={(item, index) => {
326
- return item.name
327
- }}
328
- buttonStyle={styles.selectOption}
329
- buttonTextStyle={{
330
- color: theme.colors.disabled,
331
- fontSize: 14,
332
- textAlign: 'left',
333
- marginHorizontal: 0
334
- }}
335
- dropdownStyle={{
336
- borderRadius: 8,
337
- borderColor: theme.colors.lightGray,
338
- marginTop: Platform.OS === 'ios' ? 12 : -top
339
- }}
340
- rowStyle={{
341
- borderBottomColor: theme.colors.backgroundGray100,
342
- backgroundColor: theme.colors.backgroundGray100,
343
- height: 40,
344
- flexDirection: 'column',
345
- alignItems: 'flex-start',
346
- paddingTop: 8,
347
- paddingHorizontal: 14
348
- }}
349
- rowTextStyle={{
350
- color: theme.colors.disabled,
351
- fontSize: 14,
352
- marginHorizontal: 0
353
- }}
354
- renderDropdownIcon={() => dropDownIcon()}
355
- dropdownOverlayColor='transparent'
356
- />
357
- </PreorderTypeWrapper>
305
+ {isPreOrderSetting && (
306
+ <PreorderTypeWrapper>
307
+ <OText
308
+ size={16}
309
+ style={{
310
+ fontWeight: '600',
311
+ lineHeight: 24,
312
+ marginBottom: 12
313
+ }}
314
+ >
315
+ {t('PREORDER_TYPE', 'Preorder type')}
316
+ </OText>
317
+ <SelectDropdown
318
+ defaultValueByIndex={selectedPreorderType}
319
+ data={preorderTypeList}
320
+ // disabled={orderState.loading}
321
+ onSelect={(selectedItem, index) => {
322
+ setSelectedPreorderType(index)
323
+ }}
324
+ buttonTextAfterSelection={(selectedItem, index) => {
325
+ return selectedItem.name
326
+ }}
327
+ rowTextForSelection={(item, index) => {
328
+ return item.name
329
+ }}
330
+ buttonStyle={styles.selectOption}
331
+ buttonTextStyle={{
332
+ color: theme.colors.disabled,
333
+ fontSize: 14,
334
+ textAlign: 'left',
335
+ marginHorizontal: 0
336
+ }}
337
+ dropdownStyle={{
338
+ borderRadius: 8,
339
+ borderColor: theme.colors.lightGray,
340
+ marginTop: Platform.OS === 'ios' ? 12 : -top
341
+ }}
342
+ rowStyle={{
343
+ borderBottomColor: theme.colors.backgroundGray100,
344
+ backgroundColor: theme.colors.backgroundGray100,
345
+ height: 40,
346
+ flexDirection: 'column',
347
+ alignItems: 'flex-start',
348
+ paddingTop: 8,
349
+ paddingHorizontal: 14
350
+ }}
351
+ rowTextStyle={{
352
+ color: theme.colors.disabled,
353
+ fontSize: 14,
354
+ marginHorizontal: 0
355
+ }}
356
+ renderDropdownIcon={() => dropDownIcon()}
357
+ dropdownOverlayColor='transparent'
358
+ />
359
+ </PreorderTypeWrapper>
360
+ )}
358
361
  {selectedPreorderType === 1 && (
359
362
  <MenuWrapper>
360
363
  <OText
@@ -374,7 +377,7 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
374
377
  />
375
378
  </MenuWrapper>
376
379
  )}
377
- {showOrderTime && (
380
+ {isPreOrderSetting && (
378
381
  <OrderTimeWrapper>
379
382
  <OText
380
383
  size={16}
@@ -448,6 +451,20 @@ const BusinessPreorderUI = (props: BusinessPreorderParams) => {
448
451
  </TimeListWrapper>
449
452
  </OrderTimeWrapper>
450
453
  )}
454
+ {!isPreOrderSetting && (
455
+ <OText
456
+ size={16}
457
+ style={{
458
+ fontWeight: '600',
459
+ lineHeight: 24,
460
+ marginTop: 30,
461
+ marginBottom: 12,
462
+ textAlign: 'center'
463
+ }}
464
+ >
465
+ {t('ERROR_ADD_PRODUCT_BUSINESS_CLOSED', 'The business is closed at the moment')}
466
+ </OText>
467
+ )}
451
468
  <OButton
452
469
  text={t('GO_TO_MENU', 'Go to menu')}
453
470
  textStyle={{ color: 'white' }}
@@ -111,7 +111,7 @@ const BusinessProductsCategoriesUI = (props: any) => {
111
111
  categories.length &&
112
112
  categories.map((category: any) => (
113
113
  <Tab
114
- key={category.name}
114
+ key={category.id}
115
115
  onPress={() => handleCategoryScroll(category)}
116
116
  style={[
117
117
  category.id === 'featured' && !featured && styles.featuredStyle,
@@ -61,7 +61,6 @@ const BusinessesListingUI = (props: BusinessesListingParams) => {
61
61
  handleChangeSearch,
62
62
  businessId
63
63
  } = props;
64
-
65
64
  const theme = useTheme();
66
65
  const isFocused = useIsFocused();
67
66
  const appState = useRef(AppState.currentState)
@@ -22,9 +22,9 @@ export const CartContent = (props: any) => {
22
22
  <CCContainer>
23
23
  {isOrderStateCarts && carts?.length > 0 && (
24
24
  <>
25
- <OText size={24} lineHeight={36} weight={'600'} style={{ marginBottom: 20 }}>
25
+ {/* <OText size={24} lineHeight={36} weight={'600'} style={{ marginBottom: 20 }}>
26
26
  {carts.length > 1 ? t('MY_CARTS', 'My Carts') : t('CART', 'Cart')}
27
- </OText>
27
+ </OText> */}
28
28
  {carts.map((cart: any, i: number) => (
29
29
  <CCList key={i} style={{ overflow: 'visible' }}>
30
30
  {cart.products.length > 0 && (
@@ -540,6 +540,11 @@ const styles = StyleSheet.create({
540
540
 
541
541
  export const Messages = (props: MessagesParams) => {
542
542
  const [allMessages, setAllMessages] = useState(props.messages)
543
+
544
+ useEffect(() => {
545
+ setAllMessages(props.messages)
546
+ }, [props.messages])
547
+
543
548
  const MessagesProps = {
544
549
  ...props,
545
550
  UIComponent: MessagesUI,
@@ -1,7 +1,5 @@
1
-
2
1
  import styled, { css } from 'styled-components/native'
3
2
 
4
-
5
3
  export const Wrapper = styled.View`
6
4
  flex: 1;
7
5
  background-color: ${(props: any) => props.theme.colors.white};
@@ -39,4 +37,4 @@ export const MessageTypeItem = styled.View`
39
37
  ${({ active }: any) => active && css`
40
38
  background-color: ${(props: any) => props.theme.colors.whiteGray};
41
39
  `}
42
- `
40
+ `
@@ -136,10 +136,10 @@ const ProfileListUI = (props: ProfileParams) => {
136
136
  }
137
137
 
138
138
  return (
139
- <View style={{ flex: 1, height: height - top - bottom - 62 }}>
140
- <OText size={24} style={{ marginTop: 15, paddingHorizontal: 40 }}>
139
+ <View style={{ flex: 1, height: height - top - bottom - 62, paddingTop: 20 }}>
140
+ {/* <OText size={24} style={{ marginTop: 15, paddingHorizontal: 40 }}>
141
141
  {t('PROFILE', 'Profile')}
142
- </OText>
142
+ </OText> */}
143
143
  <CenterView style={styles.pagePadding}>
144
144
  {user?.photo && (
145
145
  <View style={styles.photo}>
@@ -0,0 +1,20 @@
1
+ import React from 'react';
2
+ import OText from './OText';
3
+
4
+ const HeaderTitle = (props: any) => {
5
+ const { text, style } = props
6
+ return (
7
+ <OText
8
+ size={24}
9
+ style={style ?? {
10
+ marginTop: 30,
11
+ paddingHorizontal: 40,
12
+ textTransform: 'capitalize'
13
+ }}
14
+ >
15
+ {text}
16
+ </OText>
17
+ )
18
+ }
19
+
20
+ export default HeaderTitle
@@ -11,6 +11,7 @@ import OKeyButton from './OKeyButton'
11
11
  import OModal from './OModal'
12
12
  import OAlert from './OAlert'
13
13
  import OBottomPopup from './OBottomPopup'
14
+ import HeaderTitle from './HeaderTitle'
14
15
 
15
16
  export {
16
17
  OText,
@@ -26,4 +27,5 @@ export {
26
27
  OAlert,
27
28
  OModal,
28
29
  OBottomPopup,
30
+ HeaderTitle
29
31
  }