@@ -0,0 +1,48 @@
|
||||
// The pages of the modules that bring their own, by the first path segment under a project
|
||||
// (`/<org>/<workspace>/<project>/<segment>/...`). The web shell has one catch-all route
|
||||
// (apps/web/src/routes/$org.$workspace.$project.$module.$.tsx) that looks a segment up here: its server
|
||||
// loader runs the page's `load`, and the browser renders its `View` (F10, docs/reference/app-kit.md). A
|
||||
// module with pages is added with its manifest in `modules/index.ts` and a line below, and no route file.
|
||||
// A page above any project goes in `workspacePages`, by module id, and is served under
|
||||
// `/<org>/<workspace>/modules/<module>/...`.
|
||||
//
|
||||
// This file imports no manifest, so the browser's bundle can import it: each page is loaded on demand, and
|
||||
// the worker, which imports `modules/index.ts` for the manifests, never loads a page (or React). The route
|
||||
// answers 404 for a segment whose module is not registered, so a business module that is off has no page
|
||||
// even when it is listed here.
|
||||
|
||||
import type { Container, TransportCaller } from "@conusai-kit/core"
|
||||
import type { I18n } from "@conusai-kit/i18n"
|
||||
import type { ProjectPage, WorkspacePage } from "@conusai-kit/ui"
|
||||
import { moduleSelected, OPTIONAL_MODULE_IDS, type OptionalModuleId } from "./inclusion.js"
|
||||
|
||||
/** A module's page under a project, as the web shell calls it. Its data type is the module's own. */
|
||||
// biome-ignore lint/suspicious/noExplicitAny: each page's data type is its own; the shell only passes it through
|
||||
export type ModuleProjectPage = ProjectPage<TransportCaller, I18n, Container, any>
|
||||
|
||||
/** A module's page above a project. */
|
||||
// biome-ignore lint/suspicious/noExplicitAny: each page's data type is its own; the shell only passes it through
|
||||
export type ModuleWorkspacePage = WorkspacePage<TransportCaller, I18n, Container, any>
|
||||
|
||||
const allModulePages: Readonly<Record<string, () => Promise<ModuleProjectPage>>> = {
|
||||
activities: async () => (await import("./activities/ui/pages.js")).activitiesPage,
|
||||
agent: async () => (await import("./agent/ui/pages.js")).agentPage, // kit:agent
|
||||
archive: async () => (await import("./archive/ui/pages.js")).archivePage,
|
||||
catalog: async () => (await import("./catalog/ui/pages.js")).catalogPage,
|
||||
crm: async () => (await import("./crm/ui/pages.js")).crmPage,
|
||||
inventory: async () => (await import("./inventory/ui/pages.js")).inventoryPage,
|
||||
invoicing: async () => (await import("./invoicing/ui/pages.js")).invoicingPage,
|
||||
knowledge: async () => (await import("./knowledge/ui/pages.js")).knowledgePage, // kit:knowledge
|
||||
ledger: async () => (await import("./ledger/ui/pages.js")).ledgerPage,
|
||||
notes: async () => (await import("./notes/ui/pages.js")).notesPage, // kit:notes
|
||||
}
|
||||
|
||||
export const modulePages: Readonly<Record<string, () => Promise<ModuleProjectPage>>> = Object.fromEntries(
|
||||
Object.entries(allModulePages).filter(
|
||||
([id]) => !OPTIONAL_MODULE_IDS.includes(id as OptionalModuleId) || moduleSelected(id as OptionalModuleId),
|
||||
),
|
||||
)
|
||||
|
||||
export const workspacePages: Readonly<Record<string, () => Promise<ModuleWorkspacePage>>> = {
|
||||
notes: async () => (await import("./notes/ui/workspace-page.js")).notesWorkspacePage, // kit:notes
|
||||
}
|
||||
Reference in New Issue
Block a user