@mattisvensson/strapi-plugin-webatlas 0.3.0 → 0.4.0

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.
Files changed (82) hide show
  1. package/dist/_chunks/{EmptyBox-7D4LrvdH.mjs → EmptyBox-BM4IscSk.mjs} +2 -6
  2. package/dist/_chunks/{EmptyBox-DT6D5gcf.js → EmptyBox-T8t29l25.js} +1 -5
  3. package/dist/_chunks/FullLoader-Cmsf8xS6.js +11 -0
  4. package/dist/_chunks/FullLoader-CrPED_dY.mjs +12 -0
  5. package/dist/_chunks/{de-C8PE3n3B.mjs → de-Dn24NwJf.mjs} +11 -1
  6. package/dist/_chunks/{de-4tL_cJTC.js → de-RiCps8UH.js} +11 -1
  7. package/dist/_chunks/{en-CR1YZvJo.mjs → en-D9Lxaugc.mjs} +11 -1
  8. package/dist/_chunks/{en-Bg4z3fR7.js → en-JLW5S3ZC.js} +11 -1
  9. package/dist/_chunks/index-B3JakJZB.mjs +126 -0
  10. package/dist/_chunks/index-BpvDMe8t.js +126 -0
  11. package/dist/_chunks/index-C1rj8TbT.js +281 -0
  12. package/dist/_chunks/{index-B0XE_zRP.js → index-CKHmlZdc.js} +1381 -363
  13. package/dist/_chunks/index-Cce7AGi-.mjs +281 -0
  14. package/dist/_chunks/{index-B85fJxGa.js → index-ChDbwEb-.js} +43 -61
  15. package/dist/_chunks/{index-C7B8QHDT.mjs → index-DJ-Du5aY.mjs} +1375 -357
  16. package/dist/_chunks/{index-CCiDvLAC.mjs → index-DUxYbDKG.mjs} +43 -61
  17. package/dist/admin/index.js +1 -1
  18. package/dist/admin/index.mjs +1 -1
  19. package/dist/admin/src/components/UI/FullLoader.d.ts +3 -0
  20. package/dist/admin/src/components/UI/index.d.ts +2 -1
  21. package/dist/admin/src/components/modals/Delete.d.ts +3 -3
  22. package/dist/admin/src/components/modals/NavEdit.d.ts +2 -2
  23. package/dist/admin/src/components/modals/externalItem/index.d.ts +10 -4
  24. package/dist/admin/src/components/modals/internalItem/internalItemCreate.d.ts +1 -1
  25. package/dist/admin/src/components/modals/wrapperItem/index.d.ts +11 -5
  26. package/dist/admin/src/hooks/useApi.d.ts +6 -5
  27. package/dist/admin/src/hooks/useNavigations.d.ts +2 -0
  28. package/dist/admin/src/hooks/usePluginConfig.d.ts +3 -3
  29. package/dist/admin/src/pages/Navigation/PageWrapper.d.ts +7 -0
  30. package/dist/admin/src/pages/Navigation/index.d.ts +1 -1
  31. package/dist/admin/src/pages/Routes/PageWrapper.d.ts +4 -0
  32. package/dist/admin/src/pages/Routes/TableHeader.d.ts +1 -0
  33. package/dist/admin/src/pages/Routes/TableRow.d.ts +4 -0
  34. package/dist/admin/src/pages/Settings/ContentTypeAccordion.d.ts +7 -0
  35. package/dist/admin/src/pages/Settings/PageWrapper.d.ts +8 -0
  36. package/dist/admin/src/utils/createTempNavItemObject.d.ts +25 -0
  37. package/dist/admin/src/utils/index.d.ts +2 -1
  38. package/dist/server/index.js +228 -177
  39. package/dist/server/index.mjs +228 -177
  40. package/dist/server/src/controllers/admin.d.ts +1 -4
  41. package/dist/server/src/controllers/index.d.ts +1 -4
  42. package/dist/server/src/index.d.ts +2 -8
  43. package/dist/server/src/services/admin.d.ts +2 -5
  44. package/dist/server/src/services/index.d.ts +1 -4
  45. package/dist/server/src/utils/navItemHandler.d.ts +5 -0
  46. package/dist/server/src/utils/routeHandler.d.ts +3 -0
  47. package/package.json +1 -1
  48. package/dist/_chunks/EmptyBox-7D4LrvdH.mjs.map +0 -1
  49. package/dist/_chunks/EmptyBox-DT6D5gcf.js.map +0 -1
  50. package/dist/_chunks/_baseConvert-B84_vf8X.js +0 -864
  51. package/dist/_chunks/_baseConvert-B84_vf8X.js.map +0 -1
  52. package/dist/_chunks/_baseConvert-C2SW1VHq.mjs +0 -865
  53. package/dist/_chunks/_baseConvert-C2SW1VHq.mjs.map +0 -1
  54. package/dist/_chunks/de-4tL_cJTC.js.map +0 -1
  55. package/dist/_chunks/de-C8PE3n3B.mjs.map +0 -1
  56. package/dist/_chunks/en-Bg4z3fR7.js.map +0 -1
  57. package/dist/_chunks/en-CR1YZvJo.mjs.map +0 -1
  58. package/dist/_chunks/index-B2Tiv3EK.mjs +0 -92
  59. package/dist/_chunks/index-B48CGofU.mjs +0 -17170
  60. package/dist/_chunks/index-B48CGofU.mjs.map +0 -1
  61. package/dist/_chunks/index-BbM9Sn1t.js +0 -17195
  62. package/dist/_chunks/index-BocSkZOu.mjs +0 -17176
  63. package/dist/_chunks/index-CXzNr2cH.mjs +0 -93
  64. package/dist/_chunks/index-CXzNr2cH.mjs.map +0 -1
  65. package/dist/_chunks/index-Cd6y6nuf.js +0 -93
  66. package/dist/_chunks/index-Cd6y6nuf.js.map +0 -1
  67. package/dist/_chunks/index-Cf9ZIBLd.js +0 -4195
  68. package/dist/_chunks/index-Cf9ZIBLd.js.map +0 -1
  69. package/dist/_chunks/index-D981K4TK.mjs +0 -4179
  70. package/dist/_chunks/index-D981K4TK.mjs.map +0 -1
  71. package/dist/_chunks/index-DGb8ESH-.js +0 -92
  72. package/dist/_chunks/index-DYiJBXKE.js +0 -10131
  73. package/dist/_chunks/index-DYiJBXKE.js.map +0 -1
  74. package/dist/_chunks/index-DjZ3ZaVB.js +0 -17189
  75. package/dist/_chunks/index-DjZ3ZaVB.js.map +0 -1
  76. package/dist/_chunks/index-DkhJl5mF.mjs +0 -10131
  77. package/dist/_chunks/index-DkhJl5mF.mjs.map +0 -1
  78. package/dist/admin/index.js.map +0 -1
  79. package/dist/admin/index.mjs.map +0 -1
  80. package/dist/admin/src/pages/Navigation/Header.d.ts +0 -6
  81. package/dist/server/index.js.map +0 -1
  82. package/dist/server/index.mjs.map +0 -1
