ordering-ui-react-native 0.15.58 → 0.15.59

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.58",
3
+ "version": "0.15.59",
4
4
  "description": "Reusable components made in react native",
5
5
  "main": "src/index.tsx",
6
6
  "author": "ordering.inc",
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react'
2
- import { StyleSheet, View, ScrollView, TouchableOpacity, Dimensions, Platform, PlatformIOSStatic } from 'react-native'
2
+ import { StyleSheet, View, ScrollView, Dimensions, Platform, PlatformIOSStatic, Pressable } from 'react-native'
3
3
  import { Fade, Placeholder, PlaceholderLine } from 'rn-placeholder'
4
4
  import { BusinessTypeFilter as BusinessTypeFilterController, useLanguage } from 'ordering-components/native'
5
5
 
@@ -9,6 +9,7 @@ import { BusinessTypeFilterParams } from '../../types'
9
9
  import { useTheme } from 'styled-components/native'
10
10
  import MaterialIcon from 'react-native-vector-icons/MaterialCommunityIcons';
11
11
  import DeviceInfo from 'react-native-device-info';
12
+ import { TouchableOpacity } from 'react-native-gesture-handler'
12
13
 
13
14
  const windowWidth = Dimensions.get('window').width;
14
15
 
@@ -71,11 +72,13 @@ export const BusinessTypeFilterUI = (props: BusinessTypeFilterParams) => {
71
72
  <OIcon
72
73
  url={item.image}
73
74
  style={styles.logo}
75
+ cover
74
76
  />
75
77
  ) : (
76
78
  <OIcon
77
79
  src={theme.images.categories.all}
78
80
  style={styles.logo}
81
+ cover
79
82
  />
80
83
  )}
81
84
  <OText
