UX: Tweaks to admin color palette dropdown (#10502)

UX: Tweaks to admin color palette dropdown (#10502)

diff --git a/app/assets/javascripts/select-kit/addon/components/color-palettes/color-palettes-row.js b/app/assets/javascripts/select-kit/addon/components/color-palettes/color-palettes-row.js
index e3845ef..f8a00b7 100644
--- a/app/assets/javascripts/select-kit/addon/components/color-palettes/color-palettes-row.js
+++ b/app/assets/javascripts/select-kit/addon/components/color-palettes/color-palettes-row.js
@@ -10,11 +10,22 @@ export default SelectKitRowComponent.extend({
 
   palettes: computed("item.colors.[]", function() {
     return (this.item.colors || [])
+      .filter(color => color.name !== "secondary")
       .map(color => `#${escapeExpression(color.hex)}`)
       .map(
         hex => `<span class="palette" style="background-color:${hex}"></span>`
       )
       .join("")
       .htmlSafe();
+  }),
+
+  backgroundColor: computed("item.colors.[]", function() {
+    const secondary = (this.item.colors || []).findBy("name", "secondary");
+
+    if (secondary && secondary.hex) {
+      return `background-color:#${escapeExpression(secondary.hex)}`.htmlSafe();
+    } else {
+      return "";
+    }
   })
 });
diff --git a/app/assets/javascripts/select-kit/addon/templates/components/color-palettes/color-palettes-row.hbs b/app/assets/javascripts/select-kit/addon/templates/components/color-palettes/color-palettes-row.hbs
index 53501d9..7b36e22 100644
--- a/app/assets/javascripts/select-kit/addon/templates/components/color-palettes/color-palettes-row.hbs
+++ b/app/assets/javascripts/select-kit/addon/templates/components/color-palettes/color-palettes-row.hbs
@@ -3,7 +3,7 @@
 </span>
 
 {{#if item.colors}}
-  <div class="palettes">
+  <div class="palettes" style={{backgroundColor}}>
     {{palettes}}
   </div>
 {{/if}}
diff --git a/app/assets/stylesheets/common/select-kit/color-palettes.scss b/app/assets/stylesheets/common/select-kit/color-palettes.scss
index 0709888..e7b0879 100644
--- a/app/assets/stylesheets/common/select-kit/color-palettes.scss
+++ b/app/assets/stylesheets/common/select-kit/color-palettes.scss
@@ -7,6 +7,7 @@
           align-items: center;
           margin-left: 0.5em;
           flex: 1 0 0;
+          padding: 8px;
 
           .palette {
             height: 15px;
diff --git a/app/controllers/admin/themes_controller.rb b/app/controllers/admin/themes_controller.rb
index 8d70ea9..b4c222d 100644
--- a/app/controllers/admin/themes_controller.rb
+++ b/app/controllers/admin/themes_controller.rb
@@ -135,8 +135,6 @@ class Admin::ThemesController < Admin::AdminController
                                           theme_fields: :upload
                                           )
     @color_schemes = ColorScheme.all.includes(:theme, color_scheme_colors: :color_scheme).to_a
-    light = ColorScheme.new(name: I18n.t("color_schemes.light_default"))
-    @color_schemes.unshift(light)
 
     payload = {
       themes: ActiveModel::ArraySerializer.new(@themes, each_serializer: ThemeSerializer),
diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml
index 66515d8..ef5c3a5 100644
--- a/config/locales/server.en.yml
+++ b/config/locales/server.en.yml
@@ -3874,7 +3874,6 @@ en:
   color_schemes:
     base_theme_name: "Base"
     light: "Light"
-    light_default: "Light (default)"
     dark: "Dark"
     neutral: "Neutral"
     grey_amber: "Grey Amber"
diff --git a/spec/requests/admin/themes_controller_spec.rb b/spec/requests/admin/themes_controller_spec.rb
index 1db8e6c..f75c1c7 100644
--- a/spec/requests/admin/themes_controller_spec.rb
+++ b/spec/requests/admin/themes_controller_spec.rb
@@ -252,7 +252,7 @@ describe Admin::ThemesController do
 
       json = response.parsed_body
 
-      expect(json["extras"]["color_schemes"].length).to eq(2)
+      expect(json["extras"]["color_schemes"].length).to eq(1)
       theme_json = json["themes"].find { |t| t["id"] == theme.id }
       expect(theme_json["theme_fields"].length).to eq(2)
       expect(theme_json["remote_theme"]["remote_version"]).to eq("7")

GitHub sha: 8b2c4b07

This commit appears in #10502 which was merged by pmusaraj.