Product shells
A product shell provides an out-of-the-box user experience tailored to a persona (admins, members, care ops). It supplies layouts, navigation, and enforces a cohesive UX so that domain features integrate seamlessly.
A shell is a module factory: it takes the persona's modules and configuration, and returns one standard Module the app registers like any other.
global-customer-dashboard
The admin dashboard shell is the first product shell built on the Core framework.
Source: frontend/shared/global-customer-dashboard/
customerDashboardShell
The exported shell factory. It takes the dashboard modules and the app's menu, and returns the dashboard module: the modules' screens under the dashboard layout, the sidebar as declared by menu.
import { customerDashboardShell } from "@alan-eu/global-customer-dashboard/module";
const dashboardModule = customerDashboardShell({
modules: [myDashboardModule, customerAdminManagementModule],
menu: {
main: {
order: 1,
label: () => tString("app:menu.main"),
items: ["employees", { item: "retirees", checkCapabilities: (c) => c.hasRetireeContracts }],
},
administrative: { order: 2, label: () => tString("app:menu.administrative"), items: ["admins"] },
},
OverlaySlot: MyOverlay,
useMenuCapabilities: useMyMenuCapabilities,
});
Each section lists its links in order, by the modules' menu item keys — checked at compile time against the modules' menuItems. An item can be gated with checkCapabilities.
CustomerDashboardModule
Extends ShellModule<"admindashboard"> with an optional menuItems record. Modules declare their own menu items — the shell collects them and the app places them.
import type { CustomerDashboardModule } from "@alan-eu/global-customer-dashboard/module";
type CustomerDashboardModule = ShellModule<"admindashboard"> & {
menuItems?: Record<string, DashboardMenuItem>;
};
Options
Other customerDashboardShell(config) fields:
| Field | Type | Description |
|---|---|---|
OverlaySlot | ComponentType | Rendered on the menu'd dashboard pages, e.g. a floating help button |
useActiveLanguages | ActiveLanguagesHook | Hook returning the language options for the top nav (runs at render time, after i18n init) |
useMenuCapabilities | () => CapabilitiesMap | Menu-only capability facts merged on top of the app's useCapabilitiesHook for checkCapabilities |
Provided layouts
The shell provides several layouts that features reference via ScreenWithLayout:
| Layout | Use case |
|---|---|
CustomerDashboardLayout | Standard two-column layout with sidebar, top nav, and content area |
CustomerDashboardFullPageLayout | Full-page modal overlay |
CustomerDashboardAdHocPageLayout | Minimal wrapper for custom layouts |
rootPath
The shell's base path is exported as rootPath ("dashboard/company"). Use it to build the homePage of your application:
<GlobalApp homePage={`/${rootPath}/admins`} api={api} modules={myModules} />
Writing a dashboard feature
A dashboard feature is a CustomerDashboardModule. Its screens reference shell layouts, and it declares its own menu items.
import type { CustomerDashboardModule } from "@alan-eu/global-customer-dashboard/module";
import { CustomerDashboardPageLayout } from "@alan-eu/global-customer-dashboard/shared-layout/CustomerDashboardPageLayout";
export const myDashboardFeature: CustomerDashboardModule = {
__moduleType: "admindashboard",
name: "my-feature",
translations: {
namespace: "myFeature",
resources: {
fr: require("./translations/fr.json"),
en: require("./translations/en.json"),
},
},
screens: {
"my-page": {
path: "my-page",
screen: {
layout: CustomerDashboardPageLayout,
props: {
children: <MyPage />,
title: tString("myFeature:pageTitle"),
},
},
},
},
menuItems: {
myPage: {
relativePath: "my-page",
iconVisual: "MyIcon",
label: () => tString("myFeature:menuLabel"),
},
},
};
customerDashboardShell automatically:
- Collects screens from the given
CustomerDashboardModules - Builds the sidebar from
menu, resolving each item key against the modules'menuItems - Routes screens under the correct layout based on the
layoutcomponent reference - Sets up the sidebar, top navigation, and entity context