-
Notifications
You must be signed in to change notification settings - Fork 143
Task list - add a shortcut back to store setup #4853
Conversation
This allows the click outside functionality to work.
It was simpler to maintain a separate list of visible tabs for situations where we display the setup progress tab. It was a nice to have to display the task list, but I had some issues with that, which will require some refactoring of those components and I've decided to avoid doing that here. For now we support the most basic functionality which is routing to the home page where the setup task list exists.
| } | ||
|
|
||
| closePanel() { | ||
| this.setState( ( state ) => ( { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
one thing that was happening a lot before was that ActivityPanel was setting state to be a completely different shaped object in various scenarios. This lead to a lot of confusion about what state was at any given time. I've changed this to always keep state the same shape.
| case 'inbox': | ||
| return <InboxPanel />; | ||
| case 'orders': | ||
| const { hasUnreadOrders } = this.props; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not a good idea to declare variables inside case's since they'll clash if you reuse them in separate cases.
| height: 18px; | ||
|
|
||
| // custom progress icon, requires specific coloring | ||
| &.setup-progress { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Setup progress is different from all the other icons, its a 2 toned SVG rather than all the other tab icons which are dashicons.
| { | ||
| name: 'setup', | ||
| title: __( 'Store Setup', 'woocommerce-admin' ), | ||
| icon: <SetupProgress />, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool ✨
|
|
||
| import { Tab } from '../'; | ||
|
|
||
| const renderTab = () => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
😍 thanks for the tests!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love all these tests 💯
| orientation="horizontal" | ||
| className="woocommerce-layout__activity-panel-tabs" | ||
| > | ||
| { tabs && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this refactor, we could now have a filter right here for the tabs. Given the uncertain future of the activity panels though, my vote is to not add it quite yet - but still really cool that your changes have allowed for a good spot to add it in.
| }; | ||
|
|
||
| describe( 'Activity Panel Tabs', () => { | ||
| it( 'correctly tracks the selected tab', () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice test here!
|
@timmyc You're right no need for the lock. I have reverted that. |
| // Ensure that if the user is trying to get to the task list they can see it even if | ||
| // it was dismissed. | ||
| updateOptions( { woocommerce_task_list_hidden: 'no' } ); | ||
| getHistory().push( getAdminLink( 'admin.php?page=wc-admin' ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The url comes out to this:
http://tangaroa.test/wp-admin/http://tangaroa.test/wp-admin/http://tangaroa.test/wp-admin/admin.php?page=wc-admin
getAdminLink is for external links. Sorry about this not being documented anywhere! This will look more like
woocommerce-admin/client/task-list/tasks.js
Line 106 in d2be77c
| getHistory().push( getNewPath( {}, `/profiler`, {} ) ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops! Thanks, I'll fix that
joshuatf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really awesome to have this feature, @samueljseay! Great work on this PR; left a couple quick questions, but testing well for me.
|
|
||
| import { Tab } from '../'; | ||
|
|
||
| const renderTab = () => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love all these tests 💯
joshuatf
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing really well! Thanks for the updates here, Sam! LGTM 🚢
|
@samueljseay pinged you on the original issue that the design changed a bit here, but let's land this and we can take care of those revisions in a follow-up. Solid work!!! |
Fixes #4592
This adds the functionality to support a store setup tab displayed in ActivityPanel. The tab currently just redirects to the home page, rather than implementing the nice-to-haves of displaying the task list in the panel. The reason for this, is that I found it would require significant refactoring of the task list to support this currently.
As part of this I have also refactored rendering of tabs inside into 2 new functional components:
<Tabs>and<Tab>. The reason for this is to decompose large untestable components, test them and by virtue of being decomposed they will also be more reusable in future. Ideally would have been refactored to a functional component as well, but it would have been too large a task.The logic for showing the setup progress tab is something I'd be keen to have checked. At the moment it only displays if:
Accessibility
Screenshots
Detailed test instructions:
Test the ActivityPanel refactor
Because there has been some refactoring of the ActivityPanel in general it would be really great to smoke test its general functionality such as:
Test the Setup Progress tab
Testing the setup progress tab will require having a site with some setup tasks not completed.