Add a screen
Add a new screen to an onhr product, with its own route.
Each screen has its own route, so a page loads only the scripts its own screen needs. Adding one takes four steps.
Who can do this
The team maintaining this installation. Agree the screen and access requirements with the workspace administrator before implementation.
Steps
- Write the screen in
src/screens/<product>/<name>.tsx, with a default export. - Make sure its menu item exists in
src/config/nav.ts. - Import it in
src/screens/registry.tsand add its key, such as'crm/plugins'. The key must be a menu item insrc/config/nav.ts. - Run
pnpm gen:routes, and commit thepage.tsxit writes undersrc/app/(app)/<product>/<name>/with your change.
pnpm dev and pnpm build run step 4 for you. pnpm gen:routes --check changes nothing and fails if a route file is out of date.
When the screen reads and writes the workspace's own data, add its key to src/config/live-screens.ts. Until then it shows sample data with a work-in-progress banner.
Common problems
pnpm testfails. A route file is missing or out of date. Runpnpm gen:routesand commit the result.- Do not edit the generated
page.tsxfiles. They are rewritten from the registry and the menu. - Do not import
src/screens/registry.tsfrom app code. That puts every screen back on every page. - The menu item shows a placeholder. It has no screen in the registry yet.