woocommerce/plugins/woocommerce-admin/client/dashboard
Joshua T Flowers d41ce76451 Onboarding: Add WebPreview component for theme previewing (https://github.com/woocommerce/woocommerce-admin/pull/2681)
* Add WebPreview component

* Add theme preview component

* Add WebPreview example for devdocs

* Update loading content prop name for WebPreview

* Add selected class state for device buttons

* Fix tabbing issue in stylesheet

* Fix loadingContent prop changes

* Add in translators note

* Fix theme details height issue

* Add theme demo track events (https://github.com/woocommerce/woocommerce-admin/pull/2715)

* Add theme demo track events

* Track theme chosen location

* Track theme slug on device switch

* Apply design feedback
2019-08-02 07:27:38 +08:00
..
dashboard-charts Send a tracks event when the dashboard chart type is toggled. 2019-07-12 11:46:36 -06:00
leaderboards Tracks: Add dashboard events 2019-07-02 12:31:48 +12:00
profile-wizard Onboarding: Add WebPreview component for theme previewing (https://github.com/woocommerce/woocommerce-admin/pull/2681) 2019-08-02 07:27:38 +08:00
store-performance Tracks: Add dashboard events 2019-07-02 12:31:48 +12:00
task-list Onboarding - Task List: Add store connection task (https://github.com/woocommerce/woocommerce-admin/pull/2718) 2019-08-01 14:09:08 -04:00
README.md Dashboard: Fix index and extension issues 2019-05-13 07:20:14 +12:00
customizable.js Send tracks event when dashboard sections are renamed. 2019-07-12 11:46:35 -06:00
default-sections.js Dashboard Charts: simplify data 2019-05-21 08:09:49 +12:00
index.js Onboarding: Add products task (https://github.com/woocommerce/woocommerce-admin/pull/2667) 2019-07-19 10:54:38 +08: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 Fix flash of unstyled content for onboarding pages (https://github.com/woocommerce/woocommerce-admin/pull/2673) 2019-07-22 12:53:13 +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.