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
2 changes: 1 addition & 1 deletion admin/build/index.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => 'e7ba886decc02a88b978');
<?php return array('dependencies' => array('react', 'react-dom', 'wp-api-fetch', 'wp-element', 'wp-hooks', 'wp-i18n'), 'version' => '71a3abd97070ba94673e');
8 changes: 4 additions & 4 deletions admin/build/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion admin/build/palette-rtl.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion admin/build/palette.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array(), 'version' => '3effee0387256efdbdfa');
<?php return array('dependencies' => array(), 'version' => '8d00695da538c9378cf6');
2 changes: 1 addition & 1 deletion admin/build/palette.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion admin/build/style-index-rtl.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion admin/build/style-index.css

Large diffs are not rendered by default.

6 changes: 6 additions & 0 deletions admin/src/components/Frame.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -489,6 +489,12 @@ export default function Frame( {
let width = PAGE_WIDTH;
if ( head.showSidebar ) {
width = MODULE_WIDTH;
} else if ( 'page' === head.layout ) {
// One page is as wide as Home; its Settings reads like a module's.
width =
area.tabs && area.tabs[ 0 ] && area.tabs[ 0 ].key === tab
? HOME_WIDTH
: MODULE_WIDTH;
} else if ( 'home' === area.key && 'overview' === tab ) {
width = HOME_WIDTH;
}
Expand Down
1 change: 1 addition & 0 deletions admin/src/extensions.js
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ const FEATURES = [
'view',
'drill-in',
'subtabs',
'page-layout',
];

// What this shell supports, for addons that feature-detect. Set when the
Expand Down
24 changes: 21 additions & 3 deletions admin/src/frame-logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@
* (`&tab=`) and, in a section with two or more pages, an icon tab row
* (`&sub=`). Core's pages keep their header tab row instead.
*
* A module that declares `layout: 'page'` is one page instead: no sidebar and
* no icon tab row. Its first tab is the page; any other tab (Settings) is a
* drill-in reached by address, read as `Saddle / Module / Settings`.
*
* A module screen opens one item with `&view=`. While it is open, the screen
* may call `props.header.drillIn( { title } )`: the breadcrumb then reads
* `Saddle / Module / Section / title` and the icon tab row steps aside. The
Expand All @@ -28,7 +32,7 @@
* @param {Object} props.home The first crumb: `{ label, url }` (Saddle, to Home).
* @param {string=} props.crumb The page's name when it is not the area's title
* (first run's "Welcome").
* @return {{crumbs: Array, title: string, drilled: boolean, showTabs: boolean, showSidebar: boolean, showSubtabs: boolean}}
* @return {{crumbs: Array, title: string, drilled: boolean, layout: string, showTabs: boolean, showSidebar: boolean, showSubtabs: boolean}}
* The header. Each crumb is `{ key, label, url }`; `key` is `home`,
* `module`, `section` or `current`, and the last one has no url.
*/
Expand All @@ -44,7 +48,9 @@ export function frameHeader( {
const tabs = area && Array.isArray( area.tabs ) ? area.tabs : [];
const title = ( area && area.title ) || '';
const module = !! ( area && area.module ) && ! crumb;
const onePage = module && 'page' === area.layout;
const current = tabs.find( ( t ) => t.key === tab );
const first = tabs.length > 0 && tabs[ 0 ].key === tab;
const pages =
current && Array.isArray( current.subtabs ) ? current.subtabs : [];

Expand All @@ -68,6 +74,17 @@ export function frameHeader( {
crumbs = [ homeCrumb, { key: 'current', label: crumb, url: '' } ];
} else if ( area && 'home' === area.key ) {
crumbs = [ { ...homeCrumb, url: '' } ];
} else if ( onePage && ( drilled || ( current && ! first ) ) ) {
// One page has no sections to name: the module, then what is open.
crumbs = [
homeCrumb,
{ key: 'module', label: title, url: ( area && area.url ) || '' },
{
key: 'current',
label: drilled ? drill.title : current.label,
url: '',
},
];
} else if ( drilled ) {
const page = sub && pages.find( ( p ) => p.key === sub );
crumbs = [
Expand All @@ -92,9 +109,10 @@ export function frameHeader( {
crumbs,
title: crumbs[ crumbs.length - 1 ].label,
drilled,
layout: onePage ? 'page' : 'sections',
showTabs: ! module && ! drilled && tabs.length > 1,
showSidebar: module && tabs.length > 0,
showSubtabs: module && ! drilled && pages.length > 1,
showSidebar: module && ! onePage && tabs.length > 0,
showSubtabs: module && ! onePage && ! drilled && pages.length > 1,
};
}

Expand Down
1 change: 1 addition & 0 deletions includes/admin/class-saddle-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,7 @@ private static function areas_for_app() {
'version' => isset( $area['version'] ) ? $area['version'] : '',
'summary' => isset( $area['summary'] ) ? $area['summary'] : '',
'content' => isset( $area['content'] ) ? $area['content'] : '',
'layout' => $area['layout'],
'tabs' => $tabs,
);
}
Expand Down
Loading
Loading