@@ -1,9 +1,6 @@
1
- import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { Flex, Box, Typography } from "@strapi/design-system";
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
3
2
  import { EmptyDocuments } from "@strapi/icons/symbols";
4
- function Center({ height = 400, children }) {
5
- return /* @__PURE__ */ jsx(Flex, { direction: "column", minHeight: `${height}px`, justifyContent: "center", children });
6
- }
3
+ import { Box, Typography } from "@strapi/design-system";
7
4
  function EmptyBox({ msg }) {
8
5
  return /* @__PURE__ */ jsxs(Fragment, { children: [
9
6
  /* @__PURE__ */ jsx(EmptyDocuments, { width: "10rem", height: "6rem" }),
@@ -11,6 +8,5 @@ function EmptyBox({ msg }) {
11
8
  ] });
12
9
  }
13
10
  export {
14
- Center as C,
15
11
  EmptyBox as E
16
12
  };
@@ -1,15 +1,11 @@
1
1
  "use strict";
2
2
  const jsxRuntime = require("react/jsx-runtime");
3
- const designSystem = require("@strapi/design-system");
4
3
  const symbols = require("@strapi/icons/symbols");
5
- function Center({ height = 400, children }) {
6
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", minHeight: `${height}px`, justifyContent: "center", children });
7
- }
4
+ const designSystem = require("@strapi/design-system");
8
5
  function EmptyBox({ msg }) {
9
6
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
10
7
  /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "10rem", height: "6rem" }),
