ordering-ui-react-native 0.15.76 → 0.15.77

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.76",
3
+ "version": "0.15.77",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -20,7 +20,7 @@ import { NotFoundSource } from '../NotFoundSource'
20
20
  import { View, StyleSheet, ScrollView } from 'react-native'
21
21
  import FastImage from 'react-native-fast-image'
22
22
  import { PromotionParams } from '../../types'
23
- const PromotionsUI = (props : PromotionParams) => {
23
+ const PromotionsUI = (props: PromotionParams) => {
24
24
  const {
25
25
  navigation,
26
26
  offersState,
@@ -65,20 +65,19 @@ const PromotionsUI = (props : PromotionParams) => {
65
65
 
66
66
  const [, t] = useLanguage()
67
67
  const [{ parseDate, parsePrice, optimizeImage }] = useUtils()
68
- const [events] = useEvent()
69
68
  const [openModal, setOpenModal] = useState(false)
70
69
 
71
- const handleClickOffer = (offer : any) => {
70
+ const handleClickOffer = (offer: any) => {
72
71
  setOpenModal(true)
73
72
  setOfferSelected(offer)
74
73
  }
75
74
 
76
- const handleBusinessClick = (business : any) => {
77
- events.emit('go_to_page', { page: 'business', params: { store: business.slug } })
75
+ const handleBusinessClick = (store: any) => {
76
+ setOpenModal(false)
77
+ navigation.navigate('Business', { store: store.slug })
78
78
  }
79
79
 
80
- const filteredOffers = offersState?.offers?.filter((offer : any) => offer.name.toLowerCase().includes(searchValue.toLowerCase()))
81
-
80
+ const filteredOffers = offersState?.offers?.filter((offer: any) => offer.name.toLowerCase().includes(searchValue.toLowerCase()))
82
81
  const targetString = offerSelected?.target === 1
83
82
  ? t('SUBTOTAL', 'Subtotal')
84
83
  : offerSelected?.target === 2
@@ -121,21 +120,23 @@ const PromotionsUI = (props : PromotionParams) => {
121
120
  />
122
121
  )}
123
122
  <ScrollView>
124
- {!offersState?.loading && offersState.offers?.length > 0 && filteredOffers?.map((offer : any) => (
123
+ {!offersState?.loading && offersState.offers?.length > 0 && filteredOffers?.map((offer: any) => (
125
124
  <SingleOfferContainer key={offer.id}>
126
125
  <OfferInformation>
127
- <OText style={styles.offerTitle}>{offer?.name}</OText>
126
+ <OText style={styles.offerTitle} numberOfLines={2}>{offer?.name}</OText>
128
127
  {offer?.description && (
129
- <OText style={styles.offerDescription}>{offer?.description}</OText>
128
+ <OText style={styles.offerDescription} numberOfLines={2}>{offer?.description}</OText>
130
129
  )}
131
130
  <OText style={styles.offerExtraInfo}>
132
131
  {t('EXPIRES', 'Expires')} {parseDate(offer?.end, { outputFormat: 'MMM DD, YYYY' })}
133
132
  </OText>
134
133
  <AvailableBusinesses>
135
- <OText style={styles.offerExtraInfo}>{t('APPLY_FOR', 'Apply for')}:</OText>
136
- {offer.businesses.map((business: any, i: number) => (
137
- <OText style={styles.offerExtraInfo} key={business?.id}>{' '}{business?.name}{i + 1 < offer.businesses?.length ? ',' : ''}</OText>
138
- ))}
134
+ <OText style={styles.offerExtraInfo} numberOfLines={1}>
135
+ {t('APPLY_FOR', 'Apply for')}:
136
+ {offer.businesses.map((business: any, i: number) => (
137
+ <React.Fragment key={i}>{' '}{business?.name}{i + 1 < offer.businesses?.length ? ',' : ''}</React.Fragment>
138
+ ))}
139
+ </OText>
139
140
  </AvailableBusinesses>
140
141
  </OfferInformation>
141
142
  <OButton
@@ -170,7 +171,7 @@ const PromotionsUI = (props : PromotionParams) => {
170
171
  <OText>{t('OFFER_AUTOMATIC', 'This offer applies automatic')}</OText>
171
172
  )}
172
173
  {offerSelected?.minimum && (
173
- <OText>{t('MINIMUM_PURCHASE_FOR_OFFER', 'Minimum purshase for use this offer')}: {parsePrice(offerSelected?.minimum)}</OText>
174
+ <OText>{t('MINIMUM_PURCHASE_FOR_OFFER', 'Minimum purchase for use this offer')}: {parsePrice(offerSelected?.minimum)}</OText>
174
175
  )}
175
176
  {offerSelected?.max_discount && (
176
177
  <OText>{t('MAX_DISCOUNT_ALLOWED', 'Max discount allowed')}: {parsePrice(offerSelected?.max_discount)}</OText>
@@ -182,8 +183,8 @@ const PromotionsUI = (props : PromotionParams) => {
182
183
  <OText style={{ marginTop: 10, marginBottom: 10 }}>
183
184
  {t('AVAILABLE_BUSINESSES_FOR_OFFER', 'Available businesses for this offer')}:
184
185
  </OText>
185
- <ScrollView style={{height: '75%'}}>
186
- {offerSelected?.businesses?.map((business : any) => {
186
+ <ScrollView style={{ height: '75%' }}>
187
+ {offerSelected?.businesses?.map((business: any) => {
187
188
  return (
188
189
  <SingleBusinessOffer key={business.id}>
189
190
  {business?.logo ? (
@@ -202,7 +203,7 @@ const PromotionsUI = (props : PromotionParams) => {
202
203
  />
203
204
  )}
204
205
  <BusinessInfo>
205
- <OText>{business.name}</OText>
206
+ <OText style={{ maxWidth: '60%' }}>{business.name}</OText>
206
207
  <OButton
207
208
  onClick={() => handleBusinessClick(business)}
208
209
  text={t('GO_TO_BUSINESSS', 'Go to business')}
@@ -220,7 +221,7 @@ const PromotionsUI = (props : PromotionParams) => {
220
221
  )
221
222
  }
222
223
 
223
- export const Promotions = (props : PromotionParams) => {
224
+ export const Promotions = (props: PromotionParams) => {
224
225
  const PromotionsProps = {
225
226
  ...props,
226
227
  UIComponent: PromotionsUI
@@ -7,7 +7,6 @@ export const PromotionsContainer = styled.View`
7
7
  export const SingleOfferContainer = styled.View`
8
8
  flex-direction: row;
9
9
  width: 100%;
10
- height: 80px;
11
10
  justify-content: space-between;
12
11
  align-items: center;
13
12
  margin-bottom: 20px;