-
Notifications
You must be signed in to change notification settings - Fork 117
[IMP] website_sale: design ecommerce dashboard #4833
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master-awesome-ecommerce-dashboard-nipl
Are you sure you want to change the base?
[IMP] website_sale: design ecommerce dashboard #4833
Conversation
|
This PR targets the un-managed branch odoo-dev/odoo:master-awesome-ecommerce-dashboard-nipl, it needs to be retargeted before it can be merged. |
c14465f to
fdeda0a
Compare
nipl-odoo
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.
Hello Laetitia 👋🏻, thanks for the new design iteration, the dashboard’s looking really nice!
I’ve left a few comments on the JS diff. Not sure if you or I should handle those, so let me know if it’s on my side.
| useBus(this.env.searchModel, 'update', () => { | ||
| if(!this.getIsActiveSearchEquivalentToFilterCard(this.state.selectedFilter)) { | ||
| this.state.selectedFilter = null; | ||
| } | ||
| }); | ||
|
|
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.
Instead of this, why don't you maintain a variable like I did with selectedDateFilter?
Because with this diff, if I select a similar filter as a card from the search bar, the card will stay selected, but the state variable will not be the same, which kinda feels weird for a state variable.
I would suggest setting a variable with the active filter values in this searchModel update and in onwillstart, you just compare that state variable with the current search items by sorting the same way you did in getIsActiveSearchEquivalentToFilterCard.
| this.state.selectedFilter = filters; | ||
| } | ||
|
|
||
| getIsActiveSearchEquivalentToFilterCard(filters) { |
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.
Maybe rename to compareFilter or isSameFilter if you want a shorter name. Up to you, though :p
| html .o_web_client > .o_action_manager > .o_website_sale_dashboard_kanban_view .o_content, | ||
| html .o_web_client > .o_action_manager > .o_website_sale_dashboard_list_view .o_content { |
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.
I am no CSS expert (correct me if I am wrong), but maybe
.o_website_sale_dashboard_kanban_view .o_content,
.o_website_sale_dashboard_list_view .o_content {}this is enough, no? 🤔 Also move this to addons/website_sale/static/src/views/website_sale_kanban_view.scss and addons/website_sale/static/src/views/website_sale_list_view.scss it looks like their home.
| <DateFilterButton update.bind="updateDashboardState" selectedFilter="state.selectedFilter"/> | ||
| <div class="d-none d-lg-flex border rounded-3 py-3"> | ||
| <div class="o_date_filter_wrapper d-flex align-items-center"> | ||
| <DateFilterButton update.bind="updateDashboardState" selectedFilter="state.selectedDateFilter"/> |
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.
Maybe also rename DateFilterButton's prop to selectedDateFilter, it's clearer, no?
| @@ -10,10 +10,17 @@ export class WebsiteSaleDashboard extends Component { | |||
| setup() { | |||
| this.state = useState({ | |||
| eCommerceData: {}, | |||
| selectedFilter: DATE_OPTIONS[0], | |||
| selectedDateFilter: DATE_OPTIONS[0], | |||
| selectedFilter: null, | |||
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.
| selectedFilter: null, | |
| selectedFilter: [], |
should be declared as an empty array since you will be maintaining an array with this variable
| if (!filters) { | ||
| return false; | ||
| } | ||
| const activeSearchFilterNames = this.env.searchModel.getSearchItems(el => el.isActive && el.type === 'filter')?.map(el => el.name).sort(); | ||
| return filters.length === activeSearchFilterNames?.length && filters.sort().every((val, i) => val === activeSearchFilterNames[i]); |
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.
Instead of comparing with the searchModel's filters, maybe you can properly maintain the state variable and compare it.
So basically state variable will contain a subset of searchModel items (only with type filters), and you use that state variable to compare with the filters array in here.
fdeda0a to
190c448
Compare
|
Hey @nipl-odoo, |
Brieuc-brd
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.
.../website_sale/static/src/js/website_sale_dashboard/date_filter_button/date_filter_button.xml
Outdated
Show resolved
Hide resolved
addons/website_sale/static/src/js/website_sale_dashboard/website_sale_dashboard.scss
Outdated
Show resolved
Hide resolved
addons/website_sale/static/src/js/website_sale_dashboard/website_sale_dashboard.dark.scss
Show resolved
Hide resolved
| } | ||
| const filters = filterName == 'to_confirm' ? [filterName, 'from_website'] : [filterName, 'from_website','order_confirmed']; | ||
| if(this.isSameFilter(filters)) { | ||
| dashboardCardClasses.push('o_dashboard_card--active'); |
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.
If you apply my suggestion you should change this class as well.
| dashboardCardClasses.push('o_dashboard_card--active'); | |
| dashboardCardClasses.push('active'); |
| <templates> | ||
| <t t-name="website_sale.WebsiteSaleDashboard"> | ||
| <div class="o_website_sale_dashboard container-fluid d-flex flex-wrap justify-content-between align-items-start gap-3 p-3 border-bottom"> | ||
| <div class="o_website_sale_dashboard container-fluid d-flex justify-content-between align-items-center gap-3 p-3 border-bottom"> |
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.
To handle easily the size of dashboard cards (and avoid custom css like this : , I wonder if it wouldn't be easier to use grid 🤔 something like this :
<div class="o_website_sale_dashboard container-fluid grid gap-3 p-3 border-bottom">
<!-- Left Section -->
<div class="g-col-12 g-col-lg-5">
...
</div>
<!-- Right Section -->
<div class="g-col-7 d-none d-lg-flex">
...
</div>
</div>You could easily manage the size depending on breakpoints 👍
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.
I preferred to do it differently and fix the size, otherwise the right side wasn't great.
addons/website_sale/static/src/js/website_sale_dashboard/website_sale_dashboard.xml
Outdated
Show resolved
Hide resolved
addons/website_sale/static/src/js/website_sale_dashboard/website_sale_dashboard.xml
Outdated
Show resolved
Hide resolved
addons/website_sale/static/src/js/website_sale_dashboard/website_sale_dashboard.xml
Outdated
Show resolved
Hide resolved
| <h2 class="m-0 fw-bold o_dashboard_card_data" t-esc="state.eCommerceData['overall']['to_fulfill']"/> | ||
| <h4 class="fw-semibold text-muted o_dashboard_card_text">To Fulfill</h4> | ||
| </a> | ||
| <span class="o_dashboard_card_data fs-4 fw-bolder" t-esc="state.eCommerceData['overall']['to_fulfill']"/> |
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.
o_dashboard_card_data is no longer used if I'm not mistaken, you can remove it (same for the other iterations).
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.
I kept it in order to use it to target the number and colour it (that way I can remove the famous text-body that was overwriting the colour I had defined).
| </h3> | ||
| <div class="fw-semibold text-muted o_dashboard_card_text">Visitors</div> | ||
| </span> | ||
| <span class="o_dashboard_card_text fs-6 text-body fw-bold">Visitors</span> |
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.
Are you sure text-body is necessary here (same for the other iterations) ? 🤔
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.
(see comment above)
190c448 to
fb510a9
Compare
30351d5 to
8a3d7df
Compare
fb510a9 to
bb0079c
Compare
4aa1139 to
91a027e
Compare
bb0079c to
02ce7bb
Compare
This commit adapts the ecommerce dashboard design by: - emphasizing the cards when there is data to display. - making the card active on click. - hiding the "To confirm" card when there is no data to display because it's not a common case. task-5177259
02ce7bb to
b42e24c
Compare
This PR adapts the e-commerce dashboard design by:
it's not a common case.
task-5177259