11
8
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", textColor: "neutral600", children: msg }) })
12
9
  ] });
13
10
  }
14
- exports.Center = Center;
15
11
  exports.EmptyBox = EmptyBox;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ const jsxRuntime = require("react/jsx-runtime");
3
+ const designSystem = require("@strapi/design-system");
4
+ function Center({ height = 400, children }) {
5
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", minHeight: `${height}px`, justifyContent: "center", children });
6
+ }
7
+ function FullLoader({ height }) {
8
+ return /* @__PURE__ */ jsxRuntime.jsx(Center, { height, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: "Loading..." }) });
9
+ }
10
+ exports.Center = Center;
11
+ exports.FullLoader = FullLoader;
@@ -0,0 +1,12 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Flex, Loader } from "@strapi/design-system";
3
+ function Center({ height = 400, children }) {
4
+ return /* @__PURE__ */ jsx(Flex, { direction: "column", minHeight: `${height}px`, justifyContent: "center", children });
5
+ }
6
+ function FullLoader({ height }) {
7
+ return /* @__PURE__ */ jsx(Center, { height, children: /* @__PURE__ */ jsx(Loader, { children: "Loading..." }) });
8
+ }
9
+ export {
10
+ Center as C,
11
+ FullLoader as F
12
+ };
@@ -97,7 +97,17 @@ const de = {
97
97
  "webatlas.cancel": "Abbrechen",
98
98
  "webatlas.save": "Speichern",
99
99
  "webatlas.select": "Auswählen",
100
- "webatlas.manage": "Verwalten"
100
+ "webatlas.manage": "Verwalten",
101
+ "webatlas.published": "Veröffentlicht",
102
+ "webatlas.draft": "Entwurf",
103
+ "webatlas.modified": "Geändert",
104
+ "webatlas.deleted": "Gelöscht",
105
+ "webatlas.notification.error": "Ein Fehler ist aufgetreten",
106
+ "webatlas.notification.settings.saved": "Einstellungen erfolgreich gespeichert",
107
+ "webatlas.notification.routes.fetchFailed": "Routen konnten nicht abgerufen werden",
108
+ "webatlas.notification.navigation.saveNavigationFailed": "Fehler beim Aktualisieren des Navigationselements",
109
+ "webatlas.notification.navigation.navigationSaved": "Navigation erfolgreich aktualisiert",
110
+ "webatlas.notification.navigation.fetchFailed": "Fehler beim Abrufen der Navigationen"
101
111
  };
