Repository navigation
Conversation
Phase 0 of #269: the data model of the content types control panel, the ContentTypesDriver interface with its capabilities, a mock driver seeded with fixtures from a real site, the ControlPanelsProvider (router, translations, notifications) and a guard that keeps the package's dependencies usable in Volto.
The mock inferred them from the fixture type schemas, so behaviors no fixture type enables (Lead image, Rich text, add-on behaviors) looked like they added no fields. Also drop the Folder fixture: plone.volto doesn't use folders, so Document carries the sample items instead. Add an add-on behavior to the fixtures.
States can carry a color from the backend. stateColor() picks the color to show: app overrides, then the backend's color, then defaults for Plone's core states, then a color derived from who can see items in the state, so custom workflows get one too.
The app that uses it compiles it, so it has no tsup build and is not part of build:deps.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Phase 0 of #269 (content types control panel). Stacked on #263.
What
A new package,
@plone/controlpanels, for control panel screens that run unchanged in Plone Aurora and in Volto. This PR adds no screens yet, only what they will be built on:src/content-types/types.ts): what the screens show and edit, including type settings, schema, behaviors, workflows, workflow change previews and jobs, and site defaults. It's independent of any backend payload.ContentTypesDriver(src/content-types/driver.tsx): the interface every app implements to read and write that data. In Aurora that's resource routes and@plone/client; in Volto it will be redux; stories and tests use the mock. The driver'scapabilitiessay what its backend supports, so the screens can ship against today's plone.restapi and turn features on as [DRAFT] Endpoints for per-type content settings, behavior order and workflow assignment plone.restapi#2061 lands. Optional methods exist only when their capability is on.createMockDriver(): an in-memory driver seeded with fixtures captured from the acceptance backend (Plone 6.2 + plone.volto), completed by hand where plone.restapi has no data yet (per-type settings, behavior order, workflows, state counts). Each behavior's fields come from its own schema (captured from scratch types with every behavior enabled), and an add-on behavior (collective.sponsors) stands for behaviors the frontend knows nothing about. Folder is left out, since plone.volto replaces folders with folderish pages. It covers every method, including workflow changes run as jobs, plus options for latency and turning capabilities off.suggestStateMapping(): the workflow change suggestion from the design. It keeps who can see an item and never makes content more visible. Unlike the classic panel, it maps Published to Externally visible instead of Internal draft.stateColor(): the color the UI shows a workflow state with, one of the six Quanta color families (gray,blue,teal,green,yellow,red). The first that applies wins: app overrides by state id, the color the backend sets on the state, defaults for Plone's core states (DEFAULT_STATE_COLORS), then a color derived from who can see items in the state, so custom workflows get a meaningful color too.ControlPanelsProvider: connects the screens to the app's router (through the react-aria-componentsRouterProvider), translations (translate, in react-intl's message shape so both Aurora and Volto can plug in) and notifications (notify).Keeping it usable in Volto
react,react-aria-components,@plone/quanta,@plone/helpers,@plone/registry,jotai. React peers stay at 16.8–19.src/dependencies.test.tsfails whenpackage.jsonor a source file uses anything else. ESLint'sno-restricted-importsreports the usual offenders (react-router, i18n libraries,@plone/client,@plone/cmsui,@plone/components…) in the editor.AGENTS.md.Also
pnpm --filter @plone/controlpanels storybook, port 6007), with an introduction page for now.Not in this PR
controlpanels.csscomes with the Volto port.quanta.cssonly ships tokens, not Tailwind utilities, so Volto needs the utilities compiled for it. Aurora compiles the package's classes from its source.Checks
pnpm --filter @plone/controlpanels test --run: 31 tests pass. I confirmed the dependency guard fails whenreact-routeris imported.pnpm --filter @plone/controlpanels check:tsandbuild-storybookpass.