Repository navigation
Conversation
A portal with its own CSS stays on its old theme until someone switches. Its old Settings › Portal page now offers the switch: today's portal beside the portal switched, a report on the CSS, and Switch, held while the CSS has refusals. History offers the way back. The switch publishes today's branding converted, with the theme variables the CSS sets on :root and .dark read in first, since the design sets those variables itself and a tenant-layer :root would stop applying. The CSS carries over unchanged without asking the plan, as it is the portal's already. Switching back unpublishes the design, so the old theme, never touched, shows again; the design's versions stay. Both are audited. The switched frame is drawn by the engine on the server: with ?design=switch the bootstrap draws the portal switched, for a dashboard session that can edit branding only. The CSS check now offers the post-card part for .post-card.
Member
Author
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.
The twenty-second of the stack that builds a new design engine for the portal, and the third of phase 5. A portal with its own CSS stays on its old theme until someone switches. This adds the switch, with today's portal beside the switched one and a report on the CSS, and the way back. Behind the
portalDesignV2flag.The card
With the engine on, the old Settings › Portal page shows one card above today's settings: "Your portal uses custom CSS. Switch to the new design system." It has:
:rootor.darkthat become design fields, such as--primarybecoming the accent and--radiusthe corners.--ring), internal class names with the part to use, and the CSS check's other warnings.Once switched, History has "Switch back", with a confirmation, since visitors see it straight away.
What switching does
lib/server/domains/design/switch.ts::rootand.darktheme variables read in over the stored ones first. The design sets the portal's theme variables on<html>outside any layer, so a:rootvariable in the tenant layer would otherwise stop applying without a word.css, rendering in the tenant layer. It is the portal's CSS already, so the plan is not asked. The check still refuses what reaches past styling, here as before.publishedRevisionIdto null), so the engine draws the old theme again; the design's versions and any draft stay, and the switch can be made again.design.switchedanddesign.switched_back, with filters in the audit log.PORTAL_DESIGN_ENGINE=legacy) is aNOT_SWITCHABLErefusal; switching back with nothing published isNOT_SWITCHED.carriesThemeVariable()in the converter answers whether it would carry a value, so the report and the conversion cannot disagree: colours that parse, corners in rem, px or em, and a font the design bundles, the last two from the light theme only..post-cardnow gets its part as a fix in the CSS check, since the class sits on thepost-cardpart's element; the switch round on a real portal showed it was missing.The switched frame
The portal draws quite differently on each engine, so the frame cannot fake the design over a portal drawn by the old theme. With
?design=switch, the root asks the bootstrap for the portal drawn as it would be after switching, and the bootstrap gives it only to a dashboard session that can edit branding; anyone else, or a portal with nothing to switch, gets the settings unchanged. The portal keeps the flag as the frame navigates, likethemeandpreview.Verification
:rootand.darkvariables, internal classes), with Playwright: the card offered the switch; the report moved--primaryand--radiusinto the design and warned about--ringand the internal classes; the left frame drew the old theme and the right one the design with the CSS (accent, sharp corners, the 3px header rule); visitors kept the old theme until Switch; then the page became Appearance and visitors saw the design with the CSS; History's "Switch back" returned the old page with the card, and visitors saw the old theme again. No page errors.