@nyris/nyris-webapp 0.3.34 → 0.3.36

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.
Files changed (60) hide show
  1. package/build/asset-manifest.json +13 -13
  2. package/build/index.html +1 -1
  3. package/build/{precache-manifest.b85c7807a93875355f9f0f6490e6dc8c.js → precache-manifest.a2657ad49c132fb9c82629d37be15547.js} +14 -14
  4. package/build/service-worker.js +1 -1
  5. package/build/static/css/main.41fb4769.chunk.css +2 -0
  6. package/build/static/css/main.41fb4769.chunk.css.map +1 -0
  7. package/build/static/js/2.ff44260e.chunk.js +3 -0
  8. package/build/static/js/2.ff44260e.chunk.js.map +1 -0
  9. package/build/static/js/main.0b3b11fc.chunk.js +3 -0
  10. package/build/static/js/main.0b3b11fc.chunk.js.map +1 -0
  11. package/build/static/media/error.48b946a9.svg +3 -0
  12. package/package.json +3 -3
  13. package/public/index.html +13 -0
  14. package/src/Store/search/Search.ts +4 -4
  15. package/src/Store/search/search.initialState.ts +1 -1
  16. package/src/Store/search/types.ts +1 -1
  17. package/src/common/assets/icons/arrow_left.svg +3 -0
  18. package/src/common/assets/icons/arrow_right.svg +3 -0
  19. package/src/common/assets/icons/error.svg +3 -0
  20. package/src/components/AppMobile.tsx +111 -0
  21. package/src/components/DetailItem.tsx +21 -18
  22. package/src/components/DragDropFile.tsx +5 -4
  23. package/src/components/FooterMobile.tsx +9 -3
  24. package/src/components/Header.tsx +2 -1
  25. package/src/components/HeaderMobile.tsx +5 -3
  26. package/src/components/ImageCaptureHelpModal.tsx +7 -1
  27. package/src/components/ImagePreviewMobile.tsx +87 -0
  28. package/src/components/Layout.tsx +32 -92
  29. package/src/components/ProductList/index.tsx +4 -1
  30. package/src/components/RfqBanner.tsx +120 -0
  31. package/src/components/SidePanel.tsx +147 -0
  32. package/src/components/appMobile.scss +147 -142
  33. package/src/components/carousel/ImagePreviewCarousel.tsx +1 -7
  34. package/src/components/drawer/cameraCustom.tsx +5 -4
  35. package/src/components/input/inputSearch.tsx +12 -7
  36. package/src/components/modal/DefaultModal.tsx +1 -1
  37. package/src/components/pre-filter/index.tsx +144 -83
  38. package/src/components/results/ItemResult.tsx +9 -20
  39. package/src/components/rfq/RfqModal.tsx +262 -0
  40. package/src/helpers/ToastHelper.ts +10 -0
  41. package/src/helpers/getCroppedCanvas.ts +26 -0
  42. package/src/hooks/useFilteredRegions.ts +37 -0
  43. package/src/index.css +0 -4
  44. package/src/page/landingPage/AppMD.tsx +0 -11
  45. package/src/page/landingPage/AppMobile.tsx +1 -0
  46. package/src/page/landingPage/common.scss +44 -60
  47. package/src/page/result/index.tsx +256 -309
  48. package/src/translations.ts +2 -2
  49. package/src/types.ts +1 -0
  50. package/src/utils.ts +0 -1
  51. package/build/static/css/main.f2aa67fc.chunk.css +0 -2
  52. package/build/static/css/main.f2aa67fc.chunk.css.map +0 -1
  53. package/build/static/js/2.d1f7e826.chunk.js +0 -3
  54. package/build/static/js/2.d1f7e826.chunk.js.map +0 -1
  55. package/build/static/js/main.e9aec8a9.chunk.js +0 -3
  56. package/build/static/js/main.e9aec8a9.chunk.js.map +0 -1
  57. package/build/static/media/support3.4a17f96e.svg +0 -3
  58. package/src/hooks/useVisualSearch.tsx +0 -77
  59. /package/build/static/js/{2.d1f7e826.chunk.js.LICENSE.txt → 2.ff44260e.chunk.js.LICENSE.txt} +0 -0
  60. /package/build/static/js/{main.e9aec8a9.chunk.js.LICENSE.txt → main.0b3b11fc.chunk.js.LICENSE.txt} +0 -0
