@mattisvensson/strapi-plugin-webatlas 0.11.0 → 0.11.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/README.md +14 -8
- package/dist/admin/{FullLoader-CrPED_dY.mjs → FullLoader-Btjb2W2p.mjs} +5 -2
- package/dist/admin/FullLoader-Btjb2W2p.mjs.map +1 -0
- package/dist/admin/{FullLoader-Cmsf8xS6.js → FullLoader-Da2n70bJ.js} +5 -2
- package/dist/admin/FullLoader-Da2n70bJ.js.map +1 -0
- package/dist/admin/{SettingTitle-BjE_2u6R.js → SettingTitle-B0quw3f8.js} +6 -3
- package/dist/admin/SettingTitle-B0quw3f8.js.map +1 -0
- package/dist/admin/{SettingTitle-B1IaU3qs.mjs → SettingTitle-HMfQOJnK.mjs} +6 -3
- package/dist/admin/SettingTitle-HMfQOJnK.mjs.map +1 -0
- package/dist/admin/{index-Cf9j0bn2.mjs → index-9_HhKDUC.mjs} +32 -59
- package/dist/admin/index-9_HhKDUC.mjs.map +1 -0
- package/dist/admin/{index-DCYCtKrj.mjs → index-B79ELMEC.mjs} +221 -215
- package/dist/admin/index-B79ELMEC.mjs.map +1 -0
- package/dist/admin/{index-JLpXBQVL.js → index-BEVoxEAm.js} +32 -59
- package/dist/admin/index-BEVoxEAm.js.map +1 -0
- package/dist/admin/index-Bmg-ERct.mjs +244 -0
- package/dist/admin/index-Bmg-ERct.mjs.map +1 -0
- package/dist/admin/{index-AVI3QJ0R.js → index-C8YjuuOx.js} +497 -354
- package/dist/admin/index-C8YjuuOx.js.map +1 -0
- package/dist/admin/{index-Yq-QR8t0.js → index-Cx_mktdk.js} +221 -215
- package/dist/admin/index-Cx_mktdk.js.map +1 -0
- package/dist/admin/{index-BbnlyBrZ.mjs → index-Cz_k_jjp.mjs} +42 -31
- package/dist/admin/index-Cz_k_jjp.mjs.map +1 -0
- package/dist/admin/{index-D8bG0YFB.js → index-D2hB1vTw.js} +42 -31
- package/dist/admin/index-D2hB1vTw.js.map +1 -0
- package/dist/admin/index-YdWxpvOH.js +244 -0
- package/dist/admin/index-YdWxpvOH.js.map +1 -0
- package/dist/admin/{index-BIEUXWe7.mjs → index-oEJT_mvw.mjs} +497 -354
- package/dist/admin/index-oEJT_mvw.mjs.map +1 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +273 -214
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +273 -214
- package/dist/server/index.mjs.map +1 -1
- package/package.json +108 -108
- package/dist/admin/FullLoader-Cmsf8xS6.js.map +0 -1
- package/dist/admin/FullLoader-CrPED_dY.mjs.map +0 -1
- package/dist/admin/SettingTitle-B1IaU3qs.mjs.map +0 -1
- package/dist/admin/SettingTitle-BjE_2u6R.js.map +0 -1
- package/dist/admin/index-AVI3QJ0R.js.map +0 -1
- package/dist/admin/index-B90eSO4a.js +0 -219
- package/dist/admin/index-B90eSO4a.js.map +0 -1
- package/dist/admin/index-BIEUXWe7.mjs.map +0 -1
- package/dist/admin/index-BbnlyBrZ.mjs.map +0 -1
- package/dist/admin/index-Cf9j0bn2.mjs.map +0 -1
- package/dist/admin/index-D8bG0YFB.js.map +0 -1
- package/dist/admin/index-DCYCtKrj.mjs.map +0 -1
- package/dist/admin/index-JLpXBQVL.js.map +0 -1
- package/dist/admin/index-Y_PYIiRA.mjs +0 -219
- package/dist/admin/index-Y_PYIiRA.mjs.map +0 -1
- package/dist/admin/index-Yq-QR8t0.js.map +0 -1
package/README.md
CHANGED
|
@@ -27,10 +27,11 @@ This plugin is still in the early stages of development. Many features are plann
|
|
|
27
27
|
|
|
28
28
|
- **Strapi v5** - [v0.x.x (work in progress - beta)](https://github.com/mattisvensson/strapi-plugin-webatlas/releases)
|
|
29
29
|
- **Strapi v4** - not supported
|
|
30
|
+
|
|
30
31
|
## ✨ Features
|
|
31
32
|
|
|
32
33
|
- **🚀 Automatic Slug Generation:** Automatically generate clean, SEO-friendly slugs based on your content fields and the route hierarchy. No more manual slug writing — just choose the field, place it under a different route and the plugin takes care of the rest. Slugs are unique and easily customizable.
|
|
33
|
-
- **🗺️ Route Hierarchy and Overview:** Create a hierarchical structure for your routes and gain a full, centralized overview of all registered routes and their corresponding content entries.
|
|
34
|
+
- **🗺️ Route Hierarchy and Overview:** Create a hierarchical structure for your routes and gain a full, centralized overview of all registered routes and their corresponding content entries.
|
|
34
35
|
- **🧭 Multiple Navigations** Support for creating and managing multiple navigation structures. Whether it's a main menu, footer links, or a custom mobile drawer — organize your content into any number of navigations with drag-and-drop sorting, nested items, and visibility toggles.
|
|
35
36
|
- **🧩 Composable Component Integration** Use plugin-generated slugs and navigations directly in your frontend. Fetch routes and navigation data by slug and with a consistent API response, optimized for dynamic rendering.
|
|
36
37
|
- **🧠 Conflict Detection & Validation** Webatlas prevents slug collisions and helps avoid route conflicts by validating changes in real time. Get clear error messages and automatic suggestions when something doesn’t align.
|
|
@@ -38,13 +39,16 @@ This plugin is still in the early stages of development. Many features are plann
|
|
|
38
39
|
## ⏳ Installation
|
|
39
40
|
|
|
40
41
|
### Via command line
|
|
42
|
+
|
|
41
43
|
Install Webatlas via command line with a package manager of your choice.
|
|
42
44
|
Using NPM:
|
|
45
|
+
|
|
43
46
|
```bash
|
|
44
47
|
npm install @mattisvensson/strapi-plugin-webatlas@beta
|
|
45
48
|
```
|
|
46
49
|
|
|
47
50
|
Using Yarn:
|
|
51
|
+
|
|
48
52
|
```bash
|
|
49
53
|
yarn add @mattisvensson/strapi-plugin-webatlas@beta
|
|
50
54
|
```
|
|
@@ -66,13 +70,13 @@ Your schema should contain the following:
|
|
|
66
70
|
|
|
67
71
|
```json
|
|
68
72
|
{
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
// ... other schema properties ...
|
|
74
|
+
"pluginOptions": {
|
|
75
|
+
"webatlas": {
|
|
76
|
+
"enabled": true
|
|
77
|
+
}
|
|
78
|
+
// ... other plugin options ...
|
|
79
|
+
}
|
|
76
80
|
}
|
|
77
81
|
```
|
|
78
82
|
|
|
@@ -107,6 +111,7 @@ Webatlas provides two API endpoints. One to fetch routes and one to fetch naviga
|
|
|
107
111
|
`GET /api/webatlas/path`
|
|
108
112
|
|
|
109
113
|
Query parameters:
|
|
114
|
+
|
|
110
115
|
- `slug` (string, required): The slug/path to fetch the route for. This can either be the generated path from webatlas, the uId path or the canonical path.
|
|
111
116
|
- `populate` (string, optional): Comma-separated list of relations to populate. Use `deep` to populate all relations in any depth.
|
|
112
117
|
- `populateDeepDepth` (string, optional): Depth for deep population.
|
|
@@ -120,6 +125,7 @@ The response contains the entity's content type and a `webatlas` object with add
|
|
|
120
125
|
`GET /api/webatlas/navigation`
|
|
121
126
|
|
|
122
127
|
One of these query parameters (`documentId`, `slug`, `name`, or `id`) are mandatory to fetch a navigation. If you provide multiple, `documentId` has the highest priority, followed by `slug`, `name` and `id`.
|
|
128
|
+
|
|
123
129
|
- `documentId` (string, optional): The document ID of the navigation to fetch.
|
|
124
130
|
- `slug` (string, optional): The slug of the navigation to fetch.
|
|
125
131
|
- `name` (string, optional): The name of the navigation to fetch.
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Flex, Loader } from "@strapi/design-system";
|
|
3
|
-
function Center({
|
|
3
|
+
function Center({
|
|
4
|
+
height = 400,
|
|
5
|
+
children
|
|
6
|
+
}) {
|
|
4
7
|
return /* @__PURE__ */ jsx(Flex, { direction: "column", minHeight: `${height}px`, justifyContent: "center", children });
|
|
5
8
|
}
|
|
6
9
|
function FullLoader({ height }) {
|
|
@@ -10,4 +13,4 @@ export {
|
|
|
10
13
|
Center as C,
|
|
11
14
|
FullLoader as F
|
|
12
15
|
};
|
|
13
|
-
//# sourceMappingURL=FullLoader-
|
|
16
|
+
//# sourceMappingURL=FullLoader-Btjb2W2p.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FullLoader-Btjb2W2p.mjs","sources":["../../admin/src/components/UI/Center.tsx","../../admin/src/components/UI/FullLoader.tsx"],"sourcesContent":["import { Flex } from '@strapi/design-system'\n\nexport default function Center({\n\theight = 400,\n\tchildren,\n}: {\n\theight?: number\n\tchildren: React.ReactNode\n}) {\n\treturn (\n\t\t<Flex direction=\"column\" minHeight={`${height}px`} justifyContent=\"center\">\n\t\t\t{children}\n\t\t</Flex>\n\t)\n}\n","import { Loader, Box } from '@strapi/design-system'\nimport Center from './Center'\n\nexport default function FullLoader({ height }: { height?: number }) {\n\treturn (\n\t\t<Center height={height}>\n\t\t\t<Loader>Loading...</Loader>\n\t\t</Center>\n\t)\n}\n"],"names":[],"mappings":";;AAEA,SAAwB,OAAO;AAAA,EAC9B,SAAS;AAAA,EACT;AACD,GAGG;AACF,SACC,oBAAC,MAAA,EAAK,WAAU,UAAS,WAAW,GAAG,MAAM,MAAM,gBAAe,UAChE,SAAA,CACF;AAEF;ACXA,SAAwB,WAAW,EAAE,UAA+B;AACnE,6BACE,QAAA,EAAO,QACP,UAAA,oBAAC,QAAA,EAAO,wBAAU,EAAA,CACnB;AAEF;"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const designSystem = require("@strapi/design-system");
|
|
4
|
-
function Center({
|
|
4
|
+
function Center({
|
|
5
|
+
height = 400,
|
|
6
|
+
children
|
|
7
|
+
}) {
|
|
5
8
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", minHeight: `${height}px`, justifyContent: "center", children });
|
|
6
9
|
}
|
|
7
10
|
function FullLoader({ height }) {
|
|
@@ -9,4 +12,4 @@ function FullLoader({ height }) {
|
|
|
9
12
|
}
|
|
10
13
|
exports.Center = Center;
|
|
11
14
|
exports.FullLoader = FullLoader;
|
|
12
|
-
//# sourceMappingURL=FullLoader-
|
|
15
|
+
//# sourceMappingURL=FullLoader-Da2n70bJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FullLoader-Da2n70bJ.js","sources":["../../admin/src/components/UI/Center.tsx","../../admin/src/components/UI/FullLoader.tsx"],"sourcesContent":["import { Flex } from '@strapi/design-system'\n\nexport default function Center({\n\theight = 400,\n\tchildren,\n}: {\n\theight?: number\n\tchildren: React.ReactNode\n}) {\n\treturn (\n\t\t<Flex direction=\"column\" minHeight={`${height}px`} justifyContent=\"center\">\n\t\t\t{children}\n\t\t</Flex>\n\t)\n}\n","import { Loader, Box } from '@strapi/design-system'\nimport Center from './Center'\n\nexport default function FullLoader({ height }: { height?: number }) {\n\treturn (\n\t\t<Center height={height}>\n\t\t\t<Loader>Loading...</Loader>\n\t\t</Center>\n\t)\n}\n"],"names":["jsx","Flex","Loader"],"mappings":";;;AAEA,SAAwB,OAAO;AAAA,EAC9B,SAAS;AAAA,EACT;AACD,GAGG;AACF,SACCA,2BAAAA,IAACC,aAAAA,MAAA,EAAK,WAAU,UAAS,WAAW,GAAG,MAAM,MAAM,gBAAe,UAChE,SAAA,CACF;AAEF;ACXA,SAAwB,WAAW,EAAE,UAA+B;AACnE,wCACE,QAAA,EAAO,QACP,UAAAD,+BAACE,aAAAA,QAAA,EAAO,wBAAU,EAAA,CACnB;AAEF;;;"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
const jsxRuntime = require("react/jsx-runtime");
|
|
3
3
|
const designSystem = require("@strapi/design-system");
|
|
4
4
|
const admin = require("@strapi/strapi/admin");
|
|
5
|
-
const index = require("./index-
|
|
5
|
+
const index = require("./index-Cx_mktdk.js");
|
|
6
6
|
const reactIntl = require("react-intl");
|
|
7
7
|
const icons = require("@strapi/icons");
|
|
8
8
|
function PageWrapper({
|
|
@@ -38,7 +38,10 @@ function PageWrapper({
|
|
|
38
38
|
/* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children }) })
|
|
39
39
|
] });
|
|
40
40
|
}
|
|
41
|
-
function ContentBox({
|
|
41
|
+
function ContentBox({
|
|
42
|
+
title,
|
|
43
|
+
children
|
|
44
|
+
}) {
|
|
42
45
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
43
46
|
designSystem.Flex,
|
|
44
47
|
{
|
|
@@ -65,4 +68,4 @@ function SettingTitle({ children }) {
|
|
|
65
68
|
exports.ContentBox = ContentBox;
|
|
66
69
|
exports.PageWrapper = PageWrapper;
|
|
67
70
|
exports.SettingTitle = SettingTitle;
|
|
68
|
-
//# sourceMappingURL=SettingTitle-
|
|
71
|
+
//# sourceMappingURL=SettingTitle-B0quw3f8.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingTitle-B0quw3f8.js","sources":["../../admin/src/pages/Settings/PageWrapper.tsx","../../admin/src/pages/Settings/ContentBox.tsx","../../admin/src/pages/Settings/SettingTitle.tsx"],"sourcesContent":["import { Button, Flex } from '@strapi/design-system'\nimport { Page, Layouts } from '@strapi/strapi/admin'\nimport { PLUGIN_NAME } from '../../../../utils/pluginId'\nimport { getTranslation } from '../../utils'\nimport { useIntl } from 'react-intl'\nimport { Check } from '@strapi/icons'\n\nexport default function PageWrapper({\n\tsave,\n\tisSaving,\n\tdisabledCondition,\n\tsubtitle,\n\tchildren,\n}: {\n\tsave?: () => void\n\tisSaving: boolean\n\tdisabledCondition: boolean\n\tsubtitle: string\n\tchildren: React.ReactNode\n}) {\n\tconst { formatMessage } = useIntl()\n\n\treturn (\n\t\t<Page.Main>\n\t\t\t<Layouts.Header\n\t\t\t\ttitle={PLUGIN_NAME}\n\t\t\t\tsubtitle={subtitle}\n\t\t\t\tprimaryAction={\n\t\t\t\t\tdisabledCondition !== undefined &&\n\t\t\t\t\tsave && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tonClick={() => save()}\n\t\t\t\t\t\t\tloading={isSaving}\n\t\t\t\t\t\t\tdisabled={disabledCondition || isSaving}\n\t\t\t\t\t\t\tstartIcon={<Check />}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{/* <Check /> */}\n\t\t\t\t\t\t\t{formatMessage({\n\t\t\t\t\t\t\t\tid: getTranslation('save'),\n\t\t\t\t\t\t\t\tdefaultMessage: 'Save',\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<Layouts.Content>\n\t\t\t\t<Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n\t\t\t\t\t{children}\n\t\t\t\t</Flex>\n\t\t\t</Layouts.Content>\n\t\t</Page.Main>\n\t)\n}\n","import { Typography, Flex, Box } from '@strapi/design-system'\n\nexport default function ContentBox({\n\ttitle,\n\tchildren,\n}: {\n\ttitle: string\n\tchildren: React.ReactNode\n}) {\n\treturn (\n\t\t<Flex\n\t\t\tbackground=\"neutral0\"\n\t\t\thasRadius\n\t\t\tpaddingTop={6}\n\t\t\tpaddingBottom={6}\n\t\t\tpaddingLeft={7}\n\t\t\tpaddingRight={7}\n\t\t\tshadow=\"tableShadow\"\n\t\t\tdirection=\"column\"\n\t\t\talignItems=\"stretch\"\n\t\t\tgap={4}\n\t\t>\n\t\t\t<Typography variant=\"delta\">{title}</Typography>\n\t\t\t<Box>{children}</Box>\n\t\t</Flex>\n\t)\n}\n","import { Typography } from '@strapi/design-system'\n\nexport default function SettingTitle({ children }: { children: React.ReactNode }) {\n\treturn (\n\t\t<Typography variant=\"sigma\" textColor=\"neutral600\">\n\t\t\t{children}\n\t\t</Typography>\n\t)\n}\n"],"names":["useIntl","jsxs","Page","jsx","Layouts","PLUGIN_NAME","Button","Check","getTranslation","Flex","Typography","Box"],"mappings":";;;;;;;AAOA,SAAwB,YAAY;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;A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YAAA,EAAW,SAAQ,SAAQ,WAAU,cACpC,UACF;AAEF;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Button, Flex, Typography, Box } from "@strapi/design-system";
|
|
3
3
|
import { Page, Layouts } from "@strapi/strapi/admin";
|
|
4
|
-
import { f as PLUGIN_NAME, g as getTranslation } from "./index-
|
|
4
|
+
import { f as PLUGIN_NAME, g as getTranslation } from "./index-B79ELMEC.mjs";
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
6
|
import { Check } from "@strapi/icons";
|
|
7
7
|
function PageWrapper({
|
|
@@ -37,7 +37,10 @@ function PageWrapper({
|
|
|
37
37
|
/* @__PURE__ */ jsx(Layouts.Content, { children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children }) })
|
|
38
38
|
] });
|
|
39
39
|
}
|
|
40
|
-
function ContentBox({
|
|
40
|
+
function ContentBox({
|
|
41
|
+
title,
|
|
42
|
+
children
|
|
43
|
+
}) {
|
|
41
44
|
return /* @__PURE__ */ jsxs(
|
|
42
45
|
Flex,
|
|
43
46
|
{
|
|
@@ -66,4 +69,4 @@ export {
|
|
|
66
69
|
PageWrapper as P,
|
|
67
70
|
SettingTitle as S
|
|
68
71
|
};
|
|
69
|
-
//# sourceMappingURL=SettingTitle-
|
|
72
|
+
//# sourceMappingURL=SettingTitle-HMfQOJnK.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SettingTitle-HMfQOJnK.mjs","sources":["../../admin/src/pages/Settings/PageWrapper.tsx","../../admin/src/pages/Settings/ContentBox.tsx","../../admin/src/pages/Settings/SettingTitle.tsx"],"sourcesContent":["import { Button, Flex } from '@strapi/design-system'\nimport { Page, Layouts } from '@strapi/strapi/admin'\nimport { PLUGIN_NAME } from '../../../../utils/pluginId'\nimport { getTranslation } from '../../utils'\nimport { useIntl } from 'react-intl'\nimport { Check } from '@strapi/icons'\n\nexport default function PageWrapper({\n\tsave,\n\tisSaving,\n\tdisabledCondition,\n\tsubtitle,\n\tchildren,\n}: {\n\tsave?: () => void\n\tisSaving: boolean\n\tdisabledCondition: boolean\n\tsubtitle: string\n\tchildren: React.ReactNode\n}) {\n\tconst { formatMessage } = useIntl()\n\n\treturn (\n\t\t<Page.Main>\n\t\t\t<Layouts.Header\n\t\t\t\ttitle={PLUGIN_NAME}\n\t\t\t\tsubtitle={subtitle}\n\t\t\t\tprimaryAction={\n\t\t\t\t\tdisabledCondition !== undefined &&\n\t\t\t\t\tsave && (\n\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\ttype=\"submit\"\n\t\t\t\t\t\t\tonClick={() => save()}\n\t\t\t\t\t\t\tloading={isSaving}\n\t\t\t\t\t\t\tdisabled={disabledCondition || isSaving}\n\t\t\t\t\t\t\tstartIcon={<Check />}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{/* <Check /> */}\n\t\t\t\t\t\t\t{formatMessage({\n\t\t\t\t\t\t\t\tid: getTranslation('save'),\n\t\t\t\t\t\t\t\tdefaultMessage: 'Save',\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</Button>\n\t\t\t\t\t)\n\t\t\t\t}\n\t\t\t/>\n\t\t\t<Layouts.Content>\n\t\t\t\t<Flex direction=\"column\" alignItems=\"stretch\" gap={6}>\n\t\t\t\t\t{children}\n\t\t\t\t</Flex>\n\t\t\t</Layouts.Content>\n\t\t</Page.Main>\n\t)\n}\n","import { Typography, Flex, Box } from '@strapi/design-system'\n\nexport default function ContentBox({\n\ttitle,\n\tchildren,\n}: {\n\ttitle: string\n\tchildren: React.ReactNode\n}) {\n\treturn (\n\t\t<Flex\n\t\t\tbackground=\"neutral0\"\n\t\t\thasRadius\n\t\t\tpaddingTop={6}\n\t\t\tpaddingBottom={6}\n\t\t\tpaddingLeft={7}\n\t\t\tpaddingRight={7}\n\t\t\tshadow=\"tableShadow\"\n\t\t\tdirection=\"column\"\n\t\t\talignItems=\"stretch\"\n\t\t\tgap={4}\n\t\t>\n\t\t\t<Typography variant=\"delta\">{title}</Typography>\n\t\t\t<Box>{children}</Box>\n\t\t</Flex>\n\t)\n}\n","import { Typography } from '@strapi/design-system'\n\nexport default function SettingTitle({ children }: { children: React.ReactNode }) {\n\treturn (\n\t\t<Typography variant=\"sigma\" textColor=\"neutral600\">\n\t\t\t{children}\n\t\t</Typography>\n\t)\n}\n"],"names":[],"mappings":";;;;;;AAOA,SAAwB,YAAY;AAAA,EACnC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,GAMG;AACF,QAAM,EAAE,cAAA,IAAkB,QAAA;AAE1B,SACC,qBAAC,KAAK,MAAL,EACA,UAAA;AAAA,IAAA;AAAA,MAAC,QAAQ;AAAA,MAAR;AAAA,QACA,OAAO;AAAA,QACP;AAAA,QACA,eACC,sBAAsB,UACtB,QACC;AAAA,UAAC;AAAA,UAAA;AAAA,YACA,MAAK;AAAA,YACL,SAAS,MAAM,KAAA;AAAA,YACf,SAAS;AAAA,YACT,UAAU,qBAAqB;AAAA,YAC/B,+BAAY,OAAA,EAAM;AAAA,YAGjB,UAAA,cAAc;AAAA,cACd,IAAI,eAAe,MAAM;AAAA,cACzB,gBAAgB;AAAA,YAAA,CAChB;AAAA,UAAA;AAAA,QAAA;AAAA,MACF;AAAA,IAAA;AAAA,IAIH,oBAAC,QAAQ,SAAR,EACA,UAAA,oBAAC,MAAA,EAAK,WAAU,UAAS,YAAW,WAAU,KAAK,GACjD,UACF,EAAA,CACD;AAAA,EAAA,GACD;AAEF;ACnDA,SAAwB,WAAW;AAAA,EAClC;AAAA,EACA;AACD,GAGG;AACF,SACC;AAAA,IAAC;AAAA,IAAA;AAAA,MACA,YAAW;AAAA,MACX,WAAS;AAAA,MACT,YAAY;AAAA,MACZ,eAAe;AAAA,MACf,aAAa;AAAA,MACb,cAAc;AAAA,MACd,QAAO;AAAA,MACP,WAAU;AAAA,MACV,YAAW;AAAA,MACX,KAAK;AAAA,MAEL,UAAA;AAAA,QAAA,oBAAC,YAAA,EAAW,SAAQ,SAAS,UAAA,OAAM;AAAA,QACnC,oBAAC,OAAK,SAAA,CAAS;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGlB;ACxBA,SAAwB,aAAa,EAAE,YAA2C;AACjF,6BACE,YAAA,EAAW,SAAQ,SAAQ,WAAU,cACpC,UACF;AAEF;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsxs, jsx, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useEffect, useMemo } from "react";
|
|
3
|
-
import { g as getTranslation, u as useApi, d as debounce, p as pluginPermissions } from "./index-
|
|
3
|
+
import { g as getTranslation, u as useApi, d as debounce, p as pluginPermissions } from "./index-B79ELMEC.mjs";
|
|
4
4
|
import { Page, Layouts, useNotification } from "@strapi/strapi/admin";
|
|
5
5
|
import { Grid, Box, Field, Thead, Tr, Th, Typography, VisuallyHidden, Td, Flex, LinkButton, Table, Tbody, EmptyStateLayout } from "@strapi/design-system";
|
|
6
6
|
import "@strapi/icons/symbols";
|
|
7
|
-
import { F as FullLoader } from "./FullLoader-
|
|
7
|
+
import { F as FullLoader } from "./FullLoader-Btjb2W2p.mjs";
|
|
8
8
|
import { useIntl } from "react-intl";
|
|
9
9
|
import { useSearchParams } from "react-router-dom";
|
|
10
10
|
import { Cross, ChevronDown, Pencil } from "@strapi/icons";
|
|
@@ -73,8 +73,15 @@ function SearchInput({
|
|
|
73
73
|
"button",
|
|
74
74
|
{
|
|
75
75
|
type: "button",
|
|
76
|
-
onClick: () => handleSearchChange({
|
|
77
|
-
|
|
76
|
+
onClick: () => handleSearchChange({
|
|
77
|
+
target: { value: "" }
|
|
78
|
+
}),
|
|
79
|
+
style: {
|
|
80
|
+
color: "inherit",
|
|
81
|
+
background: "none",
|
|
82
|
+
border: "none",
|
|
83
|
+
cursor: "pointer"
|
|
84
|
+
},
|
|
78
85
|
"aria-label": "Clear search",
|
|
79
86
|
children: /* @__PURE__ */ jsx(Cross, {})
|
|
80
87
|
}
|
|
@@ -125,25 +132,11 @@ function TableHeader({
|
|
|
125
132
|
function TableRow({ route }) {
|
|
126
133
|
const { formatMessage } = useIntl();
|
|
127
134
|
return /* @__PURE__ */ jsxs(Tr, { children: [
|
|
128
|
-
[route.title, route.canonicalPath, route.path].map((field, index) => /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
|
|
129
|
-
|
|
130
|
-
{
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
children: field || "-"
|
|
134
|
-
}
|
|
135
|
-
) }, index)),
|
|
136
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
|
|
137
|
-
Typography,
|
|
138
|
-
{
|
|
139
|
-
title: route.type,
|
|
140
|
-
textColor: "neutral800",
|
|
141
|
-
children: formatMessage({
|
|
142
|
-
id: getTranslation(`path.type.${route.type}`),
|
|
143
|
-
defaultMessage: "-"
|
|
144
|
-
})
|
|
145
|
-
}
|
|
146
|
-
) }),
|
|
135
|
+
[route.title, route.canonicalPath, route.path].map((field, index) => /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { title: field, textColor: "neutral800", children: field || "-" }) }, index)),
|
|
136
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { title: route.type, textColor: "neutral800", children: formatMessage({
|
|
137
|
+
id: getTranslation(`path.type.${route.type}`),
|
|
138
|
+
defaultMessage: "-"
|
|
139
|
+
}) }) }),
|
|
147
140
|
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Flex, { gap: 2, justifyContent: "end", children: route.type === "internal" && /* @__PURE__ */ jsx(
|
|
148
141
|
LinkButton,
|
|
149
142
|
{
|
|
@@ -165,26 +158,19 @@ function PathTable({
|
|
|
165
158
|
}) {
|
|
166
159
|
const { formatMessage } = useIntl();
|
|
167
160
|
const TABLE_COL_COUNT = 5;
|
|
168
|
-
return /* @__PURE__ */ jsxs(
|
|
169
|
-
|
|
170
|
-
{
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
defaultMessage: "No paths found"
|
|
182
|
-
})
|
|
183
|
-
}
|
|
184
|
-
) }) }) })
|
|
185
|
-
]
|
|
186
|
-
}
|
|
187
|
-
);
|
|
161
|
+
return /* @__PURE__ */ jsxs(Table, { colCount: TABLE_COL_COUNT, rowCount: routes.length, children: [
|
|
162
|
+
/* @__PURE__ */ jsx(TableHeader, { sortKey, handleSort }),
|
|
163
|
+
/* @__PURE__ */ jsx(Tbody, { children: routes.length > 0 ? routes.map((route) => /* @__PURE__ */ jsx(TableRow, { route }, route.id)) : /* @__PURE__ */ jsx(Tr, { children: /* @__PURE__ */ jsx(Td, { colSpan: TABLE_COL_COUNT, children: /* @__PURE__ */ jsx(
|
|
164
|
+
EmptyStateLayout,
|
|
165
|
+
{
|
|
166
|
+
shadow: "none",
|
|
167
|
+
content: formatMessage({
|
|
168
|
+
id: getTranslation("paths.page.emptyPaths"),
|
|
169
|
+
defaultMessage: "No paths found"
|
|
170
|
+
})
|
|
171
|
+
}
|
|
172
|
+
) }) }) })
|
|
173
|
+
] });
|
|
188
174
|
}
|
|
189
175
|
const Paths = () => {
|
|
190
176
|
const { getAllRoutes } = useApi();
|
|
@@ -249,24 +235,11 @@ const Paths = () => {
|
|
|
249
235
|
return /* @__PURE__ */ jsx(PageWrapper, { children: /* @__PURE__ */ jsx(FullLoader, {}) });
|
|
250
236
|
}
|
|
251
237
|
return /* @__PURE__ */ jsx(Page.Protect, { permissions: pluginPermissions["page.routes"], children: /* @__PURE__ */ jsxs(PageWrapper, { children: [
|
|
252
|
-
/* @__PURE__ */ jsx(
|
|
253
|
-
|
|
254
|
-
{
|
|
255
|
-
handleSearchChange,
|
|
256
|
-
searchQuery
|
|
257
|
-
}
|
|
258
|
-
),
|
|
259
|
-
/* @__PURE__ */ jsx(
|
|
260
|
-
PathTable,
|
|
261
|
-
{
|
|
262
|
-
routes: sortedRoutes,
|
|
263
|
-
sortKey,
|
|
264
|
-
handleSort
|
|
265
|
-
}
|
|
266
|
-
)
|
|
238
|
+
/* @__PURE__ */ jsx(SearchInput, { handleSearchChange, searchQuery }),
|
|
239
|
+
/* @__PURE__ */ jsx(PathTable, { routes: sortedRoutes, sortKey, handleSort })
|
|
267
240
|
] }) });
|
|
268
241
|
};
|
|
269
242
|
export {
|
|
270
243
|
Paths as default
|
|
271
244
|
};
|
|
272
|
-
//# sourceMappingURL=index-
|
|
245
|
+
//# sourceMappingURL=index-9_HhKDUC.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-9_HhKDUC.mjs","sources":["../../admin/src/pages/Paths/PageWrapper.tsx","../../admin/src/pages/Paths/compareBy.ts","../../admin/src/pages/Paths/SearchInput.tsx","../../admin/src/pages/Paths/TableHeader.tsx","../../admin/src/pages/Paths/TableRow.tsx","../../admin/src/pages/Paths/PathTable.tsx","../../admin/src/pages/Paths/index.tsx"],"sourcesContent":["import { Layouts, Page } from '@strapi/strapi/admin'\nimport { getTranslation } from '../../utils'\nimport { useIntl } from 'react-intl'\n\nexport default function PageWrapper({ children }: { children: React.ReactNode }) {\n\tconst { formatMessage } = useIntl()\n\n\treturn (\n\t\t<Page.Main>\n\t\t\t<Layouts.Header\n\t\t\t\ttitle={formatMessage({\n\t\t\t\t\tid: getTranslation('paths.page.title'),\n\t\t\t\t\tdefaultMessage: 'Paths',\n\t\t\t\t})}\n\t\t\t\tsubtitle={formatMessage({\n\t\t\t\t\tid: getTranslation('paths.page.subtitle'),\n\t\t\t\t\tdefaultMessage: 'Overview of all existing paths',\n\t\t\t\t})}\n\t\t\t/>\n\t\t\t<Layouts.Content>\n\t\t\t\t<>{children}</>\n\t\t\t</Layouts.Content>\n\t\t</Page.Main>\n\t)\n}\n","import type { Route } from '../../../../types'\nimport type { RouteSortKey } from '../../types'\n\nexport default function compareBy(field: RouteSortKey, direction: 'asc' | 'desc') {\n\tif (!field) {\n\t\treturn () => 0\n\t}\n\tif (field === 'type') {\n\t\treturn (a: Route, b: Route) => {\n\t\t\treturn direction === 'asc' ? a.type.localeCompare(b.type) : b.type.localeCompare(a.type)\n\t\t}\n\t}\n\treturn (a: Route, b: Route) => {\n\t\tconst aValue = a[field]\n\t\tconst bValue = b[field]\n\n\t\tif (aValue == null && bValue == null) {\n\t\t\treturn 0\n\t\t}\n\t\tif (aValue == null) {\n\t\t\treturn direction === 'asc' ? 1 : -1\n\t\t}\n\t\tif (bValue == null) {\n\t\t\treturn direction === 'asc' ? -1 : 1\n\t\t}\n\n\t\tif (typeof aValue === 'string' && typeof bValue === 'string') {\n\t\t\treturn direction === 'asc' ? aValue.localeCompare(bValue) : bValue.localeCompare(aValue)\n\t\t}\n\t\treturn 0\n\t}\n}\n","import { Box, Grid, Field } from '@strapi/design-system'\nimport { Cross } from '@strapi/icons'\nimport { useIntl } from 'react-intl'\nimport { getTranslation } from '../../utils'\n\nfunction SearchInput({\n\tsearchQuery,\n\thandleSearchChange,\n}: {\n\tsearchQuery: string\n\thandleSearchChange: (e: React.ChangeEvent<HTMLInputElement>) => void\n}) {\n\tconst { formatMessage } = useIntl()\n\n\treturn (\n\t\t<Grid.Root style={{ marginBottom: '16px' }}>\n\t\t\t<Grid.Item col={4} s={12}>\n\t\t\t\t<Box width=\"100%\">\n\t\t\t\t\t<Field.Root>\n\t\t\t\t\t\t<Field.Input\n\t\t\t\t\t\t\tname=\"search\"\n\t\t\t\t\t\t\tplaceholder={formatMessage({\n\t\t\t\t\t\t\t\tid: getTranslation('paths.page.searchPlaceholder'),\n\t\t\t\t\t\t\t\tdefaultMessage: 'Search paths',\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\tvalue={searchQuery}\n\t\t\t\t\t\t\tonChange={handleSearchChange}\n\t\t\t\t\t\t\tendAction={\n\t\t\t\t\t\t\t\tsearchQuery ? (\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\tonClick={() =>\n\t\t\t\t\t\t\t\t\t\t\thandleSearchChange({\n\t\t\t\t\t\t\t\t\t\t\t\ttarget: { value: '' },\n\t\t\t\t\t\t\t\t\t\t\t} as React.ChangeEvent<HTMLInputElement>)\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\tstyle={{\n\t\t\t\t\t\t\t\t\t\t\tcolor: 'inherit',\n\t\t\t\t\t\t\t\t\t\t\tbackground: 'none',\n\t\t\t\t\t\t\t\t\t\t\tborder: 'none',\n\t\t\t\t\t\t\t\t\t\t\tcursor: 'pointer',\n\t\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\t\taria-label=\"Clear search\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<Cross />\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t) : null\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t/>\n\t\t\t\t\t</Field.Root>\n\t\t\t\t</Box>\n\t\t\t</Grid.Item>\n\t\t</Grid.Root>\n\t)\n}\n\nexport default SearchInput\n","import type { RouteSortKey } from '../../types'\nimport { Typography, Thead, Tr, Th, VisuallyHidden } from '@strapi/design-system'\nimport { getTranslation } from '../../utils'\nimport { useIntl } from 'react-intl'\nimport { ChevronDown } from '@strapi/icons'\n\nexport default function TableHeader({\n\tsortKey,\n\thandleSort,\n}: {\n\tsortKey: RouteSortKey\n\thandleSort: (key: RouteSortKey) => void\n}) {\n\tconst { formatMessage } = useIntl()\n\n\treturn (\n\t\t<Thead>\n\t\t\t<Tr>\n\t\t\t\t<Th onClick={() => handleSort('title')} cursor=\"pointer\">\n\t\t\t\t\t<Typography variant=\"sigma\">\n\t\t\t\t\t\t{formatMessage({\n\t\t\t\t\t\t\tid: getTranslation('title'),\n\t\t\t\t\t\t\tdefaultMessage: 'Title',\n\t\t\t\t\t\t})}\n\t\t\t\t\t</Typography>\n\t\t\t\t\t{sortKey === 'title' && <ChevronDown />}\n\t\t\t\t</Th>\n\t\t\t\t<Th onClick={() => handleSort('canonicalPath')} cursor=\"pointer\">\n\t\t\t\t\t<Typography variant=\"sigma\">\n\t\t\t\t\t\t{formatMessage({\n\t\t\t\t\t\t\tid: getTranslation('canonicalPath'),\n\t\t\t\t\t\t\tdefaultMessage: 'Canonical Path',\n\t\t\t\t\t\t})}\n\t\t\t\t\t</Typography>\n\t\t\t\t\t{sortKey === 'canonicalPath' && <ChevronDown />}\n\t\t\t\t</Th>\n\t\t\t\t<Th onClick={() => handleSort('path')} cursor=\"pointer\">\n\t\t\t\t\t<Typography variant=\"sigma\">\n\t\t\t\t\t\t{formatMessage({\n\t\t\t\t\t\t\tid: getTranslation('path'),\n\t\t\t\t\t\t\tdefaultMessage: 'Path',\n\t\t\t\t\t\t})}\n\t\t\t\t\t</Typography>\n\t\t\t\t\t{sortKey === 'path' && <ChevronDown />}\n\t\t\t\t</Th>\n\t\t\t\t<Th onClick={() => handleSort('type')} cursor=\"pointer\">\n\t\t\t\t\t<Typography variant=\"sigma\">\n\t\t\t\t\t\t{formatMessage({\n\t\t\t\t\t\t\tid: getTranslation('paths.page.column.type'),\n\t\t\t\t\t\t\tdefaultMessage: 'Type',\n\t\t\t\t\t\t})}\n\t\t\t\t\t</Typography>\n\t\t\t\t\t{sortKey === 'type' && <ChevronDown />}\n\t\t\t\t</Th>\n\t\t\t\t<Th>\n\t\t\t\t\t<VisuallyHidden>\n\t\t\t\t\t\t{formatMessage({\n\t\t\t\t\t\t\tid: getTranslation('actions'),\n\t\t\t\t\t\t\tdefaultMessage: 'Actions',\n\t\t\t\t\t\t})}\n\t\t\t\t\t</VisuallyHidden>\n\t\t\t\t</Th>\n\t\t\t</Tr>\n\t\t</Thead>\n\t)\n}\n","import type { Route } from '../../../../types'\nimport { Typography, Tr, Td, Flex, LinkButton } from '@strapi/design-system'\nimport { getTranslation } from '../../utils'\nimport { useIntl } from 'react-intl'\nimport { Pencil } from '@strapi/icons'\n\nexport default function TableRow({ route }: { route: Route }) {\n\tconst { formatMessage } = useIntl()\n\n\treturn (\n\t\t<Tr>\n\t\t\t{[route.title, route.canonicalPath, route.path].map((field, index) => (\n\t\t\t\t<Td key={index}>\n\t\t\t\t\t<Typography title={field} textColor=\"neutral800\">\n\t\t\t\t\t\t{field || '-'}\n\t\t\t\t\t</Typography>\n\t\t\t\t</Td>\n\t\t\t))}\n\t\t\t<Td>\n\t\t\t\t<Typography title={route.type} textColor=\"neutral800\">\n\t\t\t\t\t{formatMessage({\n\t\t\t\t\t\tid: getTranslation(`path.type.${route.type}`),\n\t\t\t\t\t\tdefaultMessage: '-',\n\t\t\t\t\t})}\n\t\t\t\t</Typography>\n\t\t\t</Td>\n\t\t\t<Td>\n\t\t\t\t<Flex gap={2} justifyContent=\"end\">\n\t\t\t\t\t{route.type === 'internal' && (\n\t\t\t\t\t\t<LinkButton\n\t\t\t\t\t\t\tvariant=\"secondary\"\n\t\t\t\t\t\t\tstartIcon={<Pencil />}\n\t\t\t\t\t\t\thref={`/admin/content-manager/collection-types/${route.relatedContentType}/${route.relatedDocumentId}`}\n\t\t\t\t\t\t>\n\t\t\t\t\t\t\t{formatMessage({\n\t\t\t\t\t\t\t\tid: getTranslation('edit'),\n\t\t\t\t\t\t\t\tdefaultMessage: 'Edit',\n\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t</LinkButton>\n\t\t\t\t\t)}\n\t\t\t\t</Flex>\n\t\t\t</Td>\n\t\t</Tr>\n\t)\n}\n","import type { Route } from '../../../../types'\nimport type { RouteSortKey } from '../../types'\nimport { Table, Tbody, EmptyStateLayout, Tr, Td } from '@strapi/design-system'\nimport TableHeader from './TableHeader'\nimport TableRow from './TableRow'\nimport { useIntl } from 'react-intl'\nimport { getTranslation } from '../../utils'\n\nfunction PathTable({\n\troutes,\n\tsortKey,\n\thandleSort,\n}: {\n\troutes: Route[]\n\tsortKey: RouteSortKey\n\thandleSort: (key: RouteSortKey) => void\n}) {\n\tconst { formatMessage } = useIntl()\n\n\tconst TABLE_COL_COUNT = 5\n\n\treturn (\n\t\t<Table colCount={TABLE_COL_COUNT} rowCount={routes.length}>\n\t\t\t<TableHeader sortKey={sortKey} handleSort={handleSort} />\n\t\t\t<Tbody>\n\t\t\t\t{routes.length > 0 ? (\n\t\t\t\t\troutes.map((route: Route) => <TableRow key={route.id} route={route} />)\n\t\t\t\t) : (\n\t\t\t\t\t<Tr>\n\t\t\t\t\t\t<Td colSpan={TABLE_COL_COUNT}>\n\t\t\t\t\t\t\t<EmptyStateLayout\n\t\t\t\t\t\t\t\tshadow=\"none\"\n\t\t\t\t\t\t\t\tcontent={formatMessage({\n\t\t\t\t\t\t\t\t\tid: getTranslation('paths.page.emptyPaths'),\n\t\t\t\t\t\t\t\t\tdefaultMessage: 'No paths found',\n\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</Td>\n\t\t\t\t\t</Tr>\n\t\t\t\t)}\n\t\t\t</Tbody>\n\t\t</Table>\n\t)\n}\n\nexport default PathTable\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 type { RouteSortKey } from '../../types'\nimport { useState, useEffect } from 'react'\nimport { useApi } from '../../hooks'\nimport { FullLoader } from '../../components/UI'\nimport { getTranslation } from '../../utils'\nimport { useIntl } from 'react-intl'\nimport { useNotification, Page } from '@strapi/strapi/admin'\nimport PageWrapper from './PageWrapper'\nimport { useSearchParams } from 'react-router-dom'\nimport debounce from '../../utils/debounce'\nimport { useMemo } from 'react'\nimport compareBy from './compareBy'\nimport pluginPermissions from '../../permissions'\nimport SearchInput from './SearchInput'\nimport PathTable from './PathTable'\n\nconst Paths = () => {\n\tconst { getAllRoutes } = useApi()\n\tconst { formatMessage } = useIntl()\n\tconst { toggleNotification } = useNotification()\n\n\tconst [allRoutes, setAllRoutes] = useState<Route[]>([])\n\tconst [routes, setRoutes] = useState<Route[]>([])\n\tconst [loading, setLoading] = useState(true)\n\tconst [searchParams, setSearchParams] = useSearchParams()\n\tconst initialQuery = searchParams.get('search') || ''\n\tconst [searchQuery, setSearchQuery] = useState(initialQuery)\n\tconst [sortKey, setSortKey] = useState<RouteSortKey>('canonicalPath')\n\tconst [sortDirection, setSortDirection] = useState<'asc' | 'desc'>('asc')\n\n\tuseEffect(() => {\n\t\tconst query = searchQuery.toLowerCase()\n\t\tsetRoutes(\n\t\t\tallRoutes.filter(\n\t\t\t\t(route) =>\n\t\t\t\t\tJSON.stringify(route.id).toLowerCase().includes(query) ||\n\t\t\t\t\troute.title.toLowerCase().includes(query) ||\n\t\t\t\t\troute.path.toLowerCase().includes(query) ||\n\t\t\t\t\troute.relatedDocumentId.toLowerCase().includes(query) ||\n\t\t\t\t\troute.relatedContentType.toLowerCase().includes(query),\n\t\t\t),\n\t\t)\n\t}, [searchQuery, allRoutes])\n\n\tconst debouncedSetSearchParams = useMemo(\n\t\t() =>\n\t\t\tdebounce((value: string) => {\n\t\t\t\tvalue ? setSearchParams({ search: value }) : setSearchParams({})\n\t\t\t}, 300),\n\t\t[setSearchParams],\n\t)\n\n\tconst handleSearchChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n\t\tconst value = e.target.value\n\t\tsetSearchQuery(value)\n\t\tdebouncedSetSearchParams(value)\n\t}\n\n\tuseEffect(() => {\n\t\tasync function fetchRoutes() {\n\t\t\ttry {\n\t\t\t\tconst data = await getAllRoutes()\n\t\t\t\tsetAllRoutes(data)\n\t\t\t\tsetRoutes(data)\n\t\t\t} catch (err) {\n\t\t\t\tstrapi.log.error('Failed to fetch paths:', err)\n\t\t\t\ttoggleNotification({\n\t\t\t\t\ttype: 'danger',\n\t\t\t\t\tmessage: formatMessage({\n\t\t\t\t\t\tid: getTranslation('notification.paths.fetchFailed'),\n\t\t\t\t\t\tdefaultMessage: 'Failed to fetch paths',\n\t\t\t\t\t}),\n\t\t\t\t})\n\t\t\t} finally {\n\t\t\t\tsetLoading(false)\n\t\t\t}\n\t\t}\n\t\tfetchRoutes()\n\t}, [])\n\n\tconst handleSort = (key: RouteSortKey) => {\n\t\tsetSortDirection((prev) => (prev === 'asc' ? 'desc' : 'asc'))\n\t\tsetSortKey(key)\n\t}\n\n\tconst sortedRoutes = useMemo(() => {\n\t\treturn sortKey ? [...routes].sort(compareBy(sortKey, sortDirection)) : routes\n\t}, [routes, sortKey, sortDirection])\n\n\tif (loading) {\n\t\treturn (\n\t\t\t<PageWrapper>\n\t\t\t\t<FullLoader />\n\t\t\t</PageWrapper>\n\t\t)\n\t}\n\n\treturn (\n\t\t<Page.Protect permissions={pluginPermissions['page.routes']}>\n\t\t\t<PageWrapper>\n\t\t\t\t<SearchInput handleSearchChange={handleSearchChange} searchQuery={searchQuery} />\n\t\t\t\t<PathTable routes={sortedRoutes} sortKey={sortKey} handleSort={handleSort} />\n\t\t\t</PageWrapper>\n\t\t</Page.Protect>\n\t)\n}\n\nexport default Paths\n"],"names":[],"mappings":";;;;;;;;;;AAIA,SAAwB,YAAY,EAAE,YAA2C;AAChF,QAAM,EAAE,cAAA,IAAkB,QAAA;AAE1B,SACC,qBAAC,KAAK,MAAL,EACA,UAAA;AAAA,IAAA;AAAA,MAAC,QAAQ;AAAA,MAAR;AAAA,QACA,OAAO,cAAc;AAAA,UACpB,IAAI,eAAe,kBAAkB;AAAA,UACrC,gBAAgB;AAAA,QAAA,CAChB;AAAA,QACD,UAAU,cAAc;AAAA,UACvB,IAAI,eAAe,qBAAqB;AAAA,UACxC,gBAAgB;AAAA,QAAA,CAChB;AAAA,MAAA;AAAA,IAAA;AAAA,wBAED,QAAQ,SAAR,EACA,UAAA,oBAAA,UAAA,EAAG,UAAS,EAAA,CACb;AAAA,EAAA,GACD;AAEF;ACrBA,SAAwB,UAAU,OAAqB,WAA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