102
112
  export {
103
113
  de as default
@@ -99,6 +99,16 @@ const de = {
99
99
  "webatlas.cancel": "Abbrechen",
100
100
  "webatlas.save": "Speichern",
101
101
  "webatlas.select": "Auswählen",
102
- "webatlas.manage": "Verwalten"
102
+ "webatlas.manage": "Verwalten",
103
+ "webatlas.published": "Veröffentlicht",
104
+ "webatlas.draft": "Entwurf",
105
+ "webatlas.modified": "Geändert",
106
+ "webatlas.deleted": "Gelöscht",
107
+ "webatlas.notification.error": "Ein Fehler ist aufgetreten",
108
+ "webatlas.notification.settings.saved": "Einstellungen erfolgreich gespeichert",
109
+ "webatlas.notification.routes.fetchFailed": "Routen konnten nicht abgerufen werden",
110
+ "webatlas.notification.navigation.saveNavigationFailed": "Fehler beim Aktualisieren des Navigationselements",
111
+ "webatlas.notification.navigation.navigationSaved": "Navigation erfolgreich aktualisiert",
112
+ "webatlas.notification.navigation.fetchFailed": "Fehler beim Abrufen der Navigationen"
103
113
  };
104
114
  exports.default = de;
@@ -97,7 +97,17 @@ const en = {
97
97
  "webatlas.cancel": "Cancel",
98
98
  "webatlas.save": "Save",
99
99
  "webatlas.select": "Select",
100
- "webatlas.manage": "Manage"
100
+ "webatlas.manage": "Manage",
101
+ "webatlas.published": "Published",
102
+ "webatlas.draft": "Draft",
103
+ "webatlas.modified": "Modified",
104
+ "webatlas.deleted": "Deleted",
105
+ "webatlas.notification.error": "An error occurred",
106
+ "webatlas.notification.settings.saved": "Settings saved successfully",
107
+ "webatlas.notification.routes.fetchFailed": "Failed to fetch routes",
108
+ "webatlas.notification.navigation.saveNavigationFailed": "Error updating navigation item",
109
+ "webatlas.notification.navigation.navigationSaved": "Navigation updated successfully",
110
+ "webatlas.notification.navigation.fetchFailed": "Failed to fetch navigations"
101
111
  };
102
112
  export {
103
113
  en as default
@@ -99,6 +99,16 @@ const en = {
99
99
  "webatlas.cancel": "Cancel",
100
100
  "webatlas.save": "Save",
101
101
  "webatlas.select": "Select",
102
- "webatlas.manage": "Manage"
102
+ "webatlas.manage": "Manage",
103
+ "webatlas.published": "Published",
104
+ "webatlas.draft": "Draft",
105
+ "webatlas.modified": "Modified",
106
+ "webatlas.deleted": "Deleted",
107
+ "webatlas.notification.error": "An error occurred",
108
+ "webatlas.notification.settings.saved": "Settings saved successfully",
109
+ "webatlas.notification.routes.fetchFailed": "Failed to fetch routes",
110
+ "webatlas.notification.navigation.saveNavigationFailed": "Error updating navigation item",
111
+ "webatlas.notification.navigation.navigationSaved": "Navigation updated successfully",
112
+ "webatlas.notification.navigation.fetchFailed": "Failed to fetch navigations"
103
113
  };
104
114
  exports.default = en;
@@ -0,0 +1,126 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useState, useEffect } from "react";
3
+ import { Thead, Tr, Th, Typography, VisuallyHidden, Td, Flex, LinkButton, Box, Table, Tbody } from "@strapi/design-system";
4
+ import { g as getTranslation, u as useApi } from "./index-DUxYbDKG.mjs";
5
+ import { Page, Layouts, useNotification } from "@strapi/strapi/admin";
6
+ import { F as FullLoader, C as Center } from "./FullLoader-CrPED_dY.mjs";
7
+ import { E as EmptyBox } from "./EmptyBox-BM4IscSk.mjs";
8
+ import { useIntl } from "react-intl";
9
+ import { Pencil } from "@strapi/icons";
10
+ function getRouteType(route) {
11
+ if (route.wrapper) {
12
+ return "wrapper";
13
+ } else if (!route.internal) {
14
+ return "external";
15
+ } else {
16
+ return "internal";
17
+ }
18
+ }
19
+ function TableHeader() {
20
+ const { formatMessage } = useIntl();
21
+ return /* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
22
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "ID" }) }),
23
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: formatMessage({
24
+ id: getTranslation("title"),
25
+ defaultMessage: "Title"
26
+ }) }) }),
27
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: formatMessage({
28
+ id: getTranslation("route"),
29
+ defaultMessage: "Route"
30
+ }) }) }),
31
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: formatMessage({
32
+ id: getTranslation("routes.page.column.type"),
33
+ defaultMessage: "Type"
34
+ }) }) }),
35
+ /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(VisuallyHidden, { children: formatMessage({
36
+ id: getTranslation("actions"),
37
+ defaultMessage: "Actions"
38
+ }) }) })
39
+ ] }) });
40
+ }
41
+ function TableRow({ route }) {
42
+ const { formatMessage } = useIntl();
43
+ return /* @__PURE__ */ jsxs(Tr, { children: [
44
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: route.id }) }),
45
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: route.title }) }),
46
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: route.fullPath }) }),
47
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: formatMessage({
48
+ id: getTranslation(`route.type.${getRouteType(route)}`),
49
+ defaultMessage: "-"
50
+ }) }) }),
51
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Flex, { gap: 2, justifyContent: "end", children: route.internal && /* @__PURE__ */ jsx(
52
+ LinkButton,
53
+ {
54
+ variant: "secondary",
55
+ startIcon: /* @__PURE__ */ jsx(Pencil, {}),
56
+ href: `/admin/content-manager/collection-types/${route.relatedContentType}/${route.relatedDocumentId}`,
57
+ children: formatMessage({
58
+ id: getTranslation("edit"),
59
+ defaultMessage: "Edit"
60
+ })
61
+ }
62
+ ) }) })
63
+ ] });
64
+ }
65
+ function PageWrapper({ children }) {
66
+ const { formatMessage } = useIntl();
67
+ return /* @__PURE__ */ jsxs(Page.Main, { children: [
68
+ /* @__PURE__ */ jsx(
69
+ Layouts.Header,
70
+ {
71
+ title: formatMessage({
72
+ id: getTranslation("routes.page.title"),
73
+ defaultMessage: "Routes"
74
+ }),
75
+ subtitle: formatMessage({
76
+ id: getTranslation("routes.page.subtitle"),
77
+ defaultMessage: "Overview of all existing routes"
78
+ })
79
+ }
80
+ ),
81
+ /* @__PURE__ */ jsx(Layouts.Content, { children: /* @__PURE__ */ jsx(Box, { children }) })
82
+ ] });
83
+ }
84
+ const Routes = () => {
85
+ const { getRoutes } = useApi();
86
+ const { formatMessage } = useIntl();
87
+ const { toggleNotification } = useNotification();
88
+ const [routes, setRoutes] = useState([]);
89
+ const [loading, setLoading] = useState(true);
90
+ useEffect(() => {
91
+ async function fetchRoutes() {
92
+ try {
93
+ const data = await getRoutes();
94
+ setRoutes(data);
95
+ } catch (err) {
96
+ console.error("Failed to fetch routes:", err);
97
+ toggleNotification({
98
+ type: "danger",
99
+ message: formatMessage({
100
+ id: getTranslation("notification.routes.fetchFailed"),
101
+ defaultMessage: "Failed to fetch routes"
102
+ })
103
+ });
104
+ } finally {
105
+ setLoading(false);
106
+ }
107
+ }
108
+ fetchRoutes();
109
+ }, []);
110
+ if (loading) {
111
+ return /* @__PURE__ */ jsx(PageWrapper, { children: /* @__PURE__ */ jsx(FullLoader, {}) });
112
+ }
113
+ if (routes.length === 0) {
114
+ return /* @__PURE__ */ jsx(PageWrapper, { children: /* @__PURE__ */ jsx(Center, { height: 400, children: /* @__PURE__ */ jsx(EmptyBox, { msg: formatMessage({
115
+ id: getTranslation("routes.page.emptyRoutes"),
116
+ defaultMessage: "No routes found"
117
+ }) }) }) });
118
+ }
119
+ return /* @__PURE__ */ jsx(PageWrapper, { children: /* @__PURE__ */ jsxs(Table, { colCount: 4, rowCount: routes.length, children: [
120
+ /* @__PURE__ */ jsx(TableHeader, {}),
121
+ /* @__PURE__ */ jsx(Tbody, { children: routes.map((route) => /* @__PURE__ */ jsx(TableRow, { route }, route.id)) })
122
+ ] }) });
123
+ };
124
+ export {
125
+ Routes as default
126
+ };
@@ -0,0 +1,126 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const React = require("react");
5
+ const designSystem = require("@strapi/design-system");
6
+ const index = require("./index-ChDbwEb-.js");
7
+ const admin = require("@strapi/strapi/admin");
8
+ const FullLoader = require("./FullLoader-Cmsf8xS6.js");
9
+ const EmptyBox = require("./EmptyBox-T8t29l25.js");
10
+ const reactIntl = require("react-intl");
11
+ const icons = require("@strapi/icons");
12
+ function getRouteType(route) {
13
+ if (route.wrapper) {
14
+ return "wrapper";
15
+ } else if (!route.internal) {
16
+ return "external";
17
+ } else {
18
+ return "internal";
19
+ }
20
+ }
21
+ function TableHeader() {
22
+ const { formatMessage } = reactIntl.useIntl();
23
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
24
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: "ID" }) }),
25
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: formatMessage({
26
+ id: index.getTranslation("title"),
27
+ defaultMessage: "Title"
28
+ }) }) }),
29
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: formatMessage({
30
+ id: index.getTranslation("route"),
31
+ defaultMessage: "Route"
32
+ }) }) }),
33
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: formatMessage({
34
+ id: index.getTranslation("routes.page.column.type"),
35
+ defaultMessage: "Type"
36
+ }) }) }),
37
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: formatMessage({
38
+ id: index.getTranslation("actions"),
39
+ defaultMessage: "Actions"
40
+ }) }) })
41
+ ] }) });
42
+ }
43
+ function TableRow({ route }) {
44
+ const { formatMessage } = reactIntl.useIntl();
45
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
46
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: route.id }) }),
47
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: route.title }) }),
48
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: route.fullPath }) }),
49
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: formatMessage({
50
+ id: index.getTranslation(`route.type.${getRouteType(route)}`),
51
+ defaultMessage: "-"
52
+ }) }) }),
53
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, justifyContent: "end", children: route.internal && /* @__PURE__ */ jsxRuntime.jsx(
54
+ designSystem.LinkButton,
55
+ {
56
+ variant: "secondary",
57
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Pencil, {}),
58
+ href: `/admin/content-manager/collection-types/${route.relatedContentType}/${route.relatedDocumentId}`,
59
+ children: formatMessage({
60
+ id: index.getTranslation("edit"),
61
+ defaultMessage: "Edit"
62
+ })
63
+ }
64
+ ) }) })
65
+ ] });
66
+ }
67
+ function PageWrapper({ children }) {
68
+ const { formatMessage } = reactIntl.useIntl();
69
+ return /* @__PURE__ */ jsxRuntime.jsxs(admin.Page.Main, { children: [
70
+ /* @__PURE__ */ jsxRuntime.jsx(
71
+ admin.Layouts.Header,
72
+ {
73
+ title: formatMessage({
74
+ id: index.getTranslation("routes.page.title"),
75
+ defaultMessage: "Routes"
76
+ }),
77
+ subtitle: formatMessage({
78
+ id: index.getTranslation("routes.page.subtitle"),
79
+ defaultMessage: "Overview of all existing routes"
80
+ })
81
+ }
82
+ ),
83
+ /* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children }) })
84
+ ] });
85
+ }
86
+ const Routes = () => {
87
+ const { getRoutes } = index.useApi();
88
+ const { formatMessage } = reactIntl.useIntl();
89
+ const { toggleNotification } = admin.useNotification();
90
+ const [routes, setRoutes] = React.useState([]);
91
+ const [loading, setLoading] = React.useState(true);
92
+ React.useEffect(() => {
93
+ async function fetchRoutes() {
94
+ try {
95
+ const data = await getRoutes();
96
+ setRoutes(data);
97
+ } catch (err) {
98
+ console.error("Failed to fetch routes:", err);
99
+ toggleNotification({
100
+ type: "danger",
101
+ message: formatMessage({
102
+ id: index.getTranslation("notification.routes.fetchFailed"),
103
+ defaultMessage: "Failed to fetch routes"
104
+ })
105
+ });
106
+ } finally {
107
+ setLoading(false);
108
+ }
109
+ }
110
+ fetchRoutes();
111
+ }, []);
112
+ if (loading) {
113
+ return /* @__PURE__ */ jsxRuntime.jsx(PageWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(FullLoader.FullLoader, {}) });
114
+ }
115
+ if (routes.length === 0) {
116
+ return /* @__PURE__ */ jsxRuntime.jsx(PageWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(FullLoader.Center, { height: 400, children: /* @__PURE__ */ jsxRuntime.jsx(EmptyBox.EmptyBox, { msg: formatMessage({
117
+ id: index.getTranslation("routes.page.emptyRoutes"),
118
+ defaultMessage: "No routes found"
119
+ }) }) }) });
120
+ }
121
+ return /* @__PURE__ */ jsxRuntime.jsx(PageWrapper, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount: 4, rowCount: routes.length, children: [
122
+ /* @__PURE__ */ jsxRuntime.jsx(TableHeader, {}),
123
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: routes.map((route) => /* @__PURE__ */ jsxRuntime.jsx(TableRow, { route }, route.id)) })
124
+ ] }) });
125
+ };
126
+ exports.default = Routes;