@@ -10,4 +10,14 @@ export class ToastHelper {
10
10
  },
11
11
  });
12
12
  }
13
+
14
+ static error(msg: string) {
15
+ toast.error(msg, {
16
+ duration: 3000,
17
+ style: {
18
+ background: '#1E1F31',
19
+ color: '#fff',
20
+ },
21
+ });
22
+ }
13
23
  }
@@ -0,0 +1,26 @@
1
+ import {
2
+ RectCoords,
3
+ getElementSize,
4
+ getRectAspectRatio,
5
+ getThumbSizeArea,
6
+ elementToCanvas,
7
+ } from '@nyris/nyris-api';
8
+
9
+ export const getCroppedCanvas = (
10
+ canvas: HTMLCanvasElement | HTMLImageElement | HTMLVideoElement,
11
+ cropRect?: RectCoords,
12
+ ) => {
13
+ let crop = cropRect || {
14
+ x1: 0,
15
+ x2: 1,
16
+ y1: 0,
17
+ y2: 1,
18
+ };
19
+ if (!canvas) return null;
20
+
21
+ const originalSize = getElementSize(canvas);
22
+ const aspectRatio = getRectAspectRatio(crop, originalSize);
23
+ let scaledSize = getThumbSizeArea(600, 600, aspectRatio);
24
+ let resizedCroppedCanvas = elementToCanvas(canvas, scaledSize, crop);
25
+ return resizedCroppedCanvas;
26
+ };
@@ -0,0 +1,37 @@
1
+ import { useMemo } from 'react';
2
+
3
+ const useFilteredRegions = (regions: any, imageSelection: any) => {
4
+ const filteredRegions = useMemo(
5
+ () =>
6
+ regions.map(
7
+ (region: {
8
+ normalizedRect: { x1: any; x2: any; y1: any; y2: any };
9
+ }) => {
10
+ if (
11
+ region.normalizedRect?.x1 === imageSelection?.x1 &&
12
+ region.normalizedRect?.x2 === imageSelection?.x2 &&
13
+ region.normalizedRect?.y1 === imageSelection?.y1 &&
14
+ region.normalizedRect?.y2 === imageSelection?.y2
15
+ ) {
16
+ return { ...region, show: false };
17
+ }
18
+ if (
19
+ imageSelection?.x1 === 0 &&
20
+ imageSelection?.x2 === 1 &&
21
+ imageSelection?.y1 === 0 &&
22
+ imageSelection?.y2 === 1
23
+ ) {
24
+ return { ...region, show: false };
25
+ }
26
+
27
+ return { ...region, show: true };
28
+ },
29
+ ),
30
+
31
+ [regions, imageSelection],
32
+ );
33
+
34
+ return filteredRegions;
35
+ };
36
+
37
+ export default useFilteredRegions;
package/src/index.css CHANGED
@@ -581,10 +581,6 @@ h6 {
581
581
  margin: 22px auto 8px;
582
582
  }
583
583
 
584
- p {
585
- margin-bottom: 16px;
586
- }
587
-
588
584
  p a {
589
585
  text-decoration: underline;
590
586
  }
@@ -3,12 +3,9 @@ import React, { useState } from 'react';
3
3
  import './common.scss';
4
4
  import { cadExtensions } from '@nyris/nyris-api';
5
5
  import algoliasearch from 'algoliasearch/lite';
6
- import IconSupport from 'common/assets/icons/support3.svg';
7
6
  import DragDropFile from 'components/DragDropFile';
8
7
  import CustomSearchBox from 'components/input/inputSearch';
9
8
  import { connectInfiniteHits } from 'react-instantsearch-dom';
10
- import { useMediaQuery } from 'react-responsive';
11
- import { Link } from 'react-router-dom';
12
9
  import { useAppSelector } from 'Store/Store';
13
10
  import { AlgoliaSettings } from '../../types';
14
11
 
