@mattisvensson/strapi-plugin-webatlas 0.6.2 → 0.7.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.
Files changed (59) hide show
  1. package/dist/_chunks/{de-CL1TIZPg.js → de-BZc1BkzH.js} +4 -1
  2. package/dist/_chunks/{de-CL1TIZPg.js.map → de-BZc1BkzH.js.map} +1 -1
  3. package/dist/_chunks/{de-CzVD4dbZ.mjs → de-oxxH8hft.mjs} +4 -1
  4. package/dist/_chunks/{de-CzVD4dbZ.mjs.map → de-oxxH8hft.mjs.map} +1 -1
  5. package/dist/_chunks/{en-Du-Ap60j.js → en-Deg4n_IM.js} +4 -1
  6. package/dist/_chunks/{en-Du-Ap60j.js.map → en-Deg4n_IM.js.map} +1 -1
  7. package/dist/_chunks/{en-Nk6QcTdr.mjs → en-DqC5aDzA.mjs} +4 -1
  8. package/dist/_chunks/{en-Nk6QcTdr.mjs.map → en-DqC5aDzA.mjs.map} +1 -1
  9. package/dist/_chunks/{index-Z3yKckP0.js → index-2J9mPFyV.js} +6 -6
  10. package/dist/_chunks/{index-Z3yKckP0.js.map → index-2J9mPFyV.js.map} +1 -1
  11. package/dist/_chunks/{index-CjA6bLGU.js → index-B79--vLg.js} +1 -1
  12. package/dist/_chunks/{index-BDoljrOj.js.map → index-B79--vLg.js.map} +1 -1
  13. package/dist/_chunks/{index-C4-VBSgi.mjs → index-BFMLU2kR.mjs} +18 -13
  14. package/dist/_chunks/index-BFMLU2kR.mjs.map +1 -0
  15. package/dist/_chunks/{index-iF1y6Mhe.mjs → index-C6Dorrjz.mjs} +6 -6
  16. package/dist/_chunks/{index-iF1y6Mhe.mjs.map → index-C6Dorrjz.mjs.map} +1 -1
  17. package/dist/_chunks/{index-Ch8tSWp4.js → index-C6e9wLau.js} +5 -5
  18. package/dist/_chunks/index-C6e9wLau.js.map +1 -0
  19. package/dist/_chunks/index-CHB_8c7e.js +246 -0
  20. package/dist/_chunks/index-CHB_8c7e.js.map +1 -0
  21. package/dist/_chunks/{index-B9OfSpne.mjs → index-D5Uc0GLu.mjs} +17 -12
  22. package/dist/_chunks/index-D5Uc0GLu.mjs.map +1 -0
  23. package/dist/_chunks/{index-D1zlwukG.js → index-DCejsR9X.js} +18 -13
  24. package/dist/_chunks/index-DCejsR9X.js.map +1 -0
  25. package/dist/_chunks/{index-CC1UR_w8.mjs → index-DLZJ_sUK.mjs} +2 -2
  26. package/dist/_chunks/{index-CC1UR_w8.mjs.map → index-DLZJ_sUK.mjs.map} +1 -1
  27. package/dist/_chunks/{index-BPIdov2N.mjs → index-DY1ICa5c.mjs} +5 -5
  28. package/dist/_chunks/index-DY1ICa5c.mjs.map +1 -0
  29. package/dist/_chunks/{index-13yB9fna.mjs → index-DcFYhqke.mjs} +1 -1
  30. package/dist/_chunks/index-DcFYhqke.mjs.map +1 -0
  31. package/dist/_chunks/{index-Bw2Yq-Hx.js → index-DeCgextE.js} +17 -12
  32. package/dist/_chunks/index-DeCgextE.js.map +1 -0
  33. package/dist/_chunks/index-DzqTj_0f.mjs +247 -0
  34. package/dist/_chunks/index-DzqTj_0f.mjs.map +1 -0
  35. package/dist/_chunks/index-KC82xDAD.mjs +246 -0
  36. package/dist/_chunks/index-KC82xDAD.mjs.map +1 -0
  37. package/dist/_chunks/{index-BDoljrOj.js → index-NZpDoHIv.js} +2 -2
  38. package/dist/_chunks/index-NZpDoHIv.js.map +1 -0
  39. package/dist/_chunks/index-dzRHjemo.js +247 -0
  40. package/dist/_chunks/index-dzRHjemo.js.map +1 -0
  41. package/dist/admin/index.js +1 -1
  42. package/dist/admin/index.mjs +1 -1
  43. package/dist/admin/src/pages/Routes/TableHeader.d.ts +5 -1
  44. package/dist/admin/src/pages/Routes/compareBy.d.ts +2 -0
  45. package/dist/server/index.js +1 -1
  46. package/dist/server/index.mjs +1 -1
  47. package/package.json +1 -1
  48. package/dist/_chunks/EmptyBox-BM4IscSk.mjs +0 -13
  49. package/dist/_chunks/EmptyBox-BM4IscSk.mjs.map +0 -1
  50. package/dist/_chunks/EmptyBox-T8t29l25.js +0 -12
  51. package/dist/_chunks/EmptyBox-T8t29l25.js.map +0 -1
  52. package/dist/_chunks/index-AIXu4HZz.mjs +0 -127
  53. package/dist/_chunks/index-AIXu4HZz.mjs.map +0 -1
  54. package/dist/_chunks/index-BOF-1QDH.js +0 -127
  55. package/dist/_chunks/index-BOF-1QDH.js.map +0 -1
  56. package/dist/_chunks/index-BluRjThy.mjs +0 -126
  57. package/dist/_chunks/index-C4-VBSgi.mjs.map +0 -1
  58. package/dist/_chunks/index-D1zlwukG.js.map +0 -1
  59. package/dist/_chunks/index-DeNZkmpv.js +0 -126
