diff --git a/apps/console/src/environments.ts b/apps/console/src/environments.ts index d67d353a1..7f5023a57 100644 --- a/apps/console/src/environments.ts +++ b/apps/console/src/environments.ts @@ -7,12 +7,12 @@ const store = new Store(source, { gcReleaseBufferSize: 20, }); -export const consoleEnvironment = new Environment({ +export const coreEnvironment = new Environment({ network: Network.create(makeFetchQuery("/api/console/v1/graphql")), store, }); -export const connectEnvironment = new Environment({ +export const iamEnvironment = new Environment({ network: Network.create(makeFetchQuery("/api/connect/v1/graphql")), store, }); diff --git a/apps/console/src/pages/iam/organizations/OrganizationLayout.tsx b/apps/console/src/pages/iam/organizations/OrganizationLayout.tsx index 77aa480fc..b962859fa 100644 --- a/apps/console/src/pages/iam/organizations/OrganizationLayout.tsx +++ b/apps/console/src/pages/iam/organizations/OrganizationLayout.tsx @@ -1,19 +1,15 @@ -import { - RelayEnvironmentProvider, - usePreloadedQuery, - type PreloadedQuery, -} from "react-relay"; +import { usePreloadedQuery, type PreloadedQuery } from "react-relay"; import { organizationLayoutQuery } from "./OrganizationLayoutQuery"; import { Link, Outlet } from "react-router"; import { Badge, Button, IconPeopleAdd, Layout, Skeleton } from "@probo/ui"; import { Sidebar } from "./_components/Sidebar"; import { OrganizationDropdown } from "./_components/OrganizationDropdown"; -import { consoleEnvironment } from "/environments"; import type { OrganizationLayoutQuery } from "./__generated__/OrganizationLayoutQuery.graphql"; import { PermissionsProvider } from "/providers/PermissionsProvider"; import { SessionDropdown } from "./_components/SessionDropdown"; import { Suspense } from "react"; import { useTranslate } from "@probo/i18n"; +import { CoreRelayProvider } from "/providers/CoreRelayProvider"; interface OrganizationLayoutProps { queryRef: PreloadedQuery; @@ -59,9 +55,9 @@ export default function OrganizationLayout(props: OrganizationLayoutProps) { } sidebar={} > - + - + ); diff --git a/apps/console/src/providers/CoreRelayProvider.tsx b/apps/console/src/providers/CoreRelayProvider.tsx new file mode 100644 index 000000000..5dbbfb2cd --- /dev/null +++ b/apps/console/src/providers/CoreRelayProvider.tsx @@ -0,0 +1,7 @@ +import type { ReactNode } from "react"; +import { RelayEnvironmentProvider } from "react-relay"; +import { coreEnvironment } from "/environments"; + +export function CoreRelayProvider(props: { children: ReactNode }) { + return ; +} diff --git a/apps/console/src/providers/IAMRelayProvider.tsx b/apps/console/src/providers/IAMRelayProvider.tsx new file mode 100644 index 000000000..26f326d32 --- /dev/null +++ b/apps/console/src/providers/IAMRelayProvider.tsx @@ -0,0 +1,7 @@ +import type { ReactNode } from "react"; +import { RelayEnvironmentProvider } from "react-relay"; +import { iamEnvironment } from "/environments"; + +export function IAMRelayProvider(props: { children: ReactNode }) { + return ; +} diff --git a/apps/console/src/routes.tsx b/apps/console/src/routes.tsx index 8b023de54..bdbad52b8 100644 --- a/apps/console/src/routes.tsx +++ b/apps/console/src/routes.tsx @@ -41,8 +41,7 @@ import { employeeDocumentSignatureQuery } from "./pages/organizations/employee/E import { Role } from "@probo/helpers"; import { PermissionsContext } from "./providers/PermissionsContext"; import { use } from "react"; -import { RelayEnvironmentProvider } from "react-relay"; -import { connectEnvironment, consoleEnvironment } from "./environments.ts"; +import { coreEnvironment } from "./environments.ts"; import { ForbiddenError, UnAuthenticatedError, @@ -50,6 +49,7 @@ import { } from "@probo/relay"; import { OrganizationsPageQuery } from "./pages/iam/organizations/OrganizationsPageQuery.tsx"; import { OrganizationLayoutQuery } from "./pages/iam/organizations/OrganizationLayoutQuery.tsx"; +import { IAMRelayProvider } from "./providers/IAMRelayProvider.tsx"; const NewOrganizationPage = lazy( () => import("./pages/iam/organizations/NewOrganizationPage"), @@ -80,9 +80,9 @@ const routes = [ { path: "/auth", Component: () => ( - + - + ), children: [ { @@ -120,17 +120,17 @@ const routes = [ { index: true, Component: () => ( - + - + ), }, { path: "organizations/new", Component: () => ( - + - + ), }, { @@ -154,7 +154,7 @@ const routes = [ path: "", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, employeeDocumentsQuery, { + loadQuery(coreEnvironment, employeeDocumentsQuery, { organizationId: organizationId!, }), ), @@ -170,7 +170,7 @@ const routes = [ Fallback: PageSkeleton, ErrorBoundary: ErrorBoundary, loader: loaderFromQueryLoader(({ documentId }) => - loadQuery(consoleEnvironment, employeeDocumentSignatureQuery, { + loadQuery(coreEnvironment, employeeDocumentSignatureQuery, { documentId: documentId!, }), ), @@ -186,9 +186,9 @@ const routes = [ { path: "/organizations/:organizationId", Component: () => ( - + - + ), ErrorBoundary: ErrorBoundary, children: [ @@ -210,7 +210,7 @@ const routes = [ path: "settings", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, organizationViewQuery, { + loadQuery(coreEnvironment, organizationViewQuery, { organizationId: organizationId!, }), ), diff --git a/apps/console/src/routes/assetRoutes.ts b/apps/console/src/routes/assetRoutes.ts index 64669b72d..75ed36fb7 100644 --- a/apps/console/src/routes/assetRoutes.ts +++ b/apps/console/src/routes/assetRoutes.ts @@ -1,53 +1,65 @@ import { loadQuery } from "react-relay"; -import { consoleEnvironment } from "/environments"; +import { coreEnvironment } from "/environments"; import { PageSkeleton } from "/components/skeletons/PageSkeleton"; import { lazy } from "@probo/react-lazy"; import { assetsQuery, assetNodeQuery } from "../hooks/graph/AssetGraph"; import type { AssetGraphListQuery } from "/hooks/graph/__generated__/AssetGraphListQuery.graphql"; import type { AssetGraphNodeQuery } from "/hooks/graph/__generated__/AssetGraphNodeQuery.graphql"; -import { loaderFromQueryLoader, withQueryRef, type AppRoute } from "@probo/routes"; +import { + loaderFromQueryLoader, + withQueryRef, + type AppRoute, +} from "@probo/routes"; export const assetRoutes = [ { path: "assets", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, assetsQuery, { + loadQuery(coreEnvironment, assetsQuery, { organizationId: organizationId, snapshotId: null, }), ), - Component: withQueryRef(lazy(() => import("/pages/organizations/assets/AssetsPage"))), + Component: withQueryRef( + lazy(() => import("/pages/organizations/assets/AssetsPage")), + ), }, { path: "snapshots/:snapshotId/assets", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId, snapshotId }) => - loadQuery(consoleEnvironment, assetsQuery, { + loadQuery(coreEnvironment, assetsQuery, { organizationId: organizationId, snapshotId: snapshotId, }), ), - Component: withQueryRef(lazy(() => import("/pages/organizations/assets/AssetsPage"))), + Component: withQueryRef( + lazy(() => import("/pages/organizations/assets/AssetsPage")), + ), }, { path: "assets/:assetId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ assetId }) => - loadQuery(consoleEnvironment, assetNodeQuery, { assetId }), + loadQuery(coreEnvironment, assetNodeQuery, { + assetId, + }), + ), + Component: withQueryRef( + lazy(() => import("/pages/organizations/assets/AssetDetailsPage")), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/assets/AssetDetailsPage"), - )), }, { path: "snapshots/:snapshotId/assets/:assetId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ assetId }) => - loadQuery(consoleEnvironment, assetNodeQuery, { assetId }), + loadQuery(coreEnvironment, assetNodeQuery, { + assetId, + }), + ), + Component: withQueryRef( + lazy(() => import("/pages/organizations/assets/AssetDetailsPage")), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/assets/AssetDetailsPage"), - )), }, ] satisfies AppRoute[]; diff --git a/apps/console/src/routes/auditRoutes.ts b/apps/console/src/routes/auditRoutes.ts index 01f56ada9..02f55bb61 100644 --- a/apps/console/src/routes/auditRoutes.ts +++ b/apps/console/src/routes/auditRoutes.ts @@ -1,31 +1,39 @@ import { loadQuery } from "react-relay"; -import { consoleEnvironment } from "/environments"; +import { coreEnvironment } from "/environments"; import { PageSkeleton } from "/components/skeletons/PageSkeleton"; import { lazy } from "@probo/react-lazy"; import { auditsQuery, auditNodeQuery } from "../hooks/graph/AuditGraph"; import type { AuditGraphListQuery } from "/hooks/graph/__generated__/AuditGraphListQuery.graphql"; import type { AuditGraphNodeQuery } from "/hooks/graph/__generated__/AuditGraphNodeQuery.graphql"; -import { loaderFromQueryLoader, withQueryRef, type AppRoute } from "@probo/routes"; +import { + loaderFromQueryLoader, + withQueryRef, + type AppRoute, +} from "@probo/routes"; export const auditRoutes = [ { path: "audits", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, auditsQuery, { organizationId }), + loadQuery(coreEnvironment, auditsQuery, { + organizationId, + }), + ), + Component: withQueryRef( + lazy(() => import("/pages/organizations/audits/AuditsPage")), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/audits/AuditsPage") - )), }, { path: "audits/:auditId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ auditId }) => - loadQuery(consoleEnvironment, auditNodeQuery, { auditId }), + loadQuery(coreEnvironment, auditNodeQuery, { + auditId, + }), + ), + Component: withQueryRef( + lazy(() => import("/pages/organizations/audits/AuditDetailsPage")), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/audits/AuditDetailsPage") - )), }, ] satisfies AppRoute[]; diff --git a/apps/console/src/routes/continualImprovementRoutes.ts b/apps/console/src/routes/continualImprovementRoutes.ts index 387146c4e..a5c2a1137 100644 --- a/apps/console/src/routes/continualImprovementRoutes.ts +++ b/apps/console/src/routes/continualImprovementRoutes.ts @@ -1,61 +1,96 @@ import { loadQuery } from "react-relay"; -import { consoleEnvironment } from "/environments"; +import { coreEnvironment } from "/environments"; import { PageSkeleton } from "/components/skeletons/PageSkeleton"; import { lazy } from "@probo/react-lazy"; -import { continualImprovementsQuery, continualImprovementNodeQuery } from "/hooks/graph/ContinualImprovementGraph"; +import { + continualImprovementsQuery, + continualImprovementNodeQuery, +} from "/hooks/graph/ContinualImprovementGraph"; import type { ContinualImprovementGraphListQuery } from "/hooks/graph/__generated__/ContinualImprovementGraphListQuery.graphql"; import type { ContinualImprovementGraphNodeQuery } from "/hooks/graph/__generated__/ContinualImprovementGraphNodeQuery.graphql"; -import { loaderFromQueryLoader, withQueryRef, type AppRoute } from "@probo/routes"; +import { + loaderFromQueryLoader, + withQueryRef, + type AppRoute, +} from "@probo/routes"; export const continualImprovementRoutes = [ { path: "continual-improvements", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, continualImprovementsQuery, { - organizationId, - snapshotId: null - }), + loadQuery( + coreEnvironment, + continualImprovementsQuery, + { + organizationId, + snapshotId: null, + }, + ), + ), + Component: withQueryRef( + lazy( + () => + import("/pages/organizations/continualImprovements/ContinualImprovementsPage"), + ), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/continualImprovements/ContinualImprovementsPage") - )), }, { path: "snapshots/:snapshotId/continual-improvements", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId, snapshotId }) => - loadQuery(consoleEnvironment, continualImprovementsQuery, { - organizationId, - snapshotId, - }), + loadQuery( + coreEnvironment, + continualImprovementsQuery, + { + organizationId, + snapshotId, + }, + ), + ), + Component: withQueryRef( + lazy( + () => + import("/pages/organizations/continualImprovements/ContinualImprovementsPage"), + ), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/continualImprovements/ContinualImprovementsPage") - )), }, { path: "continual-improvements/:improvementId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ improvementId }) => - loadQuery(consoleEnvironment, continualImprovementNodeQuery, { - continualImprovementId: improvementId!, - }), + loadQuery( + coreEnvironment, + continualImprovementNodeQuery, + { + continualImprovementId: improvementId!, + }, + ), + ), + Component: withQueryRef( + lazy( + () => + import("/pages/organizations/continualImprovements/ContinualImprovementDetailsPage"), + ), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/continualImprovements/ContinualImprovementDetailsPage") - )), }, { path: "snapshots/:snapshotId/continual-improvements/:improvementId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ improvementId }) => - loadQuery(consoleEnvironment, continualImprovementNodeQuery, { - continualImprovementId: improvementId!, - }), + loadQuery( + coreEnvironment, + continualImprovementNodeQuery, + { + continualImprovementId: improvementId!, + }, + ), + ), + Component: withQueryRef( + lazy( + () => + import("/pages/organizations/continualImprovements/ContinualImprovementDetailsPage"), + ), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/continualImprovements/ContinualImprovementDetailsPage") - )), }, ] satisfies AppRoute[]; diff --git a/apps/console/src/routes/dataRoutes.ts b/apps/console/src/routes/dataRoutes.ts index 910e716ca..fd62155e5 100644 --- a/apps/console/src/routes/dataRoutes.ts +++ b/apps/console/src/routes/dataRoutes.ts @@ -1,57 +1,65 @@ import { loadQuery } from "react-relay"; -import { consoleEnvironment } from "/environments"; +import { coreEnvironment } from "/environments"; import { PageSkeleton } from "/components/skeletons/PageSkeleton"; import { lazy } from "@probo/react-lazy"; import { dataQuery, datumNodeQuery } from "../hooks/graph/DatumGraph"; import type { DatumGraphListQuery } from "/hooks/graph/__generated__/DatumGraphListQuery.graphql"; import type { DatumGraphNodeQuery } from "/hooks/graph/__generated__/DatumGraphNodeQuery.graphql"; -import { loaderFromQueryLoader, withQueryRef, type AppRoute } from "@probo/routes"; +import { + loaderFromQueryLoader, + withQueryRef, + type AppRoute, +} from "@probo/routes"; export const dataRoutes = [ { path: "data", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, dataQuery, { + loadQuery(coreEnvironment, dataQuery, { organizationId: organizationId, - snapshotId: null + snapshotId: null, }), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/data/DataPage") - )), + Component: withQueryRef( + lazy(() => import("/pages/organizations/data/DataPage")), + ), }, { path: "snapshots/:snapshotId/data", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId, snapshotId }) => - loadQuery(consoleEnvironment, dataQuery, { + loadQuery(coreEnvironment, dataQuery, { organizationId, snapshotId, }), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/data/DataPage") - )), + Component: withQueryRef( + lazy(() => import("/pages/organizations/data/DataPage")), + ), }, { path: "data/:dataId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ dataId }) => - loadQuery(consoleEnvironment, datumNodeQuery, { dataId }), + loadQuery(coreEnvironment, datumNodeQuery, { + dataId, + }), + ), + Component: withQueryRef( + lazy(() => import("../pages/organizations/data/DatumDetailsPage")), ), - Component: withQueryRef(lazy( - () => import("../pages/organizations/data/DatumDetailsPage") - )), }, { path: "snapshots/:snapshotId/data/:dataId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ dataId }) => - loadQuery(consoleEnvironment, datumNodeQuery, { dataId }), + loadQuery(coreEnvironment, datumNodeQuery, { + dataId, + }), + ), + Component: withQueryRef( + lazy(() => import("../pages/organizations/data/DatumDetailsPage")), ), - Component: withQueryRef(lazy( - () => import("../pages/organizations/data/DatumDetailsPage") - )), }, ] satisfies AppRoute[]; diff --git a/apps/console/src/routes/documentsRoutes.ts b/apps/console/src/routes/documentsRoutes.ts index 2185e21b4..ccb75da95 100644 --- a/apps/console/src/routes/documentsRoutes.ts +++ b/apps/console/src/routes/documentsRoutes.ts @@ -1,13 +1,17 @@ import { Fragment } from "react"; import { loadQuery } from "react-relay"; -import { consoleEnvironment } from "/environments"; +import { coreEnvironment } from "/environments"; import { documentsQuery } from "/hooks/graph/DocumentGraph"; import { documentNodeQuery } from "/hooks/graph/DocumentGraph"; import { PageSkeleton } from "/components/skeletons/PageSkeleton"; import { redirect, type LoaderFunctionArgs } from "react-router"; import { lazy } from "@probo/react-lazy"; import { LinkCardSkeleton } from "/components/skeletons/LinkCardSkeleton"; -import { loaderFromQueryLoader, withQueryRef, type AppRoute } from "@probo/routes"; +import { + loaderFromQueryLoader, + withQueryRef, + type AppRoute, +} from "@probo/routes"; import type { DocumentGraphListQuery } from "/hooks/graph/__generated__/DocumentGraphListQuery.graphql"; import type { DocumentGraphNodeQuery } from "/hooks/graph/__generated__/DocumentGraphNodeQuery.graphql"; @@ -15,7 +19,9 @@ const documentTabs = (prefix: string) => { return [ { path: `${prefix}`, - loader: ({ params: { organizationId, documentId, versionId } }: LoaderFunctionArgs) => { + loader: ({ + params: { organizationId, documentId, versionId }, + }: LoaderFunctionArgs) => { const basePath = `/organizations/${organizationId}/documents/${documentId}`; const redirectPath = versionId ? `${basePath}/versions/${versionId}/description` @@ -29,9 +35,7 @@ const documentTabs = (prefix: string) => { Fallback: LinkCardSkeleton, Component: lazy( () => - import( - "../pages/organizations/documents/tabs/DocumentDescriptionTab" - ), + import("../pages/organizations/documents/tabs/DocumentDescriptionTab"), ), }, { @@ -58,21 +62,25 @@ export const documentsRoutes = [ path: "documents", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, documentsQuery, { organizationId: organizationId! }), + loadQuery(coreEnvironment, documentsQuery, { + organizationId: organizationId!, + }), + ), + Component: withQueryRef( + lazy(() => import("/pages/organizations/documents/DocumentsPage")), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/documents/DocumentsPage"), - )), }, { path: "documents/:documentId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ documentId }) => - loadQuery(consoleEnvironment, documentNodeQuery, { documentId: documentId! }), + loadQuery(coreEnvironment, documentNodeQuery, { + documentId: documentId!, + }), + ), + Component: withQueryRef( + lazy(() => import("../pages/organizations/documents/DocumentDetailPage")), ), - Component: withQueryRef(lazy( - () => import("../pages/organizations/documents/DocumentDetailPage"), - )), children: [...documentTabs(""), ...documentTabs("versions/:versionId/")], }, ] satisfies AppRoute[]; diff --git a/apps/console/src/routes/frameworkRoutes.ts b/apps/console/src/routes/frameworkRoutes.ts index 4a1308a77..a52b7252e 100644 --- a/apps/console/src/routes/frameworkRoutes.ts +++ b/apps/console/src/routes/frameworkRoutes.ts @@ -1,6 +1,6 @@ import { loadQuery } from "react-relay"; import { PageSkeleton } from "/components/skeletons/PageSkeleton"; -import { consoleEnvironment } from "/environments"; +import { coreEnvironment } from "/environments"; import { frameworksQuery, frameworkNodeQuery, @@ -9,7 +9,11 @@ import { import { Fragment } from "react"; import { lazy } from "@probo/react-lazy"; import { ControlSkeleton } from "../components/skeletons/ControlSkeleton"; -import { loaderFromQueryLoader, withQueryRef, type AppRoute } from "@probo/routes"; +import { + loaderFromQueryLoader, + withQueryRef, + type AppRoute, +} from "@probo/routes"; import type { FrameworkGraphListQuery } from "/hooks/graph/__generated__/FrameworkGraphListQuery.graphql"; import type { FrameworkGraphNodeQuery } from "/hooks/graph/__generated__/FrameworkGraphNodeQuery.graphql"; import type { FrameworkGraphControlNodeQuery } from "/hooks/graph/__generated__/FrameworkGraphControlNodeQuery.graphql"; @@ -19,21 +23,25 @@ export const frameworkRoutes = [ path: "frameworks", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, frameworksQuery, { organizationId: organizationId! }), + loadQuery(coreEnvironment, frameworksQuery, { + organizationId: organizationId!, + }), + ), + Component: withQueryRef( + lazy(() => import("/pages/organizations/frameworks/FrameworksPage")), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/frameworks/FrameworksPage") - )), }, { path: "frameworks/:frameworkId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ frameworkId }) => - loadQuery(consoleEnvironment, frameworkNodeQuery, { frameworkId: frameworkId! }), + loadQuery(coreEnvironment, frameworkNodeQuery, { + frameworkId: frameworkId!, + }), + ), + Component: withQueryRef( + lazy(() => import("/pages/organizations/frameworks/FrameworkDetailPage")), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/frameworks/FrameworkDetailPage") - )), children: [ { path: "", @@ -43,11 +51,18 @@ export const frameworkRoutes = [ path: "controls/:controlId", Fallback: ControlSkeleton, loader: loaderFromQueryLoader(({ controlId }) => - loadQuery(consoleEnvironment, frameworkControlNodeQuery, { controlId: controlId! }), + loadQuery( + coreEnvironment, + frameworkControlNodeQuery, + { controlId: controlId! }, + ), + ), + Component: withQueryRef( + lazy( + () => + import("/pages/organizations/frameworks/FrameworkControlPage"), + ), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/frameworks/FrameworkControlPage") - )), }, ], }, diff --git a/apps/console/src/routes/measureRoutes.ts b/apps/console/src/routes/measureRoutes.ts index 56faf8024..328185b2c 100644 --- a/apps/console/src/routes/measureRoutes.ts +++ b/apps/console/src/routes/measureRoutes.ts @@ -1,12 +1,16 @@ import { Fragment } from "react"; import { loadQuery } from "react-relay"; -import { consoleEnvironment } from "/environments"; +import { coreEnvironment } from "/environments"; import { measureNodeQuery, measuresQuery } from "/hooks/graph/MeasureGraph"; import { PageSkeleton } from "/components/skeletons/PageSkeleton"; import { redirect } from "react-router"; import { lazy } from "@probo/react-lazy"; import { LinkCardSkeleton } from "/components/skeletons/LinkCardSkeleton"; -import { loaderFromQueryLoader, withQueryRef, type AppRoute } from "@probo/routes"; +import { + loaderFromQueryLoader, + withQueryRef, + type AppRoute, +} from "@probo/routes"; import type { MeasureGraphListQuery } from "/hooks/graph/__generated__/MeasureGraphListQuery.graphql"; import type { MeasureGraphNodeQuery } from "/hooks/graph/__generated__/MeasureGraphNodeQuery.graphql"; @@ -15,9 +19,13 @@ export const measureRoutes = [ path: "measures", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, measuresQuery, { organizationId: organizationId! }), + loadQuery(coreEnvironment, measuresQuery, { + organizationId: organizationId!, + }), + ), + Component: withQueryRef( + lazy(() => import("/pages/organizations/measures/MeasuresPage")), ), - Component: withQueryRef(lazy(() => import("/pages/organizations/measures/MeasuresPage"))), children: [ { path: "category/:categoryId", @@ -29,9 +37,13 @@ export const measureRoutes = [ path: "measures/:measureId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ measureId }) => - loadQuery(consoleEnvironment, measureNodeQuery, { measureId: measureId! }), + loadQuery(coreEnvironment, measureNodeQuery, { + measureId: measureId!, + }), + ), + Component: withQueryRef( + lazy(() => import("/pages/organizations/measures/MeasureDetailPage")), ), - Component: withQueryRef(lazy(() => import("/pages/organizations/measures/MeasureDetailPage"))), children: [ { path: "", @@ -44,14 +56,16 @@ export const measureRoutes = [ path: "risks", Fallback: LinkCardSkeleton, Component: lazy( - () => import("/pages/organizations/measures/tabs/MeasureRisksTab.tsx") + () => + import("/pages/organizations/measures/tabs/MeasureRisksTab.tsx"), ), }, { path: "tasks", Fallback: LinkCardSkeleton, Component: lazy( - () => import("/pages/organizations/measures/tabs/MeasureTasksTab.tsx") + () => + import("/pages/organizations/measures/tabs/MeasureTasksTab.tsx"), ), }, { @@ -59,7 +73,7 @@ export const measureRoutes = [ Fallback: LinkCardSkeleton, Component: lazy( () => - import("/pages/organizations/measures/tabs/MeasureControlsTab.tsx") + import("/pages/organizations/measures/tabs/MeasureControlsTab.tsx"), ), }, { @@ -67,7 +81,7 @@ export const measureRoutes = [ Fallback: LinkCardSkeleton, Component: lazy( () => - import("/pages/organizations/measures/tabs/MeasureEvidencesTab.tsx") + import("/pages/organizations/measures/tabs/MeasureEvidencesTab.tsx"), ), }, ], diff --git a/apps/console/src/routes/meetingsRoutes.ts b/apps/console/src/routes/meetingsRoutes.ts index 5add46203..fd1872412 100644 --- a/apps/console/src/routes/meetingsRoutes.ts +++ b/apps/console/src/routes/meetingsRoutes.ts @@ -1,6 +1,6 @@ import { Fragment } from "react"; import { loadQuery } from "react-relay"; -import { consoleEnvironment } from "/environments"; +import { coreEnvironment } from "/environments"; import { meetingsQuery } from "/hooks/graph/MeetingGraph"; import { meetingNodeQuery } from "/hooks/graph/MeetingGraph"; import { PageSkeleton } from "/components/skeletons/PageSkeleton"; @@ -9,13 +9,19 @@ import { lazy } from "@probo/react-lazy"; import { LinkCardSkeleton } from "/components/skeletons/LinkCardSkeleton"; import type { MeetingGraphListQuery } from "/hooks/graph/__generated__/MeetingGraphListQuery.graphql"; import type { MeetingGraphNodeQuery } from "/hooks/graph/__generated__/MeetingGraphNodeQuery.graphql"; -import { loaderFromQueryLoader, withQueryRef, type AppRoute } from "@probo/routes"; +import { + loaderFromQueryLoader, + withQueryRef, + type AppRoute, +} from "@probo/routes"; const meetingTabs = (prefix: string) => { return [ { path: `${prefix}`, - loader: ({ params: { organizationId, meetingId } }: LoaderFunctionArgs) => { + loader: ({ + params: { organizationId, meetingId }, + }: LoaderFunctionArgs) => { const basePath = `/organizations/${organizationId}/meetings/${meetingId}`; const redirectPath = `${basePath}/minutes`; throw redirect(redirectPath); @@ -26,10 +32,7 @@ const meetingTabs = (prefix: string) => { path: `${prefix}minutes`, Fallback: LinkCardSkeleton, Component: lazy( - () => - import( - "../pages/organizations/meetings/tabs/MeetingMinutesTab" - ), + () => import("../pages/organizations/meetings/tabs/MeetingMinutesTab"), ), }, ]; @@ -40,22 +43,25 @@ export const meetingsRoutes = [ path: "meetings", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, meetingsQuery, { organizationId }), + loadQuery(coreEnvironment, meetingsQuery, { + organizationId, + }), + ), + Component: withQueryRef( + lazy(() => import("/pages/organizations/meetings/MeetingsPage")), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/meetings/MeetingsPage"), - )), }, { path: "meetings/:meetingId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ meetingId }) => - loadQuery(consoleEnvironment, meetingNodeQuery, { meetingId }), + loadQuery(coreEnvironment, meetingNodeQuery, { + meetingId, + }), + ), + Component: withQueryRef( + lazy(() => import("../pages/organizations/meetings/MeetingDetailPage")), ), - Component: withQueryRef(lazy( - () => import("../pages/organizations/meetings/MeetingDetailPage"), - )), children: [...meetingTabs("")], }, ] satisfies AppRoute[]; - diff --git a/apps/console/src/routes/nonconformityRoutes.ts b/apps/console/src/routes/nonconformityRoutes.ts index 4d51aaa8c..b7f1def2b 100644 --- a/apps/console/src/routes/nonconformityRoutes.ts +++ b/apps/console/src/routes/nonconformityRoutes.ts @@ -1,61 +1,96 @@ import { loadQuery } from "react-relay"; -import { consoleEnvironment } from "/environments"; +import { coreEnvironment } from "/environments"; import { PageSkeleton } from "/components/skeletons/PageSkeleton"; import { lazy } from "@probo/react-lazy"; -import { nonconformitiesQuery, nonconformityNodeQuery } from "../hooks/graph/NonconformityGraph"; +import { + nonconformitiesQuery, + nonconformityNodeQuery, +} from "../hooks/graph/NonconformityGraph"; import type { NonconformityGraphListQuery } from "/hooks/graph/__generated__/NonconformityGraphListQuery.graphql"; import type { NonconformityGraphNodeQuery } from "/hooks/graph/__generated__/NonconformityGraphNodeQuery.graphql"; -import { loaderFromQueryLoader, withQueryRef, type AppRoute } from "@probo/routes"; +import { + loaderFromQueryLoader, + withQueryRef, + type AppRoute, +} from "@probo/routes"; export const nonconformityRoutes = [ { path: "nonconformities", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, nonconformitiesQuery, { - organizationId, - snapshotId: null - }), + loadQuery( + coreEnvironment, + nonconformitiesQuery, + { + organizationId, + snapshotId: null, + }, + ), + ), + Component: withQueryRef( + lazy( + () => + import("../pages/organizations/nonconformities/NonconformitiesPage"), + ), ), - Component: withQueryRef(lazy( - () => import("../pages/organizations/nonconformities/NonconformitiesPage") - )), }, { path: "snapshots/:snapshotId/nonconformities", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId, snapshotId }) => - loadQuery(consoleEnvironment, nonconformitiesQuery, { - organizationId, - snapshotId, - }), + loadQuery( + coreEnvironment, + nonconformitiesQuery, + { + organizationId, + snapshotId, + }, + ), + ), + Component: withQueryRef( + lazy( + () => + import("../pages/organizations/nonconformities/NonconformitiesPage"), + ), ), - Component: withQueryRef(lazy( - () => import("../pages/organizations/nonconformities/NonconformitiesPage") - )), }, { path: "nonconformities/:nonconformityId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ nonconformityId }) => - loadQuery(consoleEnvironment, nonconformityNodeQuery, { - nonconformityId, - }), + loadQuery( + coreEnvironment, + nonconformityNodeQuery, + { + nonconformityId, + }, + ), + ), + Component: withQueryRef( + lazy( + () => + import("../pages/organizations/nonconformities/NonconformityDetailsPage"), + ), ), - Component: withQueryRef(lazy( - () => import("../pages/organizations/nonconformities/NonconformityDetailsPage") - )), }, { path: "snapshots/:snapshotId/nonconformities/:nonconformityId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ nonconformityId }) => - loadQuery(consoleEnvironment, nonconformityNodeQuery, { - nonconformityId: nonconformityId - }), + loadQuery( + coreEnvironment, + nonconformityNodeQuery, + { + nonconformityId: nonconformityId, + }, + ), + ), + Component: withQueryRef( + lazy( + () => + import("../pages/organizations/nonconformities/NonconformityDetailsPage"), + ), ), - Component: withQueryRef(lazy( - () => import("../pages/organizations/nonconformities/NonconformityDetailsPage") - )), }, ] satisfies AppRoute[]; diff --git a/apps/console/src/routes/obligationRoutes.ts b/apps/console/src/routes/obligationRoutes.ts index 61f8422bd..c3bccd7b9 100644 --- a/apps/console/src/routes/obligationRoutes.ts +++ b/apps/console/src/routes/obligationRoutes.ts @@ -1,61 +1,80 @@ import { loadQuery } from "react-relay"; -import { consoleEnvironment } from "/environments"; +import { coreEnvironment } from "/environments"; import { PageSkeleton } from "/components/skeletons/PageSkeleton"; import { lazy } from "@probo/react-lazy"; -import { obligationsQuery, obligationNodeQuery } from "/hooks/graph/ObligationGraph"; +import { + obligationsQuery, + obligationNodeQuery, +} from "/hooks/graph/ObligationGraph"; import type { ObligationGraphListQuery } from "/hooks/graph/__generated__/ObligationGraphListQuery.graphql"; import type { ObligationGraphNodeQuery } from "/hooks/graph/__generated__/ObligationGraphNodeQuery.graphql"; -import { loaderFromQueryLoader, withQueryRef, type AppRoute } from "@probo/routes"; +import { + loaderFromQueryLoader, + withQueryRef, + type AppRoute, +} from "@probo/routes"; export const obligationRoutes = [ { path: "obligations", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, obligationsQuery, { + loadQuery(coreEnvironment, obligationsQuery, { organizationId, - snapshotId: null + snapshotId: null, }), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/obligations/ObligationsPage") - )), + Component: withQueryRef( + lazy(() => import("/pages/organizations/obligations/ObligationsPage")), + ), }, { path: "snapshots/:snapshotId/obligations", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId, snapshotId }) => - loadQuery(consoleEnvironment, obligationsQuery, { + loadQuery(coreEnvironment, obligationsQuery, { organizationId, snapshotId, }), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/obligations/ObligationsPage") - )), + Component: withQueryRef( + lazy(() => import("/pages/organizations/obligations/ObligationsPage")), + ), }, { path: "obligations/:obligationId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ obligationId }) => - loadQuery(consoleEnvironment, obligationNodeQuery, { - obligationId, - }), + loadQuery( + coreEnvironment, + obligationNodeQuery, + { + obligationId, + }, + ), + ), + Component: withQueryRef( + lazy( + () => import("/pages/organizations/obligations/ObligationDetailsPage"), + ), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/obligations/ObligationDetailsPage") - )), }, { path: "snapshots/:snapshotId/obligations/:obligationId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ obligationId }) => - loadQuery(consoleEnvironment, obligationNodeQuery, { - obligationId, - }), + loadQuery( + coreEnvironment, + obligationNodeQuery, + { + obligationId, + }, + ), + ), + Component: withQueryRef( + lazy( + () => import("/pages/organizations/obligations/ObligationDetailsPage"), + ), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/obligations/ObligationDetailsPage") - )), }, ] satisfies AppRoute[]; diff --git a/apps/console/src/routes/peopleRoutes.ts b/apps/console/src/routes/peopleRoutes.ts index d5cd5c05d..214735115 100644 --- a/apps/console/src/routes/peopleRoutes.ts +++ b/apps/console/src/routes/peopleRoutes.ts @@ -1,13 +1,17 @@ import { lazy } from "@probo/react-lazy"; import { loadQuery } from "react-relay"; -import { consoleEnvironment } from "/environments"; +import { coreEnvironment } from "/environments"; import { PageSkeleton } from "/components/skeletons/PageSkeleton.tsx"; import { paginatedPeopleQuery, peopleNodeQuery, } from "/hooks/graph/PeopleGraph"; import { LinkCardSkeleton } from "/components/skeletons/LinkCardSkeleton"; -import { loaderFromQueryLoader, withQueryRef, type AppRoute } from "@probo/routes"; +import { + loaderFromQueryLoader, + withQueryRef, + type AppRoute, +} from "@probo/routes"; import type { PeopleGraphPaginatedQuery } from "/hooks/graph/__generated__/PeopleGraphPaginatedQuery.graphql"; import type { PeopleGraphNodeQuery } from "/hooks/graph/__generated__/PeopleGraphNodeQuery.graphql"; @@ -16,39 +20,47 @@ export const peopleRoutes = [ path: "people", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, paginatedPeopleQuery, { organizationId: organizationId! }), + loadQuery( + coreEnvironment, + paginatedPeopleQuery, + { organizationId: organizationId! }, + ), + ), + Component: withQueryRef( + lazy(() => import("/pages/organizations/people/PeopleListPage")), ), - Component: withQueryRef(lazy(() => import("/pages/organizations/people/PeopleListPage"))), }, { path: "people/:peopleId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ peopleId }) => - loadQuery(consoleEnvironment, peopleNodeQuery, { peopleId: peopleId! }), + loadQuery(coreEnvironment, peopleNodeQuery, { + peopleId: peopleId!, + }), + ), + Component: withQueryRef( + lazy(() => import("/pages/organizations/people/PeopleDetailPage")), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/people/PeopleDetailPage") - )), children: [ { path: "tasks", Fallback: LinkCardSkeleton, Component: lazy( - () => import("/pages/organizations/people/tabs/PeopleTasksTab") + () => import("/pages/organizations/people/tabs/PeopleTasksTab"), ), }, { path: "role", Fallback: LinkCardSkeleton, Component: lazy( - () => import("/pages/organizations/people/tabs/PeopleRoleTab") + () => import("/pages/organizations/people/tabs/PeopleRoleTab"), ), }, { path: "profile", Fallback: LinkCardSkeleton, Component: lazy( - () => import("/pages/organizations/people/tabs/PeopleProfileTab") + () => import("/pages/organizations/people/tabs/PeopleProfileTab"), ), }, ], diff --git a/apps/console/src/routes/processingActivityRoutes.ts b/apps/console/src/routes/processingActivityRoutes.ts index 2d153e91e..fcf3f979e 100644 --- a/apps/console/src/routes/processingActivityRoutes.ts +++ b/apps/console/src/routes/processingActivityRoutes.ts @@ -1,9 +1,16 @@ import { loadQuery } from "react-relay"; -import { consoleEnvironment } from "/environments"; +import { coreEnvironment } from "/environments"; import { PageSkeleton } from "/components/skeletons/PageSkeleton"; import { lazy } from "@probo/react-lazy"; -import { processingActivitiesQuery, processingActivityNodeQuery } from "/hooks/graph/ProcessingActivityGraph"; -import { loaderFromQueryLoader, withQueryRef, type AppRoute } from "@probo/routes"; +import { + processingActivitiesQuery, + processingActivityNodeQuery, +} from "/hooks/graph/ProcessingActivityGraph"; +import { + loaderFromQueryLoader, + withQueryRef, + type AppRoute, +} from "@probo/routes"; import type { ProcessingActivityGraphListQuery } from "/hooks/graph/__generated__/ProcessingActivityGraphListQuery.graphql"; import type { ProcessingActivityGraphNodeQuery } from "/hooks/graph/__generated__/ProcessingActivityGraphNodeQuery.graphql"; @@ -12,50 +19,78 @@ export const processingActivityRoutes = [ path: "processing-activities", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, processingActivitiesQuery, { - organizationId: organizationId!, - snapshotId: null - }), + loadQuery( + coreEnvironment, + processingActivitiesQuery, + { + organizationId: organizationId!, + snapshotId: null, + }, + ), + ), + Component: withQueryRef( + lazy( + () => + import("/pages/organizations/processingActivities/ProcessingActivitiesPage"), + ), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/processingActivities/ProcessingActivitiesPage") - )), }, { path: "snapshots/:snapshotId/processing-activities", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId, snapshotId }) => - loadQuery(consoleEnvironment, processingActivitiesQuery, { - organizationId: organizationId!, - snapshotId, - }), + loadQuery( + coreEnvironment, + processingActivitiesQuery, + { + organizationId: organizationId!, + snapshotId, + }, + ), + ), + Component: withQueryRef( + lazy( + () => + import("/pages/organizations/processingActivities/ProcessingActivitiesPage"), + ), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/processingActivities/ProcessingActivitiesPage") - )), }, { path: "processing-activities/:activityId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ activityId }) => - loadQuery(consoleEnvironment, processingActivityNodeQuery, { - processingActivityId: activityId!, - }), + loadQuery( + coreEnvironment, + processingActivityNodeQuery, + { + processingActivityId: activityId!, + }, + ), + ), + Component: withQueryRef( + lazy( + () => + import("/pages/organizations/processingActivities/ProcessingActivityDetailsPage"), + ), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/processingActivities/ProcessingActivityDetailsPage") - )), }, { path: "snapshots/:snapshotId/processing-activities/:activityId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ activityId }) => - loadQuery(consoleEnvironment, processingActivityNodeQuery, { - processingActivityId: activityId!, - }), + loadQuery( + coreEnvironment, + processingActivityNodeQuery, + { + processingActivityId: activityId!, + }, + ), + ), + Component: withQueryRef( + lazy( + () => + import("/pages/organizations/processingActivities/ProcessingActivityDetailsPage"), + ), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/processingActivities/ProcessingActivityDetailsPage") - )), }, ] satisfies AppRoute[]; diff --git a/apps/console/src/routes/riskRoutes.ts b/apps/console/src/routes/riskRoutes.ts index 73be8fbef..6379a6559 100644 --- a/apps/console/src/routes/riskRoutes.ts +++ b/apps/console/src/routes/riskRoutes.ts @@ -1,14 +1,18 @@ import { Fragment } from "react"; import { loadQuery } from "react-relay"; import { RisksPageSkeleton } from "/components/skeletons/RisksPageSkeleton.tsx"; -import { consoleEnvironment } from "/environments"; +import { coreEnvironment } from "/environments"; import { riskNodeQuery, risksQuery } from "/hooks/graph/RiskGraph"; import { PageSkeleton } from "/components/skeletons/PageSkeleton"; import { redirect } from "react-router"; import { lazy } from "@probo/react-lazy"; import { LinkCardSkeleton } from "/components/skeletons/LinkCardSkeleton"; import type { RiskGraphNodeQuery } from "/hooks/graph/__generated__/RiskGraphNodeQuery.graphql"; -import { loaderFromQueryLoader, withQueryRef, type AppRoute } from "@probo/routes"; +import { + loaderFromQueryLoader, + withQueryRef, + type AppRoute, +} from "@probo/routes"; import type { RiskGraphListQuery } from "/hooks/graph/__generated__/RiskGraphListQuery.graphql"; export const riskRoutes = [ @@ -16,31 +20,39 @@ export const riskRoutes = [ path: "risks", Fallback: RisksPageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, risksQuery, { + loadQuery(coreEnvironment, risksQuery, { organizationId: organizationId!, - snapshotId: null + snapshotId: null, }), ), - Component: withQueryRef(lazy(() => import("/pages/organizations/risks/RisksPage"))), + Component: withQueryRef( + lazy(() => import("/pages/organizations/risks/RisksPage")), + ), }, { path: "snapshots/:snapshotId/risks", Fallback: RisksPageSkeleton, loader: loaderFromQueryLoader(({ organizationId, snapshotId }) => - loadQuery(consoleEnvironment, risksQuery, { + loadQuery(coreEnvironment, risksQuery, { organizationId: organizationId!, - snapshotId: snapshotId! + snapshotId: snapshotId!, }), ), - Component: withQueryRef(lazy(() => import("/pages/organizations/risks/RisksPage"))), + Component: withQueryRef( + lazy(() => import("/pages/organizations/risks/RisksPage")), + ), }, { path: "risks/:riskId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ riskId }) => - loadQuery(consoleEnvironment, riskNodeQuery, { riskId: riskId! }), + loadQuery(coreEnvironment, riskNodeQuery, { + riskId: riskId!, + }), + ), + Component: withQueryRef( + lazy(() => import("/pages/organizations/risks/RiskDetailPage")), ), - Component: withQueryRef(lazy(() => import("/pages/organizations/risks/RiskDetailPage"))), children: [ { path: "", @@ -53,35 +65,36 @@ export const riskRoutes = [ path: "overview", Fallback: LinkCardSkeleton, Component: lazy( - () => import("/pages/organizations/risks/tabs/RiskOverviewTab.tsx") + () => import("/pages/organizations/risks/tabs/RiskOverviewTab.tsx"), ), }, { path: "measures", Fallback: LinkCardSkeleton, Component: lazy( - () => import("/pages/organizations/risks/tabs/RiskMeasuresTab.tsx") + () => import("/pages/organizations/risks/tabs/RiskMeasuresTab.tsx"), ), }, { path: "documents", Fallback: LinkCardSkeleton, Component: lazy( - () => import("/pages/organizations/risks/tabs/RiskDocumentsTab.tsx") + () => import("/pages/organizations/risks/tabs/RiskDocumentsTab.tsx"), ), }, { path: "controls", Fallback: LinkCardSkeleton, Component: lazy( - () => import("/pages/organizations/risks/tabs/RiskControlsTab.tsx") + () => import("/pages/organizations/risks/tabs/RiskControlsTab.tsx"), ), }, { path: "obligations", Fallback: LinkCardSkeleton, Component: lazy( - () => import("/pages/organizations/risks/tabs/RiskObligationsTab.tsx") + () => + import("/pages/organizations/risks/tabs/RiskObligationsTab.tsx"), ), }, ], @@ -90,9 +103,13 @@ export const riskRoutes = [ path: "snapshots/:snapshotId/risks/:riskId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ riskId }) => - loadQuery(consoleEnvironment, riskNodeQuery, { riskId: riskId! }), + loadQuery(coreEnvironment, riskNodeQuery, { + riskId: riskId!, + }), + ), + Component: withQueryRef( + lazy(() => import("/pages/organizations/risks/RiskDetailPage")), ), - Component: withQueryRef(lazy(() => import("/pages/organizations/risks/RiskDetailPage"))), children: [ { path: "", @@ -105,7 +122,7 @@ export const riskRoutes = [ path: "overview", Fallback: LinkCardSkeleton, Component: lazy( - () => import("/pages/organizations/risks/tabs/RiskOverviewTab.tsx") + () => import("/pages/organizations/risks/tabs/RiskOverviewTab.tsx"), ), }, ], diff --git a/apps/console/src/routes/snapshotsRoutes.ts b/apps/console/src/routes/snapshotsRoutes.ts index 05d85c708..46b490b76 100644 --- a/apps/console/src/routes/snapshotsRoutes.ts +++ b/apps/console/src/routes/snapshotsRoutes.ts @@ -1,31 +1,39 @@ import { loadQuery } from "react-relay"; import { PageSkeleton } from "/components/skeletons/PageSkeleton"; -import { consoleEnvironment } from "/environments"; +import { coreEnvironment } from "/environments"; import { snapshotsQuery, snapshotNodeQuery } from "/hooks/graph/SnapshotGraph"; import { lazy } from "@probo/react-lazy"; import type { SnapshotGraphListQuery } from "/hooks/graph/__generated__/SnapshotGraphListQuery.graphql"; import type { SnapshotGraphNodeQuery } from "/hooks/graph/__generated__/SnapshotGraphNodeQuery.graphql"; -import { loaderFromQueryLoader, withQueryRef, type AppRoute } from "@probo/routes"; +import { + loaderFromQueryLoader, + withQueryRef, + type AppRoute, +} from "@probo/routes"; export const snapshotsRoutes = [ { path: "snapshots", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, snapshotsQuery, { organizationId }), + loadQuery(coreEnvironment, snapshotsQuery, { + organizationId, + }), + ), + Component: withQueryRef( + lazy(() => import("/pages/organizations/snapshots/SnapshotsPage")), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/snapshots/SnapshotsPage") - )), }, { path: "snapshots/:snapshotId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ snapshotId }) => - loadQuery(consoleEnvironment, snapshotNodeQuery, { snapshotId }), + loadQuery(coreEnvironment, snapshotNodeQuery, { + snapshotId, + }), + ), + Component: withQueryRef( + lazy(() => import("/pages/organizations/snapshots/SnapshotDetailPage")), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/snapshots/SnapshotDetailPage") - )), }, ] satisfies AppRoute[]; diff --git a/apps/console/src/routes/taskRoutes.ts b/apps/console/src/routes/taskRoutes.ts index a0445e985..bf93c3677 100644 --- a/apps/console/src/routes/taskRoutes.ts +++ b/apps/console/src/routes/taskRoutes.ts @@ -1,19 +1,25 @@ import { lazy } from "@probo/react-lazy"; import { PageSkeleton } from "/components/skeletons/PageSkeleton"; import { loadQuery } from "react-relay"; -import { consoleEnvironment } from "/environments"; +import { coreEnvironment } from "/environments"; import { tasksQuery } from "/hooks/graph/TaskGraph"; -import { loaderFromQueryLoader, withQueryRef, type AppRoute } from "@probo/routes"; +import { + loaderFromQueryLoader, + withQueryRef, + type AppRoute, +} from "@probo/routes"; import type { TaskGraphQuery } from "/hooks/graph/__generated__/TaskGraphQuery.graphql"; export const taskRoutes = [ { path: "tasks", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, tasksQuery, { + loadQuery(coreEnvironment, tasksQuery, { organizationId, }), ), - Component: withQueryRef(lazy(() => import("/pages/organizations/tasks/TasksPage"))), + Component: withQueryRef( + lazy(() => import("/pages/organizations/tasks/TasksPage")), + ), }, ] satisfies AppRoute[]; diff --git a/apps/console/src/routes/trustCenterRoutes.ts b/apps/console/src/routes/trustCenterRoutes.ts index f4ec23ea1..4ba69ea3a 100644 --- a/apps/console/src/routes/trustCenterRoutes.ts +++ b/apps/console/src/routes/trustCenterRoutes.ts @@ -1,70 +1,84 @@ import { loadQuery } from "react-relay"; -import { consoleEnvironment } from "/environments"; +import { coreEnvironment } from "/environments"; import { PageSkeleton } from "/components/skeletons/PageSkeleton"; import { LinkCardSkeleton } from "/components/skeletons/LinkCardSkeleton"; import { lazy } from "@probo/react-lazy"; import { trustCenterQuery } from "../hooks/graph/TrustCenterGraph"; import type { TrustCenterGraphQuery } from "/hooks/graph/__generated__/TrustCenterGraphQuery.graphql"; -import { loaderFromQueryLoader, withQueryRef, type AppRoute } from "@probo/routes"; +import { + loaderFromQueryLoader, + withQueryRef, + type AppRoute, +} from "@probo/routes"; export const trustCenterRoutes = [ { path: "trust-center", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, trustCenterQuery, { organizationId }, { fetchPolicy: "network-only" }), + loadQuery( + coreEnvironment, + trustCenterQuery, + { organizationId }, + { fetchPolicy: "network-only" }, + ), + ), + Component: withQueryRef( + lazy(() => import("/pages/organizations/trustCenter/TrustCenterPage")), ), - Component: withQueryRef(lazy( - () => import("/pages/organizations/trustCenter/TrustCenterPage") - )), children: [ { index: true, Fallback: LinkCardSkeleton, Component: lazy( - () => import("/pages/organizations/trustCenter/TrustCenterOverviewTab") + () => + import("/pages/organizations/trustCenter/TrustCenterOverviewTab"), ), }, { path: "trust-by", Fallback: LinkCardSkeleton, Component: lazy( - () => import("/pages/organizations/trustCenter/TrustCenterReferencesTab") + () => + import("/pages/organizations/trustCenter/TrustCenterReferencesTab"), ), }, { path: "audits", Fallback: LinkCardSkeleton, Component: lazy( - () => import("/pages/organizations/trustCenter/TrustCenterAuditsTab") + () => import("/pages/organizations/trustCenter/TrustCenterAuditsTab"), ), }, { path: "documents", Fallback: LinkCardSkeleton, Component: lazy( - () => import("/pages/organizations/trustCenter/TrustCenterDocumentsTab") + () => + import("/pages/organizations/trustCenter/TrustCenterDocumentsTab"), ), }, { path: "files", Fallback: LinkCardSkeleton, Component: lazy( - () => import("/pages/organizations/trustCenter/TrustCenterFilesTab") + () => import("/pages/organizations/trustCenter/TrustCenterFilesTab"), ), }, { path: "vendors", Fallback: LinkCardSkeleton, Component: lazy( - () => import("/pages/organizations/trustCenter/TrustCenterVendorsTab") + () => + import("/pages/organizations/trustCenter/TrustCenterVendorsTab"), ), }, { path: "access", Fallback: LinkCardSkeleton, Component: lazy( - () => import("/pages/organizations/trustCenter/TrustCenterAccessTab/TrustCenterAccessTab") + () => + import("/pages/organizations/trustCenter/TrustCenterAccessTab/TrustCenterAccessTab"), ), }, ], diff --git a/apps/console/src/routes/vendorRoutes.ts b/apps/console/src/routes/vendorRoutes.ts index c6520db32..025c2b0c5 100644 --- a/apps/console/src/routes/vendorRoutes.ts +++ b/apps/console/src/routes/vendorRoutes.ts @@ -1,10 +1,14 @@ import { lazy } from "@probo/react-lazy"; import { loadQuery } from "react-relay"; -import { consoleEnvironment } from "/environments"; +import { coreEnvironment } from "/environments"; import { PageSkeleton } from "/components/skeletons/PageSkeleton"; import { vendorNodeQuery, vendorsQuery } from "/hooks/graph/VendorGraph"; import { LinkCardSkeleton } from "/components/skeletons/LinkCardSkeleton"; -import { loaderFromQueryLoader, withQueryRef, type AppRoute } from "@probo/routes"; +import { + loaderFromQueryLoader, + withQueryRef, + type AppRoute, +} from "@probo/routes"; import type { VendorGraphListQuery } from "/hooks/graph/__generated__/VendorGraphListQuery.graphql"; import type { VendorGraphNodeQuery } from "/hooks/graph/__generated__/VendorGraphNodeQuery.graphql"; @@ -13,41 +17,45 @@ export const vendorRoutes = [ path: "vendors", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId }) => - loadQuery(consoleEnvironment, vendorsQuery, { + loadQuery(coreEnvironment, vendorsQuery, { organizationId: organizationId!, - snapshotId: null + snapshotId: null, }), ), - Component: withQueryRef(lazy(() => import("/pages/organizations/vendors/VendorsPage"))), + Component: withQueryRef( + lazy(() => import("/pages/organizations/vendors/VendorsPage")), + ), }, { path: "snapshots/:snapshotId/vendors", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ organizationId, snapshotId }) => - loadQuery(consoleEnvironment, vendorsQuery, { + loadQuery(coreEnvironment, vendorsQuery, { organizationId: organizationId!, - snapshotId + snapshotId, }), ), - Component: withQueryRef(lazy(() => import("/pages/organizations/vendors/VendorsPage"))), + Component: withQueryRef( + lazy(() => import("/pages/organizations/vendors/VendorsPage")), + ), }, { path: "vendors/:vendorId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ vendorId }) => - loadQuery(consoleEnvironment, vendorNodeQuery, { + loadQuery(coreEnvironment, vendorNodeQuery, { vendorId: vendorId!, }), ), - Component: withQueryRef(lazy( - () => import("../pages/organizations/vendors/VendorDetailPage") - )), + Component: withQueryRef( + lazy(() => import("../pages/organizations/vendors/VendorDetailPage")), + ), children: [ { path: "overview", Fallback: LinkCardSkeleton, Component: lazy( - () => import("../pages/organizations/vendors/tabs/VendorOverviewTab") + () => import("../pages/organizations/vendors/tabs/VendorOverviewTab"), ), }, { @@ -55,9 +63,7 @@ export const vendorRoutes = [ Fallback: LinkCardSkeleton, Component: lazy( () => - import( - "../pages/organizations/vendors/tabs/VendorCertificationsTab" - ) + import("../pages/organizations/vendors/tabs/VendorCertificationsTab"), ), }, { @@ -65,7 +71,7 @@ export const vendorRoutes = [ Fallback: LinkCardSkeleton, Component: lazy( () => - import("../pages/organizations/vendors/tabs/VendorComplianceTab") + import("../pages/organizations/vendors/tabs/VendorComplianceTab"), ), }, { @@ -73,25 +79,21 @@ export const vendorRoutes = [ Fallback: LinkCardSkeleton, Component: lazy( () => - import( - "../pages/organizations/vendors/tabs/VendorRiskAssessmentTab" - ) + import("../pages/organizations/vendors/tabs/VendorRiskAssessmentTab"), ), }, { path: "contacts", Fallback: LinkCardSkeleton, Component: lazy( - () => - import("../pages/organizations/vendors/tabs/VendorContactsTab") + () => import("../pages/organizations/vendors/tabs/VendorContactsTab"), ), }, { path: "services", Fallback: LinkCardSkeleton, Component: lazy( - () => - import("../pages/organizations/vendors/tabs/VendorServicesTab") + () => import("../pages/organizations/vendors/tabs/VendorServicesTab"), ), }, ], @@ -100,19 +102,19 @@ export const vendorRoutes = [ path: "snapshots/:snapshotId/vendors/:vendorId", Fallback: PageSkeleton, loader: loaderFromQueryLoader(({ vendorId }) => - loadQuery(consoleEnvironment, vendorNodeQuery, { + loadQuery(coreEnvironment, vendorNodeQuery, { vendorId: vendorId!, }), ), - Component: withQueryRef(lazy( - () => import("../pages/organizations/vendors/VendorDetailPage") - )), + Component: withQueryRef( + lazy(() => import("../pages/organizations/vendors/VendorDetailPage")), + ), children: [ { path: "overview", Fallback: LinkCardSkeleton, Component: lazy( - () => import("../pages/organizations/vendors/tabs/VendorOverviewTab") + () => import("../pages/organizations/vendors/tabs/VendorOverviewTab"), ), }, { @@ -120,9 +122,7 @@ export const vendorRoutes = [ Fallback: LinkCardSkeleton, Component: lazy( () => - import( - "../pages/organizations/vendors/tabs/VendorCertificationsTab" - ) + import("../pages/organizations/vendors/tabs/VendorCertificationsTab"), ), }, { @@ -130,7 +130,7 @@ export const vendorRoutes = [ Fallback: LinkCardSkeleton, Component: lazy( () => - import("../pages/organizations/vendors/tabs/VendorComplianceTab") + import("../pages/organizations/vendors/tabs/VendorComplianceTab"), ), }, { @@ -138,25 +138,21 @@ export const vendorRoutes = [ Fallback: LinkCardSkeleton, Component: lazy( () => - import( - "../pages/organizations/vendors/tabs/VendorRiskAssessmentTab" - ) + import("../pages/organizations/vendors/tabs/VendorRiskAssessmentTab"), ), }, { path: "contacts", Fallback: LinkCardSkeleton, Component: lazy( - () => - import("../pages/organizations/vendors/tabs/VendorContactsTab") + () => import("../pages/organizations/vendors/tabs/VendorContactsTab"), ), }, { path: "services", Fallback: LinkCardSkeleton, Component: lazy( - () => - import("../pages/organizations/vendors/tabs/VendorServicesTab") + () => import("../pages/organizations/vendors/tabs/VendorServicesTab"), ), }, ],