@nyris/nyris-webapp 0.3.22 → 0.3.24
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/README.md +1 -1
- package/build/asset-manifest.json +12 -18
- package/build/index.html +1 -1
- package/build/{precache-manifest.6f6124db008881782a26c64db1f10264.js → precache-manifest.982b135daeb2c083ccf4eeeddf132bf3.js} +11 -35
- package/build/service-worker.js +1 -1
- package/build/static/css/{main.c956b74c.chunk.css → main.1e43a778.chunk.css} +2 -2
- package/build/static/css/main.1e43a778.chunk.css.map +1 -0
- package/build/static/js/2.fe9108d5.chunk.js +3 -0
- package/build/static/js/{2.a2732c2b.chunk.js.LICENSE.txt → 2.fe9108d5.chunk.js.LICENSE.txt} +0 -15
- package/build/static/js/2.fe9108d5.chunk.js.map +1 -0
- package/build/static/js/main.83cb88a3.chunk.js +3 -0
- package/build/static/js/main.83cb88a3.chunk.js.map +1 -0
- package/package.json +3 -3
- package/src/App.tsx +6 -14
- package/src/Router.tsx +6 -41
- package/src/Store/Store.ts +14 -23
- package/src/components/DetailItem.tsx +33 -22
- package/src/components/FooterMobile.tsx +3 -51
- package/src/components/FooterResult.tsx +1 -1
- package/src/components/HeaderMobile.tsx +13 -20
- package/src/components/HeaderNewVersion.tsx +5 -83
- package/src/components/Layout.tsx +3 -19
- package/src/components/PanelResult/index.tsx +1 -1
- package/src/components/clear-refinements/clear-refinements.tsx +1 -1
- package/src/components/drawer/cameraCustom.tsx +6 -12
- package/src/components/input/inputSearch.tsx +3 -3
- package/src/components/pre-filter/desktop/index.tsx +2 -2
- package/src/components/results/ItemResult.tsx +8 -8
- package/src/defaults.ts +19 -35
- package/src/helpers/CommonHelper.ts +10 -6
- package/src/hooks/useVisualSearch.tsx +1 -1
- package/src/index.css +13 -0
- package/src/index.tsx +0 -20
- package/src/modules/LandingPage/AppMD.tsx +59 -386
- package/src/modules/LandingPage/AppMobile.tsx +1 -1
- package/src/modules/LandingPage/propsType.ts +35 -37
- package/src/page/result/index.tsx +2 -2
- package/src/services/Feedback.ts +48 -71
- package/src/services/filter.tsx +1 -1
- package/src/services/types.ts +30 -39
- package/src/types.ts +8 -63
- package/build/js/test.js +0 -84
- package/build/static/css/main.c956b74c.chunk.css.map +0 -1
- package/build/static/js/2.a2732c2b.chunk.js +0 -3
- package/build/static/js/2.a2732c2b.chunk.js.map +0 -1
- package/build/static/js/main.93b05e17.chunk.js +0 -3
- package/build/static/js/main.93b05e17.chunk.js.map +0 -1
- package/build/static/media/Rectangle.4dd8b747.png +0 -0
- package/build/static/media/icon_company.2b2a0a61.svg +0 -3
- package/build/static/media/icon_email.132d632b.svg +0 -3
- package/build/static/media/icon_phone.09335da9.svg +0 -3
- package/build/static/media/icon_textArea.f6d78b61.svg +0 -3
- package/build/static/media/icon_users.2013c76e.svg +0 -3
- package/public/js/test.js +0 -84
- package/src/App.css +0 -65
- package/src/components/AppContainer.tsx +0 -126
- package/src/components/CategoryFilter.tsx +0 -17
- package/src/components/Codes.tsx +0 -20
- package/src/components/CustomHits/index.tsx +0 -47
- package/src/components/Footer.tsx +0 -96
- package/src/components/FooterMD.tsx +0 -54
- package/src/components/HeaderMd.tsx +0 -38
- package/src/components/Navigation.tsx +0 -34
- package/src/components/PredictedCategories.tsx +0 -14
- package/src/components/Refine.tsx +0 -28
- package/src/components/RelevantSort.tsx +0 -12
- package/src/components/Result.tsx +0 -210
- package/src/components/Saved/AllItem.tsx +0 -32
- package/src/components/Saved/Category.tsx +0 -16
- package/src/components/auto-complete/basic.tsx +0 -153
- package/src/components/autocomplete/plugins/popular-searches/popular-searches.css +0 -3
- package/src/components/autocomplete/plugins/popular-searches/popular-searches.tsx +0 -75
- package/src/components/button/clear-fillter.tsx +0 -30
- package/src/components/camera/screenshot.tsx +0 -33
- package/src/components/count/count.tsx +0 -20
- package/src/components/hitItem/hits.tsx +0 -50
- package/src/components/hitItem/infinitiHits.tsx +0 -33
- package/src/components/icon/icon.tsx +0 -13
- package/src/components/icon_textArea.svg +0 -3
- package/src/components/refinement-list/index.tsx +0 -42
- package/src/components/results/pagination.tsx +0 -34
- package/src/components/search/ListSearch.tsx +0 -209
- package/src/modules/LandingPage/App.tsx +0 -318
- package/src/modules/LandingPage/index.tsx +0 -186
- package/src/modules/LandingPage/indexNewVersion.tsx +0 -72
- package/src/page/Auth/login.tsx +0 -7
- package/src/page/Exception/404.tsx +0 -11
- package/src/page/History/index.tsx +0 -76
- package/src/page/Profile/index.tsx +0 -140
- package/src/page/ResultMobile/index.tsx +0 -12
- package/src/page/Saved/MockData.ts +0 -223
- package/src/page/Saved/index.tsx +0 -166
- package/src/page/Support/MockData.ts +0 -45
- package/src/page/Support/index.tsx +0 -492
- /package/build/static/js/{main.93b05e17.chunk.js.LICENSE.txt → main.83cb88a3.chunk.js.LICENSE.txt} +0 -0
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { Box, Typography } from "@material-ui/core";
|
|
2
|
-
import React, { memo } from "react";
|
|
3
|
-
import { connectRefinementList } from "react-instantsearch-dom";
|
|
4
|
-
|
|
5
|
-
function RefinementList({
|
|
6
|
-
items,
|
|
7
|
-
refine,
|
|
8
|
-
searchForItems,
|
|
9
|
-
options,
|
|
10
|
-
currentRefinement,
|
|
11
|
-
switched,
|
|
12
|
-
}: any) {
|
|
13
|
-
|
|
14
|
-
return (
|
|
15
|
-
<ul>
|
|
16
|
-
{options?.searchable && (
|
|
17
|
-
<input
|
|
18
|
-
type="search"
|
|
19
|
-
onChange={(event) => searchForItems(event.currentTarget.value)}
|
|
20
|
-
/>
|
|
21
|
-
)}
|
|
22
|
-
{items.map((item: any) => {
|
|
23
|
-
return (
|
|
24
|
-
<li key={item.label}>
|
|
25
|
-
<Box display={"flex"} alignItems={"center"}>
|
|
26
|
-
<input
|
|
27
|
-
style={{ marginRight: 5 }}
|
|
28
|
-
type="checkbox"
|
|
29
|
-
onChange={(e: any) => {
|
|
30
|
-
return refine(item.value);
|
|
31
|
-
}}
|
|
32
|
-
/>
|
|
33
|
-
<Typography>{item.label}</Typography>
|
|
34
|
-
</Box>
|
|
35
|
-
</li>
|
|
36
|
-
);
|
|
37
|
-
})}
|
|
38
|
-
</ul>
|
|
39
|
-
);
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export const CustomRefinemnetList = connectRefinementList(memo(RefinementList));
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
import { connectPagination } from "react-instantsearch-dom";
|
|
2
|
-
import React from "react";
|
|
3
|
-
|
|
4
|
-
const Pagination = ({ currentRefinement, nbPages, refine, createURL }: any) => {
|
|
5
|
-
console.log('currentRefinement', currentRefinement);
|
|
6
|
-
|
|
7
|
-
return (
|
|
8
|
-
<ul>
|
|
9
|
-
{new Array(nbPages).fill(null).map((_, index) => {
|
|
10
|
-
const page = index + 1;
|
|
11
|
-
const style = {
|
|
12
|
-
fontWeight: currentRefinement === page ? "bold" : "",
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
return (
|
|
16
|
-
<li key={index}>
|
|
17
|
-
<a
|
|
18
|
-
href={createURL(page)}
|
|
19
|
-
// style={style}
|
|
20
|
-
onClick={(event) => {
|
|
21
|
-
event.preventDefault();
|
|
22
|
-
refine(page);
|
|
23
|
-
}}
|
|
24
|
-
>
|
|
25
|
-
{page}
|
|
26
|
-
</a>
|
|
27
|
-
</li>
|
|
28
|
-
);
|
|
29
|
-
})}
|
|
30
|
-
</ul>
|
|
31
|
-
);
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
export const CustomPagination = connectPagination(Pagination);
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
import * as React from "react";
|
|
2
|
-
import {
|
|
3
|
-
DataGrid,
|
|
4
|
-
} from "@material-ui/data-grid";
|
|
5
|
-
import { Box, Button, Typography } from "@material-ui/core";
|
|
6
|
-
import ViewOff from "common/assets/icons/view_off.png";
|
|
7
|
-
import ImageTest from "common/assets/images/image_test.png";
|
|
8
|
-
import MoreVertOutlinedIcon from "@material-ui/icons/MoreVertOutlined";
|
|
9
|
-
import KeyboardArrowUpOutlinedIcon from "@material-ui/icons/KeyboardArrowUpOutlined";
|
|
10
|
-
import KeyboardArrowDownOutlinedIcon from "@material-ui/icons/KeyboardArrowDownOutlined";
|
|
11
|
-
// image_test.png
|
|
12
|
-
const handleCellClick = (param: any, event: any) => {
|
|
13
|
-
// console.log(param);
|
|
14
|
-
// console.log(event);
|
|
15
|
-
if (param.colIndex === 2) {
|
|
16
|
-
event.stopPropagation();
|
|
17
|
-
}
|
|
18
|
-
};
|
|
19
|
-
|
|
20
|
-
const handleRowClick = (param: any, event: any) => {
|
|
21
|
-
// console.log("Row:");
|
|
22
|
-
// console.log(param);
|
|
23
|
-
// console.log(event);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
const columns: any = [
|
|
27
|
-
{
|
|
28
|
-
field: "time",
|
|
29
|
-
headerName: "Time",
|
|
30
|
-
width: 42,
|
|
31
|
-
renderHeader: (params: any) => {
|
|
32
|
-
return (
|
|
33
|
-
<Typography className="text-f9 text-white fw-700">Time</Typography>
|
|
34
|
-
);
|
|
35
|
-
},
|
|
36
|
-
renderCell: (cellValues: any) => {
|
|
37
|
-
console.log("cellValues", cellValues);
|
|
38
|
-
return (
|
|
39
|
-
<Typography className="text-f9 fw-500 text-gray2">
|
|
40
|
-
{cellValues.value}
|
|
41
|
-
</Typography>
|
|
42
|
-
);
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
field: "search",
|
|
47
|
-
headerName: "Search",
|
|
48
|
-
width: 139,
|
|
49
|
-
renderHeader: (params: any) => {
|
|
50
|
-
return (
|
|
51
|
-
<Typography className="text-f9 text-white fw-700">Search</Typography>
|
|
52
|
-
);
|
|
53
|
-
},
|
|
54
|
-
renderCell: (cellValues: any) => {
|
|
55
|
-
console.log("cellValues", cellValues);
|
|
56
|
-
return (
|
|
57
|
-
<Box display={"flex"} alignItems={"center"}>
|
|
58
|
-
<Box className="box-image-search">
|
|
59
|
-
<img src={cellValues?.row.search.image} alt="img_search" />
|
|
60
|
-
</Box>
|
|
61
|
-
<Typography className="text-f9 text-gray2 fw-500">
|
|
62
|
-
{cellValues?.row.search.text}
|
|
63
|
-
</Typography>
|
|
64
|
-
</Box>
|
|
65
|
-
);
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
{
|
|
69
|
-
field: "order",
|
|
70
|
-
headerName: "Order",
|
|
71
|
-
width: 112,
|
|
72
|
-
renderHeader: (params: any) => {
|
|
73
|
-
return (
|
|
74
|
-
<Typography className="text-f9 text-white fw-700">Order</Typography>
|
|
75
|
-
);
|
|
76
|
-
},
|
|
77
|
-
renderCell: (cellValues: any) => {
|
|
78
|
-
console.log("cellValues", cellValues);
|
|
79
|
-
return (
|
|
80
|
-
<Typography className="text-f9 text-gray2 fw-500">
|
|
81
|
-
{cellValues?.row.order ? cellValues?.row.order : "_"}
|
|
82
|
-
</Typography>
|
|
83
|
-
);
|
|
84
|
-
},
|
|
85
|
-
},
|
|
86
|
-
{
|
|
87
|
-
field: "device",
|
|
88
|
-
headerName: "Device",
|
|
89
|
-
width: 161,
|
|
90
|
-
// align: "left",
|
|
91
|
-
renderHeader: (params: any) => {
|
|
92
|
-
return (
|
|
93
|
-
<Typography className="text-f9 text-white fw-700">Device</Typography>
|
|
94
|
-
);
|
|
95
|
-
},
|
|
96
|
-
renderCell: (cellValues: any) => {
|
|
97
|
-
console.log("cellValues", cellValues);
|
|
98
|
-
return (
|
|
99
|
-
<Typography className="text-f9 text-gray2 fw-500">
|
|
100
|
-
{cellValues?.row.device ? cellValues?.row.device : "_"}
|
|
101
|
-
</Typography>
|
|
102
|
-
);
|
|
103
|
-
},
|
|
104
|
-
},
|
|
105
|
-
{
|
|
106
|
-
field: "more",
|
|
107
|
-
headerName: "More",
|
|
108
|
-
sortable: false,
|
|
109
|
-
width: 48,
|
|
110
|
-
// valueGetter: (params: any) => {
|
|
111
|
-
// return `${params.getValue(params.id, "firstName") || ""} ${
|
|
112
|
-
// params.getValue(params.id, "lastName") || ""
|
|
113
|
-
// }`;
|
|
114
|
-
// },
|
|
115
|
-
renderHeader: (params: any) => {
|
|
116
|
-
return (
|
|
117
|
-
<Typography className="text-f9 text-white fw-700">More</Typography>
|
|
118
|
-
);
|
|
119
|
-
},
|
|
120
|
-
renderCell: (cellValues: any) => {
|
|
121
|
-
console.log("cellValues", cellValues);
|
|
122
|
-
return (
|
|
123
|
-
<Box>
|
|
124
|
-
<Button>
|
|
125
|
-
<MoreVertOutlinedIcon style={{ fontSize: 12 }} />
|
|
126
|
-
</Button>
|
|
127
|
-
</Box>
|
|
128
|
-
);
|
|
129
|
-
},
|
|
130
|
-
},
|
|
131
|
-
];
|
|
132
|
-
|
|
133
|
-
const rows = [
|
|
134
|
-
{
|
|
135
|
-
id: 1,
|
|
136
|
-
time: "14:32",
|
|
137
|
-
search: {
|
|
138
|
-
image: ViewOff,
|
|
139
|
-
text: "engine bühler",
|
|
140
|
-
},
|
|
141
|
-
order: "",
|
|
142
|
-
device: "Desktop app",
|
|
143
|
-
more: "",
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
id: 2,
|
|
147
|
-
time: "14:32",
|
|
148
|
-
search: {
|
|
149
|
-
image: ImageTest,
|
|
150
|
-
text: "",
|
|
151
|
-
},
|
|
152
|
-
order: "Secondary search",
|
|
153
|
-
device: "Desktop app",
|
|
154
|
-
more: "",
|
|
155
|
-
},
|
|
156
|
-
{
|
|
157
|
-
id: 3,
|
|
158
|
-
time: "14:32",
|
|
159
|
-
search: {
|
|
160
|
-
image: ViewOff,
|
|
161
|
-
text: "engine bühler",
|
|
162
|
-
},
|
|
163
|
-
order: "",
|
|
164
|
-
device: "Desktop app",
|
|
165
|
-
more: "",
|
|
166
|
-
},
|
|
167
|
-
];
|
|
168
|
-
|
|
169
|
-
export default function ListSearch() {
|
|
170
|
-
return (
|
|
171
|
-
<>
|
|
172
|
-
<Box>
|
|
173
|
-
<Typography
|
|
174
|
-
className="text-f12 text-gray2 box-gray2 fw-700"
|
|
175
|
-
style={{ padding: "2px 10px" }}
|
|
176
|
-
>
|
|
177
|
-
Monday January 1st, 2021
|
|
178
|
-
</Typography>
|
|
179
|
-
</Box>
|
|
180
|
-
<DataGrid
|
|
181
|
-
// rowHeight={32}
|
|
182
|
-
// className={classes.root}
|
|
183
|
-
rows={rows}
|
|
184
|
-
columns={columns}
|
|
185
|
-
// pageSize={100}
|
|
186
|
-
checkboxSelection
|
|
187
|
-
onCellClick={handleCellClick}
|
|
188
|
-
onRowClick={handleRowClick}
|
|
189
|
-
disableSelectionOnClick
|
|
190
|
-
hideFooter
|
|
191
|
-
disableColumnMenu
|
|
192
|
-
autoHeight
|
|
193
|
-
components={{
|
|
194
|
-
ColumnSortedAscendingIcon: () => (
|
|
195
|
-
<KeyboardArrowUpOutlinedIcon
|
|
196
|
-
style={{ fontSize: 12, color: "#fff" }}
|
|
197
|
-
/>
|
|
198
|
-
),
|
|
199
|
-
ColumnSortedDescendingIcon: () => (
|
|
200
|
-
<KeyboardArrowDownOutlinedIcon
|
|
201
|
-
style={{ fontSize: 12, color: "#fff" }}
|
|
202
|
-
/>
|
|
203
|
-
),
|
|
204
|
-
// Checkbox: (props) => <div>{...props}</div>
|
|
205
|
-
}}
|
|
206
|
-
/>
|
|
207
|
-
</>
|
|
208
|
-
);
|
|
209
|
-
}
|
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
import "App.css";
|
|
2
|
-
import React, { useEffect, useState } from "react";
|
|
3
|
-
import Result from "components/Result";
|
|
4
|
-
import ExampleImages from "components/ExampleImages";
|
|
5
|
-
import CategoryFilter from "components/CategoryFilter";
|
|
6
|
-
import PredictedCategories from "components/PredictedCategories";
|
|
7
|
-
import Codes from "components/Codes";
|
|
8
|
-
import { useDropzone } from "react-dropzone";
|
|
9
|
-
import classNames from "classnames";
|
|
10
|
-
import { Animate, NodeGroup } from "react-move";
|
|
11
|
-
import {
|
|
12
|
-
makeFileHandler,
|
|
13
|
-
Capture, Preview,
|
|
14
|
-
} from "@nyris/nyris-react-components";
|
|
15
|
-
import { Snackbar } from "@material-ui/core";
|
|
16
|
-
import MuiAlert, { AlertProps } from "@material-ui/lab/Alert";
|
|
17
|
-
|
|
18
|
-
import {AppProps} from "./propsType";
|
|
19
|
-
|
|
20
|
-
function Alert(props: AlertProps) {
|
|
21
|
-
return <MuiAlert elevation={6} variant="filled" {...props} />;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
const LandingPageApp = (props: AppProps) => {
|
|
25
|
-
const {
|
|
26
|
-
handlers,
|
|
27
|
-
showPart,
|
|
28
|
-
acceptTypes,
|
|
29
|
-
settings,
|
|
30
|
-
search,
|
|
31
|
-
loading,
|
|
32
|
-
previewImage
|
|
33
|
-
} = props;
|
|
34
|
-
|
|
35
|
-
const {
|
|
36
|
-
results,
|
|
37
|
-
requestId,
|
|
38
|
-
duration,
|
|
39
|
-
categoryPredictions,
|
|
40
|
-
codes,
|
|
41
|
-
filterOptions,
|
|
42
|
-
errorMessage,
|
|
43
|
-
regions,
|
|
44
|
-
previewSelection
|
|
45
|
-
} = search;
|
|
46
|
-
|
|
47
|
-
const {
|
|
48
|
-
onExampleImageClick,
|
|
49
|
-
onImageClick,
|
|
50
|
-
onLinkClick,
|
|
51
|
-
onFileDropped,
|
|
52
|
-
onCaptureComplete,
|
|
53
|
-
onCaptureCanceled,
|
|
54
|
-
onSelectFile,
|
|
55
|
-
onCameraClick,
|
|
56
|
-
onShowStart,
|
|
57
|
-
onSelectionChange,
|
|
58
|
-
} = handlers;
|
|
59
|
-
|
|
60
|
-
const { getRootProps, getInputProps, isDragActive } = useDropzone({
|
|
61
|
-
onDrop: (fs: File[]) => {
|
|
62
|
-
onFileDropped(fs[0]);
|
|
63
|
-
},
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const [toastOpen, setToastOpen] = useState(false);
|
|
68
|
-
useEffect(() => {
|
|
69
|
-
if (errorMessage !== "") {
|
|
70
|
-
setToastOpen(true);
|
|
71
|
-
}
|
|
72
|
-
}, [errorMessage]);
|
|
73
|
-
|
|
74
|
-
const minPreviewHeight = 400;
|
|
75
|
-
const halfOfTheScreenHeight = Math.floor(window.innerHeight * 0.45);
|
|
76
|
-
const maxPreviewHeight = Math.max(minPreviewHeight, halfOfTheScreenHeight);
|
|
77
|
-
|
|
78
|
-
return (
|
|
79
|
-
<div>
|
|
80
|
-
{showPart === "camera" && (
|
|
81
|
-
<Capture
|
|
82
|
-
onCaptureComplete={ onCaptureComplete }
|
|
83
|
-
onCaptureCanceled={ onCaptureCanceled }
|
|
84
|
-
useAppText="Use default camera app"
|
|
85
|
-
/>
|
|
86
|
-
)}
|
|
87
|
-
<div
|
|
88
|
-
className={classNames("headSection", {
|
|
89
|
-
hidden: showPart === "results",
|
|
90
|
-
})}
|
|
91
|
-
id="headSection"
|
|
92
|
-
>
|
|
93
|
-
<div
|
|
94
|
-
{...getRootProps({
|
|
95
|
-
onClick: (e) => {
|
|
96
|
-
e.stopPropagation();
|
|
97
|
-
},
|
|
98
|
-
})}
|
|
99
|
-
className={classNames("wrapper", "dragAndDropActionArea", {
|
|
100
|
-
fileIsHover: isDragActive,
|
|
101
|
-
})}
|
|
102
|
-
>
|
|
103
|
-
<div className="contentWrap">
|
|
104
|
-
<section className="uploadImage">
|
|
105
|
-
<input
|
|
106
|
-
type="button"
|
|
107
|
-
name="file"
|
|
108
|
-
id="capture"
|
|
109
|
-
className="inputfile"
|
|
110
|
-
accept="image/*"
|
|
111
|
-
capture="environment"
|
|
112
|
-
onClick={() => onCameraClick()}
|
|
113
|
-
/>
|
|
114
|
-
<input
|
|
115
|
-
type="file"
|
|
116
|
-
name="file"
|
|
117
|
-
id="capture_file"
|
|
118
|
-
className="inputfile"
|
|
119
|
-
accept={acceptTypes}
|
|
120
|
-
capture="environment"
|
|
121
|
-
/>
|
|
122
|
-
<input
|
|
123
|
-
{...getInputProps()}
|
|
124
|
-
type="file"
|
|
125
|
-
name="file"
|
|
126
|
-
id="select_file"
|
|
127
|
-
className="inputfile"
|
|
128
|
-
accept={acceptTypes}
|
|
129
|
-
onChange={makeFileHandler(onSelectFile)}
|
|
130
|
-
/>
|
|
131
|
-
<div className="onDesktop">
|
|
132
|
-
Drop an image
|
|
133
|
-
<div className="smallText">or</div>
|
|
134
|
-
</div>
|
|
135
|
-
<div className="onMobile camIcon">
|
|
136
|
-
<img src="./images/ic_cam_large.svg" alt="Camera" />
|
|
137
|
-
</div>
|
|
138
|
-
<label
|
|
139
|
-
htmlFor="capture"
|
|
140
|
-
className="btn primary onMobile"
|
|
141
|
-
style={{ marginBottom: "2em", width: "22em" }}
|
|
142
|
-
>
|
|
143
|
-
<span className="onMobile">Take a picture</span>
|
|
144
|
-
</label>
|
|
145
|
-
<br />
|
|
146
|
-
<label
|
|
147
|
-
htmlFor="select_file"
|
|
148
|
-
className="btn primary"
|
|
149
|
-
style={{ width: "22em" }}
|
|
150
|
-
>
|
|
151
|
-
<span>Select a file</span>
|
|
152
|
-
</label>
|
|
153
|
-
<label
|
|
154
|
-
htmlFor="capture"
|
|
155
|
-
className="mobileUploadHandler onMobile"
|
|
156
|
-
/>
|
|
157
|
-
</section>
|
|
158
|
-
<ExampleImages
|
|
159
|
-
images={settings.exampleImages}
|
|
160
|
-
onExampleImageClicked={onExampleImageClick}
|
|
161
|
-
/>
|
|
162
|
-
</div>
|
|
163
|
-
</div>
|
|
164
|
-
<div
|
|
165
|
-
className={classNames("tryDifferent", {
|
|
166
|
-
hidden: showPart !== "results",
|
|
167
|
-
})}
|
|
168
|
-
onClick={() => onShowStart()}
|
|
169
|
-
>
|
|
170
|
-
<div className="icIcon"></div>
|
|
171
|
-
<div className="textDesc"> Try a different image</div>
|
|
172
|
-
<br style={{ clear: "both" }} />
|
|
173
|
-
</div>
|
|
174
|
-
<div className="headerSeparatorTop" />
|
|
175
|
-
<div className="headerSeparatorBack" />
|
|
176
|
-
</div>
|
|
177
|
-
|
|
178
|
-
<section
|
|
179
|
-
className={classNames(
|
|
180
|
-
"results",
|
|
181
|
-
{ resultsActive: showPart === "results" },
|
|
182
|
-
results.length === 1 ? "singleProduct" : "multipleProducts"
|
|
183
|
-
)}
|
|
184
|
-
>
|
|
185
|
-
{errorMessage && (
|
|
186
|
-
<div className="errorMsg">
|
|
187
|
-
{errorMessage}
|
|
188
|
-
<div
|
|
189
|
-
style={{
|
|
190
|
-
textAlign: "center",
|
|
191
|
-
fontSize: "0.7em",
|
|
192
|
-
paddingTop: "0.8em",
|
|
193
|
-
}}
|
|
194
|
-
>
|
|
195
|
-
<span>
|
|
196
|
-
Make sure to include the request ID when reporting a problem:{" "}
|
|
197
|
-
{requestId}
|
|
198
|
-
</span>
|
|
199
|
-
</div>
|
|
200
|
-
</div>
|
|
201
|
-
)}
|
|
202
|
-
<Animate
|
|
203
|
-
show={loading}
|
|
204
|
-
start={{ opacity: 0.0 }}
|
|
205
|
-
enter={{ opacity: [1.0], timing: { duration: 300 } }}
|
|
206
|
-
leave={{ opacity: [0.0], timing: { duration: 300 } }}
|
|
207
|
-
>
|
|
208
|
-
{(s) => (
|
|
209
|
-
<div className="loadingOverlay" style={{ ...s }}>
|
|
210
|
-
<div className="loading" />
|
|
211
|
-
</div>
|
|
212
|
-
)}
|
|
213
|
-
</Animate>
|
|
214
|
-
{settings.preview && previewImage && (
|
|
215
|
-
<div className="preview">
|
|
216
|
-
<Preview
|
|
217
|
-
key={previewImage?.id}
|
|
218
|
-
onSelectionChange={ onSelectionChange }
|
|
219
|
-
image={previewImage?.canvas}
|
|
220
|
-
selection={previewSelection}
|
|
221
|
-
regions={regions}
|
|
222
|
-
maxWidth={document.body.clientWidth}
|
|
223
|
-
maxHeight={maxPreviewHeight}
|
|
224
|
-
dotColor="#4C8F9F"
|
|
225
|
-
/>
|
|
226
|
-
</div>
|
|
227
|
-
)}
|
|
228
|
-
<div className="predicted-categories">
|
|
229
|
-
<PredictedCategories cs={categoryPredictions} />
|
|
230
|
-
</div>
|
|
231
|
-
<div className="predicted-categories">
|
|
232
|
-
<Codes codes={codes} />
|
|
233
|
-
</div>
|
|
234
|
-
<CategoryFilter cats={filterOptions} />
|
|
235
|
-
<div className="wrapper">
|
|
236
|
-
<NodeGroup
|
|
237
|
-
data={results}
|
|
238
|
-
keyAccessor={(r) => r.sku}
|
|
239
|
-
start={(r, i) => ({ opacity: 0, translateX: -100 })}
|
|
240
|
-
enter={(r, i) => ({
|
|
241
|
-
opacity: [1],
|
|
242
|
-
translateX: [0],
|
|
243
|
-
timing: { delay: i * 100, duration: 300 },
|
|
244
|
-
})}
|
|
245
|
-
>
|
|
246
|
-
{(rs) => (
|
|
247
|
-
<>
|
|
248
|
-
{rs.map(({ key, data, state }) => (
|
|
249
|
-
<Result
|
|
250
|
-
key={key}
|
|
251
|
-
noImageUrl={settings.noImageUrl}
|
|
252
|
-
template={settings.resultTemplate}
|
|
253
|
-
onImageClick={onImageClick}
|
|
254
|
-
onLinkClick={onLinkClick}
|
|
255
|
-
result={data}
|
|
256
|
-
style={{
|
|
257
|
-
opacity: state.opacity,
|
|
258
|
-
transform: `translateX(${state.translateX}%)`,
|
|
259
|
-
}}
|
|
260
|
-
/>
|
|
261
|
-
))}
|
|
262
|
-
</>
|
|
263
|
-
)}
|
|
264
|
-
</NodeGroup>
|
|
265
|
-
|
|
266
|
-
{(results.length === 0 &&
|
|
267
|
-
showPart === "results" &&
|
|
268
|
-
!loading && (
|
|
269
|
-
<div className="noResults">
|
|
270
|
-
We did not find anything{" "}
|
|
271
|
-
<span role="img" aria-label="sad face">
|
|
272
|
-
😕
|
|
273
|
-
</span>
|
|
274
|
-
</div>
|
|
275
|
-
))}
|
|
276
|
-
|
|
277
|
-
<br style={{ clear: "both" }} />
|
|
278
|
-
|
|
279
|
-
{duration && showPart === "results" && (
|
|
280
|
-
<div
|
|
281
|
-
style={{
|
|
282
|
-
textAlign: "center",
|
|
283
|
-
fontSize: "0.7em",
|
|
284
|
-
paddingTop: "0.8em",
|
|
285
|
-
}}
|
|
286
|
-
>
|
|
287
|
-
Search took {duration.toFixed(2)} seconds
|
|
288
|
-
</div>
|
|
289
|
-
)}
|
|
290
|
-
|
|
291
|
-
{requestId && showPart === "results" && (
|
|
292
|
-
<div
|
|
293
|
-
style={{
|
|
294
|
-
textAlign: "center",
|
|
295
|
-
fontSize: "0.7em",
|
|
296
|
-
paddingTop: "0.8em",
|
|
297
|
-
}}
|
|
298
|
-
>
|
|
299
|
-
Request identifier {requestId}
|
|
300
|
-
</div>
|
|
301
|
-
)}
|
|
302
|
-
</div>
|
|
303
|
-
</section>
|
|
304
|
-
|
|
305
|
-
<Snackbar
|
|
306
|
-
open={toastOpen}
|
|
307
|
-
autoHideDuration={3000}
|
|
308
|
-
onClose={() => setToastOpen(false)}
|
|
309
|
-
>
|
|
310
|
-
<Alert onClose={() => setToastOpen(false)} severity="error">
|
|
311
|
-
{errorMessage}
|
|
312
|
-
</Alert>
|
|
313
|
-
</Snackbar>
|
|
314
|
-
</div>
|
|
315
|
-
);
|
|
316
|
-
};
|
|
317
|
-
|
|
318
|
-
export default LandingPageApp;
|