@mattisvensson/strapi-plugin-webatlas 0.5.0 → 0.6.1
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/dist/_chunks/{de-D8LMOTFI.js → de-CL1TIZPg.js} +2 -1
- package/dist/_chunks/{en-BdfmJUs8.js.map → de-CL1TIZPg.js.map} +1 -1
- package/dist/_chunks/{de-BkirTac9.mjs → de-CzVD4dbZ.mjs} +2 -1
- package/dist/_chunks/{de-BkirTac9.mjs.map → de-CzVD4dbZ.mjs.map} +1 -1
- package/dist/_chunks/{en-BdfmJUs8.js → en-Du-Ap60j.js} +2 -1
- package/dist/_chunks/{de-D8LMOTFI.js.map → en-Du-Ap60j.js.map} +1 -1
- package/dist/_chunks/{en-DYbDta3m.mjs → en-Nk6QcTdr.mjs} +2 -1
- package/dist/_chunks/{en-DYbDta3m.mjs.map → en-Nk6QcTdr.mjs.map} +1 -1
- package/dist/_chunks/{index-CJtLrSxU.js → index-B5ji2Qhs.js} +5 -5
- package/dist/_chunks/{index-D4tWVnt1.js → index-BEwslndX.js} +2 -2
- package/dist/_chunks/{index-D4tWVnt1.js.map → index-BEwslndX.js.map} +1 -1
- package/dist/_chunks/{index-BOvKFOKk.js → index-BJHlAfrS.js} +81 -40
- package/dist/_chunks/{index-DTz7wDR7.mjs → index-BKds0CRq.mjs} +1 -1
- package/dist/_chunks/{index-C5ejmUpN.mjs → index-Bfu5AVqu.mjs} +81 -41
- package/dist/_chunks/{index-Ciae_OgQ.js → index-BvqWnL1-.js} +6 -6
- package/dist/_chunks/{index-Ciae_OgQ.js.map → index-BvqWnL1-.js.map} +1 -1
- package/dist/_chunks/{index-LAGFB7iO.mjs → index-C-4C6ezO.mjs} +1 -1
- package/dist/_chunks/{index-CNfpGKSw.mjs → index-C2V-ZFHK.mjs} +82 -40
- package/dist/_chunks/index-C2V-ZFHK.mjs.map +1 -0
- package/dist/_chunks/{index-BAN8PGGJ.js → index-Cp_UPsle.js} +2 -2
- package/dist/_chunks/{index-BAN8PGGJ.js.map → index-Cp_UPsle.js.map} +1 -1
- package/dist/_chunks/{index-CJNR2c7_.js → index-D2CkoDhN.js} +1 -1
- package/dist/_chunks/{index-BfgRvDzx.js → index-DBVU2KOj.js} +1 -1
- package/dist/_chunks/{index-BxnHHgGC.js → index-DCCE7rxt.js} +82 -41
- package/dist/_chunks/index-DCCE7rxt.js.map +1 -0
- package/dist/_chunks/{index-DtFIVZxq.mjs → index-DYKhGn15.mjs} +2 -2
- package/dist/_chunks/{index-DtFIVZxq.mjs.map → index-DYKhGn15.mjs.map} +1 -1
- package/dist/_chunks/{index-Ctq2vsD5.mjs → index-DesLqdi-.mjs} +5 -5
- package/dist/_chunks/{index-CuJP8Fy7.mjs → index-JVvkmiKE.mjs} +6 -6
- package/dist/_chunks/{index-CuJP8Fy7.mjs.map → index-JVvkmiKE.mjs.map} +1 -1
- package/dist/_chunks/{index-CEt9P4TS.mjs → index-mUDowsKQ.mjs} +2 -2
- package/dist/_chunks/{index-CEt9P4TS.mjs.map → index-mUDowsKQ.mjs.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/pages/Navigation/RouteItem.d.ts +1 -0
- package/dist/admin/src/pages/Navigation/SortableRouteItem.d.ts +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/_chunks/index-BxnHHgGC.js.map +0 -1
- package/dist/_chunks/index-C5ejmUpN.mjs.map +0 -1
|
@@ -104,6 +104,7 @@ const de = {
|
|
|
104
104
|
"webatlas.draft": "Entwurf",
|
|
105
105
|
"webatlas.modified": "Geändert",
|
|
106
106
|
"webatlas.deleted": "Gelöscht",
|
|
107
|
+
"webatlas.restore": "Wiederherstellen",
|
|
107
108
|
"webatlas.notification.error": "Ein Fehler ist aufgetreten",
|
|
108
109
|
"webatlas.notification.settings.saved": "Einstellungen erfolgreich gespeichert",
|
|
109
110
|
"webatlas.notification.routes.fetchFailed": "Routen konnten nicht abgerufen werden",
|
|
@@ -114,4 +115,4 @@ const de = {
|
|
|
114
115
|
"webatlas.notification.navigation.creationFailed": "Erstellung der Navigation fehlgeschlagen"
|
|
115
116
|
};
|
|
116
117
|
exports.default = de;
|
|
117
|
-
//# sourceMappingURL=de-
|
|
118
|
+
//# sourceMappingURL=de-CL1TIZPg.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"de-CL1TIZPg.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -102,6 +102,7 @@ const de = {
|
|
|
102
102
|
"webatlas.draft": "Entwurf",
|
|
103
103
|
"webatlas.modified": "Geändert",
|
|
104
104
|
"webatlas.deleted": "Gelöscht",
|
|
105
|
+
"webatlas.restore": "Wiederherstellen",
|
|
105
106
|
"webatlas.notification.error": "Ein Fehler ist aufgetreten",
|
|
106
107
|
"webatlas.notification.settings.saved": "Einstellungen erfolgreich gespeichert",
|
|
107
108
|
"webatlas.notification.routes.fetchFailed": "Routen konnten nicht abgerufen werden",
|
|
@@ -114,4 +115,4 @@ const de = {
|
|
|
114
115
|
export {
|
|
115
116
|
de as default
|
|
116
117
|
};
|
|
117
|
-
//# sourceMappingURL=de-
|
|
118
|
+
//# sourceMappingURL=de-CzVD4dbZ.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"de-
|
|
1
|
+
{"version":3,"file":"de-CzVD4dbZ.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -104,6 +104,7 @@ const en = {
|
|
|
104
104
|
"webatlas.draft": "Draft",
|
|
105
105
|
"webatlas.modified": "Modified",
|
|
106
106
|
"webatlas.deleted": "Deleted",
|
|
107
|
+
"webatlas.restore": "Restore",
|
|
107
108
|
"webatlas.notification.error": "An error occurred",
|
|
108
109
|
"webatlas.notification.settings.saved": "Settings saved successfully",
|
|
109
110
|
"webatlas.notification.routes.fetchFailed": "Failed to fetch routes",
|
|
@@ -114,4 +115,4 @@ const en = {
|
|
|
114
115
|
"webatlas.notification.navigation.creationFailed": "Creation of navigation failed"
|
|
115
116
|
};
|
|
116
117
|
exports.default = en;
|
|
117
|
-
//# sourceMappingURL=en-
|
|
118
|
+
//# sourceMappingURL=en-Du-Ap60j.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"en-Du-Ap60j.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -102,6 +102,7 @@ const en = {
|
|
|
102
102
|
"webatlas.draft": "Draft",
|
|
103
103
|
"webatlas.modified": "Modified",
|
|
104
104
|
"webatlas.deleted": "Deleted",
|
|
105
|
+
"webatlas.restore": "Restore",
|
|
105
106
|
"webatlas.notification.error": "An error occurred",
|
|
106
107
|
"webatlas.notification.settings.saved": "Settings saved successfully",
|
|
107
108
|
"webatlas.notification.routes.fetchFailed": "Failed to fetch routes",
|
|
@@ -114,4 +115,4 @@ const en = {
|
|
|
114
115
|
export {
|
|
115
116
|
en as default
|
|
116
117
|
};
|
|
117
|
-
//# sourceMappingURL=en-
|
|
118
|
+
//# sourceMappingURL=en-Nk6QcTdr.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en-
|
|
1
|
+
{"version":3,"file":"en-Nk6QcTdr.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -41,7 +41,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
|
41
41
|
);
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
|
-
const version = "0.
|
|
44
|
+
const version = "0.6.0";
|
|
45
45
|
const keywords = [];
|
|
46
46
|
const type = "commonjs";
|
|
47
47
|
const exports$1 = {
|
|
@@ -4077,7 +4077,7 @@ const index = {
|
|
|
4077
4077
|
defaultMessage: "Routes"
|
|
4078
4078
|
},
|
|
4079
4079
|
Component: async () => {
|
|
4080
|
-
const component = await Promise.resolve().then(() => require("./index-
|
|
4080
|
+
const component = await Promise.resolve().then(() => require("./index-DBVU2KOj.js"));
|
|
4081
4081
|
return { default: component.default };
|
|
4082
4082
|
},
|
|
4083
4083
|
permissions: [
|
|
@@ -4096,7 +4096,7 @@ const index = {
|
|
|
4096
4096
|
defaultMessage: "Navigation"
|
|
4097
4097
|
},
|
|
4098
4098
|
Component: async () => {
|
|
4099
|
-
const component = await Promise.resolve().then(() => require("./index-
|
|
4099
|
+
const component = await Promise.resolve().then(() => require("./index-BJHlAfrS.js"));
|
|
4100
4100
|
return { default: component.default };
|
|
4101
4101
|
},
|
|
4102
4102
|
permissions: [
|
|
@@ -4125,7 +4125,7 @@ const index = {
|
|
|
4125
4125
|
Component: async () => {
|
|
4126
4126
|
return await Promise.resolve().then(() => require(
|
|
4127
4127
|
/* webpackChunkName: "webatlas-settings-page" */
|
|
4128
|
-
"./index-
|
|
4128
|
+
"./index-D2CkoDhN.js"
|
|
4129
4129
|
));
|
|
4130
4130
|
},
|
|
4131
4131
|
permissions: [
|
|
@@ -4154,7 +4154,7 @@ const index = {
|
|
|
4154
4154
|
return Promise.all(
|
|
4155
4155
|
locales.map(async (locale) => {
|
|
4156
4156
|
try {
|
|
4157
|
-
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-
|
|
4157
|
+
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-CL1TIZPg.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-Du-Ap60j.js")) }), `./translations/${locale}.json`, 3);
|
|
4158
4158
|
return { data, locale };
|
|
4159
4159
|
} catch {
|
|
4160
4160
|
return { data: {}, locale };
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
4
|
const React = require("react");
|
|
5
5
|
const designSystem = require("@strapi/design-system");
|
|
6
|
-
const index = require("./index-
|
|
6
|
+
const index = require("./index-BvqWnL1-.js");
|
|
7
7
|
const admin = require("@strapi/strapi/admin");
|
|
8
8
|
const FullLoader = require("./FullLoader-Cmsf8xS6.js");
|
|
9
9
|
const EmptyBox = require("./EmptyBox-T8t29l25.js");
|
|
@@ -124,4 +124,4 @@ const Routes = () => {
|
|
|
124
124
|
] }) });
|
|
125
125
|
};
|
|
126
126
|
exports.default = Routes;
|
|
127
|
-
//# sourceMappingURL=index-
|
|
127
|
+
//# sourceMappingURL=index-BEwslndX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-D4tWVnt1.js","sources":["../../admin/src/utils/getRouteType.ts","../../admin/src/pages/Routes/TableHeader.tsx","../../admin/src/pages/Routes/TableRow.tsx","../../admin/src/pages/Routes/PageWrapper.tsx","../../admin/src/pages/Routes/index.tsx"],"sourcesContent":["import type { Route } from \"../../../types\";\n\nexport default function getRouteType(route: Route): 'internal' | 'external' | 'wrapper' {\n if (route.wrapper) {\n return 'wrapper';\n } else if (!route.internal) {\n return 'external';\n } else {\n return 'internal';\n }\n}","import { Typography, Thead, Tr, Th, VisuallyHidden } from '@strapi/design-system';\nimport { getTranslation } from '../../utils';\nimport { useIntl } from 'react-intl';\n\nexport default function TableHeader() {\n const { formatMessage } = useIntl();\n\n return (\n <Thead>\n <Tr>\n <Th>\n <Typography variant=\"sigma\">ID</Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\">\n {formatMessage({\n id: getTranslation('title'),\n defaultMessage: 'Title',\n })}\n </Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\">\n {formatMessage({\n id: getTranslation('route'),\n defaultMessage: 'Route',\n })}\n </Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\">\n {formatMessage({\n id: getTranslation('routes.page.column.type'),\n defaultMessage: 'Type',\n })}\n </Typography>\n </Th>\n <Th>\n <VisuallyHidden>\n {formatMessage({\n id: getTranslation('actions'),\n defaultMessage: 'Actions',\n })}\n </VisuallyHidden>\n </Th>\n </Tr>\n </Thead>\n )\n}","import type { Route } from '../../../../types';\nimport { Typography, Tr, Td, Flex, LinkButton } from '@strapi/design-system';\nimport { getTranslation, getRouteType } from '../../utils';\nimport { useIntl } from 'react-intl';\nimport { Pencil } from '@strapi/icons';\n\nexport default function TableRow({ route }: { route: Route }) {\n const { formatMessage } = useIntl();\n \n return (\n <Tr>\n <Td>\n <Typography textColor=\"neutral800\">{route.id}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">{route.title}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">{route.fullPath}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">\n {formatMessage({\n id: getTranslation(`route.type.${getRouteType(route)}`),\n defaultMessage: '-',\n })}\n </Typography>\n </Td>\n <Td>\n <Flex gap={2} justifyContent=\"end\">\n {route.internal && \n <LinkButton\n variant=\"secondary\"\n startIcon={<Pencil />} \n href={`/admin/content-manager/collection-types/${route.relatedContentType}/${route.relatedDocumentId}`}\n >\n {formatMessage({\n id: getTranslation('edit'),\n defaultMessage: 'Edit',\n })}\n </LinkButton>\n }\n </Flex>\n </Td>\n </Tr>\n )\n}","import { Layouts, Page } from '@strapi/strapi/admin';\nimport { Box } from '@strapi/design-system';\nimport { getTranslation } from '../../utils';\nimport { useIntl } from 'react-intl';\n\nexport default function PageWrapper({ children }: { children: React.ReactNode }) {\n const { formatMessage } = useIntl();\n\n return (\n <Page.Main>\n <Layouts.Header\n title={formatMessage({\n id: getTranslation('routes.page.title'),\n defaultMessage: 'Routes',\n })}\n subtitle={formatMessage({\n id: getTranslation('routes.page.subtitle'),\n defaultMessage: 'Overview of all existing routes',\n })}\n />\n <Layouts.Content>\n <Box>\n {children}\n </Box>\n </Layouts.Content>\n </Page.Main>\n );\n}","/*\n *\n * Routes\n * This file contains the Routes page of the Webatlas plugin for Strapi.\n * It displays a table of all existing routes with their details and allows editing.\n *\n*/\n\nimport type { Route } from '../../../../types';\nimport { useState, useEffect } from 'react';\nimport { Table, Tbody } from '@strapi/design-system';\nimport { useApi } from '../../hooks';\nimport { EmptyBox, Center, FullLoader } from '../../components/UI';\nimport { getTranslation } from '../../utils';\nimport { useIntl } from 'react-intl';\nimport TableHeader from './TableHeader';\nimport TableRow from './TableRow';\nimport { useNotification } from '@strapi/strapi/admin'\nimport PageWrapper from './PageWrapper';\n\nconst Routes = () => {\n const { getRoutes } = useApi();\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n \n const [routes, setRoutes] = useState<Route[]>([]);\n const [loading, setLoading] = useState(true);\n\n useEffect(() => {\n async function fetchRoutes() {\n try {\n const data = await getRoutes();\n setRoutes(data);\n } catch (err) {\n console.error('Failed to fetch routes:', err);\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: getTranslation('notification.routes.fetchFailed'),\n defaultMessage: 'Failed to fetch routes',\n }),\n });\n } finally {\n setLoading(false);\n }\n }\n fetchRoutes();\n }, [])\n\n if (loading) {\n return <PageWrapper>\n <FullLoader />\n </PageWrapper>\n }\n\n if (routes.length === 0) {\n return <PageWrapper>\n <Center height={400}>\n <EmptyBox msg={formatMessage({\n id: getTranslation('routes.page.emptyRoutes'),\n defaultMessage: 'No routes found',\n })} />\n </Center>\n </PageWrapper>;\n }\n return (\n <PageWrapper>\n <Table colCount={4} rowCount={routes.length}>\n <TableHeader />\n <Tbody>\n {routes.map((route: Route) => (\n <TableRow key={route.id} route={route} />\n ))}\n </Tbody>\n </Table>\n </PageWrapper>\n );\n};\n\nexport default Routes;"],"names":["useIntl","jsx","Thead","jsxs","Tr","Th","Typography","getTranslation","VisuallyHidden","Td","Flex","LinkButton","Pencil","Page","Layouts","Box","useApi","useNotification","useState","useEffect","FullLoader","Center","EmptyBox","Table","Tbody"],"mappings":";;;;;;;;;;;AAEA,SAAwB,aAAa,OAAmD;AACtF,MAAI,MAAM,SAAS;AACV,WAAA;AAAA,EAAA,WACE,CAAC,MAAM,UAAU;AACnB,WAAA;AAAA,EAAA,OACF;AACE,WAAA;AAAA,EAAA;AAEX;ACNA,SAAwB,cAAc;AAC9B,QAAA,EAAE,cAAc,IAAIA,kBAAQ;AAGhC,SAAAC,2BAAAA,IAACC,aAAAA,OACC,EAAA,UAAAC,2BAAAA,KAACC,aAAAA,IACC,EAAA,UAAA;AAAA,IAAAH,2BAAAA,IAACI,mBACC,UAACJ,2BAAA,IAAAK,aAAA,YAAA,EAAW,SAAQ,SAAQ,gBAAE,EAChC,CAAA;AAAA,mCACCD,aAAAA,IACC,EAAA,UAAAJ,2BAAA,IAACK,yBAAW,EAAA,SAAQ,SACjB,UAAc,cAAA;AAAA,MACb,IAAIC,qBAAe,OAAO;AAAA,MAC1B,gBAAgB;AAAA,IAAA,CACjB,GACH,EACF,CAAA;AAAA,mCACCF,aAAAA,IACC,EAAA,UAAAJ,2BAAA,IAACK,yBAAW,EAAA,SAAQ,SACjB,UAAc,cAAA;AAAA,MACb,IAAIC,qBAAe,OAAO;AAAA,MAC1B,gBA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,gBAAA,MAAM,2BAA2B,GAAG;AACzB,2BAAA;AAAA,UACjB,MAAM;AAAA,UACN,SAAS,cAAc;AAAA,YACrB,IAAIZ,qBAAe,iCAAiC;AAAA,YACpD,gBAAgB;AAAA,UACjB,CAAA;AAAA,QAAA,CACF;AAAA,MAAA,UACD;AACA,mBAAW,KAAK;AAAA,MAAA;AAAA,IAClB;AAEU,gBAAA;AAAA,EACd,GAAG,EAAE;AAEL,MAAI,SAAS;AACX,WAAQN,2BAAAA,IAAA,aAAA,EACN,UAACA,2BAAAA,IAAAmB,WAAA,YAAA,CAAW,CAAA,GACd;AAAA,EAAA;AAGE,MAAA,OAAO,WAAW,GAAG;AAChB,WAAAnB,2BAAA,IAAC,eACN,UAACA,2BAAAA,IAAAoB,WAAAA,QAAA,EAAO,QAAQ,KACd,UAAApB,2BAAA,IAACqB,SAAS,UAAA,EAAA,KAAK,cAAc;AAAA,MAC3B,IAAIf,qBAAe,yBAAyB;AAAA,MAC5C,gBAAgB;AAAA,IAAA,CACjB,EAAG,CAAA,EACN,CAAA,GACF;AAAA,EAAA;AAGA,SAAAN,2BAAA,IAAC,eACC,UAACE,2BAAA,KAAAoB,aAAA,OAAA,EAAM,UAAU,GAAG,UAAU,OAAO,QACnC,UAAA;AAAA,IAAAtB,2BAAA,IAAC,aAAY,EAAA;AAAA,IACZA,2BAAAA,IAAAuB,aAAAA,OAAA,EACE,UAAO,OAAA,IAAI,CAAC,UACVvB,2BAAAA,IAAA,UAAA,EAAwB,MAAV,GAAA,MAAM,EAAkB,CACxC,EACH,CAAA;AAAA,EAAA,EAAA,CACF,EACF,CAAA;AAEJ;;"}
|
|
1
|
+
{"version":3,"file":"index-BEwslndX.js","sources":["../../admin/src/utils/getRouteType.ts","../../admin/src/pages/Routes/TableHeader.tsx","../../admin/src/pages/Routes/TableRow.tsx","../../admin/src/pages/Routes/PageWrapper.tsx","../../admin/src/pages/Routes/index.tsx"],"sourcesContent":["import type { Route } from \"../../../types\";\n\nexport default function getRouteType(route: Route): 'internal' | 'external' | 'wrapper' {\n if (route.wrapper) {\n return 'wrapper';\n } else if (!route.internal) {\n return 'external';\n } else {\n return 'internal';\n }\n}","import { Typography, Thead, Tr, Th, VisuallyHidden } from '@strapi/design-system';\nimport { getTranslation } from '../../utils';\nimport { useIntl } from 'react-intl';\n\nexport default function TableHeader() {\n const { formatMessage } = useIntl();\n\n return (\n <Thead>\n <Tr>\n <Th>\n <Typography variant=\"sigma\">ID</Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\">\n {formatMessage({\n id: getTranslation('title'),\n defaultMessage: 'Title',\n })}\n </Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\">\n {formatMessage({\n id: getTranslation('route'),\n defaultMessage: 'Route',\n })}\n </Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\">\n {formatMessage({\n id: getTranslation('routes.page.column.type'),\n defaultMessage: 'Type',\n })}\n </Typography>\n </Th>\n <Th>\n <VisuallyHidden>\n {formatMessage({\n id: getTranslation('actions'),\n defaultMessage: 'Actions',\n })}\n </VisuallyHidden>\n </Th>\n </Tr>\n </Thead>\n )\n}","import type { Route } from '../../../../types';\nimport { Typography, Tr, Td, Flex, LinkButton } from '@strapi/design-system';\nimport { getTranslation, getRouteType } from '../../utils';\nimport { useIntl } from 'react-intl';\nimport { Pencil } from '@strapi/icons';\n\nexport default function TableRow({ route }: { route: Route }) {\n const { formatMessage } = useIntl();\n \n return (\n <Tr>\n <Td>\n <Typography textColor=\"neutral800\">{route.id}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">{route.title}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">{route.fullPath}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">\n {formatMessage({\n id: getTranslation(`route.type.${getRouteType(route)}`),\n defaultMessage: '-',\n })}\n </Typography>\n </Td>\n <Td>\n <Flex gap={2} justifyContent=\"end\">\n {route.internal && \n <LinkButton\n variant=\"secondary\"\n startIcon={<Pencil />} \n href={`/admin/content-manager/collection-types/${route.relatedContentType}/${route.relatedDocumentId}`}\n >\n {formatMessage({\n id: getTranslation('edit'),\n defaultMessage: 'Edit',\n })}\n </LinkButton>\n }\n </Flex>\n </Td>\n </Tr>\n )\n}","import { Layouts, Page } from '@strapi/strapi/admin';\nimport { Box } from '@strapi/design-system';\nimport { getTranslation } from '../../utils';\nimport { useIntl } from 'react-intl';\n\nexport default function PageWrapper({ children }: { children: React.ReactNode }) {\n const { formatMessage } = useIntl();\n\n return (\n <Page.Main>\n <Layouts.Header\n title={formatMessage({\n id: getTranslation('routes.page.title'),\n defaultMessage: 'Routes',\n })}\n subtitle={formatMessage({\n id: getTranslation('routes.page.subtitle'),\n defaultMessage: 'Overview of all existing routes',\n })}\n />\n <Layouts.Content>\n <Box>\n {children}\n </Box>\n </Layouts.Content>\n </Page.Main>\n );\n}","/*\n *\n * Routes\n * This file contains the Routes page of the Webatlas plugin for Strapi.\n * It displays a table of all existing routes with their details and allows editing.\n *\n*/\n\nimport type { Route } from '../../../../types';\nimport { useState, useEffect } from 'react';\nimport { Table, Tbody } from '@strapi/design-system';\nimport { useApi } from '../../hooks';\nimport { EmptyBox, Center, FullLoader } from '../../components/UI';\nimport { getTranslation } from '../../utils';\nimport { useIntl } from 'react-intl';\nimport TableHeader from './TableHeader';\nimport TableRow from './TableRow';\nimport { useNotification } from '@strapi/strapi/admin'\nimport PageWrapper from './PageWrapper';\n\nconst Routes = () => {\n const { getRoutes } = useApi();\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n \n const [routes, setRoutes] = useState<Route[]>([]);\n const [loading, setLoading] = useState(true);\n\n useEffect(() => {\n async function fetchRoutes() {\n try {\n const data = await getRoutes();\n setRoutes(data);\n } catch (err) {\n console.error('Failed to fetch routes:', err);\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: getTranslation('notification.routes.fetchFailed'),\n defaultMessage: 'Failed to fetch routes',\n }),\n });\n } finally {\n setLoading(false);\n }\n }\n fetchRoutes();\n }, [])\n\n if (loading) {\n return <PageWrapper>\n <FullLoader />\n </PageWrapper>\n }\n\n if (routes.length === 0) {\n return <PageWrapper>\n <Center height={400}>\n <EmptyBox msg={formatMessage({\n id: getTranslation('routes.page.emptyRoutes'),\n defaultMessage: 'No routes found',\n })} />\n </Center>\n </PageWrapper>;\n }\n return (\n <PageWrapper>\n <Table colCount={4} rowCount={routes.length}>\n <TableHeader />\n <Tbody>\n {routes.map((route: Route) => (\n <TableRow key={route.id} route={route} />\n ))}\n </Tbody>\n </Table>\n </PageWrapper>\n );\n};\n\nexport default Routes;"],"names":["useIntl","jsx","Thead","jsxs","Tr","Th","Typography","getTranslation","VisuallyHidden","Td","Flex","LinkButton","Pencil","Page","Layouts","Box","useApi","useNotification","useState","useEffect","FullLoader","Center","EmptyBox","Table","Tbody"],"mappings":";;;;;;;;;;;AAEA,SAAwB,aAAa,OAAmD;AACtF,MAAI,MAAM,SAAS;AACV,WAAA;AAAA,EAAA,WACE,CAAC,MAAM,UAAU;AACnB,WAAA;AAAA,EAAA,OACF;AACE,WAAA;AAAA,EAAA;AAEX;ACNA,SAAwB,cAAc;AAC9B,QAAA,EAAE,cAAc,IAAIA,kBAAQ;AAGhC,SAAAC,2BAAAA,IAACC,aAAAA,OACC,EAAA,UAAAC,2BAAAA,KAACC,aAAAA,IACC,EAAA,UAAA;AAAA,IAAAH,2BAAAA,IAACI,mBACC,UAACJ,2BAAA,IAAAK,aAAA,YAAA,EAAW,SAAQ,SAAQ,gBAAE,EAChC,CAAA;AAAA,mCACCD,aAAAA,IACC,EAAA,UAAAJ,2BAAA,IAACK,yBAAW,EAAA,SAAQ,SACjB,UAAc,cAAA;AAAA,MACb,IAAIC,qBAAe,OAAO;AAAA,MAC1B,gBAAgB;AAAA,IAAA,CACjB,GACH,EACF,CAAA;AAAA,mCACCF,aAAAA,IACC,EAAA,UAAAJ,2BAAA,IAACK,yBAAW,EAAA,SAAQ,SACjB,UAAc,cAAA;AAAA,MACb,IA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kBAAU,IAAI;AAAA,eACP,KAAK;AACJ,gBAAA,MAAM,2BAA2B,GAAG;AACzB,2BAAA;AAAA,UACjB,MAAM;AAAA,UACN,SAAS,cAAc;AAAA,YACrB,IAAIZ,qBAAe,iCAAiC;AAAA,YACpD,gBAAgB;AAAA,UACjB,CAAA;AAAA,QAAA,CACF;AAAA,MAAA,UACD;AACA,mBAAW,KAAK;AAAA,MAAA;AAAA,IAClB;AAEU,gBAAA;AAAA,EACd,GAAG,EAAE;AAEL,MAAI,SAAS;AACX,WAAQN,2BAAAA,IAAA,aAAA,EACN,UAACA,2BAAAA,IAAAmB,WAAA,YAAA,CAAW,CAAA,GACd;AAAA,EAAA;AAGE,MAAA,OAAO,WAAW,GAAG;AAChB,WAAAnB,2BAAA,IAAC,eACN,UAACA,2BAAAA,IAAAoB,WAAAA,QAAA,EAAO,QAAQ,KACd,UAAApB,2BAAA,IAACqB,SAAS,UAAA,EAAA,KAAK,cAAc;AAAA,MAC3B,IAAIf,qBAAe,yBAAyB;AAAA,MAC5C,gBAAgB;AAAA,IAAA,CACjB,EAAG,CAAA,EACN,CAAA,GACF;AAAA,EAAA;AAGA,SAAAN,2BAAA,IAAC,eACC,UAACE,2BAAA,KAAAoB,aAAA,OAAA,EAAM,UAAU,GAAG,UAAU,OAAO,QACnC,UAAA;AAAA,IAAAtB,2BAAA,IAAC,aAAY,EAAA;AAAA,IACZA,2BAAAA,IAAAuB,aAAAA,OAAA,EACE,UAAO,OAAA,IAAI,CAAC,UACVvB,2BAAAA,IAAA,UAAA,EAAwB,MAAV,GAAA,MAAM,EAAkB,CACxC,EACH,CAAA;AAAA,EAAA,EAAA,CACF,EACF,CAAA;AAEJ;;"}
|
|
@@ -7,7 +7,7 @@ const designSystem = require("@strapi/design-system");
|
|
|
7
7
|
const React = require("react");
|
|
8
8
|
const ReactDOM = require("react-dom");
|
|
9
9
|
const reactIntl = require("react-intl");
|
|
10
|
-
const index = require("./index-
|
|
10
|
+
const index = require("./index-B5ji2Qhs.js");
|
|
11
11
|
const admin = require("@strapi/strapi/admin");
|
|
12
12
|
const FullLoader = require("./FullLoader-Cmsf8xS6.js");
|
|
13
13
|
const EmptyBox = require("./EmptyBox-T8t29l25.js");
|
|
@@ -93,12 +93,12 @@ function Delete({ variant, item, onDelete }) {
|
|
|
93
93
|
const { setModalType } = React.useContext(ModalContext);
|
|
94
94
|
const { formatMessage } = reactIntl.useIntl();
|
|
95
95
|
const { deleteNavigation } = index.useApi();
|
|
96
|
-
|
|
96
|
+
reactRouterDom.useNavigate();
|
|
97
97
|
const handleDelete = async () => {
|
|
98
98
|
try {
|
|
99
99
|
if (variant === "NavDelete") {
|
|
100
100
|
await deleteNavigation(item.documentId);
|
|
101
|
-
|
|
101
|
+
onDelete(item);
|
|
102
102
|
} else if (variant === "ItemDelete") {
|
|
103
103
|
const editedItem = { ...item, deleted: true };
|
|
104
104
|
onDelete(editedItem);
|
|
@@ -10570,11 +10570,10 @@ function getProjection(items, activeId, overId, dragOffset) {
|
|
|
10570
10570
|
const activeItem = items[activeItemIndex];
|
|
10571
10571
|
const newItems = sortable.arrayMove(items, activeItemIndex, overItemIndex);
|
|
10572
10572
|
const previousItem = newItems[overItemIndex - 1];
|
|
10573
|
-
const nextItem = newItems[overItemIndex + 1];
|
|
10574
10573
|
const dragDepth = getDragDepth(dragOffset, indentationWidth);
|
|
10575
10574
|
const projectedDepth = activeItem && typeof activeItem.depth === "number" ? activeItem.depth + dragDepth : 0;
|
|
10576
|
-
|
|
10577
|
-
|
|
10575
|
+
let maxDepth = getMaxDepth({ previousItem });
|
|
10576
|
+
let minDepth = 0;
|
|
10578
10577
|
let depth = projectedDepth;
|
|
10579
10578
|
if (projectedDepth >= maxDepth) {
|
|
10580
10579
|
depth = maxDepth;
|
|
@@ -10589,12 +10588,6 @@ function getMaxDepth({ previousItem }) {
|
|
|
10589
10588
|
}
|
|
10590
10589
|
return 0;
|
|
10591
10590
|
}
|
|
10592
|
-
function getMinDepth({ nextItem }) {
|
|
10593
|
-
if (nextItem && typeof nextItem.depth === "number") {
|
|
10594
|
-
return nextItem.depth;
|
|
10595
|
-
}
|
|
10596
|
-
return 0;
|
|
10597
|
-
}
|
|
10598
10591
|
function getDragDepth(offset, indentationWidth2) {
|
|
10599
10592
|
return Math.round(offset / indentationWidth2);
|
|
10600
10593
|
}
|
|
@@ -10610,7 +10603,7 @@ function RouteIcon({ type, color = "neutral800" }) {
|
|
|
10610
10603
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "16px", height: "16px" });
|
|
10611
10604
|
}
|
|
10612
10605
|
}
|
|
10613
|
-
const RouteItem = React.forwardRef(({ item, setParentId, setActionItem, ghost, depth, style, wrapperRef, handleProps }, ref) => {
|
|
10606
|
+
const RouteItem = React.forwardRef(({ item, setParentId, setActionItem, setNavigationItems, ghost, depth, style, wrapperRef, handleProps }, ref) => {
|
|
10614
10607
|
if (!item || !item.route) return null;
|
|
10615
10608
|
const { setModalType } = React.useContext(ModalContext);
|
|
10616
10609
|
const { formatMessage } = reactIntl.useIntl();
|
|
@@ -10662,6 +10655,17 @@ const RouteItem = React.forwardRef(({ item, setParentId, setActionItem, ghost, d
|
|
|
10662
10655
|
setActionItem(item);
|
|
10663
10656
|
setModalType("ItemDelete");
|
|
10664
10657
|
};
|
|
10658
|
+
const handleRestore = () => {
|
|
10659
|
+
setNavigationItems(
|
|
10660
|
+
(navItems) => navItems?.map((navItem) => {
|
|
10661
|
+
if (navItem.documentId === item.documentId) {
|
|
10662
|
+
delete navItem.update;
|
|
10663
|
+
delete navItem.deleted;
|
|
10664
|
+
}
|
|
10665
|
+
return navItem;
|
|
10666
|
+
})
|
|
10667
|
+
);
|
|
10668
|
+
};
|
|
10665
10669
|
const elStyle = {
|
|
10666
10670
|
marginLeft: depth !== void 0 ? depth * 48 : 0,
|
|
10667
10671
|
opacity: ghost || item.deleted ? 0.5 : 1,
|
|
@@ -10718,18 +10722,24 @@ const RouteItem = React.forwardRef(({ item, setParentId, setActionItem, ghost, d
|
|
|
10718
10722
|
] }),
|
|
10719
10723
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "row", gap: 4, children: [
|
|
10720
10724
|
type === "internal" && item.status && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Status, { variant: itemStatusOptions[item.status].variant, size: "S", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: itemStatusOptions[item.status].status }) }),
|
|
10721
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.SimpleMenu, { label: "
|
|
10722
|
-
/* @__PURE__ */ jsxRuntime.
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
|
|
10731
|
-
|
|
10732
|
-
|
|
10725
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.SimpleMenu, { label: "Item actions", tag: designSystem.IconButton, icon: /* @__PURE__ */ jsxRuntime.jsx(icons.More, {}), children: [
|
|
10726
|
+
!item.deleted && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
10727
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.MenuItem, { onClick: () => handleEdit(), children: formatMessage({
|
|
10728
|
+
id: index.getTranslation("edit"),
|
|
10729
|
+
defaultMessage: "Edit"
|
|
10730
|
+
}) }),
|
|
10731
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.MenuItem, { onClick: () => handleAddChildren(), children: formatMessage({
|
|
10732
|
+
id: index.getTranslation("navigation.page.navItem.addChildren"),
|
|
10733
|
+
defaultMessage: "Add children"
|
|
10734
|
+
}) }),
|
|
10735
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.MenuItem, { onClick: () => handleDelete(), children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", children: formatMessage({
|
|
10736
|
+
id: index.getTranslation("delete"),
|
|
10737
|
+
defaultMessage: "Delete"
|
|
10738
|
+
}) }) })
|
|
10739
|
+
] }),
|
|
10740
|
+
(item.deleted || item.update) && /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.MenuItem, { onClick: () => handleRestore(), children: formatMessage({
|
|
10741
|
+
id: index.getTranslation("restore"),
|
|
10742
|
+
defaultMessage: "Restore"
|
|
10733
10743
|
}) }) })
|
|
10734
10744
|
] })
|
|
10735
10745
|
] })
|
|
@@ -10739,7 +10749,7 @@ const RouteItem = React.forwardRef(({ item, setParentId, setActionItem, ghost, d
|
|
|
10739
10749
|
}
|
|
10740
10750
|
);
|
|
10741
10751
|
});
|
|
10742
|
-
function SortableRouteItem({ item, depth, ...props }) {
|
|
10752
|
+
function SortableRouteItem({ item, depth, setNavigationItems, ...props }) {
|
|
10743
10753
|
if (!item) return null;
|
|
10744
10754
|
const {
|
|
10745
10755
|
isDragging,
|
|
@@ -10758,6 +10768,7 @@ function SortableRouteItem({ item, depth, ...props }) {
|
|
|
10758
10768
|
{
|
|
10759
10769
|
ref: setDraggableNodeRef,
|
|
10760
10770
|
wrapperRef: setDroppableNodeRef,
|
|
10771
|
+
setNavigationItems,
|
|
10761
10772
|
style,
|
|
10762
10773
|
item,
|
|
10763
10774
|
disableInteraction: isSorting,
|
|
@@ -10801,6 +10812,7 @@ function PageWrapper({ navigations, loading = false, children }) {
|
|
|
10801
10812
|
id: index.getTranslation("navigation.page.selectNavigation"),
|
|
10802
10813
|
defaultMessage: "Select Navigation"
|
|
10803
10814
|
}),
|
|
10815
|
+
selected: true,
|
|
10804
10816
|
onChange: (value) => {
|
|
10805
10817
|
const navItem = navigations.find((nav) => nav.slug === value);
|
|
10806
10818
|
navItem && navigate(`/plugins/webatlas/navigation/${navItem.documentId}`);
|
|
@@ -11802,6 +11814,7 @@ const Navigation = () => {
|
|
|
11802
11814
|
const { getNavigation, updateNavigationItemStructure } = index.useApi();
|
|
11803
11815
|
const [isSavingNavigation, setIsSavingNavigation] = React.useState(false);
|
|
11804
11816
|
const [loading, setLoading] = React.useState(true);
|
|
11817
|
+
const cachedNavigations = React.useRef(null);
|
|
11805
11818
|
const [projected, setProjected] = React.useState(null);
|
|
11806
11819
|
const [activeItem, setActiveItem] = React.useState();
|
|
11807
11820
|
const [activeId, setActiveId] = React.useState(null);
|
|
@@ -11845,11 +11858,10 @@ const Navigation = () => {
|
|
|
11845
11858
|
}) + ": " + updatedNavigations[0]?.name
|
|
11846
11859
|
});
|
|
11847
11860
|
navigate(`/plugins/webatlas/navigation/${updatedNavigations[0]?.documentId}`);
|
|
11861
|
+
return;
|
|
11848
11862
|
}
|
|
11849
|
-
|
|
11850
|
-
|
|
11851
|
-
setNavigationItems(selectedNav?.items || []);
|
|
11852
|
-
initialNavigationItemsRef.current = cloneDeep$1(selectedNav?.items) || null;
|
|
11863
|
+
cachedNavigations.current = updatedNavigations;
|
|
11864
|
+
switchNavigation(selectedNav, updatedNavigations);
|
|
11853
11865
|
} catch (error) {
|
|
11854
11866
|
console.error("Error fetching navigations: ", error);
|
|
11855
11867
|
toggleNotification({
|
|
@@ -11861,16 +11873,32 @@ const Navigation = () => {
|
|
|
11861
11873
|
});
|
|
11862
11874
|
}
|
|
11863
11875
|
}
|
|
11876
|
+
function switchNavigation(selectedNav, updatedNavigations) {
|
|
11877
|
+
setNavigations(updatedNavigations);
|
|
11878
|
+
setSelectedNavigation(selectedNav);
|
|
11879
|
+
setNavigationItems(selectedNav.items || []);
|
|
11880
|
+
initialNavigationItemsRef.current = cloneDeep$1(selectedNav.items) || null;
|
|
11881
|
+
}
|
|
11864
11882
|
React.useEffect(() => {
|
|
11865
11883
|
async function fetchNavigations() {
|
|
11866
11884
|
if (!navigationId) {
|
|
11867
|
-
const
|
|
11868
|
-
|
|
11869
|
-
|
|
11870
|
-
|
|
11871
|
-
|
|
11872
|
-
setLoading(false);
|
|
11885
|
+
const navs = await getNavigation({ variant: "namesOnly" });
|
|
11886
|
+
if (navs && navs.length > 0) {
|
|
11887
|
+
navigate(`/plugins/webatlas/navigation/${navs[0].documentId}`);
|
|
11888
|
+
}
|
|
11889
|
+
return;
|
|
11873
11890
|
}
|
|
11891
|
+
if (cachedNavigations.current) {
|
|
11892
|
+
const selectedNav = cachedNavigations.current.find((nav) => nav.documentId === navigationId);
|
|
11893
|
+
if (selectedNav) {
|
|
11894
|
+
switchNavigation(selectedNav, cachedNavigations.current);
|
|
11895
|
+
setLoading(false);
|
|
11896
|
+
return;
|
|
11897
|
+
}
|
|
11898
|
+
}
|
|
11899
|
+
setLoading(true);
|
|
11900
|
+
await loadNavigations();
|
|
11901
|
+
setLoading(false);
|
|
11874
11902
|
}
|
|
11875
11903
|
fetchNavigations();
|
|
11876
11904
|
}, [navigationId]);
|
|
@@ -11924,7 +11952,7 @@ const Navigation = () => {
|
|
|
11924
11952
|
})
|
|
11925
11953
|
});
|
|
11926
11954
|
} finally {
|
|
11927
|
-
loadNavigations();
|
|
11955
|
+
await loadNavigations();
|
|
11928
11956
|
setIsSavingNavigation(false);
|
|
11929
11957
|
}
|
|
11930
11958
|
}
|
|
@@ -11953,7 +11981,16 @@ const Navigation = () => {
|
|
|
11953
11981
|
const activeTreeItem = navigationItems[activeIndex];
|
|
11954
11982
|
navigationItems[activeIndex] = { ...activeTreeItem, depth };
|
|
11955
11983
|
const sortedItems = sortable.arrayMove(navigationItems, activeIndex, overIndex);
|
|
11956
|
-
|
|
11984
|
+
const fixedItems = [...sortedItems];
|
|
11985
|
+
fixedItems[0].depth = 0;
|
|
11986
|
+
for (let i = 1; i < fixedItems.length; i++) {
|
|
11987
|
+
const prev = fixedItems[i - 1].depth ?? 0;
|
|
11988
|
+
let curr = fixedItems[i].depth ?? 0;
|
|
11989
|
+
if (curr < 0) curr = 0;
|
|
11990
|
+
if (curr > prev + 1) curr = prev + 1;
|
|
11991
|
+
fixedItems[i].depth = curr;
|
|
11992
|
+
}
|
|
11993
|
+
setNavigationItems(fixedItems);
|
|
11957
11994
|
}
|
|
11958
11995
|
}
|
|
11959
11996
|
function resetState() {
|
|
@@ -12012,6 +12049,7 @@ const Navigation = () => {
|
|
|
12012
12049
|
item,
|
|
12013
12050
|
setParentId,
|
|
12014
12051
|
setActionItem,
|
|
12052
|
+
setNavigationItems,
|
|
12015
12053
|
indentationWidth,
|
|
12016
12054
|
depth: item.id === activeId && projected ? projected.depth : item.depth
|
|
12017
12055
|
},
|
|
@@ -12023,7 +12061,8 @@ const Navigation = () => {
|
|
|
12023
12061
|
{
|
|
12024
12062
|
item: activeItem,
|
|
12025
12063
|
setParentId,
|
|
12026
|
-
setActionItem
|
|
12064
|
+
setActionItem,
|
|
12065
|
+
setNavigationItems
|
|
12027
12066
|
}
|
|
12028
12067
|
) : null }),
|
|
12029
12068
|
document.body
|
|
@@ -12062,7 +12101,9 @@ const Navigation = () => {
|
|
|
12062
12101
|
{
|
|
12063
12102
|
variant: "NavDelete",
|
|
12064
12103
|
item: actionItem,
|
|
12065
|
-
onDelete: () => {
|
|
12104
|
+
onDelete: async () => {
|
|
12105
|
+
cachedNavigations.current = null;
|
|
12106
|
+
navigate("/plugins/webatlas/navigation");
|
|
12066
12107
|
}
|
|
12067
12108
|
}
|
|
12068
12109
|
),
|
|
@@ -2,7 +2,7 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useReducer, useState, useEffect } from "react";
|
|
3
3
|
import { Button, Box, Accordion, Field, SingleSelect, SingleSelectOption, MultiSelect, MultiSelectOption } from "@strapi/design-system";
|
|
4
4
|
import { Page, Layouts, useNotification } from "@strapi/strapi/admin";
|
|
5
|
-
import { P as PLUGIN_NAME, g as getTranslation, T as Tooltip, b as usePluginConfig, c as useAllContentTypes, t as transformToUrl } from "./index-
|
|
5
|
+
import { P as PLUGIN_NAME, g as getTranslation, T as Tooltip, b as usePluginConfig, c as useAllContentTypes, t as transformToUrl } from "./index-DesLqdi-.mjs";
|
|
6
6
|
import { useIntl } from "react-intl";
|
|
7
7
|
import "@strapi/icons/symbols";
|
|
8
8
|
import { F as FullLoader } from "./FullLoader-CrPED_dY.mjs";
|