@mattisvensson/strapi-plugin-webatlas 0.9.5 → 0.10.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 (117) hide show
  1. package/README.md +24 -36
  2. package/dist/_chunks/FullLoader-Cmsf8xS6.js +0 -1
  3. package/dist/_chunks/FullLoader-CrPED_dY.mjs +0 -1
  4. package/dist/_chunks/{SettingTitle-CiMKrd_1.mjs → SettingTitle-CdR3SVn_.mjs} +1 -2
  5. package/dist/_chunks/{SettingTitle-CAoYbTar.js → SettingTitle-RU1azFIM.js} +1 -1
  6. package/dist/_chunks/{de-C-uxto84.mjs → de-B5pRvs13.mjs} +13 -8
  7. package/dist/_chunks/{de-CGXL_3o_.js → de-CqU1FU8C.js} +13 -8
  8. package/dist/_chunks/{en-B1CHnIH7.mjs → en-BE-zzIv8.mjs} +13 -8
  9. package/dist/_chunks/{en-DWEd5BXK.js → en-C7I90FwV.js} +13 -8
  10. package/dist/_chunks/{index-Bqsd7oPS.mjs → index-B07UVUOa.mjs} +387 -230
  11. package/dist/_chunks/{index-DJBnQbrp.mjs → index-BmyxSosC.mjs} +3 -3
  12. package/dist/_chunks/{index-BOZDZiAv.js → index-BucL4va6.js} +38 -82
  13. package/dist/_chunks/{index-DU58LJ2w.mjs → index-BvcX9hcc.mjs} +61 -25
  14. package/dist/_chunks/{index-ezabqLEP.js → index-BxpDM360.js} +386 -228
  15. package/dist/_chunks/{index-qrC_n9-7.mjs → index-CIM-JzLK.mjs} +38 -82
  16. package/dist/_chunks/{index-qrrfKpw1.mjs → index-CNKWb8pn.mjs} +615 -321
  17. package/dist/_chunks/{index-m2ivL3ht.js → index-D-vJE_K8.js} +3 -3
  18. package/dist/_chunks/{index-BkB1x9Sn.js → index-IRSCe8PX.js} +610 -316
  19. package/dist/_chunks/{index-CC073vGB.js → index-d09V61nm.js} +61 -24
  20. package/dist/admin/index.js +1 -2
  21. package/dist/admin/index.mjs +1 -2
  22. package/dist/admin/src/components/CMEditViewAside/NewPathInfo.d.ts +2 -0
  23. package/dist/admin/src/components/CMEditViewAside/OverrideCheckbox.d.ts +7 -0
  24. package/dist/admin/src/components/CMEditViewAside/Panel.d.ts +5 -0
  25. package/dist/admin/src/components/CMEditViewAside/PathInput.d.ts +11 -0
  26. package/dist/admin/src/components/CMEditViewAside/RouteStructure.d.ts +3 -0
  27. package/dist/admin/src/components/CMEditViewAside/UidPathDisplay.d.ts +4 -0
  28. package/dist/admin/src/components/PathInfo.d.ts +2 -3
  29. package/dist/admin/src/components/modals/externalItem/index.d.ts +1 -1
  30. package/dist/admin/src/components/modals/internalItem/ItemDetails.d.ts +13 -0
  31. package/dist/admin/src/components/modals/internalItem/internalItemCreate.d.ts +1 -1
  32. package/dist/admin/src/components/modals/internalItem/internalItemEdit.d.ts +1 -1
  33. package/dist/admin/src/components/modals/useModalSharedLogic.d.ts +1 -1
  34. package/dist/admin/src/components/modals/wrapperItem/index.d.ts +1 -1
  35. package/dist/admin/src/hooks/useApi.d.ts +4 -3
  36. package/dist/admin/src/pages/Navigation/RouteItem.d.ts +1 -15
  37. package/dist/admin/src/pages/Navigation/RouteItemBadge.d.ts +4 -0
  38. package/dist/admin/src/pages/Navigation/RouteItemIcon.d.ts +5 -0
  39. package/dist/admin/src/pages/Navigation/RouteItemMenu.d.ts +10 -0
  40. package/dist/admin/src/pages/Navigation/RouteItemStatus.d.ts +5 -0
  41. package/dist/admin/src/pages/Navigation/SortableRouteItem.d.ts +1 -1
  42. package/dist/admin/src/types/index.d.ts +3 -0
  43. package/dist/admin/src/types/modal.d.ts +56 -0
  44. package/dist/admin/src/types/navigation.d.ts +18 -0
  45. package/dist/admin/src/types/panel.d.ts +41 -0
  46. package/dist/admin/src/types/route.d.ts +1 -1
  47. package/dist/admin/src/utils/buildBreadcrumbString.d.ts +16 -0
  48. package/dist/admin/src/utils/createTempNavItemObject.d.ts +6 -8
  49. package/dist/admin/src/utils/duplicateCheck.d.ts +10 -4
  50. package/dist/admin/src/utils/findParentNavItem.d.ts +13 -0
  51. package/dist/admin/src/utils/index.d.ts +3 -2
  52. package/dist/server/index.js +636 -209
  53. package/dist/server/index.mjs +636 -209
  54. package/dist/server/src/content-types/index.d.ts +18 -0
  55. package/dist/server/src/content-types/route/index.d.ts +18 -0
  56. package/dist/server/src/content-types/route/schema.d.ts +18 -0
  57. package/dist/server/src/controllers/admin.d.ts +3 -2
  58. package/dist/server/src/controllers/index.d.ts +3 -2
  59. package/dist/server/src/index.d.ts +24 -4
  60. package/dist/server/src/migrations/001-canonical-path.d.ts +7 -0
  61. package/dist/server/src/migrations/index.d.ts +3 -0
  62. package/dist/server/src/services/admin.d.ts +3 -2
  63. package/dist/server/src/services/index.d.ts +3 -2
  64. package/dist/server/src/utils/buildCanonicalPath.d.ts +1 -0
  65. package/dist/server/src/utils/buildNavigationPath.d.ts +5 -0
  66. package/dist/server/src/utils/cascadeCanonicalPathUpdates.d.ts +1 -0
  67. package/dist/server/src/utils/getNonInternalRouteIds.d.ts +1 -0
  68. package/dist/server/src/utils/getRouteAncestors.d.ts +1 -0
  69. package/dist/server/src/utils/getRouteDescendants.d.ts +1 -0
  70. package/dist/server/src/utils/index.d.ts +10 -2
  71. package/dist/server/src/utils/navigationItemStructure.d.ts +27 -0
  72. package/dist/server/src/utils/routeHandler.d.ts +4 -2
  73. package/dist/server/src/utils/validateRouteDependencies.d.ts +4 -0
  74. package/dist/types/index.d.ts +0 -1
  75. package/dist/types/navigation.d.ts +13 -12
  76. package/dist/types/route.d.ts +7 -2
  77. package/dist/types/strapi.d.ts +1 -2
  78. package/dist/utils/index.d.ts +1 -2
  79. package/package.json +1 -1
  80. package/dist/_chunks/FullLoader-Cmsf8xS6.js.map +0 -1
  81. package/dist/_chunks/FullLoader-CrPED_dY.mjs.map +0 -1
  82. package/dist/_chunks/SettingTitle-ByAhjihc.js +0 -68
  83. package/dist/_chunks/SettingTitle-ByAhjihc.js.map +0 -1
  84. package/dist/_chunks/SettingTitle-CiMKrd_1.mjs.map +0 -1
  85. package/dist/_chunks/SettingTitle-ZM5Yf2b4.mjs +0 -68
  86. package/dist/_chunks/de-C-uxto84.mjs.map +0 -1
  87. package/dist/_chunks/de-CGXL_3o_.js.map +0 -1
  88. package/dist/_chunks/en-B1CHnIH7.mjs.map +0 -1
  89. package/dist/_chunks/en-DWEd5BXK.js.map +0 -1
  90. package/dist/_chunks/index-BqceJPRl.js +0 -235
  91. package/dist/_chunks/index-BqceJPRl.js.map +0 -1
  92. package/dist/_chunks/index-Bqsd7oPS.mjs.map +0 -1
  93. package/dist/_chunks/index-CK1wisw5.mjs +0 -129
  94. package/dist/_chunks/index-CK1wisw5.mjs.map +0 -1
  95. package/dist/_chunks/index-CQ2raqxe.js +0 -129
  96. package/dist/_chunks/index-CQ2raqxe.js.map +0 -1
  97. package/dist/_chunks/index-Ca9T36AU.mjs +0 -263
  98. package/dist/_chunks/index-Ca9T36AU.mjs.map +0 -1
  99. package/dist/_chunks/index-DDN4T6c7.mjs +0 -4188
  100. package/dist/_chunks/index-DH4Rd7aA.mjs +0 -8311
  101. package/dist/_chunks/index-DH4Rd7aA.mjs.map +0 -1
  102. package/dist/_chunks/index-DU58LJ2w.mjs.map +0 -1
  103. package/dist/_chunks/index-DnE_cDwy.js +0 -8311
  104. package/dist/_chunks/index-DnE_cDwy.js.map +0 -1
  105. package/dist/_chunks/index-DzpXVfQ_.js +0 -263
  106. package/dist/_chunks/index-DzpXVfQ_.js.map +0 -1
  107. package/dist/_chunks/index-R7qsEu2N.js +0 -4205
  108. package/dist/_chunks/index-R7qsEu2N.js.map +0 -1
  109. package/dist/_chunks/index-fbC3magu.mjs +0 -234
  110. package/dist/admin/index.js.map +0 -1
  111. package/dist/admin/index.mjs.map +0 -1
  112. package/dist/admin/src/components/CMEditViewAside/Path.d.ts +0 -5
  113. package/dist/admin/src/utils/countChildren.d.ts +0 -2
  114. package/dist/server/index.js.map +0 -1
  115. package/dist/server/index.mjs.map +0 -1
  116. package/dist/types/modal.d.ts +0 -36
  117. package/dist/utils/getPath.d.ts +0 -1