@@ -1,127 +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 designSystem = require("@strapi/design-system");
6
- const index = require("./index-Z3yKckP0.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;
127
- //# sourceMappingURL=index-BOF-1QDH.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index-BOF-1QDH.js","sources":["../../admin/src/utils/getRouteType.ts","../../admin/src/pages/Routes/TableHeader.tsx","../../admin/src/pages/Routes/TableRow.tsx","../../admin/src/pages/Routes/PageWrapper.tsx","../../admin/src/pages/Routes/index.tsx"],"sourcesContent":["import type { Route } from \"../../../types\";\n\nexport default function getRouteType(route: Route): 'internal' | 'external' | 'wrapper' {\n if (route.wrapper) {\n return 'wrapper';\n } else if (!route.internal) {\n return 'external';\n } else {\n return 'internal';\n }\n}","import { Typography, Thead, Tr, Th, VisuallyHidden } from '@strapi/design-system';\nimport { getTranslation } from '../../utils';\nimport { useIntl } from 'react-intl';\n\nexport default function TableHeader() {\n const { formatMessage } = useIntl();\n\n return (\n <Thead>\n <Tr>\n <Th>\n <Typography variant=\"sigma\">ID</Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\">\n {formatMessage({\n id: getTranslation('title'),\n defaultMessage: 'Title',\n })}\n </Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\">\n {formatMessage({\n id: getTranslation('route'),\n defaultMessage: 'Route',\n })}\n </Typography>\n </Th>\n <Th>\n <Typography variant=\"sigma\">\n {formatMessage({\n id: getTranslation('routes.page.column.type'),\n defaultMessage: 'Type',\n })}\n </Typography>\n </Th>\n <Th>\n <VisuallyHidden>\n {formatMessage({\n id: getTranslation('actions'),\n defaultMessage: 'Actions',\n })}\n </VisuallyHidden>\n </Th>\n </Tr>\n </Thead>\n )\n}","import type { Route } from '../../../../types';\nimport { Typography, Tr, Td, Flex, LinkButton } from '@strapi/design-system';\nimport { getTranslation, getRouteType } from '../../utils';\nimport { useIntl } from 'react-intl';\nimport { Pencil } from '@strapi/icons';\n\nexport default function TableRow({ route }: { route: Route }) {\n const { formatMessage } = useIntl();\n \n return (\n <Tr>\n <Td>\n <Typography textColor=\"neutral800\">{route.id}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">{route.title}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">{route.fullPath}</Typography>\n </Td>\n <Td>\n <Typography textColor=\"neutral800\">\n {formatMessage({\n id: getTranslation(`route.type.${getRouteType(route)}`),\n defaultMessage: '-',\n })}\n </Typography>\n </Td>\n <Td>\n <Flex gap={2} justifyContent=\"end\">\n {route.internal && \n <LinkButton\n variant=\"secondary\"\n startIcon={<Pencil />} \n href={`/admin/content-manager/collection-types/${route.relatedContentType}/${route.relatedDocumentId}`}\n >\n {formatMessage({\n id: getTranslation('edit'),\n defaultMessage: 'Edit',\n })}\n </LinkButton>\n }\n </Flex>\n </Td>\n </Tr>\n )\n}","import { Layouts, Page } from '@strapi/strapi/admin';\nimport { Box } from '@strapi/design-system';\nimport { getTranslation } from '../../utils';\nimport { useIntl } from 'react-intl';\n\nexport default function PageWrapper({ children }: { children: React.ReactNode }) {\n const { formatMessage } = useIntl();\n\n return (\n <Page.Main>\n <Layouts.Header\n title={formatMessage({\n id: getTranslation('routes.page.title'),\n defaultMessage: 'Routes',\n })}\n subtitle={formatMessage({\n id: getTranslation('routes.page.subtitle'),\n defaultMessage: 'Overview of all existing routes',\n })}\n />\n <Layouts.Content>\n <Box>\n {children}\n </Box>\n </Layouts.Content>\n </Page.Main>\n );\n}","/*\n *\n * Routes\n * This file contains the Routes page of the Webatlas plugin for Strapi.\n * It displays a table of all existing routes with their details and allows editing.\n *\n*/\n\nimport type { Route } from '../../../../types';\nimport { useState, useEffect } from 'react';\nimport { Table, Tbody } from '@strapi/design-system';\nimport { useApi } from '../../hooks';\nimport { EmptyBox, Center, FullLoader } from '../../components/UI';\nimport { getTranslation } from '../../utils';\nimport { useIntl } from 'react-intl';\nimport TableHeader from './TableHeader';\nimport TableRow from './TableRow';\nimport { useNotification } from '@strapi/strapi/admin'\nimport PageWrapper from './PageWrapper';\n\nconst Routes = () => {\n const { getRoutes } = useApi();\n const { formatMessage } = useIntl();\n const { toggleNotification } = useNotification();\n \n const [routes, setRoutes] = useState<Route[]>([]);\n const [loading, setLoading] = useState(true);\n\n useEffect(() => {\n async function fetchRoutes() {\n try {\n const data = await getRoutes();\n setRoutes(data);\n } catch (err) {\n console.error('Failed to fetch routes:', err);\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: getTranslation('notification.routes.fetchFailed'),\n defaultMessage: 'Failed to fetch routes',\n }),\n });\n } finally {\n setLoading(false);\n }\n }\n fetchRoutes();\n }, [])\n\n if (loading) {\n return <PageWrapper>\n <FullLoader />\n </PageWrapper>\n }\n\n if (routes.length === 0) {\n return <PageWrapper>\n <Center height={400}>\n <EmptyBox msg={formatMessage({\n id: getTranslation('routes.page.emptyRoutes'),\n defaultMessage: 'No routes found',\n })} />\n </Center>\n </PageWrapper>;\n }\n return (\n <PageWrapper>\n <Table colCount={4} rowCount={routes.length}>\n <TableHeader />\n <Tbody>\n {routes.map((route: Route) => (\n <TableRow key={route.id} route={route} />\n ))}\n </Tbody>\n </Table>\n </PageWrapper>\n );\n};\n\nexport default Routes;"],"names":["useIntl","jsx","Thead","jsxs","Tr","Th","Typography","getTranslation","VisuallyHidden","Td","Flex","LinkButton","Pencil","Page","Layouts","Box","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B,2BAAA,IAAC,eACN,UAACA,2BAAAA,IAAAoB,WAAAA,QAAA,EAAO,QAAQ,KACd,UAAApB,2BAAA,IAACqB,SAAS,UAAA,EAAA,KAAK,cAAc;AAAA,MAC3B,IAAIf,qBAAe,yBAAyB;AAAA,MAC5C,gBAAgB;AAAA,IAAA,CACjB,EAAG,CAAA,EACN,CAAA,GACF;AAAA,EAAA;AAGA,SAAAN,2BAAA,IAAC,eACC,UAACE,2BAAA,KAAAoB,aAAA,OAAA,EAAM,UAAU,GAAG,UAAU,OAAO,QACnC,UAAA;AAAA,IAAAtB,2BAAA,IAAC,aAAY,EAAA;AAAA,IACZA,2BAAAA,IAAAuB,aAAAA,OAAA,EACE,UAAO,OAAA,IAAI,CAAC,UACVvB,2BAAAA,IAAA,UAAA,EAAwB,MAAV,GAAA,MAAM,EAAkB,CACxC,EACH,CAAA;AAAA,EAAA,EAAA,CACF,EACF,CAAA;AAEJ;;"}
@@ -1,126 +0,0 @@
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-BPIdov2N.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
- };