@nyris/nyris-webapp 0.3.23 → 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.
Files changed (92) hide show
  1. package/README.md +1 -1
  2. package/build/asset-manifest.json +12 -18
  3. package/build/index.html +1 -1
  4. package/build/{precache-manifest.550e76235499efc131a68c80392f6bfc.js → precache-manifest.982b135daeb2c083ccf4eeeddf132bf3.js} +11 -35
  5. package/build/service-worker.js +1 -1
  6. package/build/static/css/{main.c956b74c.chunk.css → main.1e43a778.chunk.css} +2 -2
  7. package/build/static/css/main.1e43a778.chunk.css.map +1 -0
  8. package/build/static/js/2.fe9108d5.chunk.js +3 -0
  9. package/build/static/js/{2.f0507df9.chunk.js.LICENSE.txt → 2.fe9108d5.chunk.js.LICENSE.txt} +0 -15
  10. package/build/static/js/2.fe9108d5.chunk.js.map +1 -0
  11. package/build/static/js/main.83cb88a3.chunk.js +3 -0
  12. package/build/static/js/main.83cb88a3.chunk.js.map +1 -0
  13. package/package.json +3 -3
  14. package/src/App.tsx +6 -14
  15. package/src/Router.tsx +6 -41
  16. package/src/Store/Store.ts +14 -23
  17. package/src/components/DetailItem.tsx +9 -15
  18. package/src/components/FooterMobile.tsx +3 -51
  19. package/src/components/FooterResult.tsx +1 -1
  20. package/src/components/HeaderMobile.tsx +13 -20
  21. package/src/components/HeaderNewVersion.tsx +5 -83
  22. package/src/components/Layout.tsx +3 -19
  23. package/src/components/PanelResult/index.tsx +1 -1
  24. package/src/components/clear-refinements/clear-refinements.tsx +1 -1
  25. package/src/components/drawer/cameraCustom.tsx +6 -12
  26. package/src/components/input/inputSearch.tsx +3 -3
  27. package/src/components/pre-filter/desktop/index.tsx +2 -2
  28. package/src/components/results/ItemResult.tsx +7 -7
  29. package/src/defaults.ts +19 -35
  30. package/src/index.css +13 -0
  31. package/src/index.tsx +0 -20
  32. package/src/modules/LandingPage/AppMD.tsx +59 -386
  33. package/src/modules/LandingPage/AppMobile.tsx +1 -1
  34. package/src/modules/LandingPage/propsType.ts +35 -37
  35. package/src/services/Feedback.ts +48 -71
  36. package/src/services/filter.tsx +1 -1
  37. package/src/services/types.ts +30 -39
  38. package/src/types.ts +8 -63
  39. package/build/js/test.js +0 -84
  40. package/build/static/css/main.c956b74c.chunk.css.map +0 -1
  41. package/build/static/js/2.f0507df9.chunk.js +0 -3
  42. package/build/static/js/2.f0507df9.chunk.js.map +0 -1
  43. package/build/static/js/main.247c7b7e.chunk.js +0 -3
  44. package/build/static/js/main.247c7b7e.chunk.js.map +0 -1
  45. package/build/static/media/Rectangle.4dd8b747.png +0 -0
  46. package/build/static/media/icon_company.2b2a0a61.svg +0 -3
  47. package/build/static/media/icon_email.132d632b.svg +0 -3
  48. package/build/static/media/icon_phone.09335da9.svg +0 -3
  49. package/build/static/media/icon_textArea.f6d78b61.svg +0 -3
  50. package/build/static/media/icon_users.2013c76e.svg +0 -3
  51. package/public/js/test.js +0 -84
  52. package/src/App.css +0 -65
  53. package/src/components/AppContainer.tsx +0 -126
  54. package/src/components/CategoryFilter.tsx +0 -17
  55. package/src/components/Codes.tsx +0 -20
  56. package/src/components/CustomHits/index.tsx +0 -47
  57. package/src/components/Footer.tsx +0 -96
  58. package/src/components/FooterMD.tsx +0 -54
  59. package/src/components/HeaderMd.tsx +0 -38
  60. package/src/components/Navigation.tsx +0 -34
  61. package/src/components/PredictedCategories.tsx +0 -14
  62. package/src/components/Refine.tsx +0 -28
  63. package/src/components/RelevantSort.tsx +0 -12
  64. package/src/components/Result.tsx +0 -210
  65. package/src/components/Saved/AllItem.tsx +0 -32
  66. package/src/components/Saved/Category.tsx +0 -16
  67. package/src/components/auto-complete/basic.tsx +0 -153
  68. package/src/components/autocomplete/plugins/popular-searches/popular-searches.css +0 -3
  69. package/src/components/autocomplete/plugins/popular-searches/popular-searches.tsx +0 -75
  70. package/src/components/button/clear-fillter.tsx +0 -30
  71. package/src/components/camera/screenshot.tsx +0 -33
  72. package/src/components/count/count.tsx +0 -20
  73. package/src/components/hitItem/hits.tsx +0 -50
  74. package/src/components/hitItem/infinitiHits.tsx +0 -33
  75. package/src/components/icon/icon.tsx +0 -13
  76. package/src/components/icon_textArea.svg +0 -3
  77. package/src/components/refinement-list/index.tsx +0 -42
  78. package/src/components/results/pagination.tsx +0 -34
  79. package/src/components/search/ListSearch.tsx +0 -209
  80. package/src/modules/LandingPage/App.tsx +0 -318
  81. package/src/modules/LandingPage/index.tsx +0 -186
  82. package/src/modules/LandingPage/indexNewVersion.tsx +0 -72
  83. package/src/page/Auth/login.tsx +0 -7
  84. package/src/page/Exception/404.tsx +0 -11
  85. package/src/page/History/index.tsx +0 -76
  86. package/src/page/Profile/index.tsx +0 -140
  87. package/src/page/ResultMobile/index.tsx +0 -12
  88. package/src/page/Saved/MockData.ts +0 -223
  89. package/src/page/Saved/index.tsx +0 -166
  90. package/src/page/Support/MockData.ts +0 -45
  91. package/src/page/Support/index.tsx +0 -492
  92. /package/build/static/js/{main.247c7b7e.chunk.js.LICENSE.txt → main.83cb88a3.chunk.js.LICENSE.txt} +0 -0
