Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions projects/packages/my-jetpack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ To disable the licensing UI at `/wp-admin/admin.php?page=my-jetpack#/add-license

#### React Frontend (`_inc/`)

- **Main App** (`admin.jsx`): Entry point with React Router setup
- **Main App** (`app.jsx`): React Router setup, rendered by the wp-build route in `routes/dashboard/`
- **Onboarding** (`onboarding.jsx`): Webpack entry for the full-screen onboarding takeover
- **Components** (`components/`): Reusable UI components for product cards, screens, and interstitials
- **Data Layer** (`data/`): Custom hooks and API integration using React Query (see [Data Layer Documentation](./_inc/data/README.md))
- **Context** (`context/`): Global state management for notices and values
Expand Down Expand Up @@ -130,7 +131,8 @@ To disable the licensing UI at `/wp-admin/admin.php?page=my-jetpack#/add-license

### React Files

- `_inc/admin.jsx` - Main React application entry point
- `_inc/app.jsx` - Main React application, rendered by `routes/dashboard/stage.tsx`
- `_inc/onboarding.jsx` - Onboarding takeover entry point
- `_inc/providers.tsx` - Context providers wrapper
- `_inc/constants.ts` - Route definitions and constants
- `_inc/components/my-jetpack-screen/` - Main dashboard screen
Expand Down
40 changes: 0 additions & 40 deletions projects/packages/my-jetpack/_inc/admin.jsx

This file was deleted.

2 changes: 1 addition & 1 deletion projects/packages/my-jetpack/_inc/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function ScrollToTop() {
}

/**
* The My Jetpack app tree, shared by the legacy entry and the wp-build stage.
* The My Jetpack app tree, rendered by the wp-build stage.
*
* @return {import('react').ReactElement} The App component.
*/
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/my-jetpack/_inc/design-tokens.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// @wordpress/ui design tokens (--wpds-*), or its var() lookups resolve empty.
// Legacy entry only: dependency extraction misreads a JS import as a script
// Onboarding entry only: dependency extraction misreads a JS import as a script
// handle, and wp-build leaves a bare `@import` to 404 against /wp-admin/.
@import "@wordpress/theme/design-tokens.css";
29 changes: 29 additions & 0 deletions projects/packages/my-jetpack/_inc/onboarding.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/**
* External dependencies
*/
import { createRoot } from '@wordpress/element';
/**
* Internal dependencies
*/
import './style.module.scss';
import OnboardingScreen from './components/onboarding-screen';
import Providers from './providers';
import './design-tokens.scss';

/**
* Render the onboarding takeover; the dashboard renders through wp-build.
*/
function render() {
const container = document.getElementById( 'my-jetpack-container' );
if ( null === container ) {
return;
}

createRoot( container ).render(
<Providers>
<OnboardingScreen />
</Providers>
);
}

render();
46 changes: 2 additions & 44 deletions projects/packages/my-jetpack/_inc/style.module.scss
Original file line number Diff line number Diff line change
@@ -1,51 +1,9 @@
@use "@automattic/jetpack-base-styles/admin-page-layout" as *;

:global {

// Apply the shared admin-page-layout mixin so the main My Jetpack page
// (sticky header, internally scrollable middle, JetpackFooter pinned at
// viewport bottom) matches Boost / Protect / VideoPress / Search /
// Newsletter / Publicize / Backup / Jetpack network admin / AI.

// Excluded: My Jetpack's `.jetpack-admin-full-screen` interstitial mode
// (e.g. the `step=onboarding` "Supercharge my site" screen), which hides
// the admin bar and takes over the whole viewport; its existing rules
// (further down in this file) override wp-admin chrome directly and
// should keep doing so. The class lives on `<body>` itself — added
// server-side via `admin_body_class` for `step=onboarding` and
// client-side by the `useFullScreen` hook for other full-screen routes —
// so the opt-out matches it as a sibling class on `<body>`, not as a
// descendant via `:has()`.
body.jetpack_page_my-jetpack:not(.jetpack-admin-full-screen) {

@include jetpack-admin-page-layout;

// Reserve space for the scrollable middle's vertical scrollbar so toggling
// between search results and category browse — which changes the content
// height, and thus whether the scrollbar is present — doesn't shift the
// layout sideways. Most noticeable on Firefox / platforms with classic
// (space-consuming) scrollbars; a no-op where unsupported. The selector
// mirrors the "scrollable middle" defined by jetpack-admin-page-layout.
.jp-admin-page__page > :not(:first-child):not(.jetpack-footer) {
scrollbar-gutter: stable;
}
}

// The onboarding takeover's container. The dashboard's layout
// lives in routes/dashboard/route.scss.
#my-jetpack-container {
height: 100%;

&:has(.my-jetpack-deprecate-notice-title) {

.jetpack-deprecation-notice-link {
color: inherit;
font-weight: 600;
padding-right: 5px;
}
}

.my-jetpack-deprecate-notice-title {
font-weight: 600;
}
}

#wpbody-content {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: changed

Show the dashboard in the new rounded admin page frame on every site.
12 changes: 4 additions & 8 deletions projects/packages/my-jetpack/routes/dashboard/route.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@
// Onboarding keeps its own full-viewport rules in _inc/style.module.scss.
body.jetpack_page_my-jetpack:not(.jetpack-admin-full-screen) {

// This re-emits jetpack-admin-page-layout, which _inc/style.module.scss also
// includes on the same selector at the same specificity. Keep the two in sync:
// when they conflict, source order decides, and that order is not guaranteed.
@include jetpack-admin-page-layout-wp-build;

// Matches legacy: onboarding-screen/styles.module.scss has a `:global(body)`
// rule that leaks into every My Jetpack page via the shared webpack bundle.
// The Jetpack font stack onboarding-screen/styles.module.scss sets on `body`.
// Inlined, not imported — that file is a component module, not a partial.
font-family:
-apple-system,
Expand All @@ -28,13 +24,13 @@ body.jetpack_page_my-jetpack:not(.jetpack-admin-full-screen) {
Arial,
sans-serif;

// Boot's stage sets #1e1e1e; legacy inherits wp-admin's body color.
// wp-admin's body color, not the #1e1e1e boot's stage sets.
.boot-layout__stage {
color: #3c434a;
}

// Mirrors the legacy path: keep the scrollable middle's gutter reserved
// so content-height changes don't shift the layout sideways.
// Keep the scrollable middle's gutter reserved so content-height changes
// don't shift the layout sideways.
.jp-admin-page__page > :not(:first-child):not(.jetpack-footer) {
scrollbar-gutter: stable;
}
Expand Down
4 changes: 2 additions & 2 deletions projects/packages/my-jetpack/routes/dashboard/stage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import './route.scss';
/**
* Boot stage for the My Jetpack dashboard.
*
* Renders the same tree as the legacy entry, `HashRouter` included — boot
* reads its path from `?p=`, never the hash, so `#/…` deep links still resolve.
* Keeps the app's `HashRouter` — boot reads its path from `?p=`, never the
* hash, so `#/…` deep links still resolve.
*
* @return The My Jetpack app.
*/
Expand Down
Loading
Loading