feat: empty states for favourites and search page
diff --git a/erpnext/public/js/hub/pages/favourites.js b/erpnext/public/js/hub/pages/favourites.js
index 6c2fd65..6f2c67c 100644
--- a/erpnext/public/js/hub/pages/favourites.js
+++ b/erpnext/public/js/hub/pages/favourites.js
@@ -32,11 +32,20 @@
}
render(items) {
- this.$wrapper.find('.hub-card-container').empty();
+ this.$wrapper.find('.hub-items-container').empty();
const html = get_item_card_container_html(items, __('Favourites'));
- this.$wrapper.append(html);
-
+ this.$wrapper.html(html);
this.$wrapper.find('.hub-card').addClass('closable');
+
+ if (!items.length) {
+ this.render_empty_state();
+ }
+ }
+
+ render_empty_state() {
+ this.$wrapper.find('.hub-items-container').append(`
+ <div class="col-md-12">${__("You don't have any favourites yet.")}</div>
+ `)
}
on_item_remove(hub_item_code, $hub_card = '') {
diff --git a/erpnext/public/js/hub/pages/search.js b/erpnext/public/js/hub/pages/search.js
index f3dd6fb..1cdacb6 100644
--- a/erpnext/public/js/hub/pages/search.js
+++ b/erpnext/public/js/hub/pages/search.js
@@ -27,8 +27,13 @@
}
render(items) {
- this.$wrapper.find('.hub-card-container').remove();
- const title = this.keyword ? __('Search results for "{0}"', [this.keyword]) : '';
+ this.$wrapper.find('.hub-items-container').remove();
+ const title = !items.length
+ ? __('No results found')
+ : this.keyword
+ ? __('Search results for "{0}"', [this.keyword])
+ : '';
+
const html = get_item_card_container_html(items, title);
this.$wrapper.append(html);
}