@@ -1,186 +0,0 @@
1
- import React, { useCallback, useEffect, useState } from 'react';
2
- import { RectCoords, cadExtensions, isCadFile } from '@nyris/nyris-api';
3
-
4
- import { useAppDispatch, useAppSelector } from 'Store/Store';
5
- import {
6
- setSearchResults,
7
- loadingActionResults,
8
- searchFileImageNonRegion,
9
- selectionChanged,
10
- setRequestImage,
11
- setRegions,
12
- setSelectedRegion,
13
- setError,
14
- } from 'Store/Search';
15
- import {
16
- feedbackNegative,
17
- feedbackSubmitPositive,
18
- hideFeedback,
19
- showCamera,
20
- showFeedback,
21
- showResults,
22
- showStart,
23
- } from 'Store/Nyris';
24
- import {
25
- createImage,
26
- findByCadFile,
27
- findByImage,
28
- findRegions,
29
- } from 'services/image';
30
- import { debounce } from 'lodash';
31
- import {
32
- feedbackClickEpic,
33
- feedbackRegionEpic,
34
- feedbackSuccessEpic,
35
- } from 'services/Feedback';
36
- import AppMD from './AppMD';
37
- import App from './App';
38
- import { AppHandlers, AppProps } from './propsType';
39
- import { defaultMdSettings } from '../../defaults';
40
- import { useMediaQuery } from 'react-responsive';
41
- import AppMobile from './AppMobile';
42
-
43
- const defaultSelection = { x1: 0.1, x2: 0.9, y1: 0.1, y2: 0.9 };
44
-
45
- const LandingPageApp = () => {
46
- const dispatch = useAppDispatch();
47
- const searchState = useAppSelector(state => state);
48
- const [selection, setSelection] = useState<RectCoords>(defaultSelection);
49
- const { settings, search, nyris } = searchState;
50
- const { fetchingRegions, fetchingResults, requestImage, selectedRegion } =
51
- search;
52
- const { showPart } = nyris;
53
- const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
54
- // update selection, if it is not the default one
55
- useEffect(() => {
56
- if (selectedRegion) {
57
- setSelection(selectedRegion);
58
- } else {
59
- setSelection(defaultSelection);
60
- }
61
- }, [selectedRegion]);
62
-
63
- const acceptTypes = ['image/*']
64
- .concat(settings.cadSearch ? cadExtensions : [])
65
- .join(',');
66
-
67
- function scrollTop() {
68
- // TODO might require polyfill for ios and edge
69
- window.scrollTo({ top: 0, left: 0, behavior: 'smooth' });
70
- }
71
-
72
- const onLinkClick = (_position: number, url: string) => {
73
- feedbackClickEpic(searchState, _position).catch(console.warn);
74
- if (url) {
75
- window.open(url);
76
- }
77
- };
78
-
79
- const startSearch = async (file: File | HTMLCanvasElement | string) => {
80
- try {
81
- dispatch(loadingActionResults());
82
- dispatch(showResults());
83
- if (file instanceof File && isCadFile(file)) {
84
- let res = await findByCadFile(file, settings);
85
- dispatch(setSearchResults(res));
86
- } else {
87
- let image = await createImage(file);
88
- dispatch(setRequestImage(image));
89
- let searchRegion: RectCoords | undefined;
90
- if (settings.regions) {
91
- let { regions: foundRegions, selectedRegion: suggestedRegion } =
92
- await findRegions(image, settings);
93
- searchRegion = suggestedRegion;
94
- dispatch(setRegions(foundRegions));
95
- dispatch(setSelectedRegion(searchRegion));
96
- }
97
- return findByImage({ image, settings, region: searchRegion }).then(
98
- res => {
99
- dispatch(setSearchResults(res));
100
- dispatch(showFeedback());
101
- },
102
- );
103
- }
104
- } catch (e) {
105
- // TODO show error messages
106
- dispatch(
107
- setError(
108
- 'There was an error while performing the request. Please try again later.',
109
- ),
110
- );
111
- }
112
- };
113
-
114
- const debouncedSetRectCoords = useCallback(
115
- debounce(value => {
116
- dispatch(selectionChanged(value));
117
- feedbackRegionEpic(searchState, value);
118
- dispatch(loadingActionResults());
119
- findByImage({ image: requestImage!!.canvas, settings, region: value })
120
- .then(res => {
121
- dispatch(searchFileImageNonRegion(res));
122
- dispatch(showFeedback());
123
- })
124
- .catch(e => console.warn('catch', e));
125
- }, 1200),
126
- [requestImage, searchState],
127
- );
128
-
129
- const handlers: AppHandlers = {
130
- onExampleImageClick: url => {
131
- startSearch(url);
132
- },
133
- onCameraClick: () => dispatch(showCamera),
134
- onCaptureCanceled: () => dispatch(showStart),
135
- onCaptureComplete: i => startSearch(i),
136
- onCloseFeedback: () => dispatch(hideFeedback),
137
- onFileDropped: f => startSearch(f),
138
- onImageClick: (position, url) => {
139
- startSearch(url);
140
- feedbackClickEpic(searchState, position);
141
- },
142
- onLinkClick: onLinkClick,
143
- onPositiveFeedback: () => {
144
- dispatch(feedbackSubmitPositive());
145
- feedbackSuccessEpic(searchState, true);
146
- },
147
- onNegativeFeedback: () => {
148
- dispatch(feedbackNegative());
149
- feedbackSuccessEpic(searchState, false);
150
- },
151
- onSelectFile: f => startSearch(f),
152
- onSelectionChange: r => {
153
- setSelection(r);
154
- debouncedSetRectCoords(r);
155
- },
156
- onShowStart: () => {
157
- dispatch(showStart());
158
- scrollTop();
159
- },
160
- };
161
-
162
- let props: AppProps = {
163
- search: {
164
- ...search,
165
- previewSelection: selection,
166
- },
167
- settings,
168
- previewImage: search?.requestImage,
169
- acceptTypes,
170
- showPart,
171
- handlers,
172
- loading: fetchingRegions || fetchingResults,
173
- mdSettings: settings.themePage.materialDesign || defaultMdSettings,
174
- feedbackState: nyris.feedbackState,
175
- };
176
-
177
- return isMobile ? (
178
- <AppMobile {...props} />
179
- ) : settings.themePage.materialDesign?.active ? (
180
- <AppMD {...props} />
181
- ) : (
182
- <App {...props} />
183
- );
184
- };
185
-
186
- export default LandingPageApp;
@@ -1,72 +0,0 @@
1
- import { Box } from '@material-ui/core';
2
- import React, { useState } from 'react';
3
- import './common.scss';
4
- import { cadExtensions } from '@nyris/nyris-api';
5
- import algoliasearch from 'algoliasearch/lite';
6
- import IconSupport from 'common/assets/icons/support3.svg';
7
- import DragDropFile from 'components/DragDropFile';
8
- import CustomSearchBox from 'components/input/inputSearch';
9
- import { connectInfiniteHits } from 'react-instantsearch-dom';
10
- import { useMediaQuery } from 'react-responsive';
11
- import { Link } from 'react-router-dom';
12
- import { useAppSelector } from 'Store/Store';
13
- import { AlgoliaSettings } from '../../types';
14
-
15
- interface Props {}
16
-
17
- function AppNewVersion(props: Props) {
18
- const { settings } = useAppSelector(state => state);
19
- const [isLoading, setLoading] = useState<boolean>(false);
20
- const { apiKey, appId, indexName } = settings.algolia as AlgoliaSettings;
21
- const searchClient = algoliasearch(appId, apiKey);
22
- searchClient.initIndex(indexName);
23
- const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
24
-
25
- const acceptTypes = ['image/*']
26
- .concat(settings.cadSearch ? cadExtensions : [])
27
- .join(',');
28
-
29
- const InfiniteHits = ({ hits }: any) => {
30
- return <div></div>;
31
- };
32
-
33
- const onChangeLoading = (value: boolean) => {
34
- setLoading(value);
35
- };
36
-
37
- const CustomInfiniteHits = connectInfiniteHits(InfiniteHits);
38
-
39
- return (
40
- <Box className={`box-content-main ${isLoading ? 'loading' : ''}`}>
41
- {isMobile && (
42
- <Box className="btn-open-support">
43
- <Link to={'/support'} style={{ color: '#3E36DC' }}>
44
- <img src={IconSupport} alt="" width={16} height={16} />
45
- </Link>
46
- </Box>
47
- )}
48
- <Box className="box-content_top">
49
- <Box className="fw-700 text-f32 text-dark2">
50
- <h1>{settings.headerText}</h1>
51
- </Box>
52
- <div className="box-input">
53
- <div className="wrap-input-search">
54
- <div style={{ display: 'none' }}>
55
- <CustomInfiniteHits />
56
- </div>
57
- <CustomSearchBox />
58
- </div>
59
- </div>
60
- </Box>
61
- <Box className="box-content_bottom">
62
- <DragDropFile
63
- acceptTypes={acceptTypes}
64
- isLoading={isLoading}
65
- onChangeLoading={onChangeLoading}
66
- />
67
- </Box>
68
- </Box>
69
- );
70
- }
71
-
72
- export default AppNewVersion;
@@ -1,7 +0,0 @@
1
- import React from "react";
2
-
3
- function Login(): JSX.Element {
4
- return <div>page login</div>;
5
- }
6
-
7
- export default Login;
@@ -1,11 +0,0 @@
1
- import React from "react";
2
-
3
- interface Props {}
4
-
5
- function NotFound(props: Props): JSX.Element {
6
- const {} = props;
7
-
8
- return <div>NotFound</div>;
9
- }
10
-
11
- export default NotFound;
@@ -1,76 +0,0 @@
1
- import { Box, Button, Typography } from "@material-ui/core";
2
- import React from "react";
3
- import ListSearch from "components/search/ListSearch";
4
-
5
- interface Option {
6
- readonly label: string;
7
- readonly value: string;
8
- }
9
-
10
- function SearchHistory(): JSX.Element {
11
- return (
12
- <Box className="wrap-main-search-history">
13
- <Box className="box-main-top">
14
- <Box className="box-input">
15
- {/* <InputSearch
16
- inputValueInputSearch={inputValueInputSearch}
17
- handleChange={handleChangeInputSearch}
18
- handleKeyDown={handleKeyDown}
19
- handleInputChange={handleInputChange}
20
- valueInputSearch={valueInputSearch}
21
- styleControl={{
22
- width: 640,
23
- background: "#FFFFFF",
24
- boxShadow: "0px 0px 6.66667px rgba(0, 0, 0, 0.2)",
25
- borderRadius: 21,
26
- minHeight: 42,
27
- display: "flex",
28
- alignItems: "center",
29
- paddingLeft: "16px",
30
- }}
31
- placeholder={"Search"}
32
- customComponent={{
33
- DropdownIndicator: () => {
34
- return (
35
- <Box mr={1}>
36
- <button
37
- className="btn-input-search"
38
- onClick={() => {
39
- console.log("321");
40
- }}
41
- >
42
- <img src={IconSetting} alt="icon_search" />
43
- </button>
44
- </Box>
45
- );
46
- },
47
- }}
48
- /> */}
49
- </Box>
50
- </Box>
51
-
52
- <Box className="box-main-bottom">
53
- <Box className="col-left">
54
- <ul className="box-time">
55
- <li>
56
- <Button>
57
- <Typography className="text-f9 active">2021</Typography>
58
- </Button>
59
- </li>
60
- <li>
61
- <Button>
62
- <Typography className="text-f9">2020</Typography>
63
- </Button>
64
- </li>
65
- </ul>
66
- </Box>
67
- <Box className="col-right">
68
- <ListSearch />
69
- <ListSearch />
70
- </Box>
71
- </Box>
72
- </Box>
73
- );
74
- }
75
-
76
- export default SearchHistory;
@@ -1,140 +0,0 @@
1
- import React, { useLayoutEffect } from 'react';
2
- import {
3
- Box,
4
- Button,
5
- FormControlLabel,
6
- Grid,
7
- Typography,
8
- } from '@material-ui/core';
9
- import BgColor from 'common/assets/images/Rectangle.png';
10
- import { useMediaQuery } from 'react-responsive';
11
- import { useHistory } from 'react-router-dom';
12
-
13
- interface Props {}
14
-
15
- function Profile(props: Props) {
16
- const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
17
- const history = useHistory();
18
- useLayoutEffect(() => {
19
- history.push({
20
- pathname: '/',
21
- });
22
- }, [history]);
23
-
24
- return (
25
- <Box className="wrap-main-profile">
26
- <Grid container>
27
- <Grid item lg={6} xs={12} sm={12} className="box-col-left">
28
- {!isMobile ? (
29
- <Box className="box-top">
30
- <Typography className="text-f40 fw-600 text-dark">
31
- Jose Luis Reyes
32
- </Typography>
33
- <Typography className="text-f13 text-dark2 fw-600">
34
- Nyris GmbH
35
- </Typography>
36
- </Box>
37
- ) : (
38
- <Box className="box-top">
39
- <Typography className="text-f40 fw-600 text-dark">
40
- My Account
41
- </Typography>
42
- </Box>
43
- )}
44
-
45
- <Box className="box-bottom">
46
- <Box className="box-content">
47
- {!isMobile && (
48
- <Typography className="text-f12 text-dark fw-700">
49
- Profile
50
- </Typography>
51
- )}
52
-
53
- <Box mt={1}>
54
- <FormControlLabel
55
- labelPlacement="top"
56
- control={<input />}
57
- label="Name"
58
- className="w-100"
59
- style={{ alignItems: 'flex-start', margin: 0 }}
60
- />
61
- </Box>
62
- <Box mt={1}>
63
- <FormControlLabel
64
- labelPlacement="top"
65
- control={<input />}
66
- label="E-mail"
67
- style={{ alignItems: 'flex-start', margin: 0 }}
68
- className="w-100"
69
- />
70
- </Box>
71
- <Box mt={1}>
72
- <FormControlLabel
73
- labelPlacement="top"
74
- control={<input />}
75
- label="Password"
76
- style={{ alignItems: 'flex-start', margin: 0 }}
77
- className="w-100"
78
- />
79
- </Box>
80
- {!isMobile && (
81
- <>
82
- <Box className="w-100" mt={2}>
83
- <Typography className="text-f12 text-dark fw-700">
84
- Account
85
- </Typography>
86
- </Box>
87
- <Box mt={1}>
88
- <FormControlLabel
89
- labelPlacement="top"
90
- control={<input />}
91
- label="Company"
92
- style={{ alignItems: 'flex-start', margin: 0 }}
93
- className="w-100"
94
- />
95
- </Box>
96
- <Box mt={1}>
97
- <FormControlLabel
98
- labelPlacement="top"
99
- control={<input />}
100
- label="Role"
101
- style={{ alignItems: 'flex-start', margin: 0 }}
102
- className="w-100"
103
- />
104
- </Box>
105
- </>
106
- )}
107
-
108
- <Box mt={2}>
109
- {isMobile && (
110
- <Box style={{ marginBottom: 10 }}>
111
- <a
112
- href="/#"
113
- style={{
114
- fontSize: 12,
115
- fontWeight: 500,
116
- color: '#3E36DC',
117
- }}
118
- >
119
- Reset password
120
- </a>
121
- </Box>
122
- )}
123
- <Button className="btn-log-out">Log out</Button>
124
- </Box>
125
- </Box>
126
- </Box>
127
- </Grid>
128
- {!isMobile && (
129
- <Grid item xs={6} className="box-col-right">
130
- <Box className="box-bg-image">
131
- <img src={BgColor} alt="" />
132
- </Box>
133
- </Grid>
134
- )}
135
- </Grid>
136
- </Box>
137
- );
138
- }
139
-
140
- export default Profile;
@@ -1,12 +0,0 @@
1
- import { Box } from "@material-ui/core";
2
- import React from "react";
3
-
4
- interface Props {}
5
-
6
- function ResultComponentMobile(props: Props) {
7
- const {} = props;
8
-
9
- return <Box>day la component result mobile</Box>;
10
- }
11
-
12
- export default ResultComponentMobile;