vdb-ai-chat 1.0.21 → 1.0.22
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/dist/chat-widget.js +1 -1
- package/lib/commonjs/api.js +20 -1
- package/lib/commonjs/api.js.map +1 -1
- package/lib/commonjs/components/BetaNotice.js +0 -1
- package/lib/commonjs/components/BetaNotice.js.map +1 -1
- package/lib/commonjs/components/Button.js +95 -0
- package/lib/commonjs/components/Button.js.map +1 -0
- package/lib/commonjs/components/ChatWidget.js +79 -3
- package/lib/commonjs/components/ChatWidget.js.map +1 -1
- package/lib/commonjs/components/LabelContainer.js +50 -0
- package/lib/commonjs/components/LabelContainer.js.map +1 -0
- package/lib/commonjs/components/MessageBubble.js +50 -11
- package/lib/commonjs/components/MessageBubble.js.map +1 -1
- package/lib/commonjs/components/MessageMetaRow.js +22 -6
- package/lib/commonjs/components/MessageMetaRow.js.map +1 -1
- package/lib/commonjs/components/ProductsList.js +10 -2
- package/lib/commonjs/components/ProductsList.js.map +1 -1
- package/lib/commonjs/components/ProductsListView.js +116 -311
- package/lib/commonjs/components/ProductsListView.js.map +1 -1
- package/lib/commonjs/components/utils.js +152 -4
- package/lib/commonjs/components/utils.js.map +1 -1
- package/lib/commonjs/types.js +4 -0
- package/lib/module/api.js +20 -2
- package/lib/module/api.js.map +1 -1
- package/lib/module/components/BetaNotice.js +0 -1
- package/lib/module/components/BetaNotice.js.map +1 -1
- package/lib/module/components/Button.js +88 -0
- package/lib/module/components/Button.js.map +1 -0
- package/lib/module/components/ChatWidget.js +81 -5
- package/lib/module/components/ChatWidget.js.map +1 -1
- package/lib/module/components/LabelContainer.js +43 -0
- package/lib/module/components/LabelContainer.js.map +1 -0
- package/lib/module/components/MessageBubble.js +51 -12
- package/lib/module/components/MessageBubble.js.map +1 -1
- package/lib/module/components/MessageMetaRow.js +22 -6
- package/lib/module/components/MessageMetaRow.js.map +1 -1
- package/lib/module/components/ProductsList.js +10 -2
- package/lib/module/components/ProductsList.js.map +1 -1
- package/lib/module/components/ProductsListView.js +116 -312
- package/lib/module/components/ProductsListView.js.map +1 -1
- package/lib/module/components/utils.js +147 -2
- package/lib/module/components/utils.js.map +1 -1
- package/lib/module/types.js +1 -1
- package/lib/typescript/api.d.ts +1 -0
- package/lib/typescript/api.d.ts.map +1 -1
- package/lib/typescript/components/BetaNotice.d.ts.map +1 -1
- package/lib/typescript/components/Button.d.ts +5 -0
- package/lib/typescript/components/Button.d.ts.map +1 -0
- package/lib/typescript/components/ChatWidget.d.ts.map +1 -1
- package/lib/typescript/components/LabelContainer.d.ts +10 -0
- package/lib/typescript/components/LabelContainer.d.ts.map +1 -0
- package/lib/typescript/components/MessageBubble.d.ts.map +1 -1
- package/lib/typescript/components/MessageMetaRow.d.ts.map +1 -1
- package/lib/typescript/components/ProductsList.d.ts +4 -0
- package/lib/typescript/components/ProductsList.d.ts.map +1 -1
- package/lib/typescript/components/ProductsListView.d.ts +4 -0
- package/lib/typescript/components/ProductsListView.d.ts.map +1 -1
- package/lib/typescript/components/utils.d.ts +24 -1
- package/lib/typescript/components/utils.d.ts.map +1 -1
- package/lib/typescript/types.d.ts +27 -0
- package/lib/typescript/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/api.ts +30 -2
- package/src/components/BetaNotice.tsx +0 -1
- package/src/components/Button.tsx +85 -0
- package/src/components/ChatWidget.tsx +88 -2
- package/src/components/LabelContainer.tsx +50 -0
- package/src/components/MessageBubble.tsx +50 -36
- package/src/components/MessageMetaRow.tsx +26 -9
- package/src/components/ProductsList.tsx +12 -0
- package/src/components/ProductsListView.tsx +227 -302
- package/src/components/utils.ts +164 -2
- package/src/types.ts +30 -0
|
@@ -2,8 +2,6 @@ import React, { memo, useEffect, useState } from "react";
|
|
|
2
2
|
import {
|
|
3
3
|
View,
|
|
4
4
|
StyleSheet,
|
|
5
|
-
Text,
|
|
6
|
-
TouchableOpacity,
|
|
7
5
|
ScrollView,
|
|
8
6
|
Platform,
|
|
9
7
|
Image,
|
|
@@ -14,11 +12,15 @@ import {
|
|
|
14
12
|
formatPriceValue,
|
|
15
13
|
roundUpPrices,
|
|
16
14
|
AnalyticsEventNames,
|
|
15
|
+
ProductCategory,
|
|
16
|
+
ButtonCategory,
|
|
17
|
+
ButtonType,
|
|
17
18
|
} from "./utils";
|
|
18
19
|
import { useTheme } from "styled-components/native";
|
|
19
20
|
import { DefaultTheme } from "styled-components/native";
|
|
20
21
|
import styled from "styled-components/native";
|
|
21
22
|
import { useUserAnalytics } from "../hooks/useAnalytics";
|
|
23
|
+
import Button from "./Button";
|
|
22
24
|
|
|
23
25
|
let ImageComponent: typeof Image = Image;
|
|
24
26
|
if (Platform.OS !== "web") {
|
|
@@ -29,264 +31,27 @@ if (Platform.OS !== "web") {
|
|
|
29
31
|
// expo-image not installed, use React Native Image
|
|
30
32
|
}
|
|
31
33
|
}
|
|
32
|
-
|
|
33
|
-
// Token configuration for diamond details display
|
|
34
|
-
type TokenStyle = "primary" | "secondary";
|
|
35
|
-
type TokenType =
|
|
36
|
-
| "field"
|
|
37
|
-
| "separator"
|
|
38
|
-
| "lineBreak"
|
|
39
|
-
| "group"
|
|
40
|
-
| "fieldWithSuffix"
|
|
41
|
-
| "priceField";
|
|
42
|
-
|
|
43
|
-
interface TokenConfig {
|
|
44
|
-
type: TokenType;
|
|
45
|
-
field?: string;
|
|
46
|
-
style?: TokenStyle;
|
|
47
|
-
suffix?: string;
|
|
48
|
-
prefix?: string;
|
|
49
|
-
suffixStyle?: TokenStyle;
|
|
50
|
-
prefixStyle?: TokenStyle;
|
|
51
|
-
format?: "percent";
|
|
52
|
-
showCurrencyIf?: string;
|
|
53
|
-
items?: TokenConfig[];
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const DIAMOND_TOKENS_MOBILE_WEB: TokenConfig[] = [
|
|
57
|
-
// Row 1: Basic specs
|
|
58
|
-
{ type: "field", field: "shape_long", style: "primary" },
|
|
59
|
-
{
|
|
60
|
-
type: "fieldWithSuffix",
|
|
61
|
-
field: "size",
|
|
62
|
-
style: "secondary",
|
|
63
|
-
suffix: "ct",
|
|
64
|
-
showCurrencyIf: "price_per_carat",
|
|
65
|
-
},
|
|
66
|
-
{ type: "field", field: "color", style: "primary" },
|
|
67
|
-
{ type: "field", field: "clarity_short", style: "primary" },
|
|
68
|
-
{ type: "separator" },
|
|
69
|
-
{
|
|
70
|
-
type: "group",
|
|
71
|
-
items: [
|
|
72
|
-
{ type: "field", field: "cut_short", style: "primary" },
|
|
73
|
-
{ type: "field", field: "polish_short", style: "primary", prefix: "/" },
|
|
74
|
-
{ type: "field", field: "symmetry_short", style: "primary", prefix: "/" },
|
|
75
|
-
],
|
|
76
|
-
},
|
|
77
|
-
{ type: "separator" },
|
|
78
|
-
{ type: "field", field: "fluorescence_intensity_short", style: "primary" },
|
|
79
|
-
{ type: "separator" },
|
|
80
|
-
{ type: "field", field: "lab_short", style: "primary" },
|
|
81
|
-
{ type: "separator" },
|
|
82
|
-
{
|
|
83
|
-
type: "field",
|
|
84
|
-
field: "discount_percent",
|
|
85
|
-
style: "secondary",
|
|
86
|
-
format: "percent",
|
|
87
|
-
},
|
|
88
|
-
// Row 2: Measurements & Pricing
|
|
89
|
-
{ type: "lineBreak" },
|
|
90
|
-
{
|
|
91
|
-
type: "field",
|
|
92
|
-
field: "depth_percent",
|
|
93
|
-
style: "secondary",
|
|
94
|
-
prefixStyle: "primary",
|
|
95
|
-
prefix: "D",
|
|
96
|
-
format: "percent",
|
|
97
|
-
},
|
|
98
|
-
{ type: "separator" },
|
|
99
|
-
{
|
|
100
|
-
type: "field",
|
|
101
|
-
field: "table_percent",
|
|
102
|
-
style: "secondary",
|
|
103
|
-
prefixStyle: "primary",
|
|
104
|
-
prefix: "T",
|
|
105
|
-
format: "percent",
|
|
106
|
-
},
|
|
107
|
-
{ type: "separator" },
|
|
108
|
-
{ type: "field", field: "measurement", style: "secondary" },
|
|
109
|
-
{ type: "separator" },
|
|
110
|
-
{
|
|
111
|
-
type: "priceField",
|
|
112
|
-
field: "price_per_carat",
|
|
113
|
-
style: "secondary",
|
|
114
|
-
suffixStyle: "primary",
|
|
115
|
-
suffix: "PC",
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
type: "priceField",
|
|
119
|
-
field: "total_sales_price",
|
|
120
|
-
style: "secondary",
|
|
121
|
-
prefix: " =",
|
|
122
|
-
},
|
|
123
|
-
];
|
|
124
|
-
|
|
125
|
-
const DIAMOND_TOKENS_TABLET: TokenConfig[] = [
|
|
126
|
-
// Row 1: Basic specs
|
|
127
|
-
{ type: "field", field: "shape_long", style: "primary" },
|
|
128
|
-
{
|
|
129
|
-
type: "fieldWithSuffix",
|
|
130
|
-
field: "size",
|
|
131
|
-
style: "secondary",
|
|
132
|
-
suffix: "ct",
|
|
133
|
-
showCurrencyIf: "price_per_carat",
|
|
134
|
-
},
|
|
135
|
-
{ type: "field", field: "color", style: "primary" },
|
|
136
|
-
{ type: "field", field: "clarity_short", style: "primary" },
|
|
137
|
-
{ type: "separator" },
|
|
138
|
-
{
|
|
139
|
-
type: "group",
|
|
140
|
-
items: [
|
|
141
|
-
{ type: "field", field: "cut_short", style: "primary" },
|
|
142
|
-
{ type: "field", field: "polish_short", style: "primary", prefix: "/" },
|
|
143
|
-
{ type: "field", field: "symmetry_short", style: "primary", prefix: "/" },
|
|
144
|
-
],
|
|
145
|
-
},
|
|
146
|
-
{ type: "separator" },
|
|
147
|
-
{ type: "field", field: "fluorescence_intensity_short", style: "primary" },
|
|
148
|
-
{ type: "separator" },
|
|
149
|
-
{ type: "field", field: "lab_short", style: "primary" },
|
|
150
|
-
{ type: "separator" },
|
|
151
|
-
{
|
|
152
|
-
type: "field",
|
|
153
|
-
field: "depth_percent",
|
|
154
|
-
style: "secondary",
|
|
155
|
-
prefixStyle: "primary",
|
|
156
|
-
prefix: "D",
|
|
157
|
-
format: "percent",
|
|
158
|
-
},
|
|
159
|
-
{ type: "separator" },
|
|
160
|
-
{
|
|
161
|
-
type: "field",
|
|
162
|
-
field: "table_percent",
|
|
163
|
-
style: "secondary",
|
|
164
|
-
prefixStyle: "primary",
|
|
165
|
-
prefix: "T",
|
|
166
|
-
format: "percent",
|
|
167
|
-
},
|
|
168
|
-
{ type: "separator" },
|
|
169
|
-
{ type: "field", field: "measurement", style: "secondary" },
|
|
170
|
-
{ type: "separator" }, {
|
|
171
|
-
type: "field",
|
|
172
|
-
field: "discount_percent",
|
|
173
|
-
style: "secondary",
|
|
174
|
-
format: "percent",
|
|
175
|
-
},
|
|
176
|
-
// Row 2: Measurements & Pricing
|
|
177
|
-
{ type: "lineBreak" },
|
|
178
|
-
{
|
|
179
|
-
type: "priceField",
|
|
180
|
-
field: "price_per_carat",
|
|
181
|
-
style: "secondary",
|
|
182
|
-
suffixStyle: "primary",
|
|
183
|
-
suffix: "PC",
|
|
184
|
-
},
|
|
185
|
-
{
|
|
186
|
-
type: "priceField",
|
|
187
|
-
field: "total_sales_price",
|
|
188
|
-
style: "secondary",
|
|
189
|
-
prefix: " =",
|
|
190
|
-
},
|
|
191
|
-
];
|
|
192
34
|
interface ProductsListViewProps {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
35
|
+
data: any[];
|
|
36
|
+
totalResults?: number;
|
|
37
|
+
onViewAll: (item: any) => void;
|
|
38
|
+
onItemPress?: (item: any) => void;
|
|
39
|
+
showMoreResults?: () => void;
|
|
40
|
+
showLessResults?: () => void;
|
|
41
|
+
currentPage?: number;
|
|
42
|
+
isLoadingMore?: boolean;
|
|
43
|
+
item: any;
|
|
198
44
|
}
|
|
199
45
|
|
|
200
|
-
const renderToken = (
|
|
201
|
-
token: TokenConfig,
|
|
202
|
-
item: any,
|
|
203
|
-
userCurrency: string | null,
|
|
204
|
-
index: number,
|
|
205
|
-
shouldRound: boolean = false
|
|
206
|
-
): React.ReactNode => {
|
|
207
|
-
const TextView = token.style === "secondary" ? TextStyleTwo : TextStyleOne;
|
|
208
|
-
const PrefixTextView =
|
|
209
|
-
token.prefixStyle === "secondary" ? TextStyleTwo : TextStyleOne;
|
|
210
|
-
const SuffixTextView =
|
|
211
|
-
token.suffixStyle === "secondary" ? TextStyleTwo : TextStyleOne;
|
|
212
|
-
const currency = userCurrency || "$";
|
|
213
|
-
const theme = useTheme();
|
|
214
|
-
switch (token.type) {
|
|
215
|
-
case "separator":
|
|
216
|
-
return (
|
|
217
|
-
<TextView key={index} theme={theme}>
|
|
218
|
-
{"·"}
|
|
219
|
-
</TextView>
|
|
220
|
-
);
|
|
221
|
-
|
|
222
|
-
case "lineBreak":
|
|
223
|
-
return <View key={index} style={styles.lineBreak} />;
|
|
224
|
-
|
|
225
|
-
case "field": {
|
|
226
|
-
let value = item[token.field!] ?? "-";
|
|
227
|
-
if (token.format === "percent" && value !== "-") {
|
|
228
|
-
value = `${value}%`;
|
|
229
|
-
}
|
|
230
|
-
return (
|
|
231
|
-
<React.Fragment key={index}>
|
|
232
|
-
{token.prefix && (
|
|
233
|
-
<PrefixTextView theme={theme}>{token.prefix}</PrefixTextView>
|
|
234
|
-
)}
|
|
235
|
-
<TextView theme={theme}>{value}</TextView>
|
|
236
|
-
</React.Fragment>
|
|
237
|
-
);
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
case "fieldWithSuffix": {
|
|
241
|
-
const value = item[token.field!] ?? "-";
|
|
242
|
-
const showSuffix = token.showCurrencyIf
|
|
243
|
-
? item[token.showCurrencyIf]
|
|
244
|
-
: true;
|
|
245
|
-
return (
|
|
246
|
-
<View key={index} style={styles.rowCenter}>
|
|
247
|
-
<TextView theme={theme}>{value}</TextView>
|
|
248
|
-
{showSuffix && token.suffix && (
|
|
249
|
-
<TextView theme={theme}>{token.suffix}</TextView>
|
|
250
|
-
)}
|
|
251
|
-
</View>
|
|
252
|
-
);
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
case "priceField": {
|
|
256
|
-
const value = item[token.field!];
|
|
257
|
-
const formattedPrice = formatPriceValue(token.field!, value, shouldRound);
|
|
258
|
-
|
|
259
|
-
return (
|
|
260
|
-
<View key={index} style={styles.rowCenter}>
|
|
261
|
-
{token.prefix && <TextView theme={theme}>{token.prefix}</TextView>}
|
|
262
|
-
{value && <TextView theme={theme}>{currency}</TextView>}
|
|
263
|
-
<TextView theme={theme}>{formattedPrice ?? "-"}</TextView>
|
|
264
|
-
{token.suffix && (
|
|
265
|
-
<SuffixTextView theme={theme}>{token.suffix}</SuffixTextView>
|
|
266
|
-
)}
|
|
267
|
-
</View>
|
|
268
|
-
);
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
case "group":
|
|
272
|
-
return (
|
|
273
|
-
<View key={index} style={styles.rowCenter}>
|
|
274
|
-
{token.items?.map((subToken, subIndex) =>
|
|
275
|
-
renderToken(subToken, item, userCurrency, subIndex, shouldRound)
|
|
276
|
-
)}
|
|
277
|
-
</View>
|
|
278
|
-
);
|
|
279
|
-
|
|
280
|
-
default:
|
|
281
|
-
return null;
|
|
282
|
-
}
|
|
283
|
-
};
|
|
284
|
-
|
|
285
46
|
const ProductsListViewComponent: React.FC<ProductsListViewProps> = ({
|
|
286
47
|
data,
|
|
287
48
|
totalResults,
|
|
288
49
|
onViewAll,
|
|
289
50
|
onItemPress,
|
|
51
|
+
showMoreResults,
|
|
52
|
+
showLessResults,
|
|
53
|
+
currentPage = 1,
|
|
54
|
+
isLoadingMore = false,
|
|
290
55
|
item,
|
|
291
56
|
}) => {
|
|
292
57
|
if (!data || !data.length) return null;
|
|
@@ -294,10 +59,14 @@ const ProductsListViewComponent: React.FC<ProductsListViewProps> = ({
|
|
|
294
59
|
const [userCurrency, setUserCurrency] = useState<string | null>(null);
|
|
295
60
|
const [shouldRound, setShouldRound] = useState<boolean>(false);
|
|
296
61
|
const { trackEvent } = useUserAnalytics();
|
|
297
|
-
const
|
|
298
|
-
const
|
|
299
|
-
|
|
300
|
-
|
|
62
|
+
const payload = item?.search_payload;
|
|
63
|
+
const isLabgrown =
|
|
64
|
+
typeof payload.lab_grown === "string"
|
|
65
|
+
? payload.lab_grown === "true"
|
|
66
|
+
: typeof payload.lab_grown === "boolean"
|
|
67
|
+
? payload.lab_grown
|
|
68
|
+
: false;
|
|
69
|
+
const productType = isLabgrown ? ProductCategory.LAB_GROWN_DIAMOND : ProductCategory.DIAMOND;
|
|
301
70
|
useEffect(() => {
|
|
302
71
|
const fetchCurrency = async () => {
|
|
303
72
|
const currency = await getUserCurrencySymbol();
|
|
@@ -326,38 +95,121 @@ const ProductsListViewComponent: React.FC<ProductsListViewProps> = ({
|
|
|
326
95
|
<Wrapper theme={theme}>
|
|
327
96
|
<ScrollView
|
|
328
97
|
showsVerticalScrollIndicator={false}
|
|
329
|
-
contentContainerStyle={styles.listContent}
|
|
330
98
|
>
|
|
331
99
|
{data.map((dataItem: any, index: number) => (
|
|
332
100
|
<Pressable key={dataItem.id} onPress={() => handleItemPress(dataItem)}>
|
|
333
101
|
{(state) => (
|
|
334
102
|
// @ts-ignore
|
|
335
103
|
<ListItemParent theme={theme} hovered={state.hovered}>
|
|
336
|
-
<View
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
104
|
+
<View>
|
|
105
|
+
<View style={styles.left}>
|
|
106
|
+
{/* <View style={styles.serialContainer}>
|
|
107
|
+
<Serial>{index + 1}.</Serial>
|
|
108
|
+
</View> */}
|
|
109
|
+
<View style={styles.tokens}>
|
|
110
|
+
<TopContainer>
|
|
111
|
+
<TopLeftContainer>
|
|
112
|
+
<ExtraSmallGapContainer>
|
|
113
|
+
{/* Shape */}
|
|
114
|
+
<TextStyleBold>{`${dataItem.shape_short ?? "-"}`}</TextStyleBold>
|
|
115
|
+
{/* Carat */}
|
|
116
|
+
<TextStyleBold>{`${dataItem.size ?? "-"}ct`}</TextStyleBold>
|
|
117
|
+
{/* Color */}
|
|
118
|
+
<TextStyleBold>{`${dataItem.color_short ?? "-"}`}</TextStyleBold>
|
|
119
|
+
{/* Clarity */}
|
|
120
|
+
<TextStyleBold>{`${dataItem.clarity_short ?? "-"}`}</TextStyleBold>
|
|
121
|
+
{/* LAB */}
|
|
122
|
+
<TextStyleBold>{`${dataItem.lab_short ?? "-"}`}</TextStyleBold>
|
|
123
|
+
</ExtraSmallGapContainer>
|
|
124
|
+
<View style={{ flexDirection: "row", alignItems: "center" }}>
|
|
125
|
+
{/* Cut */}
|
|
126
|
+
<TextStyleRegular>{dataItem.cut_short ?? "-"}</TextStyleRegular>
|
|
127
|
+
<TextStyleRegular>{"/"}</TextStyleRegular>
|
|
128
|
+
{/* Polish */}
|
|
129
|
+
<TextStyleRegular>{dataItem.polish_short ?? "-"}</TextStyleRegular>
|
|
130
|
+
<TextStyleRegular>{"/"}</TextStyleRegular>
|
|
131
|
+
{/* Symmetry */}
|
|
132
|
+
<TextStyleRegular>{dataItem.symmetry_short ?? "-"}</TextStyleRegular>
|
|
133
|
+
</View>
|
|
134
|
+
<TextStyleRegular>{dataItem.fluorescence_intensity_short ?? "-"}</TextStyleRegular>
|
|
135
|
+
</TopLeftContainer>
|
|
136
|
+
<TopRightContainer>
|
|
137
|
+
<PricePerCaratContainer>
|
|
138
|
+
{dataItem.price_per_carat ? <TextStyleBold>{userCurrency ? userCurrency : "$"}</TextStyleBold> : <></>}
|
|
139
|
+
<TextStyleBold>{formatPriceValue("price_per_carat", dataItem.price_per_carat, shouldRound) ?? "-"}</TextStyleBold>
|
|
140
|
+
</PricePerCaratContainer>
|
|
141
|
+
<TextStyleRegular>{"p/ct"}</TextStyleRegular>
|
|
142
|
+
</TopRightContainer>
|
|
143
|
+
</TopContainer>
|
|
144
|
+
<BottomContainer>
|
|
145
|
+
<BottomLeftContainer>
|
|
146
|
+
{/* Depth */}
|
|
147
|
+
<DepthContainer>
|
|
148
|
+
<TextStyleRegular>{"D"}</TextStyleRegular>
|
|
149
|
+
<TextStyleBold>{dataItem.depth_percent ? dataItem.depth_percent + "%" : "-"}</TextStyleBold>
|
|
150
|
+
</DepthContainer>
|
|
151
|
+
|
|
152
|
+
{/* Table */}
|
|
153
|
+
<TableContainer>
|
|
154
|
+
<TextStyleRegular>{"T"}</TextStyleRegular>
|
|
155
|
+
<TextStyleBold>{dataItem.table_percent ? dataItem.table_percent + "%" : "-"}</TextStyleBold>
|
|
156
|
+
</TableContainer>
|
|
157
|
+
|
|
158
|
+
<MeasurementsContainer>
|
|
159
|
+
{/* Meas */}
|
|
160
|
+
<TextStyleRegular>{dataItem.measurement ?? "-"}</TextStyleRegular>
|
|
161
|
+
</MeasurementsContainer>
|
|
162
|
+
</BottomLeftContainer>
|
|
163
|
+
<BottomRightContainer>
|
|
164
|
+
{/* Discount */}
|
|
165
|
+
{isLabgrown ? <></> : <TextStyleBold>{dataItem.discount_percent ? dataItem.discount_percent + "%" : "-"}</TextStyleBold>}
|
|
166
|
+
<TotalPriceContainer>
|
|
167
|
+
<TotalPriceChildContainer>
|
|
168
|
+
{dataItem.total_sales_price ? <TextStyleBold>{userCurrency ? userCurrency : "$"}</TextStyleBold> : <></>}
|
|
169
|
+
<TextStyleBold>{formatPriceValue("total_sales_price", dataItem.total_sales_price, shouldRound) ?? "-"}</TextStyleBold>
|
|
170
|
+
</TotalPriceChildContainer>
|
|
171
|
+
<TextStyleRegular>{"total"}</TextStyleRegular>
|
|
172
|
+
</TotalPriceContainer>
|
|
173
|
+
</BottomRightContainer>
|
|
174
|
+
</BottomContainer>
|
|
175
|
+
</View>
|
|
176
|
+
</View>
|
|
177
|
+
</View>
|
|
352
178
|
</ListItemParent>
|
|
353
179
|
)}
|
|
354
180
|
</Pressable>
|
|
355
181
|
))}
|
|
356
182
|
</ScrollView>
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
183
|
+
{showMoreResults && currentPage < 3 && (
|
|
184
|
+
<ShowMoreContainer>
|
|
185
|
+
<Pressable onPress={showMoreResults} disabled={isLoadingMore}>
|
|
186
|
+
<ShowMoreText theme={theme}>
|
|
187
|
+
{isLoadingMore ? 'Loading...' : `Show more`}
|
|
188
|
+
</ShowMoreText>
|
|
189
|
+
</Pressable>
|
|
190
|
+
</ShowMoreContainer>
|
|
191
|
+
)}
|
|
192
|
+
{showLessResults && (currentPage === 3 || data.length >= 15) && (
|
|
193
|
+
<ShowMoreContainer>
|
|
194
|
+
<Pressable onPress={showLessResults}>
|
|
195
|
+
<ShowMoreText theme={theme}>
|
|
196
|
+
Show less
|
|
197
|
+
</ShowMoreText>
|
|
198
|
+
</Pressable>
|
|
199
|
+
</ShowMoreContainer>
|
|
200
|
+
)}
|
|
201
|
+
<Button
|
|
202
|
+
category={isLabgrown ? ButtonCategory.lab : ButtonCategory.diam}
|
|
203
|
+
height={32}
|
|
204
|
+
type={ButtonType.primary}
|
|
205
|
+
borderRadius={8}
|
|
206
|
+
style={{
|
|
207
|
+
marginTop: 12,
|
|
208
|
+
}}
|
|
209
|
+
onPress={() => handleViewAllPress(item)}
|
|
210
|
+
>
|
|
211
|
+
<ButtonText>{`View All ${Number(totalResults).toLocaleString()} diamonds`}</ButtonText>
|
|
212
|
+
{/* <ImageComponent
|
|
361
213
|
source={{
|
|
362
214
|
uri: "https://cdn.vdbapp.com/ai/chat-widget/assets/img/right.svg",
|
|
363
215
|
}}
|
|
@@ -367,8 +219,8 @@ const ProductsListViewComponent: React.FC<ProductsListViewProps> = ({
|
|
|
367
219
|
height: 20,
|
|
368
220
|
tintColor: theme["primary-cont"] || "#ffffff",
|
|
369
221
|
}}
|
|
370
|
-
/>
|
|
371
|
-
</
|
|
222
|
+
/> */}
|
|
223
|
+
</Button>
|
|
372
224
|
</Wrapper>
|
|
373
225
|
);
|
|
374
226
|
};
|
|
@@ -377,15 +229,21 @@ const Wrapper = styled.View<{ theme: DefaultTheme }>`
|
|
|
377
229
|
padding-horizontal: 8px;
|
|
378
230
|
`;
|
|
379
231
|
|
|
380
|
-
const
|
|
381
|
-
|
|
232
|
+
const ShowMoreContainer = styled.View`
|
|
233
|
+
margin-top: 8px;
|
|
234
|
+
align-items: flex-start;
|
|
235
|
+
justify-content: center;
|
|
236
|
+
`;
|
|
237
|
+
|
|
238
|
+
const ShowMoreText = styled.Text<{ theme: DefaultTheme }>`
|
|
382
239
|
color: ${({ theme }: { theme: DefaultTheme }) =>
|
|
383
|
-
theme["
|
|
240
|
+
theme["link-static"] || "#3378F6"};
|
|
241
|
+
font-size: 14px;
|
|
384
242
|
font-weight: 500;
|
|
385
243
|
font-family: 'Roboto-Medium';
|
|
386
244
|
`;
|
|
387
245
|
|
|
388
|
-
const
|
|
246
|
+
const TextStyleRegular = styled.Text<{ theme: DefaultTheme }>`
|
|
389
247
|
font-size: 13px;
|
|
390
248
|
color: ${({ theme }: { theme: DefaultTheme }) =>
|
|
391
249
|
theme["core-06"] || "#4F4E57"};
|
|
@@ -394,7 +252,7 @@ const TextStyleOne = styled.Text<{ theme: DefaultTheme }>`
|
|
|
394
252
|
font-style: normal;
|
|
395
253
|
`;
|
|
396
254
|
|
|
397
|
-
const
|
|
255
|
+
const TextStyleBold = styled.Text<{ theme: DefaultTheme }>`
|
|
398
256
|
font-size: 13px;
|
|
399
257
|
color: ${({ theme }: { theme: DefaultTheme }) =>
|
|
400
258
|
theme["core-05"] || "#020001"};
|
|
@@ -403,23 +261,6 @@ const TextStyleTwo = styled.Text<{ theme: DefaultTheme }>`
|
|
|
403
261
|
font-style: normal;
|
|
404
262
|
`;
|
|
405
263
|
|
|
406
|
-
const ButtonView = styled.TouchableOpacity<{ theme: DefaultTheme }>`
|
|
407
|
-
margin-top: 12px;
|
|
408
|
-
margin-horizontal: 12px;
|
|
409
|
-
align-self: center;
|
|
410
|
-
padding-horizontal: 16px;
|
|
411
|
-
padding-vertical: 6px;
|
|
412
|
-
background-color: ${({ theme }: { theme: DefaultTheme }) =>
|
|
413
|
-
theme["primary-bg-static"] || "#292735"};
|
|
414
|
-
border-radius: 8px;
|
|
415
|
-
align-items: center;
|
|
416
|
-
gap: 16px;
|
|
417
|
-
width: 100%;
|
|
418
|
-
flex-direction: row;
|
|
419
|
-
justify-content: center;
|
|
420
|
-
align-content: center;
|
|
421
|
-
`;
|
|
422
|
-
|
|
423
264
|
const ButtonText = styled.Text<{ theme: DefaultTheme }>`
|
|
424
265
|
color: ${({ theme }: { theme: DefaultTheme }) =>
|
|
425
266
|
theme["primary-cont"] || "#ffffff"};
|
|
@@ -429,7 +270,10 @@ const ButtonText = styled.Text<{ theme: DefaultTheme }>`
|
|
|
429
270
|
`;
|
|
430
271
|
|
|
431
272
|
const ListItemParent = styled.View<{ theme: DefaultTheme; hovered?: boolean }>`
|
|
432
|
-
padding-vertical:
|
|
273
|
+
padding-vertical: 12px;
|
|
274
|
+
border-bottom-width: 1px;
|
|
275
|
+
border-bottom-color: ${({ theme }: { theme: DefaultTheme }) =>
|
|
276
|
+
theme["core-03"] || "#D5D5DC"};
|
|
433
277
|
background-color: ${({
|
|
434
278
|
theme,
|
|
435
279
|
hovered,
|
|
@@ -439,6 +283,87 @@ const ListItemParent = styled.View<{ theme: DefaultTheme; hovered?: boolean }>`
|
|
|
439
283
|
}) => (hovered ? theme["secondary-bg-hover"] || "#EDEDF2" : "transparent")};
|
|
440
284
|
`;
|
|
441
285
|
|
|
286
|
+
const TopContainer = styled.View`
|
|
287
|
+
flex-direction: row;
|
|
288
|
+
justify-content: space-between;
|
|
289
|
+
align-items: center;
|
|
290
|
+
width: 100%;
|
|
291
|
+
`;
|
|
292
|
+
|
|
293
|
+
const TopLeftContainer = styled.View`
|
|
294
|
+
flex-direction: row;
|
|
295
|
+
justify-content: space-between;
|
|
296
|
+
align-items: center;
|
|
297
|
+
gap: 8px;
|
|
298
|
+
`;
|
|
299
|
+
|
|
300
|
+
const TopRightContainer = styled.View`
|
|
301
|
+
flex-direction: row;
|
|
302
|
+
justify-content: space-between;
|
|
303
|
+
align-items: center;
|
|
304
|
+
gap: 4px;
|
|
305
|
+
`;
|
|
306
|
+
|
|
307
|
+
const BottomContainer = styled.View`
|
|
308
|
+
flex-direction: row;
|
|
309
|
+
justify-content: space-between;
|
|
310
|
+
align-items: center;
|
|
311
|
+
width: 100%;
|
|
312
|
+
`;
|
|
313
|
+
|
|
314
|
+
const BottomLeftContainer = styled.View`
|
|
315
|
+
flex-direction: row;
|
|
316
|
+
justify-content: space-between;
|
|
317
|
+
align-items: center;
|
|
318
|
+
gap: 8px;
|
|
319
|
+
`;
|
|
320
|
+
|
|
321
|
+
const BottomRightContainer = styled.View`
|
|
322
|
+
flex-direction: row;
|
|
323
|
+
justify-content: space-between;
|
|
324
|
+
align-items: center;
|
|
325
|
+
gap: 4px;
|
|
326
|
+
`;
|
|
327
|
+
|
|
328
|
+
const PricePerCaratContainer = styled.View`
|
|
329
|
+
flex-direction: row;
|
|
330
|
+
align-items: center;
|
|
331
|
+
`;
|
|
332
|
+
|
|
333
|
+
const TotalPriceContainer = styled.View`
|
|
334
|
+
flex-direction: row;
|
|
335
|
+
justify-content: space-between;
|
|
336
|
+
align-items: center;
|
|
337
|
+
gap: 4px;
|
|
338
|
+
`;
|
|
339
|
+
|
|
340
|
+
const TotalPriceChildContainer = styled.View`
|
|
341
|
+
flex-direction: row;
|
|
342
|
+
align-items: center;
|
|
343
|
+
width: 65px;
|
|
344
|
+
justify-content: flex-end;
|
|
345
|
+
`;
|
|
346
|
+
|
|
347
|
+
const DepthContainer = styled.View`
|
|
348
|
+
flex-direction: row;
|
|
349
|
+
align-items: center;
|
|
350
|
+
gap: 2px;
|
|
351
|
+
`;
|
|
352
|
+
|
|
353
|
+
const TableContainer = styled.View`
|
|
354
|
+
flex-direction: row;
|
|
355
|
+
align-items: center;
|
|
356
|
+
gap: 2px;
|
|
357
|
+
`;
|
|
358
|
+
|
|
359
|
+
const ExtraSmallGapContainer = styled.View`
|
|
360
|
+
flex-direction: row;
|
|
361
|
+
align-items: center;
|
|
362
|
+
gap: 2px;
|
|
363
|
+
`;
|
|
364
|
+
|
|
365
|
+
const MeasurementsContainer = styled.View``;
|
|
366
|
+
|
|
442
367
|
const styles = StyleSheet.create({
|
|
443
368
|
listContent: {
|
|
444
369
|
gap: 8,
|