@nyris/nyris-webapp 0.3.52 → 0.3.53
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/build/asset-manifest.json +7 -6
- package/build/index.html +1 -1
- package/build/js/settings.example.js +2 -0
- package/build/static/css/{main.aa443e67.css → main.8c0eb6c0.css} +2 -2
- package/build/static/css/main.8c0eb6c0.css.map +1 -0
- package/build/static/js/{main.e023bcc5.js → main.ebb92e93.js} +3 -3
- package/build/static/js/{main.e023bcc5.js.map → main.ebb92e93.js.map} +1 -1
- package/build/static/media/experience-visual-icon.41d0f3ebf64076a3b627a748e30596a5.svg +3 -0
- package/package.json +3 -3
- package/public/js/settings.example.js +2 -0
- package/src/common/experience-visual-icon.svg +3 -0
- package/src/components/Experience-visual-search/ExperienceVisualSearch.scss +197 -0
- package/src/components/Experience-visual-search/ExperienceVisualSearch.tsx +164 -0
- package/src/components/ImagePreviewMobile.tsx +8 -5
- package/src/components/SidePanel.tsx +6 -3
- package/src/page/landingPage/AppMD.tsx +6 -0
- package/src/page/landingPage/AppMobile.tsx +8 -1
- package/src/types.ts +2 -0
- package/build/static/css/main.aa443e67.css.map +0 -1
- /package/build/static/js/{main.e023bcc5.js.LICENSE.txt → main.ebb92e93.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M1.42028 4.82804C1.42028 5.22014 1.10221 5.53825 0.710142 5.53825C0.318078 5.53825 0 5.22014 0 4.82804V2.69216C0 1.20767 1.20757 0 2.69193 0H4.87323C5.26529 0 5.58337 0.318104 5.58337 0.710201C5.58337 1.1023 5.26529 1.4204 4.87323 1.4204H2.69193C1.99071 1.4204 1.42028 1.99087 1.42028 2.69216V4.82804ZM13.3081 0H11.1268C10.7347 0 10.4167 0.318104 10.4167 0.710201C10.4167 1.1023 10.7347 1.4204 11.1268 1.4204H13.3081C14.0093 1.4204 14.5798 1.99087 14.5798 2.69216V4.82804C14.5798 5.22014 14.8978 5.53825 15.2899 5.53825C15.682 5.53825 16 5.22014 16 4.82804V2.69216C16 1.20767 14.7925 0 13.3081 0ZM15.2899 10.4614C14.8978 10.4614 14.5798 10.7795 14.5798 11.1716V13.3078C14.5798 14.0091 14.0093 14.5796 13.3081 14.5796H11.1268C10.7347 14.5796 10.4167 14.8977 10.4167 15.2898C10.4167 15.6819 10.7347 16 11.1268 16H13.3081C14.7925 16 16 14.7923 16 13.3078V11.1716C16 10.7795 15.682 10.4614 15.2899 10.4614ZM4.87323 14.5796H2.69193C1.99071 14.5796 1.42028 14.0091 1.42028 13.3078V11.1716C1.42028 10.7795 1.10221 10.4614 0.710142 10.4614C0.318078 10.4614 0 10.7792 0 11.1716V13.3078C0 14.7923 1.20757 16 2.69193 16H4.87323C5.26529 16 5.58337 15.6819 5.58337 15.2898C5.58337 14.8977 5.26529 14.5796 4.87323 14.5796ZM12.6019 12.6029C12.4476 12.7572 12.2425 12.8421 12.0242 12.8421L12.0245 12.8418C11.8062 12.8418 11.6011 12.7569 11.4468 12.6026L10.2604 11.4161C9.59218 11.8613 8.81663 12.0952 8.00047 12.0952C6.90685 12.0952 5.87863 11.6694 5.1054 10.8961C4.33217 10.1228 3.90641 9.09453 3.90641 8.00082C3.90641 6.90711 4.33217 5.87881 5.1054 5.10552C5.87863 4.33222 6.90685 3.90643 8.00047 3.90643C9.09408 3.90643 10.1223 4.33222 10.8955 5.10552C11.6688 5.87881 12.0945 6.90711 12.0945 8.00082C12.0945 8.81706 11.8607 9.59266 11.4154 10.2612L12.6019 11.4478C12.9203 11.7662 12.9203 12.2845 12.6019 12.6029ZM9.73685 9.73702C9.75171 9.72248 9.76723 9.70795 9.78342 9.69407C10.2201 9.23426 10.4605 8.63373 10.4605 8.00082C10.4605 6.64418 9.35667 5.54023 8.00014 5.54023C6.6436 5.54023 5.53974 6.64418 5.53974 8.00082C5.53974 9.35747 6.64327 10.4614 8.00014 10.4614C8.63299 10.4614 9.23347 10.2213 9.69325 9.78425C9.70745 9.76774 9.72198 9.75188 9.73685 9.73702Z" fill="white"/>
|
|
3
|
+
</svg>
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nyris/nyris-webapp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.53",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@auth0/auth0-react": "^2.2.4",
|
|
6
6
|
"@emailjs/browser": "^4.3.3",
|
|
7
7
|
"@material-ui/core": "^4.12.4",
|
|
8
8
|
"@material-ui/icons": "^4.11.3",
|
|
9
9
|
"@material-ui/lab": "^4.0.0-alpha.61",
|
|
10
|
-
"@nyris/nyris-api": "^0.3.
|
|
11
|
-
"@nyris/nyris-react-components": "^0.3.
|
|
10
|
+
"@nyris/nyris-api": "^0.3.53",
|
|
11
|
+
"@nyris/nyris-react-components": "^0.3.53",
|
|
12
12
|
"@reduxjs/toolkit": "^2.2.1",
|
|
13
13
|
"@splidejs/react-splide": "^0.7.12",
|
|
14
14
|
"@testing-library/jest-dom": "^5.17.0",
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M1.42028 4.82804C1.42028 5.22014 1.10221 5.53825 0.710142 5.53825C0.318078 5.53825 0 5.22014 0 4.82804V2.69216C0 1.20767 1.20757 0 2.69193 0H4.87323C5.26529 0 5.58337 0.318104 5.58337 0.710201C5.58337 1.1023 5.26529 1.4204 4.87323 1.4204H2.69193C1.99071 1.4204 1.42028 1.99087 1.42028 2.69216V4.82804ZM13.3081 0H11.1268C10.7347 0 10.4167 0.318104 10.4167 0.710201C10.4167 1.1023 10.7347 1.4204 11.1268 1.4204H13.3081C14.0093 1.4204 14.5798 1.99087 14.5798 2.69216V4.82804C14.5798 5.22014 14.8978 5.53825 15.2899 5.53825C15.682 5.53825 16 5.22014 16 4.82804V2.69216C16 1.20767 14.7925 0 13.3081 0ZM15.2899 10.4614C14.8978 10.4614 14.5798 10.7795 14.5798 11.1716V13.3078C14.5798 14.0091 14.0093 14.5796 13.3081 14.5796H11.1268C10.7347 14.5796 10.4167 14.8977 10.4167 15.2898C10.4167 15.6819 10.7347 16 11.1268 16H13.3081C14.7925 16 16 14.7923 16 13.3078V11.1716C16 10.7795 15.682 10.4614 15.2899 10.4614ZM4.87323 14.5796H2.69193C1.99071 14.5796 1.42028 14.0091 1.42028 13.3078V11.1716C1.42028 10.7795 1.10221 10.4614 0.710142 10.4614C0.318078 10.4614 0 10.7792 0 11.1716V13.3078C0 14.7923 1.20757 16 2.69193 16H4.87323C5.26529 16 5.58337 15.6819 5.58337 15.2898C5.58337 14.8977 5.26529 14.5796 4.87323 14.5796ZM12.6019 12.6029C12.4476 12.7572 12.2425 12.8421 12.0242 12.8421L12.0245 12.8418C11.8062 12.8418 11.6011 12.7569 11.4468 12.6026L10.2604 11.4161C9.59218 11.8613 8.81663 12.0952 8.00047 12.0952C6.90685 12.0952 5.87863 11.6694 5.1054 10.8961C4.33217 10.1228 3.90641 9.09453 3.90641 8.00082C3.90641 6.90711 4.33217 5.87881 5.1054 5.10552C5.87863 4.33222 6.90685 3.90643 8.00047 3.90643C9.09408 3.90643 10.1223 4.33222 10.8955 5.10552C11.6688 5.87881 12.0945 6.90711 12.0945 8.00082C12.0945 8.81706 11.8607 9.59266 11.4154 10.2612L12.6019 11.4478C12.9203 11.7662 12.9203 12.2845 12.6019 12.6029ZM9.73685 9.73702C9.75171 9.72248 9.76723 9.70795 9.78342 9.69407C10.2201 9.23426 10.4605 8.63373 10.4605 8.00082C10.4605 6.64418 9.35667 5.54023 8.00014 5.54023C6.6436 5.54023 5.53974 6.64418 5.53974 8.00082C5.53974 9.35747 6.64327 10.4614 8.00014 10.4614C8.63299 10.4614 9.23347 10.2213 9.69325 9.78425C9.70745 9.76774 9.72198 9.75188 9.73685 9.73702Z" fill="white"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
body.overflow-hidden {
|
|
2
|
+
overflow: hidden;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.experience-visual-button {
|
|
6
|
+
background-color: #3E36DC;
|
|
7
|
+
width: 40px;
|
|
8
|
+
height: 40px;
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-direction: row;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
align-items: center;
|
|
13
|
+
border-radius: 25px;
|
|
14
|
+
cursor: pointer;
|
|
15
|
+
margin: 32px auto 0;
|
|
16
|
+
&:hover,
|
|
17
|
+
&.hover {
|
|
18
|
+
width: 197px;
|
|
19
|
+
border-radius: 25px;
|
|
20
|
+
transition: .5s;
|
|
21
|
+
span {
|
|
22
|
+
width: 149px;
|
|
23
|
+
display: inline;
|
|
24
|
+
margin-right: 8px;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
white-space: nowrap;
|
|
27
|
+
font-family: 'Source Sans 3';
|
|
28
|
+
font-size: 14px;
|
|
29
|
+
font-weight: 600;
|
|
30
|
+
line-height: 16px;
|
|
31
|
+
text-align: center;
|
|
32
|
+
&:before {
|
|
33
|
+
color: #fff;
|
|
34
|
+
content: 'Experience Visual Search';
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.custom-modal {
|
|
41
|
+
top: 0;
|
|
42
|
+
left: 0;
|
|
43
|
+
right: 0;
|
|
44
|
+
bottom: 0;
|
|
45
|
+
width: 100vw;
|
|
46
|
+
height: 100vh;
|
|
47
|
+
position: fixed;
|
|
48
|
+
background-color: rgba(22, 22, 22, 0.5);
|
|
49
|
+
z-index: 9999;
|
|
50
|
+
display: flex;
|
|
51
|
+
flex-direction: row;
|
|
52
|
+
align-items: center;
|
|
53
|
+
justify-content: center;
|
|
54
|
+
&-body {
|
|
55
|
+
position: relative;
|
|
56
|
+
width: 100%;
|
|
57
|
+
height: 100%;
|
|
58
|
+
background-color: #F3F3F5;
|
|
59
|
+
padding: 32px 16px;
|
|
60
|
+
.close-icon {
|
|
61
|
+
top: 8px;
|
|
62
|
+
right: 8px;
|
|
63
|
+
position: absolute;
|
|
64
|
+
}
|
|
65
|
+
&-title {
|
|
66
|
+
font-family: 'Source Sans 3';
|
|
67
|
+
font-size: 20px;
|
|
68
|
+
font-weight: 700;
|
|
69
|
+
line-height: 24px;
|
|
70
|
+
text-align: left;
|
|
71
|
+
|
|
72
|
+
}
|
|
73
|
+
&-content {
|
|
74
|
+
&.experience-visual-search-images {
|
|
75
|
+
margin: 32px auto;
|
|
76
|
+
height: auto;
|
|
77
|
+
display: flex;
|
|
78
|
+
flex-direction: row;
|
|
79
|
+
flex-wrap: wrap;
|
|
80
|
+
gap: 16px;
|
|
81
|
+
width: 376px;
|
|
82
|
+
.experience-visual-search-image-container {
|
|
83
|
+
width: 180px;
|
|
84
|
+
height: 180px;
|
|
85
|
+
overflow: hidden;
|
|
86
|
+
border-radius: 4px;
|
|
87
|
+
position: relative;
|
|
88
|
+
cursor: pointer;
|
|
89
|
+
.experience-visual-search-image {
|
|
90
|
+
width: 180px;
|
|
91
|
+
height: 180px;
|
|
92
|
+
background-size: cover;
|
|
93
|
+
background-position: center;
|
|
94
|
+
transform: scale(1);
|
|
95
|
+
&:hover {
|
|
96
|
+
transition: all 0.3s;
|
|
97
|
+
transform: scale(1.1);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
.box-icon-modal {
|
|
101
|
+
bottom: 6px;
|
|
102
|
+
right: 6px;
|
|
103
|
+
position: absolute;
|
|
104
|
+
border-radius: 100%;
|
|
105
|
+
background-color: #F3F3F5;
|
|
106
|
+
display: block;
|
|
107
|
+
overflow: hidden;
|
|
108
|
+
z-index: 11;
|
|
109
|
+
width: 32px;
|
|
110
|
+
height: 32px;
|
|
111
|
+
display: flex;
|
|
112
|
+
align-items: center;
|
|
113
|
+
justify-content: center;
|
|
114
|
+
cursor: pointer;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
@media only screen and (min-width: 900px) {
|
|
123
|
+
.custom-modal {
|
|
124
|
+
&-body {
|
|
125
|
+
width: 900px;
|
|
126
|
+
max-width: 900px;
|
|
127
|
+
height: 380px;
|
|
128
|
+
border-radius: 4px;
|
|
129
|
+
&-title,
|
|
130
|
+
&-subtitle {
|
|
131
|
+
margin-left: 24px;
|
|
132
|
+
}
|
|
133
|
+
&-content {
|
|
134
|
+
&.experience-visual-search-images {
|
|
135
|
+
width: 770px;
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
@media only screen and (min-width: 776px) and (max-width: 899px) {
|
|
143
|
+
.custom-modal {
|
|
144
|
+
&-body {
|
|
145
|
+
width: 600px;
|
|
146
|
+
max-width: 600px;
|
|
147
|
+
height: 600px;
|
|
148
|
+
padding: 32px;
|
|
149
|
+
border-radius: 4px;
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
@media only screen and (max-width: 776px) {
|
|
155
|
+
.experience-visual-button {
|
|
156
|
+
width: 197px;
|
|
157
|
+
span {
|
|
158
|
+
width: 149px;
|
|
159
|
+
display: inline;
|
|
160
|
+
margin-right: 8px;
|
|
161
|
+
overflow: hidden;
|
|
162
|
+
white-space: nowrap;
|
|
163
|
+
font-family: 'Source Sans 3';
|
|
164
|
+
font-size: 14px;
|
|
165
|
+
font-weight: 600;
|
|
166
|
+
line-height: 16px;
|
|
167
|
+
text-align: center;
|
|
168
|
+
&:before {
|
|
169
|
+
color: #fff;
|
|
170
|
+
content: 'Experience Visual Search';
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
@media only screen and (max-width: 408px) {
|
|
177
|
+
.custom-modal {
|
|
178
|
+
&-body {
|
|
179
|
+
padding: 32px 8px;
|
|
180
|
+
&-content {
|
|
181
|
+
&.experience-visual-search-images {
|
|
182
|
+
width: 300px;
|
|
183
|
+
gap: 8px;
|
|
184
|
+
.experience-visual-search-image-container {
|
|
185
|
+
width: 145px;
|
|
186
|
+
height: 145px;
|
|
187
|
+
.experience-visual-search-image {
|
|
188
|
+
width: 145px;
|
|
189
|
+
height: 145px;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import React, { useState, memo, useEffect, useRef } from 'react';
|
|
2
|
+
import { createPortal } from 'react-dom';
|
|
3
|
+
import CloseOutlinedIcon from '@material-ui/icons/CloseOutlined';
|
|
4
|
+
import './ExperienceVisualSearch.scss';
|
|
5
|
+
import { ReactComponent as ExperienceIcon } from 'common/experience-visual-icon.svg';
|
|
6
|
+
import { useAppDispatch, useAppSelector } from '../../Store/Store';
|
|
7
|
+
import { ReactComponent as IconSearchImage } from 'common/assets/icons/icon_search_image2.svg';
|
|
8
|
+
import {
|
|
9
|
+
loadingActionResults,
|
|
10
|
+
setImageSearchInput,
|
|
11
|
+
setRegions,
|
|
12
|
+
setRequestImage,
|
|
13
|
+
setSearchResults,
|
|
14
|
+
setSelectedRegion,
|
|
15
|
+
updateStatusLoading
|
|
16
|
+
} from '../../Store/search/Search';
|
|
17
|
+
import { createImage, find, findRegions } from '../../services/image';
|
|
18
|
+
import { RectCoords } from '@nyris/nyris-api';
|
|
19
|
+
import { isEmpty } from 'lodash';
|
|
20
|
+
|
|
21
|
+
function ExperienceVisualSearch() {
|
|
22
|
+
const dispatch = useAppDispatch();
|
|
23
|
+
const { search, settings } = useAppSelector(state => state);
|
|
24
|
+
const [showModal, setShowModal] = useState(false);
|
|
25
|
+
const [images, setImages] = useState<string[]>([])
|
|
26
|
+
const button = useRef(null);
|
|
27
|
+
let interval = useRef<NodeJS.Timeout | null>(null);
|
|
28
|
+
|
|
29
|
+
useEffect(() => {
|
|
30
|
+
if (document.body.getBoundingClientRect().width >= 776) {
|
|
31
|
+
if (!showModal) {
|
|
32
|
+
interval.current = setInterval(() => {
|
|
33
|
+
if (button?.current) {
|
|
34
|
+
(button.current as HTMLElement).classList.toggle('hover');
|
|
35
|
+
}
|
|
36
|
+
}, 3000);
|
|
37
|
+
} else {
|
|
38
|
+
if (interval?.current) {
|
|
39
|
+
clearInterval(interval?.current);
|
|
40
|
+
if (button?.current && !(button.current as HTMLElement).classList.contains('hover')) {
|
|
41
|
+
(button.current as HTMLElement).classList.toggle('hover');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return () => {
|
|
46
|
+
if (interval?.current) {
|
|
47
|
+
clearInterval(interval?.current);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
}, [showModal]);
|
|
52
|
+
|
|
53
|
+
const modalToggle = (isOpen: boolean) => {
|
|
54
|
+
setShowModal(isOpen);
|
|
55
|
+
if (isOpen) {
|
|
56
|
+
const randomImages = settings?.experienceVisualSearchImages
|
|
57
|
+
?.slice(0, Math.min(settings?.experienceVisualSearchImages?.length, 4));
|
|
58
|
+
setImages(randomImages || []);
|
|
59
|
+
document.body.classList.add('overflow-hidden');
|
|
60
|
+
} else {
|
|
61
|
+
document.body.classList.remove('overflow-hidden');
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
const getUrlToCanvasFile = async (url: string) => {
|
|
66
|
+
dispatch(updateStatusLoading(true));
|
|
67
|
+
dispatch(loadingActionResults());
|
|
68
|
+
dispatch(setImageSearchInput(url));
|
|
69
|
+
let image = await createImage(url);
|
|
70
|
+
dispatch(setRequestImage(image));
|
|
71
|
+
|
|
72
|
+
let searchRegion: RectCoords | undefined = undefined;
|
|
73
|
+
|
|
74
|
+
if (settings.regions) {
|
|
75
|
+
let res = await findRegions(image, settings);
|
|
76
|
+
searchRegion = res.selectedRegion;
|
|
77
|
+
dispatch(setRegions(res.regions));
|
|
78
|
+
dispatch(setSelectedRegion(searchRegion));
|
|
79
|
+
}
|
|
80
|
+
const preFilterValues = [
|
|
81
|
+
{
|
|
82
|
+
key: settings.visualSearchFilterKey,
|
|
83
|
+
values: Object.keys(search.preFilter) as string[],
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
find({
|
|
87
|
+
image,
|
|
88
|
+
settings,
|
|
89
|
+
region: searchRegion,
|
|
90
|
+
filters: !isEmpty(search.preFilter) ? preFilterValues : undefined,
|
|
91
|
+
}).then((res: any) => {
|
|
92
|
+
dispatch(setSearchResults(res));
|
|
93
|
+
dispatch(updateStatusLoading(false));
|
|
94
|
+
return;
|
|
95
|
+
});
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<>
|
|
100
|
+
<div
|
|
101
|
+
ref={button}
|
|
102
|
+
className="experience-visual-button"
|
|
103
|
+
onClick={() => modalToggle(true)}
|
|
104
|
+
>
|
|
105
|
+
<span />
|
|
106
|
+
<ExperienceIcon />
|
|
107
|
+
</div>
|
|
108
|
+
{showModal &&
|
|
109
|
+
createPortal(
|
|
110
|
+
<div
|
|
111
|
+
className="custom-modal"
|
|
112
|
+
onClick={(e) => {
|
|
113
|
+
e.stopPropagation();
|
|
114
|
+
modalToggle(false);
|
|
115
|
+
}}
|
|
116
|
+
>
|
|
117
|
+
<div
|
|
118
|
+
className="custom-modal-body"
|
|
119
|
+
onClick={(e) => {
|
|
120
|
+
e.stopPropagation();
|
|
121
|
+
}}
|
|
122
|
+
>
|
|
123
|
+
<CloseOutlinedIcon
|
|
124
|
+
style={{ fontSize: 24, color: '#55566B' }}
|
|
125
|
+
className="close-icon"
|
|
126
|
+
onClick={(e) => {
|
|
127
|
+
e.stopPropagation();
|
|
128
|
+
modalToggle(false);
|
|
129
|
+
}}
|
|
130
|
+
/>
|
|
131
|
+
<div className="custom-modal-body-title">Experience Visual Search</div>
|
|
132
|
+
<div className="custom-modal-body-subtitle">
|
|
133
|
+
Start your visual search by selecting an image below.
|
|
134
|
+
</div>
|
|
135
|
+
<div className="custom-modal-body-content experience-visual-search-images">
|
|
136
|
+
{images.map((itemImage) => (
|
|
137
|
+
<div
|
|
138
|
+
className="experience-visual-search-image-container"
|
|
139
|
+
onClick={() => {
|
|
140
|
+
modalToggle(false);
|
|
141
|
+
getUrlToCanvasFile(itemImage);
|
|
142
|
+
}}
|
|
143
|
+
>
|
|
144
|
+
<div
|
|
145
|
+
className="experience-visual-search-image"
|
|
146
|
+
style={{ backgroundImage: `url(${itemImage}?width=192&height=192)` }}
|
|
147
|
+
/>
|
|
148
|
+
<div
|
|
149
|
+
className="box-icon-modal"
|
|
150
|
+
>
|
|
151
|
+
<IconSearchImage width={16} height={16} color={'#AAABB5'} />
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
))}
|
|
155
|
+
</div>
|
|
156
|
+
</div>
|
|
157
|
+
</div>,
|
|
158
|
+
document.body
|
|
159
|
+
)}
|
|
160
|
+
</>
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export default memo(ExperienceVisualSearch);
|
|
@@ -125,13 +125,13 @@ function ImagePreviewMobileComponent({
|
|
|
125
125
|
image={requestImage?.canvas}
|
|
126
126
|
selection={imageSelection || DEFAULT_REGION}
|
|
127
127
|
regions={filteredRegions}
|
|
128
|
-
minWidth={
|
|
128
|
+
minWidth={100 * (requestImage?.canvas?.width / requestImage?.canvas?.height)}
|
|
129
129
|
minHeight={80}
|
|
130
130
|
maxWidth={255}
|
|
131
131
|
maxHeight={255}
|
|
132
132
|
dotColor={editActive ? '#FBD914' : ''}
|
|
133
|
-
minCropWidth={editActive ?
|
|
134
|
-
minCropHeight={editActive ?
|
|
133
|
+
minCropWidth={editActive ? 30 : 5}
|
|
134
|
+
minCropHeight={editActive ? 30 : 5}
|
|
135
135
|
rounded={false}
|
|
136
136
|
expandAnimation={editActive}
|
|
137
137
|
shrinkAnimation={!editActive}
|
|
@@ -143,10 +143,9 @@ function ImagePreviewMobileComponent({
|
|
|
143
143
|
/>
|
|
144
144
|
</div>
|
|
145
145
|
</div>
|
|
146
|
+
|
|
146
147
|
{(showAdjustInfoBasedOnConfidence || showAdjustInfo) && (
|
|
147
148
|
<div
|
|
148
|
-
className="box-title_col-left"
|
|
149
|
-
alignItems="center"
|
|
150
149
|
style={{
|
|
151
150
|
backgroundColor: '#3E36DC',
|
|
152
151
|
display: 'flex',
|
|
@@ -154,6 +153,10 @@ function ImagePreviewMobileComponent({
|
|
|
154
153
|
padding: '5px',
|
|
155
154
|
width: 'fit-content',
|
|
156
155
|
minWidth: '180px',
|
|
156
|
+
marginTop: 'auto',
|
|
157
|
+
position: 'absolute',
|
|
158
|
+
bottom: 0,
|
|
159
|
+
borderRadius: '16px',
|
|
157
160
|
}}
|
|
158
161
|
>
|
|
159
162
|
<IconInfo color="white" />
|
|
@@ -108,8 +108,8 @@ function SidePanel({
|
|
|
108
108
|
selection={imageSelection || DEFAULT_REGION}
|
|
109
109
|
regions={filteredRegions}
|
|
110
110
|
dotColor={'#FBD914'}
|
|
111
|
-
minCropWidth={
|
|
112
|
-
minCropHeight={
|
|
111
|
+
minCropWidth={30}
|
|
112
|
+
minCropHeight={30}
|
|
113
113
|
rounded={true}
|
|
114
114
|
/>
|
|
115
115
|
</div>
|
|
@@ -118,13 +118,16 @@ function SidePanel({
|
|
|
118
118
|
</div>
|
|
119
119
|
{(showAdjustInfoBasedOnConfidence || showAdjustInfo) && (
|
|
120
120
|
<div
|
|
121
|
-
className="box-title_col-left"
|
|
122
121
|
style={{
|
|
123
122
|
alignItems: 'center',
|
|
124
123
|
backgroundColor: '#3E36DC',
|
|
125
124
|
display: 'flex',
|
|
126
125
|
columnGap: '6px',
|
|
127
126
|
padding: '5px',
|
|
127
|
+
marginTop: 'auto',
|
|
128
|
+
position: 'absolute',
|
|
129
|
+
bottom: 0,
|
|
130
|
+
borderRadius: '16px',
|
|
128
131
|
}}
|
|
129
132
|
>
|
|
130
133
|
<IconInfo color="white" />
|
|
@@ -3,6 +3,7 @@ import './common.scss';
|
|
|
3
3
|
import algoliasearch from 'algoliasearch/lite';
|
|
4
4
|
import DragDropFile from 'components/DragDropFile';
|
|
5
5
|
import CustomSearchBox from 'components/input/inputSearch';
|
|
6
|
+
import ExperienceVisualSearch from 'components/Experience-visual-search/ExperienceVisualSearch';
|
|
6
7
|
import { connectInfiniteHits } from 'react-instantsearch-dom';
|
|
7
8
|
import { useAppSelector } from 'Store/Store';
|
|
8
9
|
import { AlgoliaSettings } from '../../types';
|
|
@@ -49,6 +50,11 @@ function AppMD() {
|
|
|
49
50
|
isLoading={isLoading}
|
|
50
51
|
onChangeLoading={onChangeLoading}
|
|
51
52
|
/>
|
|
53
|
+
{settings.experienceVisualSearch ? (
|
|
54
|
+
<ExperienceVisualSearch />
|
|
55
|
+
) : (
|
|
56
|
+
''
|
|
57
|
+
)}
|
|
52
58
|
</div>
|
|
53
59
|
</div>
|
|
54
60
|
);
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import CameraCustom from 'components/drawer/cameraCustom';
|
|
2
2
|
import React, { useEffect, useState } from 'react';
|
|
3
3
|
import { reset } from 'Store/search/Search';
|
|
4
|
-
import { useAppDispatch } from 'Store/Store';
|
|
4
|
+
import { useAppDispatch, useAppSelector } from 'Store/Store';
|
|
5
5
|
import { ReactComponent as CameraIcon } from 'common/assets/icons/take_photo.svg';
|
|
6
|
+
import ExperienceVisualSearch from "../../components/Experience-visual-search/ExperienceVisualSearch";
|
|
6
7
|
|
|
7
8
|
function AppMobile(): JSX.Element {
|
|
8
9
|
const dispatch = useAppDispatch();
|
|
10
|
+
const { settings } = useAppSelector(state => state);
|
|
9
11
|
const [isOpenModalCamera, setOpenModalCamera] = useState<boolean>(false);
|
|
10
12
|
|
|
11
13
|
useEffect(() => {
|
|
@@ -50,6 +52,11 @@ function AppMobile(): JSX.Element {
|
|
|
50
52
|
}}
|
|
51
53
|
/>
|
|
52
54
|
</div>
|
|
55
|
+
{settings.experienceVisualSearch ? (
|
|
56
|
+
<ExperienceVisualSearch />
|
|
57
|
+
) : (
|
|
58
|
+
''
|
|
59
|
+
)}
|
|
53
60
|
</div>
|
|
54
61
|
);
|
|
55
62
|
}
|
package/src/types.ts
CHANGED
|
@@ -80,6 +80,8 @@ export interface AppSettings extends NyrisAPISettings {
|
|
|
80
80
|
visualSearchFilterKey?: string;
|
|
81
81
|
warehouseVariant?: boolean;
|
|
82
82
|
shouldUseUserMetadata?: boolean;
|
|
83
|
+
experienceVisualSearch?: boolean;
|
|
84
|
+
experienceVisualSearchImages?: string[];
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
export interface SearchSuiteSettings {
|