@@ -18,7 +15,6 @@ function AppMD() {
18
15
  const { apiKey, appId, indexName } = settings.algolia as AlgoliaSettings;
19
16
  const searchClient = algoliasearch(appId, apiKey);
20
17
  searchClient.initIndex(indexName);
21
- const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
22
18
 
23
19
  const acceptTypes = ['image/*']
24
20
  .concat(settings.cadSearch ? cadExtensions : [])
@@ -36,13 +32,6 @@ function AppMD() {
36
32
 
37
33
  return (
38
34
  <Box className={`box-content-main ${isLoading ? 'loading' : ''}`}>
39
- {isMobile && (
40
- <Box className="btn-open-support">
41
- <Link to={'/support'} style={{ color: '#3E36DC' }}>
42
- <img src={IconSupport} alt="" width={16} height={16} />
43
- </Link>
44
- </Box>
45
- )}
46
35
  <Box className="box-content_top">
47
36
  <Box className="fw-700 text-f32 text-dark2">
48
37
  <h1>{settings.headerText}</h1>
@@ -21,6 +21,7 @@ function AppMobile(): JSX.Element {
21
21
  justifyContent: 'center',
22
22
  alignItems: 'center',
23
23
  width: '100%',
24
+ height: '100%',
24
25
  }}
25
26
  >
26
27
  <div className="take-photo">
@@ -944,6 +944,7 @@ button {
944
944
 
945
945
  // TODO: css result component
946
946
  .box-wrap-result-component {
947
+ height: 100%;
947
948
  min-height: 100%;
948
949
  display: flex;
949
950
  flex-direction: column;
@@ -968,33 +969,18 @@ button {
968
969
  }
969
970
  }
970
971
  .box-result {
971
- height: calc(100svh - 199px);
972
+ height: calc(100svh - 148px);
973
+ @media screen and (max-width: 776px) {
974
+ height: 100%
975
+ }
972
976
  display: flex;
973
977
  justify-content: space-between;
974
978
  // overflow: auto;
975
979
  position: relative;
976
-
977
- .btn-open-support {
978
- background: linear-gradient(45deg, #3e36dc 14.84%, #00ff94 85.16%);
979
- width: 50px;
980
- height: 50px;
981
- position: fixed;
982
- border-radius: 100%;
983
- display: flex;
984
- justify-content: center;
985
- align-items: center;
986
- bottom: 80px;
987
- right: 30px;
988
- a {
989
- display: flex;
990
- align-items: center;
991
- justify-content: center;
992
- }
993
- }
980
+
994
981
  .col-left {
995
982
  width: 100%;
996
983
  height: fit-content;
997
- margin-right: 62px;
998
984
  min-height: auto;
999
985
  position: relative;
1000
986
  &.toggle {
@@ -1025,7 +1011,7 @@ button {
1025
1011
  display: flex;
1026
1012
  justify-content: center;
1027
1013
  align-items: center;
1028
- max-width: 320px;
1014
+ // max-width: 320px;
1029
1015
  .box-preview {
1030
1016
  width: 100%;
1031
1017
  // border: 2px dashed #55566b;
@@ -1064,10 +1050,10 @@ button {
1064
1050
  }
1065
1051
  .col-right {
1066
1052
  // width: calc(100% - 462px);
1067
- overflow: auto;
1068
1053
  width: 100%;
1069
1054
  .box-item-result {
1070
1055
  max-width: calc(192px * 4 + 96px);
1056
+ width: 100%;
1071
1057
  @media screen and (min-width: 2047px) {
1072
1058
  max-width: 1300px;
1073
1059
  }
@@ -1102,6 +1088,32 @@ button {
1102
1088
  display: none;
1103
1089
  }
1104
1090
  }
1091
+ @media screen and (max-width: 776px) {
1092
+
1093
+
1094
+ .box-item-result {
1095
+ height: 100%;
1096
+ // padding: 0 11px;
1097
+ // gap: 8px !important;
1098
+ // justify-content: center;
1099
+ width: calc(180 * 2px + 30px);
1100
+ .wrap-main-item-result {
1101
+ width: 180px;
1102
+ max-width: 180px !important;
1103
+
1104
+ &:first-child {
1105
+ margin-top: 0px !important;
1106
+ }
1107
+ }
1108
+ }
1109
+ }
1110
+ @media screen and (max-width: 370px) {
1111
+ .box-item-result {
1112
+ padding: 0 0px;
1113
+ display: flex;
1114
+ justify-content: center;
1115
+ }
1116
+ }
1105
1117
  }
1106
1118
  }
1107
1119
 
@@ -1472,11 +1484,7 @@ button {
1472
1484
  }
1473
1485
  }
1474
1486
  }
1475
- .ais-Pagination {
1476
- @media screen and (max-width: 776px) {
1477
- margin-bottom: 50px;
1478
- }
1479
- }
1487
+
1480
1488
  .box-panigation {
1481
1489
 
1482
1490
  .ais-Pagination-list {
@@ -1690,31 +1698,11 @@ button {
1690
1698
  justify-content: space-between;
1691
1699
  }
1692
1700
 
1693
- .btn-open-support {
1694
- display: none !important;
1695
- z-index: 11;
1696
- background: linear-gradient(45deg, #3e36dc 14.84%, #00ff94 85.16%);
1697
- width: 50px;
1698
- height: 50px;
1699
- position: absolute;
1700
- border-radius: 100%;
1701
- display: flex;
1702
- justify-content: center;
1703
- align-items: center;
1704
- bottom: 40px;
1705
- right: 30px;
1706
- a {
1707
- display: flex;
1708
- align-items: center;
1709
- justify-content: center;
1710
- }
1711
- }
1712
1701
 
1713
1702
  // TODO: filter panel result
1714
1703
 
1715
1704
  .wrap-main-col-left {
1716
1705
  max-width: 320px;
1717
- margin-right: 16px;
1718
1706
  width: 100%;
1719
1707
  box-shadow: 3px -2px 3px -3px #d3d4d8;
1720
1708
  overflow-x: hidden;
@@ -1732,17 +1720,13 @@ button {
1732
1720
  display: none !important;
1733
1721
  }
1734
1722
  .box-toggle-coloumn {
1735
- transition: all 010s ease-in-out;
1723
+ // transition: all 010s ease-in-out;
1736
1724
  display: block !important;
1737
- right: 0;
1738
- left: 0;
1739
1725
  margin: auto;
1740
1726
  }
1741
1727
  }
1742
1728
  .box-toggle-coloumn {
1743
1729
  position: absolute;
1744
- right: 16px;
1745
- top: 0;
1746
1730
  z-index: 222;
1747
1731
  }
1748
1732
  .col-left__bottom {
@@ -1960,7 +1944,8 @@ button {
1960
1944
 
1961
1945
  .box-filter-desktop {
1962
1946
  background-color: #fff;
1963
- width: 70%;
1947
+ width: 90%;
1948
+ max-width: 1500px;
1964
1949
  height: 80%;
1965
1950
  margin: auto;
1966
1951
  &.isMobile {
@@ -1970,7 +1955,7 @@ button {
1970
1955
  background-color: #fff;
1971
1956
  width: 100%;
1972
1957
  height: 100%;
1973
- padding: 10px 24px 24px 24px;
1958
+ padding-top: 10px;
1974
1959
  @media only screen and (max-width: 776px) {
1975
1960
  height: fit-content;
1976
1961
  padding-bottom: 56px;
@@ -2001,8 +1986,8 @@ button {
2001
1986
  }
2002
1987
  }
2003
1988
  .box-bottom {
2004
- column-gap: 30px;
2005
- padding: 0px 20px;
1989
+ column-gap: 20px;
1990
+ padding: 0px 24px;
2006
1991
  flex-wrap: wrap;
2007
1992
  width: 100%;
2008
1993
  max-width: 100%;
@@ -2071,16 +2056,15 @@ button {
2071
2056
  border-radius: 21px;
2072
2057
  background-color: #E0E0E0;
2073
2058
  height: 100%;
2074
- padding: 0 6px;
2075
- margin-right: 10px;
2076
- border: 2px solid #2B2C46;
2059
+ padding: 4px 8px 4px 8px;
2077
2060
 
2078
2061
  .keyFilter {
2079
2062
  margin-right: 5px;
2080
2063
  font-weight: 700;
2081
- font-size: 14px;
2064
+ font-size: 12px;
2082
2065
  color: #2B2C46;
2083
2066
  text-transform: uppercase;
2067
+ margin-bottom: 0px;
2084
2068
  }
2085
2069
  }
2086
2070
  .modal-container {