@griddo/ax 11.10.38 → 11.10.40
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/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/ax",
|
|
3
3
|
"description": "Griddo Author Experience",
|
|
4
|
-
"version": "11.10.
|
|
4
|
+
"version": "11.10.40",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Diego M. Béjar <diego.bejar@secuoyas.com>",
|
|
@@ -217,5 +217,5 @@
|
|
|
217
217
|
"publishConfig": {
|
|
218
218
|
"access": "public"
|
|
219
219
|
},
|
|
220
|
-
"gitHead": "
|
|
220
|
+
"gitHead": "3f329bbd92af7e9f9d69b0b5c0746dda52b554c0"
|
|
221
221
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { memo, useCallback, useEffect, useState } from "react";
|
|
2
2
|
|
|
3
|
-
import { IBreadcrumbItem, ISchema } from "@ax/types";
|
|
4
3
|
import { Breadcrumb, Toast } from "@ax/components";
|
|
5
4
|
import { useToast } from "@ax/hooks";
|
|
5
|
+
import type { IBreadcrumbItem, ISchema } from "@ax/types";
|
|
6
6
|
|
|
7
7
|
import * as S from "./style";
|
|
8
8
|
|
|
@@ -56,16 +56,24 @@ const Header = (props: IHeaderProps) => {
|
|
|
56
56
|
};
|
|
57
57
|
}, [handleNavigation]);
|
|
58
58
|
|
|
59
|
+
// Inicializar headerHeight solo al montar
|
|
59
60
|
// biome-ignore lint/correctness/useExhaustiveDependencies: TODO: fix this
|
|
60
61
|
useEffect(() => {
|
|
61
62
|
if (headerRef.current) {
|
|
62
63
|
const height = headerRef.current.offsetHeight + headerRef.current.offsetTop;
|
|
63
64
|
setHeaderHeight(height);
|
|
65
|
+
}
|
|
66
|
+
}, []);
|
|
67
|
+
|
|
68
|
+
// Actualizar solo cuando cambia breadcrumb (navegación real)
|
|
69
|
+
// biome-ignore lint/correctness/useExhaustiveDependencies: breadcrumbOld comparison needed
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
const breadcrumbChanged = JSON.stringify(breadcrumbOld) !== JSON.stringify(breadcrumb);
|
|
72
|
+
if (headerRef.current && breadcrumbChanged) {
|
|
73
|
+
const height = headerRef.current.offsetHeight + headerRef.current.offsetTop;
|
|
74
|
+
setHeaderHeight(height);
|
|
75
|
+
window.scrollTo(0, 0);
|
|
64
76
|
setBreadcrumbOld(breadcrumb);
|
|
65
|
-
if (JSON.stringify(breadcrumbOld) !== JSON.stringify(breadcrumb)) {
|
|
66
|
-
window.scrollTo(0, 0);
|
|
67
|
-
setBreadcrumbOld(breadcrumb);
|
|
68
|
-
}
|
|
69
77
|
}
|
|
70
78
|
}, [headerRef, breadcrumb, setHeaderHeight]);
|
|
71
79
|
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
2
|
import { connect } from "react-redux";
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import { appActions } from "@ax/containers/App";
|
|
4
|
+
import { Loading, MainWrapper, Nav } from "@ax/components";
|
|
6
5
|
import { analyticsActions } from "@ax/containers/Analytics";
|
|
7
|
-
import {
|
|
8
|
-
import { useIsDirty, useModal } from "@ax/hooks";
|
|
6
|
+
import { appActions } from "@ax/containers/App";
|
|
9
7
|
import { RouteLeavingGuard } from "@ax/guards";
|
|
8
|
+
import { useModal } from "@ax/hooks";
|
|
9
|
+
import type { IAnalytics, INavItem, IRootState, ISite } from "@ax/types";
|
|
10
10
|
|
|
11
11
|
import { Dimensions, Groups, ResetModal, ScriptCode, Warning } from "./atoms";
|
|
12
|
+
|
|
12
13
|
import * as S from "./style";
|
|
13
14
|
|
|
14
15
|
const Analytics = (props: IProps): JSX.Element => {
|
|
@@ -27,7 +28,7 @@ const Analytics = (props: IProps): JSX.Element => {
|
|
|
27
28
|
|
|
28
29
|
const [showWarning, setShowWarning] = useState(false);
|
|
29
30
|
const [scriptCode, setScriptCode] = useState(analytics.scriptCode);
|
|
30
|
-
const
|
|
31
|
+
const [isDirty, setIsDirty] = useState(false);
|
|
31
32
|
const { isOpen, toggleModal } = useModal();
|
|
32
33
|
|
|
33
34
|
// biome-ignore lint/correctness/useExhaustiveDependencies: TODO: fix this
|
|
@@ -36,14 +37,15 @@ const Analytics = (props: IProps): JSX.Element => {
|
|
|
36
37
|
handleGetAnalytics();
|
|
37
38
|
}, []);
|
|
38
39
|
|
|
39
|
-
// biome-ignore lint/correctness/useExhaustiveDependencies: TODO: fix this
|
|
40
40
|
useEffect(() => {
|
|
41
41
|
setScriptCode(analytics.scriptCode);
|
|
42
42
|
setShowWarning(!analytics.siteScriptCodeExists);
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
43
|
+
setIsDirty(false);
|
|
44
|
+
}, [analytics.scriptCode, analytics.siteScriptCodeExists]);
|
|
45
|
+
|
|
46
|
+
useEffect(() => {
|
|
47
|
+
setIsDirty(scriptCode !== analytics.scriptCode);
|
|
48
|
+
}, [scriptCode, analytics.scriptCode]);
|
|
47
49
|
|
|
48
50
|
const handleSave = async () => {
|
|
49
51
|
const isSaved = !!site && (await updateScriptCode(scriptCode, site.id));
|
|
@@ -55,6 +57,9 @@ const Analytics = (props: IProps): JSX.Element => {
|
|
|
55
57
|
const handleReset = async () => {
|
|
56
58
|
await deleteScriptCode(site?.id);
|
|
57
59
|
isOpen && toggleModal();
|
|
60
|
+
setShowWarning(true);
|
|
61
|
+
setScriptCode(analytics.scriptCode);
|
|
62
|
+
setIsDirty(false);
|
|
58
63
|
};
|
|
59
64
|
|
|
60
65
|
const modalText = (
|