Open Source Platform for DTC, B2B Commerce, Marketplaces & Omnichannel. REST APIs, TypeScript SDKs, and production-ready Next.js storefront. Self-host it. Own your data. No vendor lock-in. Zero platform fees.
Ruby b2b-commercee-commerceecommerceecommerce-apiecommerce-frameworkecommerce-platformheadlessheadless-commerceheadless-ecommercemarketplacemulti-tenantmulti-vendormulti-vendor-ecommerceopen-sourcespree-commerce
Admin: improve navigation, sidebar, header
Damian Legawiec4dc5a746b3cf
diff --git a/admin/app/assets/stylesheets/spree/admin/components/_cards.scss b/admin/app/assets/stylesheets/spree/admin/components/_cards.scssindex 5adde1dd20..52ac16c726 100644--- a/admin/app/assets/stylesheets/spree/admin/components/_cards.scss+++ b/admin/app/assets/stylesheets/spree/admin/components/_cards.scss@@ -59,11 +59,14 @@border-color: $gray-50 !important;}-.card-lg {- margin-bottom: 1rem;+.card, .card-lg {+ border: 0;+ box-shadow: 0 0 0 1px $card-border-color;background-color: $white;border-radius: $border-radius-lg;- border: 1px solid $card-border-color;+}+.card-lg {+ margin-bottom: 1rem;padding: 0;}diff --git a/admin/app/assets/stylesheets/spree/admin/components/_dropdowns.scss b/admin/app/assets/stylesheets/spree/admin/components/_dropdowns.scssindex 4dfa430a70..2b716569e4 100644--- a/admin/app/assets/stylesheets/spree/admin/components/_dropdowns.scss+++ b/admin/app/assets/stylesheets/spree/admin/components/_dropdowns.scss@@ -43,6 +43,8 @@align-items: center;justify-content: flex-start;background: transparent;+ padding-top: 0.4rem;+ padding-bottom: 0.4rem;color: $gray-700;diff --git a/admin/app/assets/stylesheets/spree/admin/components/_main.scss b/admin/app/assets/stylesheets/spree/admin/components/_main.scssindex 0b4edc7029..87395a9101 100644--- a/admin/app/assets/stylesheets/spree/admin/components/_main.scss+++ b/admin/app/assets/stylesheets/spree/admin/components/_main.scss@@ -12,11 +12,6 @@font-size: 1.25rem;}-#header {- height: $header-height;- background-color: $body-bg;-}-.store-dropdown {display: flex;align-items: center;@@ -26,11 +21,11 @@background-color: $sidebar-bg;width: $sidebar-width;border-right: 1px solid $border-color;+ border-bottom: 1px solid $border-color;height: $header-height;}.store-dropdown-button {- background-color: $sidebar-bg;padding: 0.25rem;display: flex;align-items: center;@@ -78,13 +73,13 @@gap: 0.5rem;width: $sidebar-width;background-color: $sidebar-bg;- border-right: 1px solid $border-color;- height: 100vh;+ box-shadow: inset -1px 0 0 $border-color;+ height: calc(100vh - $header-height);overflow-y: auto;overflow-x: hidden;position: fixed;top: $header-height;- color: $gray-700;+ color: $gray-600;padding-top: 0.8rem;@media (max-width: 992px) {@@ -94,9 +89,7 @@.nav {padding-left: 0.75rem;padding-right: 0.75rem;- }- .nav {- gap: 0.125rem;+ gap: 0.2rem;display: flex;flex-direction: column;}@@ -109,9 +102,10 @@padding-right: 0.35rem;padding-top: 0.35rem;padding-bottom: 0.35rem;+ color: inherit;.ti {- font-size: 1rem;+ font-size: 1.125rem !important;margin-right: 0.5rem;border-radius: $border-radius-sm;padding: 0.2rem 0.2rem;@@ -119,6 +113,10 @@&:hover {background-color: $gray-50;++ .ti {+ color: theme-color('primary');+ }}&.active {color: theme-color('primary');@@ -142,9 +140,19 @@display: flex;flex-direction: column;list-style: none;-- margin-left: 1.5rem !important;-+ margin-top: 0.25rem;+ padding-left: 2rem;+ &:before {+ content: '';+ position: absolute;+ left: 1rem;+ top: 0;+ bottom: 0.25rem;+ width: 1px;+ background-color: $gray-200;+ }+ position: relative;+.nav-link {font-weight: 400;padding-top: 0.25rem;@@ -157,6 +165,17 @@font-weight: 600;background-color: transparent !important;box-shadow: none;++ &:before {+ content: '';+ position: absolute;+ left: calc(-1rem - 1px);+ top: 10%;+ width: 3px;+ height: 80%;+ background-color: theme-color('primary');+ border-radius: $border-radius-sm;+ }}}}@@ -183,29 +202,39 @@}#content {- padding-top: 0.5rem;@media (min-width: 992px) {margin-left: $sidebar-width + 1px;}}#enterprise-edition-notice {- @extend .alert;@extend .alert-info;background-image: none;- padding-left: 1rem;+ position: relative;+ padding: 0.5rem 1rem;+ padding-right: 2rem;+ border-top: 1px solid $border-color;border-left: 0;border-right: 0;border-bottom: 0;border-radius: 0;font-size: $font-size-sm;margin-bottom: 0;+ margin-right: 1px;+ p {+ margin-bottom: 0.5rem;+ }.btn-close {position: absolute;- right: 0.5rem;- top: 0.5rem;+ right: 0.25rem;+ top: 0.25rem;+ color: inherit !important;++ &:hover {+ background-color: transparent !important;+ }}}diff --git a/admin/app/assets/stylesheets/spree/admin/components/_media_form.scss b/admin/app/assets/stylesheets/spree/admin/components/_media_form.scssindex 208d7f28f6..f015dfc711 100644--- a/admin/app/assets/stylesheets/spree/admin/components/_media_form.scss+++ b/admin/app/assets/stylesheets/spree/admin/components/_media_form.scss@@ -6,7 +6,7 @@align-items: center;overflow: hidden;border-radius: 0.5rem;- border: 1px dashed $gray-50;+ border: 1px dashed $gray-100;background-color: rgba($gray-25, 0.5);padding: 0.5rem;cursor: pointer;diff --git a/admin/app/assets/stylesheets/spree/admin/components/_navbar.scss b/admin/app/assets/stylesheets/spree/admin/components/_navbar.scssindex 26890ff34b..bd21aa0e79 100644--- a/admin/app/assets/stylesheets/spree/admin/components/_navbar.scss+++ b/admin/app/assets/stylesheets/spree/admin/components/_navbar.scss@@ -1,10 +1,6 @@-@media (max-width: 768px) {- header#header {- background-color: $gray-900 !important;- color: #fff !important;- border-bottom: 0 none !important;- position: sticky;- top: 0;- z-index: 1020;- }+#header {+ height: $header-height;+ background-color: $body-bg;++ box-shadow: inset 0 -1px 0 $border-color;}diff --git a/admin/app/assets/stylesheets/spree/admin/components/_navigation.scss b/admin/app/assets/stylesheets/spree/admin/components/_navigation.scssindex a300befb6d..351685143c 100644--- a/admin/app/assets/stylesheets/spree/admin/components/_navigation.scss+++ b/admin/app/assets/stylesheets/spree/admin/components/_navigation.scss@@ -12,7 +12,6 @@position: relative;transition: background 0.15s, color 0.1s;will-change: background, color;- font-weight: 400;color: $gray-700;&:hover {diff --git a/admin/app/assets/stylesheets/spree/admin/global/_variables.scss b/admin/app/assets/stylesheets/spree/admin/global/_variables.scssindex ea1c03a384..803b4c8628 100644--- a/admin/app/assets/stylesheets/spree/admin/global/_variables.scss+++ b/admin/app/assets/stylesheets/spree/admin/global/_variables.scss@@ -57,7 +57,7 @@ $theme-colors: ();$body-color: #333 !default;-$body-bg: #FCFCFC !default;+$body-bg: $gray-25 !default;$enable-shadows: false;$enable-responsive-font-sizes: true;$font-family-sans-serif: Inter, sans-serif !default;@@ -207,4 +207,4 @@ $list-group-item-padding-x: 1rem !default;$header-height: 52px !default;$sidebar-width: 220px !default;-$sidebar-bg: $gray-25 !default;\ No newline at end of file+$sidebar-bg: $body-bg !default;\ No newline at end of filediff --git a/admin/app/views/spree/admin/orders/_customer.html.erb b/admin/app/views/spree/admin/orders/_customer.html.erbindex 022aed2945..375afb0ab9 100644--- a/admin/app/views/spree/admin/orders/_customer.html.erb+++ b/admin/app/views/spree/admin/orders/_customer.html.erb@@ -17,7 +17,6 @@<% end %></div><% if can?(:update_customer, @order) %>- <div class="dropdown-divider"></div><% if @order.user.present? %><%= link_to Spree.t('admin.orders.remove_user_from_this_order'), spree.admin_order_user_path(@order), class: 'dropdown-item btn-danger', data: { turbo_method: :delete, turbo_confirm: Spree.t(:are_you_sure), turbo_frame: :_top } %><% else %>diff --git a/admin/app/views/spree/admin/shared/_header.html.erb b/admin/app/views/spree/admin/shared/_header.html.erbindex 3937416cff..7c2e40b337 100644--- a/admin/app/views/spree/admin/shared/_header.html.erb+++ b/admin/app/views/spree/admin/shared/_header.html.erb@@ -2,14 +2,16 @@<%= render 'spree/admin/shared/offcanvas_nav' %>-<header id="header" class="sticky-top">- <nav class="navbar navbar-expand-lg border-bottom p-0 d-flex align-items-center pr-3">- <button type="button" class="btn btn-light pull-bs-canvas-left d-lg-none px-2 ml-3 text-decoration-none">- <%= icon('menu-2', class: 'mr-0') %>- </button>+<header id="header" class="sticky-top py-0">+ <nav class="navbar navbar-expand-lg p-0 d-flex align-items-center pr-3">+ <div class="d-lg-none pr-3 border-right">+ <button type="button" class="btn btn-light pull-bs-canvas-left px-2 ml-3 text-decoration-none">+ <%= icon('menu-2', class: 'mr-0') %>+ </button>+ </div><% if settings_active? %>- <div class="store-dropdown p-2">+ <div class="store-dropdown pr-2"><%= active_link_to_with_icon('arrow-back-up', Spree.t('admin.back_to_dashboard'), spree.admin_dashboard_path, class: 'btn store-dropdown-button w-100 justify-content-start mr-1') %></div><% else %>@@ -20,10 +22,16 @@<% end %><% end %>- <%= render 'spree/admin/shared/breadcrumbs' %>+ <div class="d-none d-lg-block">+ <%= render 'spree/admin/shared/breadcrumbs' %>+ </div><div class="ml-auto d-flex align-items-center"><%= render 'spree/admin/shared/user_dropdown' %></div></nav>-</header>\ No newline at end of file+</header>++<div class="d-lg-none py-3 border-bottom">+ <%= render 'spree/admin/shared/breadcrumbs' %>+</div>\ No newline at end of filediff --git a/admin/app/views/spree/admin/shared/_sidebar.html.erb b/admin/app/views/spree/admin/shared/_sidebar.html.erbindex eb1458887a..72db014d85 100644--- a/admin/app/views/spree/admin/shared/_sidebar.html.erb+++ b/admin/app/views/spree/admin/shared/_sidebar.html.erb@@ -6,9 +6,6 @@<% end %><% unless settings_active? %>- <section class="position-sticky d-none d-lg-block w-100 z-index-1000 mt-auto bottom-0">- <%= render 'spree/admin/shared/sidebar/enterprise_edition_notice' %>- <%= render 'spree/admin/shared/user_dropdown' %>- </section>+ <%= render 'spree/admin/shared/sidebar/enterprise_edition_notice' %><% end %></aside>\ No newline at end of filediff --git a/admin/app/views/spree/admin/shared/_user_dropdown.html.erb b/admin/app/views/spree/admin/shared/_user_dropdown.html.erbindex 3186d0daa6..81118b6c6a 100644--- a/admin/app/views/spree/admin/shared/_user_dropdown.html.erb+++ b/admin/app/views/spree/admin/shared/_user_dropdown.html.erb@@ -11,7 +11,7 @@<span class="d-none d-lg-inline ml-lg-2"><% if try_spree_current_user.name.present? %><%= try_spree_current_user.name&.full %><br />- <span class="small"><%= try_spree_current_user.email %></span>+ <span class="small text-muted"><%= try_spree_current_user.email %></span><% else %><%= try_spree_current_user.email %><br /><% end %>@@ -37,7 +37,7 @@<div class="dropdown-divider"></div>- <%= button_to spree_admin_logout_path, class: 'dropdown-item mb-0', method: :delete do %>+ <%= button_to spree_admin_logout_path, class: 'dropdown-item mb-0 btn-danger', method: :delete do %><%= icon('logout', class: "icon icon-logout") %><%= Spree.t(:logout) %><% end if defined?(spree_admin_logout_path) %>diff --git a/admin/app/views/spree/admin/shared/sidebar/_enterprise_edition_notice.html.erb b/admin/app/views/spree/admin/shared/sidebar/_enterprise_edition_notice.html.erbindex b960b55d71..f3d0f92cfa 100644--- a/admin/app/views/spree/admin/shared/sidebar/_enterprise_edition_notice.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_enterprise_edition_notice.html.erb@@ -1,10 +1,12 @@<% if can?(:manage, current_store) && !enterprise_edition? %><% unless session[:spree_enterprise_edition_notice_dismissed] %>- <div id="enterprise-edition-notice">- <%= link_to '', spree.admin_dismiss_enterprise_edition_notice_path, method: :patch, class: 'btn-close' %>- <p class="mb-1">You're using Spree Community Edition. To get access to all features, please upgrade to Enterprise Edition.</p>+ <section class="d-none d-lg-block">+ <div id="enterprise-edition-notice">+ <%= link_to '', spree.admin_dismiss_enterprise_edition_notice_path, method: :patch, class: 'btn-close' %>+ <p>You're using Spree Community Edition. To get access to all features, please upgrade to Enterprise Edition.</p>- <%= external_link_to 'Upgrade', 'https://spreecommerce.org/pricing', target: '_blank', class: 'btn btn-link btn-sm shadow-xs' %>- </div>+ <%= external_link_to 'Upgrade', 'https://spreecommerce.org/pricing', target: '_blank', class: 'btn btn-link btn-sm shadow-xs' %>+ </div>+ </section><% end %><% end %>\ No newline at end of filediff --git a/admin/app/views/spree/admin/shared/sidebar/_orders_nav.html.erb b/admin/app/views/spree/admin/shared/sidebar/_orders_nav.html.erbindex 86e51c430f..cc870cbe87 100644--- a/admin/app/views/spree/admin/shared/sidebar/_orders_nav.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_orders_nav.html.erb@@ -8,7 +8,7 @@<%= nav_item(orders_label.html_safe, spree.admin_orders_path, icon: 'inbox', active: orders_active) %><% if orders_active && (ready_to_ship_orders_count&.positive? || can?(:manage, :checkouts)) %>- <ul class="ml-4 pl-1 mb-2 nav-submenu mt-1">+ <ul class="nav-submenu"><% if ready_to_ship_orders_count&.positive? %><% fulfill_label = Spree.t('admin.orders.orders_to_fulfill') %><% fulfill_label += content_tag(:span, ready_to_ship_orders_count, class: 'badge ml-auto') %>@@ -16,7 +16,7 @@<% end %><% if can?(:manage, :checkouts) %>- <%= nav_item(Spree.t(:draft_orders), spree.admin_checkouts_path) %>+ <%= nav_item(Spree.t(:draft_orders), spree.admin_checkouts_path, active: controller_name == 'checkouts' || (@order.present? && @order.completed?)) %><% end %><%= render_admin_partials(:store_orders_nav_partials) %>diff --git a/admin/app/views/spree/admin/shared/sidebar/_products_nav.html.erb b/admin/app/views/spree/admin/shared/sidebar/_products_nav.html.erbindex a6b522b4d0..6ece276ff7 100644--- a/admin/app/views/spree/admin/shared/sidebar/_products_nav.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_products_nav.html.erb@@ -2,7 +2,7 @@<% if can?(:manage, Spree::Product) %><%= nav_item(Spree.t(:products), spree.admin_products_path, icon: 'package', active: products_active) %><% if products_active %>- <ul class="ml-4 pl-1 mb-2 nav-submenu mt-1">+ <ul class="nav-submenu"><% if can?(:manage, Spree::StockItem) || can?(:manage, Spree::StockTransfer) %><%= nav_item(Spree.t(:stock), spree.admin_stock_items_path, active: %w[stock_items stock_transfers].include?(controller_name)) %><% end %>diff --git a/admin/app/views/spree/admin/shared/sidebar/_promotions_nav.html.erb b/admin/app/views/spree/admin/shared/sidebar/_promotions_nav.html.erbindex f1d08d0669..45d1647e5c 100644--- a/admin/app/views/spree/admin/shared/sidebar/_promotions_nav.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_promotions_nav.html.erb@@ -7,7 +7,7 @@<% end %><% if discounts_active && defined?(Spree::GiftCard) && spree.respond_to?(:admin_gift_cards_path) && can?(:manage, Spree::GiftCard) %>- <ul class="ml-4 pl-1 mb-2 nav-submenu mt-1">+ <ul class="nav-submenu"><li class="nav-item"><%= active_link_to Spree.t(:gift_cards), spree.admin_gift_cards_path, class: 'nav-link', active: %w[gift_cards gift_card_batches].include?(controller_name) %></li>diff --git a/admin/app/views/spree/admin/shared/sidebar/_returns_nav.html.erb b/admin/app/views/spree/admin/shared/sidebar/_returns_nav.html.erbindex 001d20764c..bcef3f093a 100644--- a/admin/app/views/spree/admin/shared/sidebar/_returns_nav.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_returns_nav.html.erb@@ -4,7 +4,7 @@<%= nav_item(Spree.t(:returns), spree.admin_customer_returns_path, icon: 'receipt-refund', active: returns_active) %><% if returns_active %>- <ul class="ml-4 pl-1 mb-2 nav-submenu mt-1">+ <ul class="nav-submenu"><% if can?(:manage, Spree::ReturnAuthorization) %><%= nav_item(Spree.t(:return_authorizations), spree.admin_return_authorizations_path) %><% end %>diff --git a/admin/app/views/spree/admin/shared/sidebar/_store_nav.html.erb b/admin/app/views/spree/admin/shared/sidebar/_store_nav.html.erbindex 9078d8eba2..57cb42e2ef 100644--- a/admin/app/views/spree/admin/shared/sidebar/_store_nav.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_store_nav.html.erb@@ -117,9 +117,10 @@<li class="nav-item border-top border-top-dashed my-1"></li><%= render 'spree/admin/shared/sidebar/storefront_nav' %><%= render 'spree/admin/shared/sidebar/integrations_nav' %>+ </ul>+ <ul class="nav flex-column mt-auto mb-2"><% if can?(:manage, current_store) %>- <li class="nav-item border-top border-top-dashed my-1"></li><%= nav_item(Spree.t(:settings), spree.edit_admin_store_path(section: 'general-settings'), icon: 'settings', active: params[:section] == 'general-settings') %><%= nav_item(Spree.t(:users), spree.admin_admin_users_path, icon: 'users') %><% end %>diff --git a/admin/app/views/spree/admin/shared/sidebar/_storefront_nav.html.erb b/admin/app/views/spree/admin/shared/sidebar/_storefront_nav.html.erbindex 7969cbf673..93b826571b 100644--- a/admin/app/views/spree/admin/shared/sidebar/_storefront_nav.html.erb+++ b/admin/app/views/spree/admin/shared/sidebar/_storefront_nav.html.erb@@ -3,7 +3,7 @@<%= nav_item(Spree.t('admin.storefront'), spree.admin_themes_path, icon: 'building-store', active: storefront_active) %><% if storefront_active %>- <ul class="ml-4 pl-1 mb-2 nav-submenu mt-1">+ <ul class="nav-submenu"><%= nav_item(Spree.t(:themes), spree.admin_themes_path) %><% if can?(:manage, Spree::Page) %>diff --git a/admin/app/views/spree/admin/stores/edit_emails.html.erb b/admin/app/views/spree/admin/stores/edit_emails.html.erbindex 5922e23b03..11a73b2dfd 100644--- a/admin/app/views/spree/admin/stores/edit_emails.html.erb+++ b/admin/app/views/spree/admin/stores/edit_emails.html.erb@@ -1,7 +1,7 @@<%= turbo_frame_tag :set_customer_support_email, class: 'w-100' do %><%= form_for current_store, url: spree.admin_store_path, as: :store do |f| %><div class="form-group">- <%= f.label :customer_support_email, 'Customer support email' %>+ <%= f.label :customer_support_email, Spree.t(:customer_support_email) %><%= f.email_field :customer_support_email, class: 'form-control', required: true %></div><div class="d-flex justify-content-between">diff --git a/admin/app/views/spree/admin/stores/form/_emails.html.erb b/admin/app/views/spree/admin/stores/form/_emails.html.erbindex 527cd946b9..57b4b4ad51 100644--- a/admin/app/views/spree/admin/stores/form/_emails.html.erb+++ b/admin/app/views/spree/admin/stores/form/_emails.html.erb@@ -1,5 +1,5 @@<%= content_for(:page_title) do %>- Email settings+ <%= Spree.t(:emails) %><% end %><div class="row">diff --git a/core/config/locales/en.yml b/core/config/locales/en.ymlindex 05cbda5f99..726027c213 100644--- a/core/config/locales/en.yml+++ b/core/config/locales/en.yml@@ -1201,7 +1201,6 @@ en:list: Listlive: Liveloading: Loading- loading_tree: Loading tree. Please wait…locale_changed: Locale Changedlocation: Locationlock: Lock@@ -1216,7 +1215,6 @@ en:login_failed: Login authentication failed.login_name: Loginlogo: Logo- logo_alt: Brand logologout: Logoutlogs: Logslook_for_similar_items: Look for similar items