@visns-studio/visns-components 2.2.0 → 2.2.2

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.
@@ -117,6 +117,12 @@ const DataGrid = forwardRef(
117
117
  const audioRef = useRef(null);
118
118
  const [audioSource, setAudioSource] = useState('');
119
119
 
120
+ useEffect(() => {
121
+ if (audioSource) {
122
+ audioRef.current.play();
123
+ }
124
+ }, [audioSource]);
125
+
120
126
  /** Modal States */
121
127
  const [formData, setFormData] = useState({});
122
128
  const [formType, setFormType] = useState('');
@@ -250,8 +256,17 @@ const DataGrid = forwardRef(
250
256
  }
251
257
  }, '');
252
258
 
253
- if (soundRelation && soundRelation[d[s.path]]) {
254
- setAudioSource(soundRelation[d[s.path]]);
259
+ if (soundRelation && soundRelation[s.key] && s.url) {
260
+ CustomFetch(
261
+ `${s.url}/${soundRelation[s.key]}`,
262
+ 'POST',
263
+ {},
264
+ (res) => {
265
+ if (res && res !== '') {
266
+ setAudioSource(res);
267
+ }
268
+ }
269
+ );
255
270
  }
256
271
  break;
257
272
  case 'update':
@@ -1808,11 +1823,9 @@ const DataGrid = forwardRef(
1808
1823
  }
1809
1824
  style={gridStyle}
1810
1825
  />
1811
- {audioSource && (
1812
- <audio src={audioSource} ref={audioRef} />
1813
- )}
1814
1826
  </>
1815
1827
  )}
1828
+ {audioSource && <audio src={audioSource} ref={audioRef} />}
1816
1829
  <Popup
1817
1830
  open={modalShow}
1818
1831
  onClose={modalClose}
@@ -1,24 +1,23 @@
1
- import React, { useState } from "react";
2
- import { Link, useNavigate, useLocation } from "react-router-dom";
3
- import Reveal from "react-reveal/Reveal";
4
- import { toast } from "react-toastify";
5
- import { Person, LockOff } from "akar-icons";
1
+ import React, { useState } from 'react';
2
+ import { Link, useNavigate, useLocation } from 'react-router-dom';
3
+ import Reveal from 'react-reveal/Reveal';
4
+ import { toast } from 'react-toastify';
5
+ import { Person, LockOff } from 'akar-icons';
6
6
 
7
- import CustomFetch from "../Fetch";
7
+ import CustomFetch from '../Fetch';
8
8
 
9
9
  const Login = ({ logo, setSystemAuth, setUserProfile }) => {
10
10
  const location = useLocation();
11
- const navigate = useNavigate();
12
11
 
13
12
  const [auth, setAuth] = useState({
14
- email: "",
15
- password: "",
13
+ email: '',
14
+ password: '',
16
15
  location: location,
17
16
  });
18
17
 
19
18
  const [authClass, setAuthClass] = useState({
20
- username: "",
21
- password: "",
19
+ username: '',
20
+ password: '',
22
21
  });
23
22
 
24
23
  const handleChange = (e) => {
@@ -35,45 +34,45 @@ const Login = ({ logo, setSystemAuth, setUserProfile }) => {
35
34
  e.preventDefault();
36
35
 
37
36
  CustomFetch(
38
- "/login/authenticate",
39
- "POST",
37
+ '/login/authenticate',
38
+ 'POST',
40
39
  auth,
41
40
  (result) => {
42
- if (result.error === "") {
41
+ if (result.error === '') {
43
42
  setUserProfile(result.user);
44
- setSystemAuth(true);
45
43
 
46
44
  if (
47
45
  result.previous?.state?.referrer &&
48
- result.previous.state.referrer !== ""
46
+ result.previous.state.referrer !== ''
49
47
  ) {
50
- navigate(result.previous.state.referrer);
48
+ window.location.href =
49
+ result.previous.state.referrer;
51
50
  } else {
52
- navigate("/");
51
+ setSystemAuth(true);
53
52
  }
54
53
  } else {
55
54
  setSystemAuth(false);
56
55
  setAuthClass((prevState) => ({
57
56
  ...prevState,
58
- username: "inputError",
59
- password: "inputError",
57
+ username: 'inputError',
58
+ password: 'inputError',
60
59
  }));
61
60
 
62
61
  toast.error(
63
- "Could not log in with the supplied credentials, please try again."
62
+ 'Could not log in with the supplied credentials, please try again.'
64
63
  );
65
64
  }
66
65
  },
67
66
  (error) => {
68
67
  setAuthClass((prevState) => ({
69
68
  ...prevState,
70
- username: "inputError",
71
- password: "inputError",
69
+ username: 'inputError',
70
+ password: 'inputError',
72
71
  }));
73
72
 
74
- if (String(error) === "CSRF token mismatch.") {
73
+ if (String(error) === 'CSRF token mismatch.') {
75
74
  toast.error(
76
- "Auth token has timed out, please reload the page before attempting to log back in."
75
+ 'Auth token has timed out, please reload the page before attempting to log back in.'
77
76
  );
78
77
  } else {
79
78
  toast.error(String(error));
@@ -142,7 +141,7 @@ const Login = ({ logo, setSystemAuth, setUserProfile }) => {
142
141
  </div>
143
142
  <div className="formItem fwItem lastItem forgotten">
144
143
  <span>
145
- Forgot your password?{" "}
144
+ Forgot your password?{' '}
146
145
  <Link to="/reset">Click Here</Link>
147
146
  </span>
148
147
  </div>
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "akar-icons": "^1.9.28",
6
6
  "awesome-debounce-promise": "^2.1.0",
7
7
  "axios": "^1.4.0",
8
- "framer-motion": "^10.13.0",
8
+ "framer-motion": "^10.15.0",
9
9
  "html-react-parser": "^4.2.0",
10
10
  "lodash": "^4.17.21",
11
11
  "moment": "^2.29.4",
@@ -25,7 +25,7 @@
25
25
  "react-sortable-hoc": "^2.0.0",
26
26
  "react-toastify": "^9.1.3",
27
27
  "react-toggle": "^4.1.3",
28
- "react-tooltip": "^5.18.1",
28
+ "react-tooltip": "^5.19.0",
29
29
  "react-window": "^1.8.9",
30
30
  "reactjs-popup": "^2.0.5",
31
31
  "validator": "^13.9.0",
@@ -40,7 +40,7 @@
40
40
  "react-dom": "^17.0.1"
41
41
  },
42
42
  "name": "@visns-studio/visns-components",
43
- "version": "2.2.0",
43
+ "version": "2.2.2",
44
44
  "description": "Various packages to assist in the development of our Custom Applications.",
45
45
  "main": "index.js",
46
46
  "scripts": {