@@ -2,11 +2,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import { useReducer, useState, useRef, useEffect } from "react";
3
3
  import { Field } from "@strapi/design-system";
4
4
  import { useNotification, Page } from "@strapi/strapi/admin";
5
- import { c as usePluginConfig, g as getTranslation, p as pluginPermissions } from "./index-DDN4T6c7.mjs";
5
+ import { c as usePluginConfig, g as getTranslation, p as pluginPermissions } from "./index-B07UVUOa.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";
9
- import { P as PageWrapper, C as ContentBox, S as SettingTitle } from "./SettingTitle-ZM5Yf2b4.mjs";
9
+ import { P as PageWrapper, C as ContentBox, S as SettingTitle } from "./SettingTitle-CdR3SVn_.mjs";
10
10
  function reducer(newConfig, action) {
11
11
  switch (action.type) {
12
12
  case "SET_MAX_DEPTH":
@@ -68,7 +68,7 @@ const Settings = () => {
68
68
  defaultMessage: "An error occurred"
69
69
  }) + ": " + err
70
70
  });
71
- console.error(err);
71
+ strapi.log.error(err);
72
72
  }
73
73
  }
74
74
  if (loading) {
@@ -4,11 +4,11 @@ const jsxRuntime = require("react/jsx-runtime");
4
4
  const React = require("react");
5
5
  const designSystem = require("@strapi/design-system");
6
6
  const admin = require("@strapi/strapi/admin");
7
- const index = require("./index-ezabqLEP.js");
7
+ const index = require("./index-BxpDM360.js");
8
8
  const reactIntl = require("react-intl");
9
9
  require("@strapi/icons/symbols");
10
10
  const FullLoader = require("./FullLoader-Cmsf8xS6.js");
11
- const SettingTitle = require("./SettingTitle-CAoYbTar.js");
11
+ const SettingTitle = require("./SettingTitle-RU1azFIM.js");
12
12
  const icons = require("@strapi/icons");
13
13
  function ContentTypeAccordion({
14
14
  contentType,
@@ -23,79 +23,41 @@ function ContentTypeAccordion({
23
23
  borderColor: !contentTypeSettings.default && "danger500",
24
24
  children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Accordion.Item, { value: contentType.uid, size: "S", children: [
25
25
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Header, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Trigger, { children: contentType?.info.displayName }) }),
26
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 3, children: [
27
- /* @__PURE__ */ jsxRuntime.jsxs(
28
- designSystem.Field.Root,
29
- {
30
- name: "selectedContentTypes",
31
- hint: formatMessage({
32
- id: index.getTranslation("settings.page.generate.hint"),
33
- defaultMessage: 'The selected field from the content type will be used to generate the path. Use a field that is unique and descriptive, such as a "title" or "name".'
34
- }),
35
- error: !contentTypeSettings.default && formatMessage({
36
- id: index.getTranslation("settings.page.generate.error"),
37
- defaultMessage: "Please select a default field"
38
- }),
39
- required: true,
40
- children: [
41
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
42
- id: index.getTranslation("settings.page.generate"),
43
- defaultMessage: "Generate paths from"
44
- }) }),
45
- /* @__PURE__ */ jsxRuntime.jsx(
46
- designSystem.SingleSelect,
47
- {
48
- name: `defaultField-${contentType.uid}`,
49
- onClear: () => dispatch({ type: "SET_DEFAULT_FIELD", payload: { ctUid: contentType.uid, field: "" } }),
50
- value: contentTypeSettings?.default || "",
51
- onChange: (value) => dispatch({ type: "SET_DEFAULT_FIELD", payload: { ctUid: contentType.uid, field: value } }),
52
- children: Object.entries(contentType.attributes).map(([key], index2) => {
53
- if (key === "id" || key === "documentId" || key === "createdAt" || key === "updatedAt" || key === "createdBy" || key === "updatedBy" || key === "webatlas_path" || key === "webatlas_override") return null;
54
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: key, children: key }, index2);
55
- })
56
- }
57
- ),
58
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
59
- ]
60
- }
61
- ),
62
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(
63
- designSystem.Field.Root,
64
- {
65
- name: "pattern",
66
- hint: formatMessage({
67
- id: index.getTranslation("settings.page.pattern.hint"),
68
- defaultMessage: 'The pattern to prepend to the generated path. For example, if you enter "blog" and the value of default field is "My First Post", the generated path will be "blog/my-first-post". Leave empty for no prefix.'
69
- }),
70
- children: [
71
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Label, { children: [
72
- formatMessage({
73
- id: index.getTranslation("settings.page.pattern"),
74
- defaultMessage: "Path Pattern"
75
- }),
76
- /* @__PURE__ */ jsxRuntime.jsx(index.Tooltip, { description: formatMessage({
77
- id: index.getTranslation("settings.page.pattern.tooltip"),
78
- defaultMessage: "Leading and trailing slashes will be removed. Spaces will be replaced with hyphens. Special characters will be encoded."
79
- }) })
80
- ] }),
81
- /* @__PURE__ */ jsxRuntime.jsx(
82
- designSystem.Field.Input,
83
- {
84
- value: contentTypeSettings.pattern,
85
- onChange: (e) => dispatch({ type: "SET_PATTERN", payload: { ctUid: contentType.uid, pattern: e.target.value } }),
86
- disabled: !contentTypeSettings.default,
87
- type: "text",
88
- placeholder: formatMessage({
89
- id: index.getTranslation("settings.page.pattern.placeholder"),
90
- defaultMessage: "e.g. blog"
91
- })
92
- }
93
- ),
94
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
95
- ]
96
- }
97
- ) })
98
- ] }) })
26
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Accordion.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(
27
+ designSystem.Field.Root,
28
+ {
29
+ name: "selectedContentTypes",
30
+ hint: formatMessage({
31
+ id: index.getTranslation("settings.page.generate.hint"),
32
+ defaultMessage: 'The selected field from the content type will be used to generate the path. Use a field that is unique and descriptive, such as a "title" or "name".'
33
+ }),
34
+ error: !contentTypeSettings.default && formatMessage({
35
+ id: index.getTranslation("settings.page.generate.error"),
36
+ defaultMessage: "Please select a default field"
37
+ }),
38
+ required: true,
39
+ children: [
40
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: formatMessage({
41
+ id: index.getTranslation("settings.page.generate"),
42
+ defaultMessage: "Generate paths from"
43
+ }) }),
44
+ /* @__PURE__ */ jsxRuntime.jsx(
45
+ designSystem.SingleSelect,
46
+ {
47
+ name: `defaultField-${contentType.uid}`,
48
+ onClear: () => dispatch({ type: "SET_DEFAULT_FIELD", payload: { ctUid: contentType.uid, field: "" } }),
49
+ value: contentTypeSettings?.default || "",
50
+ onChange: (value) => dispatch({ type: "SET_DEFAULT_FIELD", payload: { ctUid: contentType.uid, field: value } }),
51
+ children: Object.entries(contentType.attributes).map(([key], index2) => {
52
+ if (key === "id" || key === "documentId" || key === "createdAt" || key === "updatedAt" || key === "createdBy" || key === "updatedBy" || key === "webatlas_path" || key === "webatlas_override" || key === "webatlas_parent") return null;
53
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: key, children: key }, index2);
54
+ })
55
+ }
56
+ ),
57
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
58
+ ]
59
+ }
60
+ ) }) })
99
61
  ] }, contentType.uid)
