@mattisvensson/strapi-plugin-webatlas 0.3.0 → 0.3.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/{index-B0XE_zRP.js → index-BAqGJ3TM.js} +1 -1
- package/dist/_chunks/{index-CCiDvLAC.mjs → index-BBL_eQ0G.mjs} +5 -5
- package/dist/_chunks/{index-BocSkZOu.mjs → index-BOq-WidK.mjs} +1 -1
- package/dist/_chunks/{index-BbM9Sn1t.js → index-C4ou6MTp.js} +1 -1
- package/dist/_chunks/{index-B85fJxGa.js → index-CKoxbSC0.js} +5 -5
- package/dist/_chunks/{index-C7B8QHDT.mjs → index-CwHhwtOU.mjs} +1 -1
- package/dist/_chunks/{index-B2Tiv3EK.mjs → index-DZmhgSeq.mjs} +1 -1
- package/dist/_chunks/{index-DGb8ESH-.js → index-DsTyLL2l.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/server/index.js +4 -2
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +4 -2
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/_chunks/EmptyBox-7D4LrvdH.mjs.map +0 -1
- package/dist/_chunks/EmptyBox-DT6D5gcf.js.map +0 -1
- package/dist/_chunks/_baseConvert-B84_vf8X.js.map +0 -1
- package/dist/_chunks/_baseConvert-C2SW1VHq.mjs.map +0 -1
- package/dist/_chunks/de-4tL_cJTC.js.map +0 -1
- package/dist/_chunks/de-C8PE3n3B.mjs.map +0 -1
- package/dist/_chunks/en-Bg4z3fR7.js.map +0 -1
- package/dist/_chunks/en-CR1YZvJo.mjs.map +0 -1
- package/dist/_chunks/index-B48CGofU.mjs +0 -17170
- package/dist/_chunks/index-B48CGofU.mjs.map +0 -1
- package/dist/_chunks/index-CXzNr2cH.mjs +0 -93
- package/dist/_chunks/index-CXzNr2cH.mjs.map +0 -1
- package/dist/_chunks/index-Cd6y6nuf.js +0 -93
- package/dist/_chunks/index-Cd6y6nuf.js.map +0 -1
- package/dist/_chunks/index-Cf9ZIBLd.js +0 -4195
- package/dist/_chunks/index-Cf9ZIBLd.js.map +0 -1
- package/dist/_chunks/index-D981K4TK.mjs +0 -4179
- package/dist/_chunks/index-D981K4TK.mjs.map +0 -1
- package/dist/_chunks/index-DYiJBXKE.js +0 -10131
- package/dist/_chunks/index-DYiJBXKE.js.map +0 -1
- package/dist/_chunks/index-DjZ3ZaVB.js +0 -17189
- package/dist/_chunks/index-DjZ3ZaVB.js.map +0 -1
- package/dist/_chunks/index-DkhJl5mF.mjs +0 -10131
- package/dist/_chunks/index-DkhJl5mF.mjs.map +0 -1
- package/dist/admin/index.js.map +0 -1
- package/dist/admin/index.mjs.map +0 -1
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useState, useEffect } from "react";
|
|
3
|
-
import { Layouts } from "@strapi/strapi/admin";
|
|
4
|
-
import { Table, Thead, Tr, Th, Typography, VisuallyHidden, Tbody, Td, Flex, LinkButton } from "@strapi/design-system";
|
|
5
|
-
import { Pencil } from "@strapi/icons";
|
|
6
|
-
import { u as useApi, g as getTranslation } from "./index-D981K4TK.mjs";
|
|
7
|
-
import { C as Center, E as EmptyBox } from "./EmptyBox-7D4LrvdH.mjs";
|
|
8
|
-
import { useIntl } from "react-intl";
|
|
9
|
-
function getRouteType(route) {
|
|
10
|
-
if (route.wrapper) {
|
|
11
|
-
return "wrapper";
|
|
12
|
-
} else if (!route.internal) {
|
|
13
|
-
return "external";
|
|
14
|
-
} else {
|
|
15
|
-
return "internal";
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
const Routes = () => {
|
|
19
|
-
const { getRoutes } = useApi();
|
|
20
|
-
const { formatMessage } = useIntl();
|
|
21
|
-
const [routes, setRoutes] = useState([]);
|
|
22
|
-
useEffect(() => {
|
|
23
|
-
async function fetchRoutes() {
|
|
24
|
-
const data = await getRoutes();
|
|
25
|
-
setRoutes(data);
|
|
26
|
-
}
|
|
27
|
-
fetchRoutes();
|
|
28
|
-
}, []);
|
|
29
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
|
-
/* @__PURE__ */ jsx(
|
|
31
|
-
Layouts.Header,
|
|
32
|
-
{
|
|
33
|
-
title: formatMessage({
|
|
34
|
-
id: getTranslation("routes.page.title"),
|
|
35
|
-
defaultMessage: "Routes"
|
|
36
|
-
}),
|
|
37
|
-
subtitle: formatMessage({
|
|
38
|
-
id: getTranslation("routes.page.subtitle"),
|
|
39
|
-
defaultMessage: "Overview of all existing routes"
|
|
40
|
-
})
|
|
41
|
-
}
|
|
42
|
-
),
|
|
43
|
-
/* @__PURE__ */ jsx(Layouts.Content, { children: routes.length === 0 ? /* @__PURE__ */ jsx(Center, { height: 400, children: /* @__PURE__ */ jsx(EmptyBox, { msg: formatMessage({
|
|
44
|
-
id: getTranslation("routes.page.emptyRoutes"),
|
|
45
|
-
defaultMessage: "No routes found"
|
|
46
|
-
}) }) }) : /* @__PURE__ */ jsxs(Table, { colCount: 4, rowCount: routes.length, children: [
|
|
47
|
-
/* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
|
|
48
|
-
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "ID" }) }),
|
|
49
|
-
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: formatMessage({
|
|
50
|
-
id: getTranslation("title"),
|
|
51
|
-
defaultMessage: "Title"
|
|
52
|
-
}) }) }),
|
|
53
|
-
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: formatMessage({
|
|
54
|
-
id: getTranslation("route"),
|
|
55
|
-
defaultMessage: "Route"
|
|
56
|
-
}) }) }),
|
|
57
|
-
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: formatMessage({
|
|
58
|
-
id: getTranslation("routes.page.column.type"),
|
|
59
|
-
defaultMessage: "Type"
|
|
60
|
-
}) }) }),
|
|
61
|
-
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(VisuallyHidden, { children: formatMessage({
|
|
62
|
-
id: getTranslation("actions"),
|
|
63
|
-
defaultMessage: "Actions"
|
|
64
|
-
}) }) })
|
|
65
|
-
] }) }),
|
|
66
|
-
/* @__PURE__ */ jsx(Tbody, { children: routes.map((route) => /* @__PURE__ */ jsxs(Tr, { children: [
|
|
67
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: route.id }) }),
|
|
68
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: route.title }) }),
|
|
69
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: route.fullPath }) }),
|
|
70
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: formatMessage({
|
|
71
|
-
id: getTranslation(`route.type.${getRouteType(route)}`),
|
|
72
|
-
defaultMessage: "-"
|
|
73
|
-
}) }) }),
|
|
74
|
-
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Flex, { gap: 2, justifyContent: "end", children: route.internal && /* @__PURE__ */ jsx(
|
|
75
|
-
LinkButton,
|
|
76
|
-
{
|
|
77
|
-
variant: "secondary",
|
|
78
|
-
startIcon: /* @__PURE__ */ jsx(Pencil, {}),
|
|
79
|
-
href: `/admin/content-manager/collection-types/${route.relatedContentType}/${route.relatedDocumentId}`,
|
|
80
|
-
children: formatMessage({
|
|
81
|
-
id: getTranslation("edit"),
|
|
82
|
-
defaultMessage: "Edit"
|
|
83
|
-
})
|
|
84
|
-
}
|
|
85
|
-
) }) })
|
|
86
|
-
] }, route.id)) })
|
|
87
|
-
] }) })
|
|
88
|
-
] });
|
|
89
|
-
};
|
|
90
|
-
export {
|
|
91
|
-
Routes as default
|
|
92
|
-
};
|
|
93
|
-
//# sourceMappingURL=index-CXzNr2cH.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-CXzNr2cH.mjs","sources":["../../admin/src/utils/getRouteType.ts","../../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}","/*\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 { useState, useEffect } from 'react';\nimport { Layouts } from '@strapi/strapi/admin';\nimport { Flex, Typography, Table, Thead, Tbody, Tr, Td, Th, VisuallyHidden, LinkButton } from '@strapi/design-system';\nimport { Pencil } from '@strapi/icons';\nimport { Route } from '../../../../types';\nimport { useApi } from '../../hooks';\nimport { EmptyBox, Center } from '../../components/UI';\nimport { getTranslation, getRouteType } from '../../utils';\nimport { useIntl } from 'react-intl';\n\nconst Routes = () => {\n const { getRoutes } = useApi();\n const { formatMessage } = useIntl();\n\n const [routes, setRoutes] = useState<Route[]>([]);\n\n useEffect(() => {\n async function fetchRoutes() {\n const data = await getRoutes();\n setRoutes(data);\n }\n fetchRoutes();\n }, [])\n\n return (\n <>\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 {routes.length === 0 ? (\n <Center height={400}>\n <EmptyBox msg={formatMessage({\n id: getTranslation('routes.page.emptyRoutes'),\n defaultMessage: 'No routes found',\n })} />\n </Center>\n ) : (\n <Table colCount={4} rowCount={routes.length}>\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 <Tbody>\n {routes.map((route: Route) => (\n <Tr key={route.id}>\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 </Tbody>\n </Table>\n )}\n </Layouts.Content>\n </>\n );\n};\n\nexport default Routes;"],"names":[],"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;ACQA,MAAM,SAAS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YACjB,CAAA;AAAA,UAAA;AAAA,WAGP,EACF,CAAA;AAAA,MAAA,KAjCO,MAAM,EAkCf,CACD,EACH,CAAA;AAAA,IAAA,EAAA,CACF,EAEJ,CAAA;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -1,93 +0,0 @@
|
|
|
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 admin = require("@strapi/strapi/admin");
|
|
6
|
-
const designSystem = require("@strapi/design-system");
|
|
7
|
-
const icons = require("@strapi/icons");
|
|
8
|
-
const index = require("./index-Cf9ZIBLd.js");
|
|
9
|
-
const EmptyBox = require("./EmptyBox-DT6D5gcf.js");
|
|
10
|
-
const reactIntl = require("react-intl");
|
|
11
|
-
function getRouteType(route) {
|
|
12
|
-
if (route.wrapper) {
|
|
13
|
-
return "wrapper";
|
|
14
|
-
} else if (!route.internal) {
|
|
15
|
-
return "external";
|
|
16
|
-
} else {
|
|
17
|
-
return "internal";
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
const Routes = () => {
|
|
21
|
-
const { getRoutes } = index.useApi();
|
|
22
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
23
|
-
const [routes, setRoutes] = React.useState([]);
|
|
24
|
-
React.useEffect(() => {
|
|
25
|
-
async function fetchRoutes() {
|
|
26
|
-
const data = await getRoutes();
|
|
27
|
-
setRoutes(data);
|
|
28
|
-
}
|
|
29
|
-
fetchRoutes();
|
|
30
|
-
}, []);
|
|
31
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
32
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
33
|
-
admin.Layouts.Header,
|
|
34
|
-
{
|
|
35
|
-
title: formatMessage({
|
|
36
|
-
id: index.getTranslation("routes.page.title"),
|
|
37
|
-
defaultMessage: "Routes"
|
|
38
|
-
}),
|
|
39
|
-
subtitle: formatMessage({
|
|
40
|
-
id: index.getTranslation("routes.page.subtitle"),
|
|
41
|
-
defaultMessage: "Overview of all existing routes"
|
|
42
|
-
})
|
|
43
|
-
}
|
|
44
|
-
),
|
|
45
|
-
/* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Content, { children: routes.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(EmptyBox.Center, { height: 400, children: /* @__PURE__ */ jsxRuntime.jsx(EmptyBox.EmptyBox, { msg: formatMessage({
|
|
46
|
-
id: index.getTranslation("routes.page.emptyRoutes"),
|
|
47
|
-
defaultMessage: "No routes found"
|
|
48
|
-
}) }) }) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount: 4, rowCount: routes.length, children: [
|
|
49
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
50
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: "ID" }) }),
|
|
51
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: formatMessage({
|
|
52
|
-
id: index.getTranslation("title"),
|
|
53
|
-
defaultMessage: "Title"
|
|
54
|
-
}) }) }),
|
|
55
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: formatMessage({
|
|
56
|
-
id: index.getTranslation("route"),
|
|
57
|
-
defaultMessage: "Route"
|
|
58
|
-
}) }) }),
|
|
59
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: formatMessage({
|
|
60
|
-
id: index.getTranslation("routes.page.column.type"),
|
|
61
|
-
defaultMessage: "Type"
|
|
62
|
-
}) }) }),
|
|
63
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: formatMessage({
|
|
64
|
-
id: index.getTranslation("actions"),
|
|
65
|
-
defaultMessage: "Actions"
|
|
66
|
-
}) }) })
|
|
67
|
-
] }) }),
|
|
68
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: routes.map((route) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
69
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: route.id }) }),
|
|
70
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: route.title }) }),
|
|
71
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: route.fullPath }) }),
|
|
72
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: formatMessage({
|
|
73
|
-
id: index.getTranslation(`route.type.${getRouteType(route)}`),
|
|
74
|
-
defaultMessage: "-"
|
|
75
|
-
}) }) }),
|
|
76
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, justifyContent: "end", children: route.internal && /* @__PURE__ */ jsxRuntime.jsx(
|
|
77
|
-
designSystem.LinkButton,
|
|
78
|
-
{
|
|
79
|
-
variant: "secondary",
|
|
80
|
-
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Pencil, {}),
|
|
81
|
-
href: `/admin/content-manager/collection-types/${route.relatedContentType}/${route.relatedDocumentId}`,
|
|
82
|
-
children: formatMessage({
|
|
83
|
-
id: index.getTranslation("edit"),
|
|
84
|
-
defaultMessage: "Edit"
|
|
85
|
-
})
|
|
86
|
-
}
|
|
87
|
-
) }) })
|
|
88
|
-
] }, route.id)) })
|
|
89
|
-
] }) })
|
|
90
|
-
] });
|
|
91
|
-
};
|
|
92
|
-
exports.default = Routes;
|
|
93
|
-
//# sourceMappingURL=index-Cd6y6nuf.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-Cd6y6nuf.js","sources":["../../admin/src/utils/getRouteType.ts","../../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}","/*\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 { useState, useEffect } from 'react';\nimport { Layouts } from '@strapi/strapi/admin';\nimport { Flex, Typography, Table, Thead, Tbody, Tr, Td, Th, VisuallyHidden, LinkButton } from '@strapi/design-system';\nimport { Pencil } from '@strapi/icons';\nimport { Route } from '../../../../types';\nimport { useApi } from '../../hooks';\nimport { EmptyBox, Center } from '../../components/UI';\nimport { getTranslation, getRouteType } from '../../utils';\nimport { useIntl } from 'react-intl';\n\nconst Routes = () => {\n const { getRoutes } = useApi();\n const { formatMessage } = useIntl();\n\n const [routes, setRoutes] = useState<Route[]>([]);\n\n useEffect(() => {\n async function fetchRoutes() {\n const data = await getRoutes();\n setRoutes(data);\n }\n fetchRoutes();\n }, [])\n\n return (\n <>\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 {routes.length === 0 ? (\n <Center height={400}>\n <EmptyBox msg={formatMessage({\n id: getTranslation('routes.page.emptyRoutes'),\n defaultMessage: 'No routes found',\n })} />\n </Center>\n ) : (\n <Table colCount={4} rowCount={routes.length}>\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 <Tbody>\n {routes.map((route: Route) => (\n <Tr key={route.id}>\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 </Tbody>\n </Table>\n )}\n </Layouts.Content>\n </>\n );\n};\n\nexport default Routes;"],"names":["useApi","useIntl","useState","useEffect","jsxs","Fragment","jsx","Layouts","getTranslation","Center","EmptyBox","Table","Thead","Tr","Th","Typography","VisuallyHidden","Tbody","Td","Flex","LinkButton","Pencil"],"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;ACQA,MAAM,SAAS,MAAM;AACb,QAAA,EAAE,UAAU,IAAIA,aAAO;AACvB,QAAA,EAAE,cAAc,IAAIC,kBAAQ;AAElC,QAAM,CAAC,QAAQ,SAAS,IAAIC,MAAAA,SAAkB,CAAA,CAAE;AAEhDC,QAAAA,UAAU,MAAM;AACd,mBAAe,cAAc;AACrB,YAAA,OAAO,MAAM,UAAU;AAC7B,gBAAU,IAAI;AAAA,IAAA;AAEJ,gBAAA;AAAA,EACd,GAAG,EAAE;AAEL,SAEIC,2BAAA,KAAAC,qBAAA,EAAA,UAAA;AAAA,IAAAC,2BAAA;AAAA,MAACC,MAAAA,QAAQ;AAAA,MAAR;AAAA,QACC,OAAO,cAAc;AAAA,UACnB,IAAIC,qBAAe,mBAAmB;AAAA,UACtC,gBAAgB;AAAA,QAAA,CACjB;AAAA,QACD,UAAU,cAAc;AAAA,UACtB,IAAIA,qBAAe,sBAAsB;AAAA,UACzC,gBAAgB;AAAA,QACjB,CAAA;AAAA,MAAA;AAAA,IACH;AAAA,IACCF,2BAAA,IAAAC,MAAA,QAAQ,SAAR,EACE,iBAAO,WAAW,IAChBD,2BAAA,IAAAG,SAAA,QAAA,EAAO,QAAQ,KACd,UAACH,2BAAA,IAAAI,mBAAA,EAAS,KAAK,cAAc;AAAA,MAC3B,IAAIF,qBAAe,yBAAyB;AAAA,MAC5C,gBAAgB;AAAA,IACjB,CAAA,GAAG,EAAA,CACN,IAEAJ,2BAAAA,KAACO,aAAAA,SAAM,UAAU,GAAG,UAAU,OAAO,QACnC,UAAA;A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