From 77bcfeb9472d51f063480022fe3f6e9387c2387a Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Thu, 11 Jan 2024 17:26:31 +0100 Subject: [PATCH 1/6] Add a light background to images Images with transparency will generally assume a light background. --- admin/app/assets/stylesheets/solidus_admin/dark.css | 1 + admin/app/assets/stylesheets/solidus_admin/dimmed.css | 1 + 2 files changed, 2 insertions(+) diff --git a/admin/app/assets/stylesheets/solidus_admin/dark.css b/admin/app/assets/stylesheets/solidus_admin/dark.css index e03ce11406e..138e31cddf5 100644 --- a/admin/app/assets/stylesheets/solidus_admin/dark.css +++ b/admin/app/assets/stylesheets/solidus_admin/dark.css @@ -9,4 +9,5 @@ html { main img { filter: invert(100%) hue-rotate(-180deg); + background-color: #fff; } diff --git a/admin/app/assets/stylesheets/solidus_admin/dimmed.css b/admin/app/assets/stylesheets/solidus_admin/dimmed.css index 48f987743f8..195381014cb 100644 --- a/admin/app/assets/stylesheets/solidus_admin/dimmed.css +++ b/admin/app/assets/stylesheets/solidus_admin/dimmed.css @@ -8,4 +8,5 @@ html { main img { filter: invert(91%) brightness(1.5) contrast(1.5) hue-rotate(-180deg); + background-color: #ddd; } From 3bf12d08bd397098dbbb0b70357912ea0c022543 Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Thu, 11 Jan 2024 17:39:01 +0100 Subject: [PATCH 2/6] Render all panel section through a single helper --- .../solidus_admin/ui/panel/component.html.erb | 19 ++++--------------- .../solidus_admin/ui/panel/component.rb | 18 +++++++++++------- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/admin/app/components/solidus_admin/ui/panel/component.html.erb b/admin/app/components/solidus_admin/ui/panel/component.html.erb index 041c3e95ea1..71c968b99be 100644 --- a/admin/app/components/solidus_admin/ui/panel/component.html.erb +++ b/admin/app/components/solidus_admin/ui/panel/component.html.erb @@ -22,29 +22,18 @@ <% end %> <% if @title %> -
+ <%= render_section do %>

<%= @title %> <%= render component("ui/toggletip").new(text: @title_hint) if @title_hint %>

-
+ <% end %> <% end %> <% sections.each do |section| %> <%= section %> <% end %> - <% if content.present? %> -
- <%= content %> -
- <% end %> - - <% if action? %> -
-
- <%= action %> -
-
- <% end %> + <%= render_section { content } if content.present? %> + <%= render_section { tag.div(action, class: "flex justify-between items-center") } if action? %> diff --git a/admin/app/components/solidus_admin/ui/panel/component.rb b/admin/app/components/solidus_admin/ui/panel/component.rb index b2f353eca07..97b8c446a42 100644 --- a/admin/app/components/solidus_admin/ui/panel/component.rb +++ b/admin/app/components/solidus_admin/ui/panel/component.rb @@ -10,13 +10,8 @@ class SolidusAdmin::UI::Panel::Component < SolidusAdmin::BaseComponent ) } - renders_many :sections, ->(wide: false, high: false, **args, &block) do - tag.section(**args, class: " - border-gray-100 border-t w-full first-of-type:border-t-0 - #{'px-6' unless wide} - #{'py-6' unless high} - #{args[:class]} - ", &block) + renders_many :sections, ->(**args, &block) do + render_section(**args, &block) end renders_many :menus, ->(name, url, **args) do @@ -33,4 +28,13 @@ def initialize(title: nil, title_hint: nil) @title = title @title_hint = title_hint end + + def render_section(wide: false, high: false, **args, &block) + tag.section(**args, class: " + border-gray-100 border-t w-full first-of-type:border-t-0 + #{'px-6' unless wide} + #{'py-6' unless high} + #{args[:class]} + ", &block) + end end From 6e370b72dac245610a30f55682d4c43850156b02 Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Thu, 11 Jan 2024 13:14:16 +0100 Subject: [PATCH 3/6] Reduce the size of the panels title --- admin/app/components/solidus_admin/ui/panel/component.html.erb | 2 +- admin/app/components/solidus_admin/ui/panel/component.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/app/components/solidus_admin/ui/panel/component.html.erb b/admin/app/components/solidus_admin/ui/panel/component.html.erb index 71c968b99be..e43ed7ff3ec 100644 --- a/admin/app/components/solidus_admin/ui/panel/component.html.erb +++ b/admin/app/components/solidus_admin/ui/panel/component.html.erb @@ -24,7 +24,7 @@ <% if @title %> <%= render_section do %>

- <%= @title %> + <%= @title %> <%= render component("ui/toggletip").new(text: @title_hint) if @title_hint %>