100
62
  },
101
63
  contentType.uid
@@ -110,12 +72,6 @@ function reducer(newConfig, action) {
110
72
  (ct) => ct.uid === action.payload.ctUid ? { ...ct, default: action.payload.field } : ct
111
73
  );
112
74
  return { ...newConfig, selectedContentTypes: updatedContentTypes || [] };
113
- case "SET_PATTERN":
114
- if (!newConfig) return null;
115
- updatedContentTypes = newConfig?.selectedContentTypes.map(
116
- (ct) => ct.uid === action.payload.ctUid ? { ...ct, pattern: index.transformToUrl(action.payload.pattern) } : ct
117
- );
118
- return { ...newConfig, selectedContentTypes: updatedContentTypes || [] };
119
75
  case "SET_CONFIG":
120
76
  return action.payload;
121
77
  default:
@@ -170,7 +126,7 @@ const Settings = () => {
170
126
  defaultMessage: "An error occurred"
171
127
  }) + ": " + err
172
128
  });
173
- console.error(err);
129
+ strapi.log.error(err);
174
130
  }
175
131
  }
176
132
  if (loading) {
@@ -1,6 +1,6 @@
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-Bqsd7oPS.mjs";
3
+ import { g as getTranslation, u as useApi, d as debounce, p as pluginPermissions } from "./index-B07UVUOa.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";
@@ -39,6 +39,15 @@ function compareBy(field, direction) {
39
39
  return (a, b) => {
40
40
  const aValue = a[field];
41
41
  const bValue = b[field];
42
+ if (aValue == null && bValue == null) {
43
+ return 0;
44
+ }
45
+ if (aValue == null) {
46
+ return direction === "asc" ? 1 : -1;
47
+ }
48
+ if (bValue == null) {
49
+ return direction === "asc" ? -1 : 1;
50
+ }
42
51
  if (typeof aValue === "string" && typeof bValue === "string") {
43
52
  return direction === "asc" ? aValue.localeCompare(bValue) : bValue.localeCompare(aValue);
44
53
  }
@@ -86,6 +95,13 @@ function TableHeader({
86
95
  }) }),
87
96
  sortKey === "title" && /* @__PURE__ */ jsx(ChevronDown, {})
88
97
  ] }),
