@nyris/nyris-webapp 0.3.23 → 0.3.25
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.550e76235499efc131a68c80392f6bfc.js → precache-manifest.3eed67031bd288eaf7ff98cd02aef6d7.js} +11 -35
- package/build/service-worker.js +1 -1
- package/build/static/css/main.0d30f026.chunk.css +2 -0
- package/build/static/css/main.0d30f026.chunk.css.map +1 -0
- package/build/static/js/2.ad8c5320.chunk.js +3 -0
- package/build/static/js/{2.f0507df9.chunk.js.LICENSE.txt → 2.ad8c5320.chunk.js.LICENSE.txt} +0 -15
- package/build/static/js/2.ad8c5320.chunk.js.map +1 -0
- package/build/static/js/main.7c54ad4d.chunk.js +3 -0
- package/build/static/js/main.7c54ad4d.chunk.js.map +1 -0
- package/package.json +5 -3
- package/src/App.tsx +24 -15
- package/src/Router.tsx +6 -41
- package/src/Store/Store.ts +14 -23
- package/src/Store/{Auth.ts → auth/Auth.ts} +6 -17
- package/src/Store/auth/types.ts +11 -0
- package/src/Store/constants.ts +21 -0
- package/src/Store/nyris/Nyris.ts +67 -0
- package/src/Store/nyris/types.ts +11 -0
- package/src/Store/{Search.ts → search/Search.ts} +3 -63
- package/src/Store/search/search.initialState.ts +28 -0
- package/src/Store/search/types.ts +34 -0
- package/src/components/DetailItem.tsx +29 -25
- package/src/components/DragDropFile.tsx +8 -3
- package/src/components/Feedback.tsx +11 -14
- package/src/components/FooterMobile.tsx +3 -51
- package/src/components/FooterResult.tsx +1 -1
- package/src/components/Header.tsx +29 -30
- package/src/components/HeaderMobile.tsx +14 -21
- package/src/components/Layout.tsx +11 -27
- package/src/components/PanelResult/index.tsx +1 -1
- package/src/components/{LoadingScreen → ProductList}/index.tsx +3 -3
- package/src/components/appMobile.scss +2 -21
- package/src/components/carousel/ImagePreviewCarousel.tsx +2 -1
- package/src/components/clear-refinements/clear-refinements.tsx +1 -1
- package/src/components/common.scss +2 -0
- package/src/components/drawer/cameraCustom.tsx +7 -14
- package/src/components/input/inputSearch.tsx +9 -8
- package/src/components/pre-filter/{desktop/index.tsx → index.tsx} +5 -5
- package/src/components/results/ItemResult.tsx +40 -34
- package/src/constants.ts +12 -0
- package/src/hooks/useVisualSearch.tsx +2 -2
- package/src/i18n.ts +10 -0
- package/src/index.css +13 -0
- package/src/index.tsx +0 -20
- package/src/{modules/LandingPage/indexNewVersion.tsx → page/landingPage/AppMD.tsx} +2 -4
- package/src/{modules/LandingPage → page/landingPage}/AppMobile.tsx +4 -5
- package/src/{modules/LandingPage → page/landingPage}/common.scss +2 -8
- package/src/page/result/index.tsx +8 -10
- package/src/services/Feedback.ts +48 -71
- package/src/services/{filter.tsx → filter.ts} +1 -1
- package/src/services/types.ts +30 -39
- package/src/translations.ts +22 -0
- package/src/types.ts +13 -66
- package/build/js/test.js +0 -84
- package/build/static/css/main.c956b74c.chunk.css +0 -2
- package/build/static/css/main.c956b74c.chunk.css.map +0 -1
- package/build/static/js/2.f0507df9.chunk.js +0 -3
- package/build/static/js/2.f0507df9.chunk.js.map +0 -1
- package/build/static/js/main.247c7b7e.chunk.js +0 -3
- package/build/static/js/main.247c7b7e.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/Store/Nyris.ts +0 -77
- 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/FooterNewVersion.tsx +0 -12
- package/src/components/HeaderMd.tsx +0 -38
- package/src/components/HeaderNewVersion.tsx +0 -112
- 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/defaults.ts +0 -37
- package/src/modules/LandingPage/App.tsx +0 -318
- package/src/modules/LandingPage/AppMD.tsx +0 -399
- package/src/modules/LandingPage/index.tsx +0 -186
- package/src/modules/LandingPage/propsType.ts +0 -43
- 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/src/page/result/MockData.ts +0 -50
- /package/build/static/js/{main.247c7b7e.chunk.js.LICENSE.txt → main.7c54ad4d.chunk.js.LICENSE.txt} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nyris/nyris-webapp",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.25",
|
|
4
4
|
"homepage": "./",
|
|
5
5
|
"dependencies": {
|
|
6
6
|
"@algolia/autocomplete-js": "^1.7.1",
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
"@material-ui/data-grid": "^4.0.0-alpha.37",
|
|
13
13
|
"@material-ui/icons": "^4.4.1",
|
|
14
14
|
"@material-ui/lab": "^4.0.0-alpha.60",
|
|
15
|
-
"@nyris/nyris-api": "^0.3.
|
|
16
|
-
"@nyris/nyris-react-components": "^0.3.
|
|
15
|
+
"@nyris/nyris-api": "^0.3.25",
|
|
16
|
+
"@nyris/nyris-react-components": "^0.3.25",
|
|
17
17
|
"@reduxjs/toolkit": "^1.6.1",
|
|
18
18
|
"@splidejs/react-splide": "^0.7.12",
|
|
19
19
|
"@types/blueimp-load-image": "^2.23.4",
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
"classnames": "^2.2.6",
|
|
32
32
|
"framer-motion": "^4.1.17",
|
|
33
33
|
"history": "^4.10.1",
|
|
34
|
+
"i18next": "^22.4.14",
|
|
34
35
|
"jotai": "^1.4.7",
|
|
35
36
|
"jquery": "^3.6.0",
|
|
36
37
|
"js-cookie": "^3.0.1",
|
|
@@ -42,6 +43,7 @@
|
|
|
42
43
|
"react-dropzone": "^10.1.8",
|
|
43
44
|
"react-hook-form": "^7.27.1",
|
|
44
45
|
"react-hot-toast": "^2.4.0",
|
|
46
|
+
"react-i18next": "^12.2.0",
|
|
45
47
|
"react-instantsearch-dom": "^6.15.0",
|
|
46
48
|
"react-instantsearch-hooks": "^6.22.0",
|
|
47
49
|
"react-konva": "16.13.0-6",
|
package/src/App.tsx
CHANGED
|
@@ -3,24 +3,33 @@ import 'react-app-polyfill/stable';
|
|
|
3
3
|
import React from 'react';
|
|
4
4
|
import 'typeface-roboto';
|
|
5
5
|
import 'index.css';
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
|
|
6
|
+
|
|
7
|
+
import { useMediaQuery } from 'react-responsive';
|
|
8
|
+
import AppMD from 'page/landingPage/AppMD';
|
|
9
|
+
import AppMobile from 'page/landingPage/AppMobile';
|
|
10
|
+
import i18n from 'i18next';
|
|
11
|
+
import { initReactI18next } from 'react-i18next';
|
|
12
|
+
import { useAppSelector } from 'Store/Store';
|
|
13
|
+
import { translations } from 'translations';
|
|
14
|
+
|
|
15
|
+
i18n.use(initReactI18next).init({
|
|
16
|
+
resources: translations,
|
|
17
|
+
fallbackLng: 'en',
|
|
18
|
+
interpolation: {
|
|
19
|
+
escapeValue: false,
|
|
20
|
+
},
|
|
21
|
+
returnNull: false,
|
|
22
|
+
});
|
|
12
23
|
|
|
13
24
|
function App(): JSX.Element {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
? AppNewVersion
|
|
21
|
-
: LandingPageApp;
|
|
25
|
+
const language = useAppSelector(state => state.settings.language);
|
|
26
|
+
|
|
27
|
+
i18n.changeLanguage(language);
|
|
28
|
+
|
|
29
|
+
const isMobile = useMediaQuery({ query: '(max-width: 776px)' });
|
|
30
|
+
let SelectedApp: any = isMobile ? AppMobile : AppMD;
|
|
22
31
|
|
|
23
|
-
|
|
32
|
+
return <SelectedApp />;
|
|
24
33
|
}
|
|
25
34
|
|
|
26
35
|
export default App;
|
package/src/Router.tsx
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import React, { memo } from
|
|
2
|
-
import { Route, Switch, Redirect } from
|
|
3
|
-
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import App from "App";
|
|
8
|
-
import ResultComponent from "page/result";
|
|
9
|
-
import SearchHistory from "page/History";
|
|
10
|
-
import Saved from "page/Saved";
|
|
11
|
-
import Profile from "page/Profile";
|
|
12
|
-
import SupportPage from "page/Support";
|
|
1
|
+
import React, { memo } from 'react';
|
|
2
|
+
import { Route, Switch, Redirect } from 'react-router-dom';
|
|
3
|
+
import Layout from 'components/Layout';
|
|
4
|
+
import { ReactNode } from 'components/common';
|
|
5
|
+
import App from 'App';
|
|
6
|
+
import ResultComponent from 'page/result';
|
|
13
7
|
|
|
14
8
|
interface PrivateRouteProps {
|
|
15
9
|
component: ReactNode;
|
|
@@ -35,7 +29,6 @@ function Router(): JSX.Element {
|
|
|
35
29
|
|
|
36
30
|
return (
|
|
37
31
|
<Switch>
|
|
38
|
-
<Route exact strict path="/login" component={Login} />
|
|
39
32
|
<Layout>
|
|
40
33
|
<Switch>
|
|
41
34
|
<PrivateRoute
|
|
@@ -52,34 +45,6 @@ function Router(): JSX.Element {
|
|
|
52
45
|
path="/result"
|
|
53
46
|
component={ResultComponent}
|
|
54
47
|
/>
|
|
55
|
-
<PrivateRoute
|
|
56
|
-
authed={!!accessToken}
|
|
57
|
-
exact
|
|
58
|
-
strict
|
|
59
|
-
path="/search-history"
|
|
60
|
-
component={SearchHistory}
|
|
61
|
-
/>
|
|
62
|
-
<PrivateRoute
|
|
63
|
-
authed={!!accessToken}
|
|
64
|
-
exact
|
|
65
|
-
strict
|
|
66
|
-
path="/saved"
|
|
67
|
-
component={Saved}
|
|
68
|
-
/>
|
|
69
|
-
<PrivateRoute
|
|
70
|
-
authed={!!accessToken}
|
|
71
|
-
exact
|
|
72
|
-
strict
|
|
73
|
-
path="/account"
|
|
74
|
-
component={Profile}
|
|
75
|
-
/>
|
|
76
|
-
<PrivateRoute
|
|
77
|
-
authed={!!accessToken}
|
|
78
|
-
exact
|
|
79
|
-
strict
|
|
80
|
-
path="/support"
|
|
81
|
-
component={SupportPage}
|
|
82
|
-
/>
|
|
83
48
|
</Switch>
|
|
84
49
|
</Layout>
|
|
85
50
|
</Switch>
|
package/src/Store/Store.ts
CHANGED
|
@@ -1,37 +1,28 @@
|
|
|
1
|
-
import { configureStore } from
|
|
2
|
-
import { TypedUseSelectorHook, useDispatch, useSelector } from
|
|
3
|
-
import { combineReducers } from
|
|
4
|
-
import Auth from
|
|
5
|
-
import {AppSettings
|
|
6
|
-
import { getUrlParam } from
|
|
7
|
-
import Search from
|
|
8
|
-
import Nyris from
|
|
9
|
-
import {
|
|
1
|
+
import { configureStore } from '@reduxjs/toolkit';
|
|
2
|
+
import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux';
|
|
3
|
+
import { combineReducers } from 'redux';
|
|
4
|
+
import Auth from 'Store/auth/Auth';
|
|
5
|
+
import { AppSettings } from 'types';
|
|
6
|
+
import { getUrlParam } from 'utils';
|
|
7
|
+
import Search from 'Store/search/Search';
|
|
8
|
+
import Nyris from 'Store/nyris/Nyris';
|
|
9
|
+
import { defaultSettings } from './constants';
|
|
10
10
|
|
|
11
11
|
declare var settings: AppSettings;
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
13
|
let normalizedSettings: AppSettings = {
|
|
16
14
|
...defaultSettings,
|
|
17
15
|
...settings,
|
|
18
16
|
};
|
|
19
17
|
|
|
20
|
-
// spread default settings for material design
|
|
21
|
-
let mdSettings : MDSettings = {
|
|
22
|
-
...defaultMdSettings,
|
|
23
|
-
...settings.themePage.materialDesign
|
|
24
|
-
}
|
|
25
|
-
normalizedSettings.themePage.materialDesign = mdSettings;
|
|
26
|
-
|
|
27
18
|
normalizedSettings = {
|
|
28
19
|
...normalizedSettings,
|
|
29
|
-
apiKey: (getUrlParam(
|
|
30
|
-
xOptions: (getUrlParam(
|
|
20
|
+
apiKey: (getUrlParam('apiKey') as string) || normalizedSettings.apiKey,
|
|
21
|
+
xOptions: (getUrlParam('xOptions') as string) || normalizedSettings.xOptions,
|
|
31
22
|
regions:
|
|
32
|
-
(getUrlParam(
|
|
23
|
+
(getUrlParam('use.regions') as boolean) || normalizedSettings.regions,
|
|
33
24
|
preview:
|
|
34
|
-
(getUrlParam(
|
|
25
|
+
(getUrlParam('use.preview') as boolean) || normalizedSettings.preview,
|
|
35
26
|
};
|
|
36
27
|
|
|
37
28
|
const reducers = combineReducers({
|
|
@@ -43,7 +34,7 @@ const reducers = combineReducers({
|
|
|
43
34
|
|
|
44
35
|
export const store = configureStore({
|
|
45
36
|
reducer: reducers,
|
|
46
|
-
devTools: process.env.NODE_ENV !==
|
|
37
|
+
devTools: process.env.NODE_ENV !== 'production',
|
|
47
38
|
});
|
|
48
39
|
|
|
49
40
|
export type RootState = ReturnType<typeof store.getState>;
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import { createSlice, PayloadAction } from
|
|
2
|
-
import jscookie from
|
|
3
|
-
|
|
4
|
-
interface InitialStateTypes {
|
|
5
|
-
accessToken?: string | Record<string, unknown> | null;
|
|
6
|
-
name?: string | null;
|
|
7
|
-
role?: string | null;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
interface LoginResponse {
|
|
11
|
-
access_token?: string | Record<string, unknown> | null;
|
|
12
|
-
name?: string | null;
|
|
13
|
-
role?: string | null;
|
|
14
|
-
}
|
|
1
|
+
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
2
|
+
import jscookie from 'js-cookie';
|
|
3
|
+
import { InitialStateTypes, LoginResponse } from './types';
|
|
15
4
|
|
|
16
5
|
const initialState: InitialStateTypes = {
|
|
17
6
|
accessToken: null,
|
|
@@ -20,7 +9,7 @@ const initialState: InitialStateTypes = {
|
|
|
20
9
|
};
|
|
21
10
|
|
|
22
11
|
export const authSlice = createSlice({
|
|
23
|
-
name:
|
|
12
|
+
name: 'auth',
|
|
24
13
|
initialState,
|
|
25
14
|
reducers: {
|
|
26
15
|
login: (state, data: PayloadAction<LoginResponse>) => {
|
|
@@ -31,11 +20,11 @@ export const authSlice = createSlice({
|
|
|
31
20
|
// jscookie.set("token", payload?.access_token);
|
|
32
21
|
// }
|
|
33
22
|
},
|
|
34
|
-
logout:
|
|
23
|
+
logout: state => {
|
|
35
24
|
state.accessToken = null;
|
|
36
25
|
state.name = null;
|
|
37
26
|
state.role = null;
|
|
38
|
-
jscookie.remove(
|
|
27
|
+
jscookie.remove('token');
|
|
39
28
|
},
|
|
40
29
|
},
|
|
41
30
|
});
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface InitialStateTypes {
|
|
2
|
+
accessToken?: string | Record<string, unknown> | null;
|
|
3
|
+
name?: string | null;
|
|
4
|
+
role?: string | null;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface LoginResponse {
|
|
8
|
+
access_token?: string | Record<string, unknown> | null;
|
|
9
|
+
name?: string | null;
|
|
10
|
+
role?: string | null;
|
|
11
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AppSettings } from '../types';
|
|
2
|
+
|
|
3
|
+
export const defaultSettings: AppSettings = {
|
|
4
|
+
xOptions: false,
|
|
5
|
+
apiKey: 'UNSET',
|
|
6
|
+
exampleImages: [],
|
|
7
|
+
preview: true,
|
|
8
|
+
regions: false,
|
|
9
|
+
maxWidth: 500,
|
|
10
|
+
maxHeight: 500,
|
|
11
|
+
jpegQuality: 0.92,
|
|
12
|
+
baseUrl: 'https://api.nyris.io',
|
|
13
|
+
instantRedirectPatterns: [
|
|
14
|
+
'^https?://(www.)?youtube.com/',
|
|
15
|
+
'^https?://(www.)?youtu.be/',
|
|
16
|
+
'^https?://(www.)?vimeo.com/',
|
|
17
|
+
'^https?://(www.)?dailymotion.com/',
|
|
18
|
+
'^https?://(www.)?dai.ly/',
|
|
19
|
+
],
|
|
20
|
+
theme: {},
|
|
21
|
+
};
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
import { NyrisAppState, NyrisFeedbackState } from './types';
|
|
3
|
+
|
|
4
|
+
const initialState: NyrisAppState | NyrisFeedbackState = {
|
|
5
|
+
showPart: 'start',
|
|
6
|
+
feedbackState: 'hidden',
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const nyrisSlice = createSlice({
|
|
10
|
+
name: 'nyris',
|
|
11
|
+
initialState,
|
|
12
|
+
reducers: {
|
|
13
|
+
showStart: state => {
|
|
14
|
+
return {
|
|
15
|
+
...state,
|
|
16
|
+
showPart: 'start',
|
|
17
|
+
};
|
|
18
|
+
},
|
|
19
|
+
showCamera: state => {
|
|
20
|
+
return {
|
|
21
|
+
...state,
|
|
22
|
+
showPart: 'camera',
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
showResults: state => {
|
|
26
|
+
return {
|
|
27
|
+
...state,
|
|
28
|
+
showPart: 'results',
|
|
29
|
+
};
|
|
30
|
+
},
|
|
31
|
+
showFeedback: state => {
|
|
32
|
+
return {
|
|
33
|
+
...state,
|
|
34
|
+
feedbackState: 'question',
|
|
35
|
+
};
|
|
36
|
+
},
|
|
37
|
+
hideFeedback: state => {
|
|
38
|
+
return {
|
|
39
|
+
...state,
|
|
40
|
+
feedbackState: 'hidden',
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
feedbackSubmitPositive: state => {
|
|
44
|
+
return {
|
|
45
|
+
...state,
|
|
46
|
+
feedbackState: 'positive',
|
|
47
|
+
};
|
|
48
|
+
},
|
|
49
|
+
feedbackNegative: state => {
|
|
50
|
+
return {
|
|
51
|
+
...state,
|
|
52
|
+
feedbackState: 'negative',
|
|
53
|
+
};
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
});
|
|
57
|
+
|
|
58
|
+
export const {
|
|
59
|
+
showStart,
|
|
60
|
+
showCamera,
|
|
61
|
+
showResults,
|
|
62
|
+
showFeedback,
|
|
63
|
+
hideFeedback,
|
|
64
|
+
feedbackSubmitPositive,
|
|
65
|
+
feedbackNegative,
|
|
66
|
+
} = nyrisSlice.actions;
|
|
67
|
+
export default nyrisSlice.reducer;
|
|
@@ -1,67 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { RectCoords, Region } from '@nyris/nyris-api';
|
|
2
2
|
import { createSlice, PayloadAction } from '@reduxjs/toolkit';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
interface CategoryPrediction {
|
|
7
|
-
name: string;
|
|
8
|
-
score: number;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
export interface SearchState {
|
|
12
|
-
results: any[];
|
|
13
|
-
duration?: number;
|
|
14
|
-
requestId?: string;
|
|
15
|
-
sessionId?: string;
|
|
16
|
-
regions: Region[];
|
|
17
|
-
selectedRegion?: RectCoords;
|
|
18
|
-
fetchingRegions: boolean;
|
|
19
|
-
fetchingResults: boolean;
|
|
20
|
-
filterOptions: string[];
|
|
21
|
-
requestImage?: CanvasWithId | undefined;
|
|
22
|
-
categoryPredictions: CategoryPrediction[];
|
|
23
|
-
codes: Code[];
|
|
24
|
-
errorMessage: string;
|
|
25
|
-
valueTextSearch: any;
|
|
26
|
-
resultSearchText: any[];
|
|
27
|
-
filters: any[];
|
|
28
|
-
configureFilter?: any;
|
|
29
|
-
loadingSearchAlgolia: boolean;
|
|
30
|
-
imageThumbSearchInput?: any;
|
|
31
|
-
textSearchInputMobile?: string;
|
|
32
|
-
isShowModalDetailItemMobile?: boolean;
|
|
33
|
-
keyFilter?: string;
|
|
34
|
-
preFilterDropdown?: boolean;
|
|
35
|
-
setPreFilterDropdown?: any;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
// TODO: init state
|
|
39
|
-
const initialState: SearchState = {
|
|
40
|
-
results: [],
|
|
41
|
-
regions: [],
|
|
42
|
-
selectedRegion: undefined,
|
|
43
|
-
requestImage: undefined,
|
|
44
|
-
fetchingResults: false,
|
|
45
|
-
fetchingRegions: false,
|
|
46
|
-
filterOptions: [],
|
|
47
|
-
categoryPredictions: [],
|
|
48
|
-
codes: [],
|
|
49
|
-
errorMessage: '',
|
|
50
|
-
valueTextSearch: {
|
|
51
|
-
configure: { filters: '' },
|
|
52
|
-
page: 1,
|
|
53
|
-
refinementList: '',
|
|
54
|
-
},
|
|
55
|
-
resultSearchText: [],
|
|
56
|
-
filters: [],
|
|
57
|
-
configureFilter: {},
|
|
58
|
-
loadingSearchAlgolia: false,
|
|
59
|
-
imageThumbSearchInput: '',
|
|
60
|
-
textSearchInputMobile: '',
|
|
61
|
-
isShowModalDetailItemMobile: false,
|
|
62
|
-
keyFilter: '',
|
|
63
|
-
preFilterDropdown: false,
|
|
64
|
-
};
|
|
3
|
+
import { DEFAULT_REGION } from '../../constants';
|
|
4
|
+
import { initialState } from './search.initialState';
|
|
65
5
|
|
|
66
6
|
export const searchSlice = createSlice({
|
|
67
7
|
name: 'search',
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { SearchState } from './types';
|
|
2
|
+
|
|
3
|
+
export const initialState: SearchState = {
|
|
4
|
+
results: [],
|
|
5
|
+
regions: [],
|
|
6
|
+
selectedRegion: undefined,
|
|
7
|
+
requestImage: undefined,
|
|
8
|
+
fetchingResults: false,
|
|
9
|
+
fetchingRegions: false,
|
|
10
|
+
filterOptions: [],
|
|
11
|
+
categoryPredictions: [],
|
|
12
|
+
codes: [],
|
|
13
|
+
errorMessage: '',
|
|
14
|
+
valueTextSearch: {
|
|
15
|
+
configure: { filters: '' },
|
|
16
|
+
page: 1,
|
|
17
|
+
refinementList: '',
|
|
18
|
+
},
|
|
19
|
+
resultSearchText: [],
|
|
20
|
+
filters: [],
|
|
21
|
+
configureFilter: {},
|
|
22
|
+
loadingSearchAlgolia: false,
|
|
23
|
+
imageThumbSearchInput: '',
|
|
24
|
+
textSearchInputMobile: '',
|
|
25
|
+
isShowModalDetailItemMobile: false,
|
|
26
|
+
keyFilter: '',
|
|
27
|
+
preFilterDropdown: false,
|
|
28
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { Region, RectCoords, Code } from '@nyris/nyris-api';
|
|
2
|
+
import { CanvasWithId } from 'types';
|
|
3
|
+
|
|
4
|
+
export interface CategoryPrediction {
|
|
5
|
+
name: string;
|
|
6
|
+
score: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface SearchState {
|
|
10
|
+
results: any[];
|
|
11
|
+
duration?: number;
|
|
12
|
+
requestId?: string;
|
|
13
|
+
sessionId?: string;
|
|
14
|
+
regions: Region[];
|
|
15
|
+
selectedRegion?: RectCoords;
|
|
16
|
+
fetchingRegions: boolean;
|
|
17
|
+
fetchingResults: boolean;
|
|
18
|
+
filterOptions: string[];
|
|
19
|
+
requestImage?: CanvasWithId | undefined;
|
|
20
|
+
categoryPredictions: CategoryPrediction[];
|
|
21
|
+
codes: Code[];
|
|
22
|
+
errorMessage: string;
|
|
23
|
+
valueTextSearch: any;
|
|
24
|
+
resultSearchText: any[];
|
|
25
|
+
filters: any[];
|
|
26
|
+
configureFilter?: any;
|
|
27
|
+
loadingSearchAlgolia: boolean;
|
|
28
|
+
imageThumbSearchInput?: any;
|
|
29
|
+
textSearchInputMobile?: string;
|
|
30
|
+
isShowModalDetailItemMobile?: boolean;
|
|
31
|
+
keyFilter?: string;
|
|
32
|
+
preFilterDropdown?: boolean;
|
|
33
|
+
setPreFilterDropdown?: any;
|
|
34
|
+
}
|
|
@@ -14,6 +14,7 @@ import { useAppSelector } from 'Store/Store';
|
|
|
14
14
|
import { prepareImageList } from '../helpers/CommonHelper';
|
|
15
15
|
import KeyboardArrowUpIcon from '@material-ui/icons/KeyboardArrowUp';
|
|
16
16
|
import NoImage from '../common/assets/images/unnamed.png';
|
|
17
|
+
import { useTranslation } from 'react-i18next';
|
|
17
18
|
|
|
18
19
|
interface Props {
|
|
19
20
|
numberResult?: number;
|
|
@@ -75,6 +76,7 @@ function DetailItem(props: Props) {
|
|
|
75
76
|
|
|
76
77
|
setDataImageCarouSel(valueKey);
|
|
77
78
|
};
|
|
79
|
+
const { t } = useTranslation();
|
|
78
80
|
|
|
79
81
|
return (
|
|
80
82
|
<Box
|
|
@@ -121,9 +123,7 @@ function DetailItem(props: Props) {
|
|
|
121
123
|
}
|
|
122
124
|
}}
|
|
123
125
|
>
|
|
124
|
-
<IconSearchImage
|
|
125
|
-
color={settings.themePage.searchSuite?.secondaryColor}
|
|
126
|
-
/>
|
|
126
|
+
<IconSearchImage color={settings.theme?.secondaryColor} />
|
|
127
127
|
</Button>
|
|
128
128
|
)}
|
|
129
129
|
</Box>
|
|
@@ -143,14 +143,14 @@ function DetailItem(props: Props) {
|
|
|
143
143
|
<Grid container justifyContent="space-between">
|
|
144
144
|
<Grid item xs={12}>
|
|
145
145
|
<Typography className="text-f13 fw-500 max-line-1">
|
|
146
|
-
SKU: {sku}
|
|
146
|
+
{settings.itemIdLabel || 'SKU'}: {sku}
|
|
147
147
|
</Typography>
|
|
148
148
|
{dataItem.keyword_1 && (
|
|
149
149
|
<Typography
|
|
150
150
|
className="text-f13 fw-500 max-line-1"
|
|
151
151
|
style={{ marginTop: '8px' }}
|
|
152
152
|
>
|
|
153
|
-
Manufacturer Number: {dataItem.keyword_1}
|
|
153
|
+
{t('Manufacturer Number')}: {dataItem.keyword_1}
|
|
154
154
|
</Typography>
|
|
155
155
|
)}
|
|
156
156
|
{settings.warehouseVariant && (
|
|
@@ -180,7 +180,7 @@ function DetailItem(props: Props) {
|
|
|
180
180
|
<Box
|
|
181
181
|
borderRadius={16}
|
|
182
182
|
style={{
|
|
183
|
-
backgroundColor: `${settings.
|
|
183
|
+
backgroundColor: `${settings.theme?.secondaryColor}26`,
|
|
184
184
|
width: 'fit-content',
|
|
185
185
|
padding: '3px 5px',
|
|
186
186
|
marginTop: 8,
|
|
@@ -188,7 +188,7 @@ function DetailItem(props: Props) {
|
|
|
188
188
|
>
|
|
189
189
|
<Typography
|
|
190
190
|
style={{
|
|
191
|
-
color: settings.
|
|
191
|
+
color: settings.theme?.secondaryColor,
|
|
192
192
|
fontSize: 12,
|
|
193
193
|
fontWeight: 700,
|
|
194
194
|
}}
|
|
@@ -223,7 +223,7 @@ function DetailItem(props: Props) {
|
|
|
223
223
|
style={{
|
|
224
224
|
display: 'flex',
|
|
225
225
|
justifyContent: 'space-between',
|
|
226
|
-
color: settings.
|
|
226
|
+
color: settings.theme?.secondaryColor,
|
|
227
227
|
fontSize: 14,
|
|
228
228
|
textTransform: 'initial',
|
|
229
229
|
paddingLeft: 5,
|
|
@@ -234,15 +234,11 @@ function DetailItem(props: Props) {
|
|
|
234
234
|
View details
|
|
235
235
|
{collapDescription ? (
|
|
236
236
|
<KeyboardArrowUpIcon
|
|
237
|
-
htmlColor={
|
|
238
|
-
settings.themePage.searchSuite?.secondaryColor
|
|
239
|
-
}
|
|
237
|
+
htmlColor={settings.theme?.secondaryColor}
|
|
240
238
|
/>
|
|
241
239
|
) : (
|
|
242
240
|
<KeyboardArrowDownIcon
|
|
243
|
-
htmlColor={
|
|
244
|
-
settings.themePage.searchSuite?.secondaryColor
|
|
245
|
-
}
|
|
241
|
+
htmlColor={settings.theme?.secondaryColor}
|
|
246
242
|
/>
|
|
247
243
|
)}
|
|
248
244
|
</Button>
|
|
@@ -256,7 +252,7 @@ function DetailItem(props: Props) {
|
|
|
256
252
|
{(settings.showMoreInfo || settings.warehouseVariant) && (
|
|
257
253
|
<Box
|
|
258
254
|
style={{
|
|
259
|
-
background: `linear-gradient(270deg, ${settings.
|
|
255
|
+
background: `linear-gradient(270deg, ${settings.theme?.primaryColor}bb 0%, ${settings.theme?.primaryColor} 100%)`,
|
|
260
256
|
// marginBottom: 25,
|
|
261
257
|
boxShadow: '0px 4px 4px rgba(0, 0, 0, 0.25)',
|
|
262
258
|
borderRadius: 4,
|
|
@@ -315,7 +311,7 @@ function DetailItem(props: Props) {
|
|
|
315
311
|
>
|
|
316
312
|
<Box
|
|
317
313
|
style={{
|
|
318
|
-
backgroundColor: `${settings.
|
|
314
|
+
backgroundColor: `${settings.theme?.secondaryColor}26`,
|
|
319
315
|
padding: '5px 10px',
|
|
320
316
|
borderRadius: 4,
|
|
321
317
|
width: '100%',
|
|
@@ -330,7 +326,7 @@ function DetailItem(props: Props) {
|
|
|
330
326
|
</Box>
|
|
331
327
|
<Box
|
|
332
328
|
style={{
|
|
333
|
-
backgroundColor: `${settings.
|
|
329
|
+
backgroundColor: `${settings.theme?.secondaryColor}26`,
|
|
334
330
|
padding: '5px 10px',
|
|
335
331
|
borderRadius: 4,
|
|
336
332
|
width: '100%',
|
|
@@ -357,7 +353,13 @@ function DetailItem(props: Props) {
|
|
|
357
353
|
alignItems="center"
|
|
358
354
|
>
|
|
359
355
|
<Grid item>
|
|
360
|
-
<Box
|
|
356
|
+
<Box
|
|
357
|
+
display={'flex'}
|
|
358
|
+
justifyContent={
|
|
359
|
+
settings.shareOption ? 'space-between' : 'space-around'
|
|
360
|
+
}
|
|
361
|
+
alignItems={'center'}
|
|
362
|
+
>
|
|
361
363
|
<Button
|
|
362
364
|
className="btn-item"
|
|
363
365
|
onClick={() => {
|
|
@@ -390,13 +392,15 @@ function DetailItem(props: Props) {
|
|
|
390
392
|
</Button>
|
|
391
393
|
</Box>
|
|
392
394
|
</Grid>
|
|
393
|
-
|
|
394
|
-
<
|
|
395
|
-
<
|
|
396
|
-
<
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
395
|
+
{settings.shareOption && (
|
|
396
|
+
<Grid item>
|
|
397
|
+
<Box display={'flex'} alignItems={'center'}>
|
|
398
|
+
<Button className="btn-item" onClick={() => false}>
|
|
399
|
+
<IconShare width={30} height={30} color="gray" />
|
|
400
|
+
</Button>
|
|
401
|
+
</Box>
|
|
402
|
+
</Grid>
|
|
403
|
+
)}
|
|
400
404
|
{/* <Grid item>
|
|
401
405
|
<Box display={'flex'} alignItems={'center'}>
|
|
402
406
|
<Button className="btn-item">
|