<% end %> diff --git a/admin/app/components/solidus_admin/ui/panel/component.rb b/admin/app/components/solidus_admin/ui/panel/component.rb index 97b8c446a42..e721ce10e25 100644 --- a/admin/app/components/solidus_admin/ui/panel/component.rb +++ b/admin/app/components/solidus_admin/ui/panel/component.rb @@ -33,7 +33,7 @@ def render_section(wide: false, high: false, **args, &block) tag.section(**args, class: " border-gray-100 border-t w-full first-of-type:border-t-0 #{'px-6' unless wide} - #{'py-6' unless high} + #{'py-4' unless high} #{args[:class]} ", &block) end From fceab4e621880bcaed82cbca97d1715c05bee32c Mon Sep 17 00:00:00 2001 From: Elia Schito Date: Mon, 15 Jan 2024 12:51:18 +0100 Subject: [PATCH 4/6] Don't set the button component background on focus --- admin/app/components/solidus_admin/ui/button/component.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/app/components/solidus_admin/ui/button/component.rb b/admin/app/components/solidus_admin/ui/button/component.rb index 1a1fd0433c2..1110b4ef01f 100644 --- a/admin/app/components/solidus_admin/ui/button/component.rb +++ b/admin/app/components/solidus_admin/ui/button/component.rb @@ -78,7 +78,7 @@ def initialize( @attributes[:class] = [ 'justify-start items-center justify-center gap-1 inline-flex rounded', - 'focus:ring focus:ring-gray-300 focus:ring-0.5 focus:bg-white focus:ring-offset-0 [&:focus-visible]:outline-none', + 'focus:ring focus:ring-gray-300 focus:ring-0.5 focus:ring-offset-0 [&:focus-visible]:outline-none', SIZES.fetch(size.to_sym), (TEXT_PADDINGS.fetch(size.to_sym) if @text), SCHEMES.fetch(scheme.to_sym), From 27b94a96cd36f2b1eeb270266630bc1965916cd8 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Tue, 16 Jan 2024 12:38:14 +0100 Subject: [PATCH 5/6] Disable admin preview for extensions test apps The new admin is far from complete and existing extensions will fail if we test them with the new default admin that we generate apps with. It can be enabled by setting ADMIN_PREVIEW=true in your test env. --- core/lib/spree/testing_support/common_rake.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/core/lib/spree/testing_support/common_rake.rb b/core/lib/spree/testing_support/common_rake.rb index 02976918685..442cfda8b14 100644 --- a/core/lib/spree/testing_support/common_rake.rb +++ b/core/lib/spree/testing_support/common_rake.rb @@ -31,6 +31,7 @@ def initialize 'solidus:install', Dir.pwd, # use the current dir as Rails.root "--auto-accept", + "--admin-preview=#{ENV.fetch('ADMIN_PREVIEW', 'false')}", "--authentication=none", "--payment-method=none", "--migrate=false", From 2a61adc6b095a8521872777126d966f8a2d334f9 Mon Sep 17 00:00:00 2001 From: Thomas von Deyen Date: Tue, 16 Jan 2024 12:48:22 +0100 Subject: [PATCH 6/6] fix(admin stock items spec): Wait for tab to be active --- admin/spec/features/stock_items_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/admin/spec/features/stock_items_spec.rb b/admin/spec/features/stock_items_spec.rb index eac6abea459..ca4c430753f 100644 --- a/admin/spec/features/stock_items_spec.rb +++ b/admin/spec/features/stock_items_spec.rb @@ -36,24 +36,28 @@ expect(find('tr', text: 'MY-SKU-1234567890')).to have_content('1 stock movement') click_on 'Back Orderable' + expect(page).to have_css('[aria-current="true"]', text: 'Back Orderable') expect(page).to_not have_content(non_backorderable.variant.sku) expect(page).to have_content(backorderable.variant.sku) expect(page).to_not have_content(out_of_stock.variant.sku) expect(page).to_not have_content(low_stock.variant.sku) click_on 'Out Of Stock' + expect(page).to have_css('[aria-current="true"]', text: 'Out Of Stock') expect(page).to_not have_content(non_backorderable.variant.sku) expect(page).to_not have_content(backorderable.variant.sku) expect(page).to have_content(out_of_stock.variant.sku) expect(page).to_not have_content(low_stock.variant.sku) click_on 'Low Stock' + expect(page).to have_css('[aria-current="true"]', text: 'Low Stock') expect(page).to_not have_content(non_backorderable.variant.sku) expect(page).to_not have_content(backorderable.variant.sku) expect(page).to_not have_content(out_of_stock.variant.sku) expect(page).to have_content(low_stock.variant.sku) click_on 'In Stock' + expect(page).to have_css('[aria-current="true"]', text: 'In Stock') expect(page).to have_content(non_backorderable.variant.sku) expect(page).to have_content(backorderable.variant.sku) expect(page).to_not have_content(out_of_stock.variant.sku)