ordering-ui-react-native 0.16.0-release → 0.16.1-release

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.16.0-release",
3
+ "version": "0.16.1-release",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -139,7 +139,7 @@ const BusinessProductsListingUI = (props: BusinessProductsListingParams) => {
139
139
 
140
140
  const onProductClick = (product: any) => {
141
141
  const productAddedToCartLength = currentCart?.products?.reduce((productsLength: number, Cproduct: any) => { return productsLength + (Cproduct?.id === product?.id ? Cproduct?.quantity : 0) }, 0)
142
- if (product?.type === 'service' && professionalSelected) {
142
+ if (product?.type === 'service' && business?.professionals?.length > 0) {
143
143
  setCurrentProduct(product)
144
144
  setOpenService(true)
145
145
  return
@@ -1,7 +1,7 @@
1
1
  import React, { useState, useEffect, useRef } from 'react'
2
2
  import { useTheme } from 'styled-components/native'
3
3
  import { Platform, View, StyleSheet, Dimensions, ScrollView, TouchableOpacity } from 'react-native'
4
- import { OText, OButton, OModal } from '../shared'
4
+ import { OText, OButton, OModal, OIcon } from '../shared'
5
5
  import FastImage from 'react-native-fast-image'
6
6
  import IconAntDesign from 'react-native-vector-icons/AntDesign'
7
7
  import SelectDropdown from 'react-native-select-dropdown'
@@ -241,13 +241,21 @@ const ServiceFormUI = (props: ServiceFormParams) => {
241
241
  return (
242
242
  <>
243
243
  <Container>
244
- <ProfessionalPhoto
245
- source={{
246
- uri:
247
- product?.images ||
248
- optimizeImage(theme?.images?.dummies?.product, 'h_250,c_limit'),
249
- }}
250
- />
244
+ {!!product?.images ? (
245
+ <ProfessionalPhoto
246
+ source={{
247
+ uri: product?.images
248
+ }}
249
+ />
250
+ ) : (
251
+ <OIcon
252
+ src={theme?.images?.dummies?.product}
253
+ cover={false}
254
+ style={{ alignSelf: 'center' }}
255
+ width={200}
256
+ height={200}
257
+ />
258
+ )}
251
259
  <InfoWrapper>
252
260
  <OText
253
261
  size={20}
@@ -295,50 +303,62 @@ const ServiceFormUI = (props: ServiceFormParams) => {
295
303
  {t('REQUIRED', 'Required')}
296
304
  </OText>
297
305
  </View>
298
- {currentProfessional && (
299
- <TouchableOpacity
300
- style={styles.professionalSelect}
301
- onPress={() => setIsOpen(true)}
302
- >
303
- <View style={{ flexDirection: 'row' }}>
304
- <FastImage
305
- style={styles.photoStyle}
306
- source={{
307
- uri: optimizeImage(currentProfessional?.photo, 'h_250,c_limit'),
308
- priority: FastImage.priority.normal,
309
- }}
310
- resizeMode={FastImage.resizeMode.cover}
311
- />
312
- <View style={{ marginLeft: 14 }}>
313
- <OText
314
- size={14}
315
- weight={'400'}
316
- lineHeight={22}
317
- >
318
- {currentProfessional?.name} {currentProfessional?.lastname}
319
- </OText>
320
- <OText
321
- size={12}
322
- weight={'400'}
323
- lineHeight={17}
324
- color={isBusyTime(currentProfessional) ? theme.colors.danger5 : theme.colors.success500}
325
- >
326
- {isBusyTime(currentProfessional)
327
- ? t('BUSY_ON_SELECTED_TIME', 'Busy on selected time')
328
- : t('AVAILABLE', 'Available')
329
- }
330
- </OText>
306
+ <TouchableOpacity
307
+ style={styles.professionalSelect}
308
+ onPress={() => setIsOpen(true)}
309
+ >
310
+ {!!currentProfessional ? (
311
+ <>
312
+ <View style={{ flexDirection: 'row' }}>
313
+ {!!currentProfessional?.photo ? (
314
+ <FastImage
315
+ style={styles.photoStyle}
316
+ source={{
317
+ uri: optimizeImage(currentProfessional?.photo, 'h_250,c_limit'),
318
+ priority: FastImage.priority.normal,
319
+ }}
320
+ resizeMode={FastImage.resizeMode.cover}
321
+ />
322
+ ) : (
323
+ <OIcon
324
+ src={theme?.images?.general?.user}
325
+ cover={false}
326
+ style={styles.photoStyle}
327
+ />
328
+ )}
329
+ <View style={{ marginLeft: 14 }}>
330
+ <OText
331
+ size={14}
332
+ weight={'400'}
333
+ lineHeight={22}
334
+ >
335
+ {currentProfessional?.name} {currentProfessional?.lastname}
336
+ </OText>
337
+ <OText
338
+ size={12}
339
+ weight={'400'}
340
+ lineHeight={17}
341
+ color={isBusyTime(currentProfessional) ? theme.colors.danger5 : theme.colors.success500}
342
+ >
343
+ {isBusyTime(currentProfessional)
344
+ ? t('BUSY_ON_SELECTED_TIME', 'Busy on selected time')
345
+ : t('AVAILABLE', 'Available')
346
+ }
347
+ </OText>
348
+ </View>
331
349
  </View>
332
- </View>
333
- <View style={{ marginLeft: 5 }}>
334
- <IconAntDesign
335
- name='down'
336
- color={theme.colors.textThird}
337
- size={12}
338
- />
339
- </View>
340
- </TouchableOpacity>
341
- )}
350
+ </>
351
+ ) : (
352
+ <OText size={12}>{t('SELECT_PROFESSIONAL', 'Select professional')}</OText>
353
+ )}
354
+ <View style={{ marginLeft: 5 }}>
355
+ <IconAntDesign
356
+ name='down'
357
+ color={theme.colors.textThird}
358
+ size={12}
359
+ />
360
+ </View>
361
+ </TouchableOpacity>
342
362
  </ProfessionalWrapper>
343
363
  <ScheduleWrapper>
344
364
  <View
@@ -448,8 +468,9 @@ const ServiceFormUI = (props: ServiceFormParams) => {
448
468
  </CalendarWrapper>
449
469
  ) : (
450
470
  <OText
451
- size={20}
452
- style={{ marginBottom: 30 }}
471
+ size={16}
472
+ style={{ marginBottom: 30, textAlign: 'center' }}
473
+ color={theme?.colors?.disabled}
453
474
  weight={Platform.OS === 'ios' ? '600' : 'bold'}
454
475
  >
455
476
  {t('NO_SCHEDULE', 'No schedule')}
@@ -525,21 +546,29 @@ const ServiceFormUI = (props: ServiceFormParams) => {
525
546
  {t('ANY_OROFESSIONAL_MEMBER', 'Any professional member')}
526
547
  </OText>
527
548
  </View>
528
- {professionalList?.map((professional: any) => professional?.products?.includes(product?.id) && (
549
+ {professionalList?.map((professional: any) => (
529
550
  <TouchableOpacity
530
551
  key={professional?.id}
531
552
  style={styles.professionalItem}
532
553
  onPress={() => handleChangeProfessional(professional)}
533
554
  >
534
555
  <View style={{ flexDirection: 'row' }}>
535
- <FastImage
536
- style={styles.photoStyle}
537
- source={{
538
- uri: optimizeImage(professional?.photo, 'h_250,c_limit'),
539
- priority: FastImage.priority.normal,
540
- }}
541
- resizeMode={FastImage.resizeMode.cover}
542
- />
556
+ {!!professional?.photo ? (
557
+ <FastImage
558
+ style={styles.photoStyle}
559
+ source={{
560
+ uri: optimizeImage(professional?.photo, 'h_250,c_limit'),
561
+ priority: FastImage.priority.normal,
562
+ }}
563
+ resizeMode={FastImage.resizeMode.cover}
564
+ />
565
+ ) : (
566
+ <OIcon
567
+ src={theme?.images?.general?.user}
568
+ cover={false}
569
+ style={styles.photoStyle}
570
+ />
571
+ )}
543
572
  <View style={{ marginLeft: 14 }}>
544
573
  <OText
545
574
  size={14}