98
+ /* @__PURE__ */ jsxs(Th, { onClick: () => handleSort("canonicalPath"), cursor: "pointer", children: [
99
+ /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: formatMessage({
100
+ id: getTranslation("canonicalPath"),
101
+ defaultMessage: "Canonical Path"
102
+ }) }),
103
+ sortKey === "canonicalPath" && /* @__PURE__ */ jsx(ChevronDown, {})
104
+ ] }),
89
105
  /* @__PURE__ */ jsxs(Th, { onClick: () => handleSort("path"), cursor: "pointer", children: [
90
106
  /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: formatMessage({
91
107
  id: getTranslation("path"),
@@ -109,12 +125,25 @@ function TableHeader({
109
125
  function TableRow({ route }) {
110
126
  const { formatMessage } = useIntl();
111
127
  return /* @__PURE__ */ jsxs(Tr, { children: [
112
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: route.title }) }),
113
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: route.path }) }),
114
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: formatMessage({
115
- id: getTranslation(`path.type.${route.type}`),
116
- defaultMessage: "-"
117
- }) }) }),
128
+ [route.title, route.canonicalPath, route.path].map((field, index) => /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(
129
+ Typography,
130
+ {
131
+ title: field,
132
+ textColor: "neutral800",
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
+ ) }),
118
147
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Flex, { gap: 2, justifyContent: "end", children: route.type === "internal" && /* @__PURE__ */ jsx(
119
148
  LinkButton,
120
149
  {
@@ -135,22 +164,30 @@ function PathTable({
135
164
  handleSort
136
165
  }) {
137
166
  const { formatMessage } = useIntl();
138
- return /* @__PURE__ */ jsxs(Table, { colCount: 4, rowCount: routes.length, children: [
139
- /* @__PURE__ */ jsx(TableHeader, { sortKey, handleSort }),
140
- /* @__PURE__ */ jsx(Tbody, { children: routes.length > 0 ? routes.map((route) => /* @__PURE__ */ jsx(TableRow, { route }, route.id)) : /* @__PURE__ */ jsx(Tr, { children: /* @__PURE__ */ jsx(Td, { colSpan: 4, children: /* @__PURE__ */ jsx(
141
- EmptyStateLayout,
142
- {
143
- content: formatMessage({
144
- id: getTranslation("paths.page.emptyPaths"),
145
- defaultMessage: "No paths found"
146
- }),
147
- shadow: false
148
- }
149
- ) }) }) })
150
- ] });
167
+ const TABLE_COL_COUNT = 5;
168
+ return /* @__PURE__ */ jsxs(
169
+ Table,
170
+ {
171
+ colCount: TABLE_COL_COUNT,
172
+ rowCount: routes.length,
173
+ children: [
174
+ /* @__PURE__ */ jsx(TableHeader, { sortKey, handleSort }),
175
+ /* @__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(
176
+ EmptyStateLayout,
177
+ {
178
+ content: formatMessage({
179
+ id: getTranslation("paths.page.emptyPaths"),
180
+ defaultMessage: "No paths found"
181
+ }),
182
+ shadow: false
183
+ }
184
+ ) }) }) })
185
+ ]
186
+ }
187
+ );
151
188
  }
152
189
  const Paths = () => {
153
- const { getRoutes } = useApi();
190
+ const { getAllRoutes } = useApi();
154
191
  const { formatMessage } = useIntl();
155
192
  const { toggleNotification } = useNotification();
156
193
  const [allRoutes, setAllRoutes] = useState([]);
@@ -159,7 +196,7 @@ const Paths = () => {
159
196
  const [searchParams, setSearchParams] = useSearchParams();
160
197
  const initialQuery = searchParams.get("search") || "";
161
198
  const [searchQuery, setSearchQuery] = useState(initialQuery);
162
- const [sortKey, setSortKey] = useState("title");
199
+ const [sortKey, setSortKey] = useState("canonicalPath");
163
200
  const [sortDirection, setSortDirection] = useState("asc");
164
201
  useEffect(() => {
165
202
  const query = searchQuery.toLowerCase();
@@ -183,11 +220,11 @@ const Paths = () => {
183
220
  useEffect(() => {
184
221
  async function fetchRoutes() {
185
222
  try {
186
- const data = await getRoutes();
223
+ const data = await getAllRoutes();
187
224
  setAllRoutes(data);
188
225
  setRoutes(data);
189
226
  } catch (err) {
190
- console.error("Failed to fetch paths:", err);
227
+ strapi.log.error("Failed to fetch paths:", err);
191
228
  toggleNotification({
192
229
  type: "danger",
193
230
  message: formatMessage({
@@ -232,4 +269,3 @@ const Paths = () => {
232
269
  export {
233
270
  Paths as default
234
271
  };
235
- //# sourceMappingURL=index-DU58LJ2w.mjs.map