woocommerce/plugins/woocommerce-admin/client/dashboard
Job 41f3859ad5 Change "Demo" to "Sample" products (https://github.com/woocommerce/woocommerce-admin/pull/4184)
* Change "Demo" to "Sample" products

A few years ago we had a discussion on the name of the files for test products and we choose "sample" data over "dummy" data. I think we should likely stick to that naming (which is also the name of the folder and the files in WC core: https://github.com/woocommerce/woocommerce/tree/master/sample-data)

This commit changes that wording

* Small update in caps of "Build a better WooCommerce"

All titles and questions in the new onboarding wizards only capitalise names and the first letter of the sentence. This seemed a tiny bit off.
2020-04-24 12:23:45 +02:00
..
components Plugins DataStore: decouple from onboarding (https://github.com/woocommerce/woocommerce-admin/pull/4048) 2020-04-17 11:58:36 +12:00
dashboard-charts Only query requested stat totals in reports. (https://github.com/woocommerce/woocommerce-admin/pull/4009) 2020-03-31 09:08:40 -06:00
leaderboards Align WooCommerce javascript code standards/linting/styles with WordPress core. (https://github.com/woocommerce/woocommerce-admin/pull/3674) 2020-02-14 15:23:21 +13:00
profile-wizard Change "Demo" to "Sample" products (https://github.com/woocommerce/woocommerce-admin/pull/4184) 2020-04-24 12:23:45 +02:00
store-performance Dynamic Currency with Context API (https://github.com/woocommerce/woocommerce-admin/pull/4027) 2020-04-03 10:54:38 +13:00
task-list Change "Demo" to "Sample" products (https://github.com/woocommerce/woocommerce-admin/pull/4184) 2020-04-24 12:23:45 +02:00
README.md Dashboard: Fix index and extension issues 2019-05-13 07:20:14 +12:00
customizable.js Plugins DataStore: decouple from onboarding (https://github.com/woocommerce/woocommerce-admin/pull/4048) 2020-04-17 11:58:36 +12:00
default-sections.js Update default dashboard view. (https://github.com/woocommerce/woocommerce-admin/pull/4035) 2020-03-31 18:58:06 -06:00
index.js Plugins DataStore: decouple from onboarding (https://github.com/woocommerce/woocommerce-admin/pull/4048) 2020-04-17 11:58:36 +12:00
section-controls.js Align WooCommerce javascript code standards/linting/styles with WordPress core. (https://github.com/woocommerce/woocommerce-admin/pull/3674) 2020-02-14 15:23:21 +13:00
section.js Align WooCommerce javascript code standards/linting/styles with WordPress core. (https://github.com/woocommerce/woocommerce-admin/pull/3674) 2020-02-14 15:23:21 +13:00
style.scss wp.data Settings refactor 2020-03-25 16:20:17 +13:00
utils.js Align WooCommerce javascript code standards/linting/styles with WordPress core. (https://github.com/woocommerce/woocommerce-admin/pull/3674) 2020-02-14 15:23:21 +13: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.