woocommerce/plugins/woocommerce-admin/client/dashboard
Joshua T Flowers ffed0e8ab2 Fix onboarding profiler layout and notices (https://github.com/woocommerce/woocommerce-admin/pull/2218)
* Hide nags in notices in profiler

* Center content layout for profiler wizard
2019-05-14 11:21:14 +08:00
..
components Dashboard: Rename class/feature to remove conflict with legacy dashboard widget (https://github.com/woocommerce/woocommerce-admin/pull/2138) 2019-05-08 09:10:05 -07:00
dashboard-charts Dashboard: Rename class/feature to remove conflict with legacy dashboard widget (https://github.com/woocommerce/woocommerce-admin/pull/2138) 2019-05-08 09:10:05 -07:00
leaderboards Dashboard: Rename class/feature to remove conflict with legacy dashboard widget (https://github.com/woocommerce/woocommerce-admin/pull/2138) 2019-05-08 09:10:05 -07:00
profile-wizard Fix onboarding profiler layout and notices (https://github.com/woocommerce/woocommerce-admin/pull/2218) 2019-05-14 11:21:14 +08:00
store-performance Dashboard: Rename class/feature to remove conflict with legacy dashboard widget (https://github.com/woocommerce/woocommerce-admin/pull/2138) 2019-05-08 09:10:05 -07:00
task-list Add onboarding task list to dashboard (https://github.com/woocommerce/woocommerce-admin/pull/1929) 2019-03-28 14:09:44 +08:00
README.md Save section/block preferences in user data (https://github.com/woocommerce/woocommerce-admin/pull/2148) 2019-05-07 09:21:34 +02:00
customizable.js Save section/block preferences in user data (https://github.com/woocommerce/woocommerce-admin/pull/2148) 2019-05-07 09:21:34 +02:00
default-sections.js Save section/block preferences in user data (https://github.com/woocommerce/woocommerce-admin/pull/2148) 2019-05-07 09:21:34 +02:00
index.js Dashboard: Rename class/feature to remove conflict with legacy dashboard widget (https://github.com/woocommerce/woocommerce-admin/pull/2138) 2019-05-08 09:10:05 -07:00
style.scss Vertically center Dashboard 'Add more' button (https://github.com/woocommerce/woocommerce-admin/pull/2171) 2019-05-07 09:21:16 +02: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.