@@ -21,7 +21,7 @@ const BusinessesListing = (props: any) => {
21
21
  ...props,
22
22
  isSearchByName: true,
23
23
  isSearchByDescription: true,
24
- propsToFetch: ['id', 'name', 'header', 'logo', 'location', 'schedule', 'open', 'delivery_price', 'distance', 'delivery_time', 'pickup_time', 'reviews', 'featured', 'offers', 'food', 'laundry', 'alcohol', 'groceries', 'slug'],
24
+ propsToFetch: ['id', 'name', 'header', 'logo', 'ribbon', 'location', 'schedule', 'open', 'delivery_price', 'distance', 'delivery_time', 'pickup_time', 'reviews', 'featured', 'offers', 'food', 'laundry', 'alcohol', 'groceries', 'slug'],
25
25
  onBusinessClick: (business: any) => {
26
26
  props.navigation.navigate('Business', { store: store || business.slug, header: business.header, logo: business.logo })
27
27
  }
@@ -95,6 +95,33 @@ export const OrderContentComponent = (props: OrderContent) => {
95
95
  {isOrderGroup && (
96
96
  <OText size={18}>{t('ORDER', 'Order')} #{isOrderGroup ? order?.order_group_id : order?.id}</OText>
97
97
  )}
98
+
99
+ {order?.metafields?.length > 0 && (
100
+ <OrderBusiness>
101
+ <OText style={{ marginBottom: 5 }} size={16} weight="600">
102
+ {t('CUSTOM_FIELDS', 'Custom fields')}
103
+ </OText>
104
+
105
+ {order.metafields.map((field: any) => (
106
+ <View
107
+ key={field.id}
108
+ style={{
109
+ width: '100%',
110
+ flexDirection: 'row',
111
+ marginBottom: 5
112
+ }}
113
+ >
114
+ <OText style={{ width: '50%' }}>
115
+ {field.key}
116
+ </OText>
117
+ <OText style={{ width: '45%', textAlign: 'right' }}>
118
+ {field.value}
119
+ </OText>
120
+ </View>
121
+ ))}
122
+ </OrderBusiness>
123
+ )}
124
+
98
125
  <OrderBusiness>
99
126
  <OText style={{ marginBottom: 5 }} size={16} weight="600">
100
127
  {t('BUSINESS_DETAILS', 'Business details')}
@@ -9,7 +9,7 @@ import {
9
9
  import { OIcon, OText } from '../shared';
10
10
  import { StyleSheet, View } from 'react-native';
11
11
  import { BusinessControllerParams } from '../../types';
12
- import { convertHoursToMinutes } from '../../utils';
12
+ import { convertHoursToMinutes, shape } from '../../utils';
13
13
  import {
14
14
  Card,
15
15
  BusinessHero,
@@ -20,6 +20,7 @@ import {
20
20
  BusinessState,
21
21
  BusinessLogo,
22
22
  Reviews,
23
+ RibbonBox
23
24
  } from './styles';
24
25
  import { useTheme } from 'styled-components/native';
25
26
  import FontAwesomeIcon from 'react-native-vector-icons/FontAwesome5';
@@ -121,6 +122,24 @@ export const BusinessControllerUI = (props: BusinessControllerParams) => {
121
122
 
122
123
  return (
123
124
  <Card activeOpacity={1} onPress={() => handleBusinessClick(business)} style={style}>
125
+ {business?.ribbon?.enabled && (
126
+ <RibbonBox
127
+ bgColor={business?.ribbon?.color}
128
+ isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
129
+ isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
130
+ >
131
+ <OText
132
+ size={10}
133
+ weight={'400'}
134
+ color={theme.colors.white}
135
+ numberOfLines={2}
136
+ ellipsizeMode='tail'
137
+ lineHeight={13}
138
+ >
139
+ {business?.ribbon?.text}
140
+ </OText>
141
+ </RibbonBox>
142
+ )}
124
143
  <BusinessHero>
125
144
  <FastImage
126
145
  style={{ height: 120 }}
@@ -53,3 +53,25 @@ export const Reviews = styled.View`
53
53
  flex-direction: row;
54
54
  align-items: center;
55
55
  `
56
+
57
+ export const RibbonBox = styled.View`
58
+ position: absolute;
59
+ z-index: 1;
60
+ top: -4px;
61
+ right: -4px;
62
+ background-color: ${(props: any) => props.theme.colors.primary};
63
+ padding: 1px 8px;
64
+ max-width: 180px;
65
+
66
+ ${(props: any) => props.bgColor && css`
67
+ background-color: ${props.bgColor};
68
+ `}
69
+
70
+ ${(props: any) => props.isRoundRect && css`
71
+ border-radius: 7.6px;
72
+ `}
73
+
74
+ ${(props: any) => props.isCapsule && css`
75
+ border-radius: 50px;
76
+ `}
77
+ `
@@ -9,7 +9,7 @@ import { useTheme } from 'styled-components/native';
9
9
  import { OIcon, OText } from '../shared';
10
10
  import { StyleSheet, useWindowDimensions, View } from 'react-native';
11
11
  import { BusinessControllerParams } from '../../types';
12
- import { convertHoursToMinutes } from '../../utils';
12
+ import { convertHoursToMinutes, shape } from '../../utils';
13
13
  import {
14
14
  Card,
15
15
  BusinessHero,
@@ -20,6 +20,7 @@ import {
20
20
  BusinessState,
21
21
  BusinessLogo,
22
22
  Reviews,
23
+ RibbonBox
23
24
  } from './styles';
24
25
 
25
26
  export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
@@ -97,6 +98,24 @@ export const BusinessFeaturedCtrlUI = (props: BusinessControllerParams) => {
97
98
 
98
99
  return (
99
100
  <Card activeOpacity={1} onPress={() => handleClick(business)}>
101
+ {business?.ribbon?.enabled && (
102
+ <RibbonBox
103
+ bgColor={business?.ribbon?.color}
104
+ isRoundRect={business?.ribbon?.shape === shape?.rectangleRound}
105
+ isCapsule={business?.ribbon?.shape === shape?.capsuleShape}
106
+ >
107
+ <OText
108
+ size={10}
109
+ weight={'400'}
110
+ color={theme.colors.white}
111
+ numberOfLines={2}
112
+ ellipsizeMode='tail'
113
+ lineHeight={13}
114
+ >
115
+ {business?.ribbon?.text}
116
+ </OText>
117
+ </RibbonBox>
118
+ )}
100
119
  <BusinessHero>
101
120
  <BusinessLogo>
102
121
  <OIcon
@@ -4,6 +4,7 @@ export const Card = styled.TouchableOpacity`
4
4
  margin-vertical: 4px;
5
5
  height: 60px;
6
6
  overflow: hidden;
7
+ position: relative;
7
8
  `;
8
9
 
9
10
  export const BusinessHero = styled.View`
@@ -48,3 +49,25 @@ export const BusinessLogo = styled.View`
48
49
  export const Reviews = styled.View`
49
50
  flex-direction: row;
50
51
  `
52
+
53
+ export const RibbonBox = styled.View`
54
+ position: absolute;
55
+ z-index: 1;
56
+ top: 0px;
57
+ right: 5px;
58
+ background-color: ${(props: any) => props.theme.colors.primary};
59
+ padding: 1px 8px;
60
+ max-width: 160px;
61
+
62
+ ${(props: any) => props.bgColor && css`
63
+ background-color: ${props.bgColor};
64
+ `}
65
+
66
+ ${(props: any) => props.isRoundRect && css`
67
+ border-radius: 7.6px;
68
+ `}
69
+
70
+ ${(props: any) => props.isCapsule && css`
71
+ border-radius: 50px;
72
+ `}
73
+ `