woocommerce/plugins/woocommerce-admin/client/dashboard
Joshua T Flowers e1bb3255c9 Onboarding: Hide plugin install step when already installed (https://github.com/woocommerce/woocommerce-admin/pull/3575)
* Remove already active plugins from install list

* Update global with newly activated and installed plugins

* Cache activated plugins to prevent step removal
2020-01-17 09:46:11 +08:00
..
components SelectControl: Add an option to show all options on refocus (https://github.com/woocommerce/woocommerce-admin/pull/3551) 2020-01-14 18:19:59 +08:00
dashboard-charts Analytics: Change Refunds to Returns (https://github.com/woocommerce/woocommerce-admin/pull/3514) 2020-01-03 15:12:53 -08:00
leaderboards Leaderboards: fix rename from getSettings (https://github.com/woocommerce/woocommerce-admin/pull/2948) 2019-09-25 08:45:59 +12:00
profile-wizard Onboarding: Update profiler theme action buttons (https://github.com/woocommerce/woocommerce-admin/pull/3548) 2020-01-14 18:19:09 +08:00
store-performance Decouple date package from `wcSettings`. (https://github.com/woocommerce/woocommerce-admin/pull/3278) 2019-11-26 14:39:40 -05:00
task-list Onboarding: Hide plugin install step when already installed (https://github.com/woocommerce/woocommerce-admin/pull/3575) 2020-01-17 09:46:11 +08:00
README.md Dashboard: Fix index and extension issues 2019-05-13 07:20:14 +12:00
customizable.js Onboarding: Add purchase products task list item (https://github.com/woocommerce/woocommerce-admin/pull/3472) 2019-12-31 16:50:45 +08:00
default-sections.js Correcting and clarifying analytics terms and calculations (https://github.com/woocommerce/woocommerce-admin/pull/3104) 2019-11-22 10:06:14 -05:00
index.js Add purchase modal at the end of the profile wizard (https://github.com/woocommerce/woocommerce-admin/pull/3444) 2019-12-20 07:58:38 -05:00
section-controls.js Dashboard: Move title edit to Controls 2019-05-23 08:43:45 +12:00
section.js Dashboard: Fix index and extension issues 2019-05-13 07:20:14 +12:00
style.scss Onboarding: Fix disabled button hover state (https://github.com/woocommerce/woocommerce-admin/pull/3492) 2019-12-31 10:47:41 +08:00
utils.js Fix exception when task list is not shown. (https://github.com/woocommerce/woocommerce-admin/pull/3513) 2020-01-06 15:10:37 -08:00

README.md

Dashboard

This folder contains the components used in the Dashboard page.

Extending the Dashboard

New Dashboard sections can be added by hooking into the filter woocommerce_dashboard_default_sections. For example:

addFilter( 'woocommerce_dashboard_default_sections', sections => {
	return [
		...sections,
		{
			key: 'example',
			component: ExampleSection,
			title: 'My Example Dashboard Section',
			isVisible: true,
			icon: 'arrow-right-alt',
			hiddenBlocks: [],
		},
	];
} );

Each section is defined by an object containing the following properties.

  • key (string): The key used internally to identify the section.
  • title (string): The title shown in the Dashboard. It can be modified by users.
  • icon (string|function|WPComponent|null): Icon to be used to identify the section.
  • component (react component): The component containing the section content.
  • isVisible (boolean): Whether the section is visible by default. Sections can be added/hidden by users.
  • hiddenBlocks (array of strings): The keys of the blocks that must be hidden by default. Used in Sections that contain several blocks that can be shown or hidden. It can be modified by users.

The component will get the following props:

  • hiddenBlocks (array of strings): Hidden blocks according to the default settings or the user preferences if they had made any modification.
  • isFirst (boolean): Whether the component is the first one shown in the Dashboard.
  • isLast (boolean): Whether the component is the last one shown in the Dashboard.
  • onMove (boolean): Event to trigger when moving the section.
  • onRemove (boolean): Event to trigger when removing the section.
  • onTitleBlur (function): Event to trigger when the edit title input box is unfocused.
  • onTitleChange (function): Event to trigger when the edit title input box receives a change event.
  • onToggleHiddenBlock (function): Event to trigger when the user toggles one of the hidden blocks preferences.
  • titleInput (string): Current string to be displayed in the edit title input box. Title is only updated on blur, so this value will be different than title when the user is modifying the input box.
  • path (string): The exact path for this view.
  • query (object): The query string for the current view, can be used to read current preferences for time periods or chart interval/type.
  • title (string): Title of the section according to the default settings or the user preferences if they had made any modification.
  • controls (react component): Controls to move a section up/down or remove it from view to be rendered inside the EllipsisMenu.