@griddo/ax 11.12.1-rc.3 → 11.12.1-rc.4
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.12.1-rc.
|
|
4
|
+
"version": "11.12.1-rc.4",
|
|
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": "da2037760c929e2ba660fda8abb67611be1bea0a"
|
|
221
221
|
}
|
|
@@ -7,7 +7,7 @@ import type { IHeadingError } from "../../utils";
|
|
|
7
7
|
import * as S from "./style";
|
|
8
8
|
|
|
9
9
|
const ErrorsItem = (props: IErrorsItemProps) => {
|
|
10
|
-
const { error, onSelectHeading } = props;
|
|
10
|
+
const { error, onSelectHeading, onDelete } = props;
|
|
11
11
|
const { message, description, headingIds } = error;
|
|
12
12
|
|
|
13
13
|
const [isOpen, setIsOpen] = useState(false);
|
|
@@ -54,7 +54,12 @@ const ErrorsItem = (props: IErrorsItemProps) => {
|
|
|
54
54
|
<Icon name={isOpen ? "UpArrow" : "DownArrow"} size="16" />
|
|
55
55
|
</S.IconWrapper>
|
|
56
56
|
)}
|
|
57
|
-
<S.IconWrapper
|
|
57
|
+
<S.IconWrapper
|
|
58
|
+
onClick={() => {
|
|
59
|
+
setIsDeleted(true);
|
|
60
|
+
onDelete();
|
|
61
|
+
}}
|
|
62
|
+
>
|
|
58
63
|
<Icon name="close" size="16" />
|
|
59
64
|
</S.IconWrapper>
|
|
60
65
|
</S.ErrorActions>
|
|
@@ -80,6 +85,7 @@ const ErrorsItem = (props: IErrorsItemProps) => {
|
|
|
80
85
|
interface IErrorsItemProps {
|
|
81
86
|
error: IHeadingError;
|
|
82
87
|
onSelectHeading: (id: number) => () => void;
|
|
88
|
+
onDelete: () => void;
|
|
83
89
|
}
|
|
84
90
|
|
|
85
91
|
export default ErrorsItem;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useState } from "react";
|
|
1
|
+
import { useMemo, useState } from "react";
|
|
2
2
|
|
|
3
3
|
import { Icon } from "@ax/components";
|
|
4
4
|
|
|
@@ -11,8 +11,18 @@ const ErrorsBanner = (props: IErrorsBannerProps) => {
|
|
|
11
11
|
const { errors, onSelectHeading, isOpen, setIsOpen, resetKey } = props;
|
|
12
12
|
|
|
13
13
|
const [isDeleted, setIsDeleted] = useState(false);
|
|
14
|
+
const [deletedErrorIndices, setDeletedErrorIndices] = useState<Set<number>>(new Set());
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
const allErrorsDeleted = useMemo(
|
|
17
|
+
() => deletedErrorIndices.size === errors.length && errors.length > 0,
|
|
18
|
+
[deletedErrorIndices.size, errors.length],
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
const handleErrorDelete = (index: number) => {
|
|
22
|
+
setDeletedErrorIndices((prev) => new Set([...prev, index]));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
if (isDeleted || allErrorsDeleted) {
|
|
16
26
|
return <></>;
|
|
17
27
|
}
|
|
18
28
|
|
|
@@ -37,8 +47,13 @@ const ErrorsBanner = (props: IErrorsBannerProps) => {
|
|
|
37
47
|
Review <strong>suggestions and warnings</strong> to enhance your page's search engine optimization.
|
|
38
48
|
</S.Description>
|
|
39
49
|
<S.ErrorListWrapper>
|
|
40
|
-
{errors.map((error) => (
|
|
41
|
-
<ErrorItem
|
|
50
|
+
{errors.map((error, index) => (
|
|
51
|
+
<ErrorItem
|
|
52
|
+
key={`${error.message}-${resetKey}`}
|
|
53
|
+
error={error}
|
|
54
|
+
onSelectHeading={onSelectHeading}
|
|
55
|
+
onDelete={() => handleErrorDelete(index)}
|
|
56
|
+
/>
|
|
42
57
|
))}
|
|
43
58
|
</S.ErrorListWrapper>
|
|
44
59
|
</S.ErrorsContent>
|
package/src/hooks/modals.tsx
CHANGED
|
@@ -13,14 +13,14 @@ const useModal = (initialState?: boolean, bodyBlock = true) => {
|
|
|
13
13
|
}
|
|
14
14
|
return () => {
|
|
15
15
|
// Solo eliminar si no hay otros modales abiertos
|
|
16
|
-
const modals = document.querySelectorAll('[data-testid="modal-wrapper"]');
|
|
16
|
+
const modals = document.querySelectorAll('[data-testid="modal-wrapper"], [data-testid="floating-panel"]');
|
|
17
17
|
if (modals.length <= 1) {
|
|
18
18
|
document.body.classList.remove("modal-open");
|
|
19
19
|
}
|
|
20
20
|
};
|
|
21
21
|
} else if (!bodyBlock || !isOpen) {
|
|
22
22
|
// Solo eliminar si no hay modales abiertos
|
|
23
|
-
const modals = document.querySelectorAll('[data-testid="modal-wrapper"]');
|
|
23
|
+
const modals = document.querySelectorAll('[data-testid="modal-wrapper"], [data-testid="floating-panel"]');
|
|
24
24
|
if (modals.length === 0) {
|
|
25
25
|
document.body.classList.remove("modal-open");
|
|
26
26
|
}
|
|
@@ -72,14 +72,14 @@ const useModals = <T extends string>(modalKeys: readonly T[], bodyBlock = true)
|
|
|
72
72
|
}
|
|
73
73
|
return () => {
|
|
74
74
|
// Solo eliminar si no hay otros modales abiertos
|
|
75
|
-
const modals = document.querySelectorAll('[data-testid="modal-wrapper"]');
|
|
75
|
+
const modals = document.querySelectorAll('[data-testid="modal-wrapper"], [data-testid="floating-panel"]');
|
|
76
76
|
if (modals.length <= 1) {
|
|
77
77
|
document.body.classList.remove("modal-open");
|
|
78
78
|
}
|
|
79
79
|
};
|
|
80
80
|
}
|
|
81
81
|
// Solo eliminar si no hay modales abiertos
|
|
82
|
-
const modals = document.querySelectorAll('[data-testid="modal-wrapper"]');
|
|
82
|
+
const modals = document.querySelectorAll('[data-testid="modal-wrapper"], [data-testid="floating-panel"]');
|
|
83
83
|
if (modals.length === 0) {
|
|
84
84
|
document.body.classList.remove("modal-open");
|
|
85
85
|
}
|