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
Storefront: new product listing page
Damian Legawiec6ccf61ea6e9c
diff --git a/core/app/finders/spree/products/find.rb b/core/app/finders/spree/products/find.rbindex 31ae80c900..884858278a 100644--- a/core/app/finders/spree/products/find.rb+++ b/core/app/finders/spree/products/find.rb@@ -1,21 +1,14 @@module Spreemodule Productsclass Find- def initialize(scope:, params:, current_currency: nil)- @scope = scope-- if current_currency.present?- Spree::Deprecation.warn(<<-DEPRECATION, caller)- `current_currency` param is deprecated and will be removed in Spree 5.- Please pass `:currency` in `params` hash instead.- DEPRECATION- end-+ def initialize(scope:, params:)+ @scope = scope+ @query = params[:q].presence&.strip@ids = String(params.dig(:filter, :ids)).split(',')@skus = String(params.dig(:filter, :skus)).split(',')@store = params[:store] || Spree::Store.default@price = map_prices(String(params.dig(:filter, :price)).split(','))- @currency = current_currency || params.dig(:filter, :currency) || params[:currency]+ @currency = params.dig(:filter, :currency) || params[:currency] || Spree::Store.default.default_currency@taxons = taxon_ids(params.dig(:filter, :taxons))@concat_taxons = taxon_ids(params.dig(:filter, :concat_taxons))@name = params.dig(:filter, :name)@@ -28,12 +21,21 @@ module Spree@in_stock = params.dig(:filter, :in_stock)@backorderable = params.dig(:filter, :backorderable)@purchasable = params.dig(:filter, :purchasable)+ @out_of_stock = params.dig(:filter, :out_of_stock).to_b@tags = params.dig(:filter, :tags).to_s.split(',').compact_blank+ @vendor_ids = params.dig(:filter, :vendor_ids)&.split(',')&.compact_blank || []++ if @purchasable.present? && @out_of_stock.present?+ @purchasable = false+ @out_of_stock = false+ endenddef executeproducts = by_ids(scope)products = by_skus(products)+ products = by_query(products)+ products = include_discontinued(products)products = by_price(products)products = by_currency(products)products = by_taxons(products)@@ -44,11 +46,12 @@ module Spreeproducts = by_properties(products)products = by_tags(products)products = include_deleted(products)- products = include_discontinued(products)products = show_only_stock(products)products = show_only_backorderable(products)products = show_only_purchasable(products)+ products = show_only_out_of_stock(products)products = ordered(products)+ products = by_vendor_ids(products)products.distinctend@@ -56,7 +59,12 @@ module Spreeprivateattr_reader :ids, :skus, :price, :currency, :taxons, :concat_taxons, :name, :options, :option_value_ids, :scope,- :sort_by, :deleted, :discontinued, :properties, :store, :in_stock, :backorderable, :purchasable, :tags+ :sort_by, :deleted, :discontinued, :properties, :store, :in_stock, :backorderable, :purchasable, :tags,+ :query, :vendor_ids, :out_of_stock++ def query?+ query.present?+ enddef ids?ids.present?@@ -102,6 +110,16 @@ module Spreeproperties.present? && properties.values.reject(&:empty?).present?end+ def vendor_ids?+ vendor_ids.present?+ end++ def by_query(products)+ return products unless query?++ products.multi_search(query)+ end+def by_ids(products)return products unless ids?@@ -157,7 +175,9 @@ module Spreedef by_options(products)return products unless options?- products_ids = options.map { |key, value| products.with_option_value(key, value)&.ids }.compact.uniq+ products_for_options = query? ? products.unscope(:order) : products++ products_ids = options.map { |key, value| products_for_options.with_option_value(key, value)&.ids }.compact.uniqproducts.where(id: products_ids.reduce(&:intersection))end@@ -202,6 +222,10 @@ module Spreeproducts.tagged_with(tags, any: true)end+ def by_vendor_ids(products)+ products+ end+def option_types_count(option_value_ids)Spree::OptionValue.where(id: option_value_ids).@@ -213,7 +237,7 @@ module Spreereturn products unless sort_by?case sort_by- when 'default'+ when 'default', 'manual'if taxons?products.ascend_by_taxons_min_position(taxons)else@@ -222,17 +246,23 @@ module Spreewhen 'name-a-z'# workaround for Mobility issue #596 - explicitly select fields to avoid error when selecting distinctproducts.i18n.- select("#{Product.table_name}.*").select(:name).order(name: :asc)+ select("#{Spree::Product.table_name}.*").select(:name).order(name: :asc)when 'name-z-a'# workaround for Mobility issue #596products.i18n.- select("#{Product.table_name}.*").select(:name).order(name: :desc)+ select("#{Spree::Product.table_name}.*").select(:name).order(name: :desc)when 'newest-first'products.order(available_on: :desc)+ when 'oldest-first'+ products.order(available_on: :asc)when 'price-high-to-low'- order_by_price(products, :descend_by_master_price)+ order_by_price(products, :desc)when 'price-low-to-high'- order_by_price(products, :ascend_by_master_price)+ order_by_price(products, :asc)+ when 'best-selling'+ order_by_best_selling(products)+ else+ productsendend@@ -262,6 +292,12 @@ module Spreeproducts.in_stock_or_backorderableend+ def show_only_out_of_stock(products)+ return products unless out_of_stock.present?++ products.out_of_stock+ end+def map_prices(prices)prices.map do |price|price == 'Infinity' ? BigDecimal::INFINITY : price.to_f@@ -275,11 +311,18 @@ module Spreetaxons.map(&:cached_self_and_descendants_ids).flatten.compact.uniq.map(&:to_s)end- def order_by_price(scope, order_type)+ def order_by_price(scope, sort_order)scope.- select("#{Product.table_name}.*, #{Spree::Price.table_name}.amount").- reorder('').- send(order_type)+ joins(variants_including_master: :prices).+ select("#{Spree::Product.table_name}.* , min(#{Spree::Price.table_name}.amount)").+ where(Spree::Price.table_name => { currency: currency }).+ where.not(Spree::Price.table_name => { amount: nil }).+ order("min(#{Spree::Price.table_name}.amount) #{sort_order}").+ group("#{Spree::Product.table_name}.id")+ end++ def order_by_best_selling(scope)+ scope.by_best_selling(:desc)endendenddiff --git a/core/app/models/spree/price.rb b/core/app/models/spree/price.rbindex 6f78e166a8..9549c550e0 100644--- a/core/app/models/spree/price.rb+++ b/core/app/models/spree/price.rb@@ -36,6 +36,7 @@ module Spreescope :with_currency, ->(currency) { where(currency: currency) }scope :non_zero, -> { where.not(amount: [nil, 0]) }scope :discounted, -> { where('compare_at_amount > amount') }+ scope :for_products, ->(products) { joins(variant: :product).where("#{Spree::Product.table_name}.id" => products) }extend DisplayMoneymoney_methods :amount, :price, :compare_at_amountdiff --git a/core/config/locales/en.yml b/core/config/locales/en.ymlindex 3564c33556..2e14bd74ee 100644--- a/core/config/locales/en.yml+++ b/core/config/locales/en.yml@@ -1651,6 +1651,7 @@ en:shipping_total: Shipping totalshipping_zone: Shipping Zoneshop_by_taxonomy: Shop by %{taxonomy}+ shop_all: Shop Allshopping_cart: Shopping Cartshow: Showshow_active: Show Activediff --git a/storefront/app/controllers/spree/products_controller.rb b/storefront/app/controllers/spree/products_controller.rbnew file mode 100644index 0000000000..fa88763402--- /dev/null+++ b/storefront/app/controllers/spree/products_controller.rb@@ -0,0 +1,96 @@+module Spree+ class ProductsController < Spree::StoreController+ helper 'spree/products'++ after_action :track_show, only: :show+ after_action :track_index, only: :index++ def index+ @current_page = current_theme.pages.find_by(type: 'Spree::Pages::ShopAll')+ end++ def show+ load_product+ redirect_if_legacy_path++ @current_page = current_theme.pages.product_details.first+ end++ def related+ @current_page = current_theme.pages.product_details.first+ section_scope = @current_page.sections.related_products+ @section = section_scope.find_by(id: params[:section_id]) || section_scope.first+ load_product+ # An interesting thing is that since we're querying the translations table (in the multi_search),+ # when using not default locale, our related products are different for different locales.+ @products = current_store.products.active(current_currency).where.not(id: @product.id).+ multi_search(@product.name).includes(storefront_products_includes).+ limit(@section.preferred_max_products_to_show)+ end++ private++ def accurate_title+ load_product if action_name == 'show' # we need this for ahoy analytics++ if @product+ @product.meta_title.blank? ? [@product.vendor&.display_name, @product.name].compact.join(' ') : @product.meta_title+ else+ params[:q].present? ? Spree.t(:search_results_for, query: params[:q]) : Spree.t(:shop_all)+ end+ end++ def load_product+ if params[:preview_id].present?+ possible_product = find_with_fallback_default_locale { current_store.products.friendly.find(params[:id]) }++ raise ActiveRecord::RecordNotFound if possible_product.id.to_s != params[:preview_id].to_s++ @product ||= possible_product+ else+ @product ||= find_with_fallback_default_locale { current_store.products.for_user(try_spree_current_user).friendly.find(params[:id]) }+ end++ options_hash = if params[:options].present?+ params[:options].split(',').to_h do |option|+ key, *value = option.split(':')+ [key, value.join(':')]+ end+ else+ {}+ end++ variant_finder = ::Storefront::VariantFinder.new(+ product: @product,+ variant_id: params[:variant_id],+ current_currency: current_currency,+ options_hash: options_hash+ )++ @selected_variant, @variant_from_options =+ Rails.cache.fetch([@product.cache_key_with_version, "variant-finder", current_currency, params[:variant_id], options_hash].compact) do+ variant_finder.find+ end+ end++ def redirect_if_legacy_path+ # If an old id or a numeric id was used to find the record,+ # we should do a 301 redirect that uses the current friendly id.+ if params[:id] != @product.friendly_id+ params[:id] = @product.friendly_id+ params.permit!+ redirect_to url_for(params), status: :moved_permanently+ end+ end++ def track_show+ return if params[:options].present? # we don't want to track product views for variants++ track_event('product_viewed', { product: @product })+ end++ def track_index+ track_event('product_list_viewed', { taxon: @taxon })+ end+ end+enddiff --git a/storefront/app/views/spree/products/index.html.erb b/storefront/app/views/spree/products/index.html.erbnew file mode 100644index 0000000000..dff4db8358--- /dev/null+++ b/storefront/app/views/spree/products/index.html.erb@@ -0,0 +1 @@+<%= render_page(current_page, products: storefront_products.records, sort: products_sort) %>diff --git a/storefront/app/views/spree/products/index.turbo_stream.erb b/storefront/app/views/spree/products/index.turbo_stream.erbnew file mode 100644index 0000000000..bf01298ccd--- /dev/null+++ b/storefront/app/views/spree/products/index.turbo_stream.erb@@ -0,0 +1 @@+<%= render 'spree/shared/load_more_products' %>diff --git a/storefront/app/views/spree/products/related.html.erb b/storefront/app/views/spree/products/related.html.erbnew file mode 100644index 0000000000..37c9dc69a1--- /dev/null+++ b/storefront/app/views/spree/products/related.html.erb@@ -0,0 +1,3 @@+<%= turbo_frame_tag "section-#{@section.id}" do %>+ <%= render 'spree/page_sections/related_products', section: @section, product: @product, products: @products, loaded: true %>+<% end %>diff --git a/storefront/app/views/spree/products/show.html.erb b/storefront/app/views/spree/products/show.html.erbnew file mode 100644index 0000000000..f96cdcdd73--- /dev/null+++ b/storefront/app/views/spree/products/show.html.erb@@ -0,0 +1 @@+<%= render_page(current_page_or_preview, product: @product) %>\ No newline at end of filediff --git a/storefront/app/views/spree/shared/_product_listing_page.html.erb b/storefront/app/views/spree/shared/_product_listing_page.html.erbnew file mode 100644index 0000000000..23f2ba9b94--- /dev/null+++ b/storefront/app/views/spree/shared/_product_listing_page.html.erb@@ -0,0 +1,11 @@+<% if turbo_frame_request? && current_theme_preview.nil? %>+ <%= render 'spree/page_sections/product_grid', products: storefront_products.records, section: current_page.sections.find_by(type: 'Spree::PageSections::ProductGrid') %>+<% else %>+ <%= render_page(+ current_page,+ taxon: @taxon,+ collection: @collection,+ products: storefront_products.records,+ ) %>+<% end %>+diff --git a/storefront/app/views/spree/shared/_products.html.erb b/storefront/app/views/spree/shared/_products.html.erbnew file mode 100644index 0000000000..e2d5e08996--- /dev/null+++ b/storefront/app/views/spree/shared/_products.html.erb@@ -0,0 +1 @@+<%= render partial: 'spree/products/product', collection: products, cached: ->(product) { product_cache_key(product) } %>diff --git a/storefront/app/views/themes/default/spree/products/_add_to_cart_button.html.erb b/storefront/app/views/themes/default/spree/products/_add_to_cart_button.html.erbnew file mode 100644index 0000000000..3bee2ca623--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_add_to_cart_button.html.erb@@ -0,0 +1,58 @@+<%+sticky_button_classes ||= ''+without_fixed_button ||= false+options_param_name ||= :options+not_selected_options = product_not_selected_options(product, selected_variant, options_param_name: options_param_name)+all_options_selected = (params[options_param_name].present? || @variant_from_options.present?) && not_selected_options.empty?+not_all_options_selected = !all_options_selected && product.any_variant_available?(current_currency)+variant_not_available = selected_variant.nil? ||+ product.discontinued? ||+ selected_variant.discontinued? ||+ !selected_variant.purchasable? ||+ !selected_variant.price_in(current_currency).amount&.positive?+%>++<div class='<%= sticky_button_classes %> bottom-0 flex flex-col gap-4 z-10' data-sticky-button-target='stickyButton'>+ <%= button_tag type: (variant_not_available || not_all_options_selected ? 'button' : 'submit'),+ class: 'btn-primary btn-icon w-full h-12 add-to-cart-button',+ data: {+ action: ('modal#open' if variant_not_available),+ product_form_target: 'submit'+ },+ disabled: product.price_in(current_currency).zero? do %>+ <% if not_selected_options.size == 1 %>+ <span><%= Spree.t(:please_select, option: not_selected_options[0].presentation) %></span>+ <% elsif not_all_options_selected %>+ <span><%= Spree.t(:please_select_all_options) %></span>+ <% elsif variant_not_available %>+ <span><%= Spree.t(:notify_me_when_available) %></span>+ <%= render 'spree/shared/icons/bell', color: theme_setting('button_text_color') %>+ <% else %>+ <span><%= Spree.t(:add_to_cart) %></span>+ <%= render 'spree/shared/icons/cart', color: theme_setting('button_text_color') %>+ <% end %>+ <% end %>+</div>+<% unless without_fixed_button %>+ <div class='p-4 fixed-pdp-button bg-background fixed bottom-0 border-t border-default hidden w-full z-40 left-0' data-sticky-button-target='fixedButton'>+ <%= button_tag type: (variant_not_available || not_all_options_selected ? 'button' : 'submit'),+ class: 'btn-primary btn-icon w-full h-12 add-to-cart-button',+ data: {+ action: ('modal#open' if variant_not_available),+ product_form_target: 'submit'+ },+ disabled: product.price_in(current_currency).zero? do %>+ <% if not_selected_options.size == 1 %>+ <span><%= Spree.t(:please_select, option: not_selected_options[0].presentation) %></span>+ <% elsif not_all_options_selected %>+ <span><%= Spree.t(:please_select_all_options) %></span>+ <% elsif variant_not_available %>+ <span><%= Spree.t(:notify_me_when_available) %></span>+ <%= render 'spree/shared/icons/bell', color: theme_setting('button_text_color') %>+ <% else %>+ <span><%= Spree.t(:add_to_cart) %></span>+ <%= render 'spree/shared/icons/cart', color: theme_setting('button_text_color') %>+ <% end %>+ <% end %>+ </div>+<% end %>diff --git a/storefront/app/views/themes/default/spree/products/_add_to_waitlist.html.erb b/storefront/app/views/themes/default/spree/products/_add_to_waitlist.html.erbnew file mode 100644index 0000000000..decc334c17--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_add_to_waitlist.html.erb@@ -0,0 +1,36 @@+<div+ data-modal-target="container"+ data-action="waitlist:created@window->modal#close click->modal#closeBackground keyup@window->modal#closeWithKeyboard"+ class="hidden animate-fadeIn fixed inset-0 overflow-y-auto flex items-end md:items-center justify-center z-[9999] h-dvh w-full"+ style="animation-duration: 150ms;">+ <div class="w-full lg:w-[600px] relative h-auto lg:max-h-screen flex justify-center flex-col gap-4 bg-background p-5 ">+ <button+ type="button"+ data-waitlist-close-button+ data-action="modal#close"+ class="absolute top-5 right-5">+ <%= render 'spree/shared/icons/close' %>+ </button>+ <div>+ <h4 class="text-xl">+ <%= Spree.t(:product_sold_out)%>+ </h4>+ <p>+ <%= Spree.t(:add_to_waitlist_description) %>+ </p>+ </div>+ <%= form_for :waitlist, url: spree.waitlists_path, method: :post, class: "flex w-full gap-4 flex-col", data: { product_form_target: 'addToWaitlistForm', controller: 'turbo-stream-form enable-button' } do |f| %>+ <div class="w-full">+ <%= f.hidden_field :variant_id, value: variant.id %>+ <%= f.email_field :email, value: try_spree_current_user&.email, class: 'w-full', required: true, placeholder: Spree.t(:email), data: { enable_button_target: 'input' } %>+ </div>+ <div class="flex flex-col gap-2">+ <label class="flex items-center gap-2 cursor-pointer group text-sm">+ <%= f.check_box :subscribe_to_newsletter, class: 'input-checkbox group-focus-within:outline' %>+ <%= Spree.t('newsletter_subscription.join') %>+ </label>+ <%= f.button Spree.t(:add_to_waitlist), type: 'submit', class: 'btn-primary w-full btn-icon h-12', disabled: true, data: { enable_button_target: 'button' } %>+ </div>+ <% end %>+ </div>+</div>diff --git a/storefront/app/views/themes/default/spree/products/_add_to_wishlist.html.erb b/storefront/app/views/themes/default/spree/products/_add_to_wishlist.html.erbnew file mode 100644index 0000000000..4cf88d1d06--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_add_to_wishlist.html.erb@@ -0,0 +1,33 @@+<% css_classes ||= 'btn-icon btn--wishlist' %>+<% icon_size ||= 18 %>+<% variant ||= nil %>+<div class="add-to-wishlist">+ <% if variant %>+ <div class="wished-item-<%= variant.id %> h-full"+ data-controller="wished-item"+ data-wished-item-variant-id-value="<%= variant.id %>"+ >+ <%= button_tag type: 'submit',+ class: "#{css_classes} disabled:animate-pulse",+ data: { 'wished-item-target': 'add', action: 'wished-item#add' },+ aria: { label: Spree.t('storefront.wished_items.add') } do %>+ <%= render 'spree/shared/icons/heart', width: icon_size, height: icon_size %>+ <span class="sr-only"><%= Spree.t('storefront.wished_items.add') %></span>+ <% end %>+ <%= button_tag type: 'submit',+ class: "#{css_classes} disabled:animate-pulse",+ data: { 'wished-item-target': 'remove', action: 'wished-item#remove' },+ aria: { label: Spree.t('storefront.wished_items.remove') } do %>+ <%= render 'spree/shared/icons/heart', active: true, width: icon_size, height: icon_size %>+ <span class="sr-only"><%= Spree.t('storefront.wished_items.remove') %></span>+ <% end %>+ </div>+ <% else %>+ <%= button_tag class: "#{css_classes} disabled:text-accent",+ data: { action: 'product-form#showNotSelectedOptions', 'product-form-target': 'addToWishlist' },+ aria: { label: Spree.t('storefront.wished_items.select_variant') } do %>+ <%= render 'spree/shared/icons/heart', width: icon_size, height: icon_size %>+ <span class="sr-only"><%= Spree.t('storefront.wished_items.select_variant') %></span>+ <% end %>+ <% end %>+</div>diff --git a/storefront/app/views/themes/default/spree/products/_breadcrumbs.html.erb b/storefront/app/views/themes/default/spree/products/_breadcrumbs.html.erbnew file mode 100644index 0000000000..ef78c67a9e--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_breadcrumbs.html.erb@@ -0,0 +1,23 @@+<nav id="breadcrumbs" aria-label="breadcrumbs">+ <!-- desktop -->+ <ul class="hidden md:inline-flex space-x-3 mb-4 lg:mb-5 text-sm">+ <% taxons.each_with_index do |taxon, index| %>+ <li class="opacity-50"><%= link_to taxon.name, spree.nested_taxons_path(taxon), title: taxon.name %></li>+ <div class="breadcrumb-square opacity-50"></div>+ <% end %>++ <li class="text-text opacity-100"><%= product.name %></li>+ </ul>++ <!-- mobile -->+ <% if taxons.any? %>+ <ul class="md:hidden mb-4 text-sm">+ <li class="opacity-50">+ <%= link_to spree.nested_taxons_path(taxons.last), title: taxons.last.name, class: 'inline-flex items-center gap-1' do %>+ <strong><%= render 'spree/shared/icons/chevron', size: 16 %></strong>+ <%= taxons.last.name %>+ <% end %>+ </li>+ </ul>+ <% end %>+</nav>diff --git a/storefront/app/views/themes/default/spree/products/_color_picker.html.erb b/storefront/app/views/themes/default/spree/products/_color_picker.html.erbnew file mode 100644index 0000000000..caf3734c51--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_color_picker.html.erb@@ -0,0 +1,19 @@+<% color_preview_class ||= '' %>+<% color_preview_container_class ||= '' %>+<% disabled ||= false %>+<% with_name ||= false %>++<div class='border border-default peer-checked:border-primary peer-checked:border-solid p-0.5 inline-flex items-center gap-2 label-container hover:border-dashed hover:border-primary rounded-full'>+ <div class='color-preview w-[24px] h-[24px] shrink-0 lg:block relative rounded-full <%= color_preview_container_class %> <%= 'opacity-50' if disabled %>'>+ <% if disabled %>+ <div class='absolute <%= color_preview_class %>'>+ <%= render 'spree/shared/icons/disabled', stroke: "var(--border-default-color)" %>+ </div>+ <% end %>+ </div>+ <% if with_name %>+ <span class='color-label !leading-[30px] text-sm lg:!block lg:pr-2'>+ <%= h(color) %>+ </span>+ <% end %>+</div>diff --git a/storefront/app/views/themes/default/spree/products/_color_swatches.html.erb b/storefront/app/views/themes/default/spree/products/_color_swatches.html.erbnew file mode 100644index 0000000000..6df2d75d27--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_color_swatches.html.erb@@ -0,0 +1,61 @@+<% color_option = product.option_types.find { |option_type| option_type.color? } %>+<% variants_with_color = product.variants.find_all { |variant| variant.option_values.find { |ov| ov.option_type_id == color_option.id } } if color_option.present? %>++<% if color_option.present? && variants_with_color.length > 0 %>+ <% cache spree_base_cache_scope.call(variants_with_color) do %>+ <% color_values = product.option_values.find_all { |ov| ov.option_type_id == color_option.id }.uniq %>+ <%= raw(Spree::ColorsPreviewStylesPresenter.new(color_values.map { |o| { name: o.presentation, filter_name: o.name } }).to_s) %>++ <div class="product-card-color-swatches pt-2 flex flex-wrap gap-0.5" data-plp-variant-picker-target="colorsContainer">+ <% color_values.each do |color_value| %>+ <% selected_variant = variants_with_color.find { |variant| variant.option_values.include?(color_value) } %>+ <% next if selected_variant.blank? %>++ <% cache spree_base_cache_scope.call(selected_variant) do %>+ <div+ data-variant-id="<%= selected_variant.id %>"+ class="[&:nth-of-type(n+4)]:hidden [&:nth-of-type(n+4)]:md:block [&:nth-of-type(n+8)]:md:hidden cursor-pointer"+ data-action="mouseenter->plp-variant-picker#handlePreview click->plp-variant-picker#redirectToVariant touch->plp-variant-picker#redirectToVariant"+ data-color="<%= color_value.presentation %>">+ <% if selected_variant.available? %>+ <%= render 'spree/products/color_picker',+ with_name: false,+ color: color_value.presentation,+ color_preview_container_class: "lg:w-[28px] lg:h-[28px]",+ color_preview_class: "lg:top-[2px] lg:left-[2px]" %>+ <% else %>+ <%= render 'spree/products/color_picker',+ with_name: false,+ color: color_value.presentation,+ disabled: true,+ color_preview_container_class: "lg:w-[28px] lg:h-[28px]",+ color_preview_class: "lg:top-[2px] lg:left-[2px]" %>+ <% end %>+ <% if selected_variant.default_image %>+ <template data-featured-image-template>+ <%= render 'spree/products/featured_image',+ object: selected_variant %>+ </template>+ <% end %>+ <template data-add-to-wishlist-template>+ <%= render 'spree/products/add_to_wishlist', selected_variant: selected_variant %>+ </template>+ <template data-price-template>+ <%= render 'spree/products/price',+ product: product,+ selected_variant: selected_variant,+ use_variant: true,+ price_class: "mt-2 font-light product-card-price" %>+ </template>+ <% end %>+ </div>+ <% end %>+ <% # Plus Button %>+ <% colors_count = color_values.length %>+ <%= button_tag class: "border border-default peer-checked:border-primary peer-checked:border-solid p-0.5 items-center justify-center hover:border-dashed hover:border-primary rounded-full h-[30px] w-[30px] md:h-[34px] md:w-[34px] #{colors_count < 4 ? 'hidden' : 'inline-flex'} #{colors_count < 8 ? 'md:hidden' : 'md:inline-flex'}",+ data: { action: "click->plp-variant-picker#showMoreColors" } do %>+ <%= render 'spree/shared/icons/plus', class: "pointer-events-none" %>+ <% end %>+ </div>+ <% end %>+<% end %>diff --git a/storefront/app/views/themes/default/spree/products/_details.html.erb b/storefront/app/views/themes/default/spree/products/_details.html.erbnew file mode 100644index 0000000000..047bafe7dc--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_details.html.erb@@ -0,0 +1,55 @@+<% cache spree_base_cache_scope.call(product) do %>+ <% if product.storefront_description.present? %>+ <% description_text = strip_tags(product.storefront_description) %>+ <div data-controller="read-more" class="py-4 flex flex-col gap-4" data-read-more-more-text-value="<%= Spree.t(:read_more) %>" data-read-more-less-text-value="Read less">+ <div class="prose product-description text-sm <%= 'product-description-truncated' if description_text.size > 250 %>" data-read-more-target="content">+ <%= raw(product.storefront_description) %>+ </div>+ <% if description_text.size > 250 %>+ <%= button_tag Spree.t(:read_more), data: { action: "read-more#toggle" }, class: "font-bold underline text-sm" %>+ <% end %>+ </div>+ <% end %>++ <div class="st-accordion" data-controller="accordion">+ <% short_description = product.property('short_description') %>++ <% if short_description.present? %>+ <div class="product-property py-4 border-b border-default">+ <%= link_to '#property_details', class: 'text-sm uppercase tracking-widest inline-flex w-full justify-between !border-b-transparent', data: { action: 'accordion#toggle' } do %>+ <%= Spree.t(:details) %>+ <%= render 'spree/shared/icons/chevron_down' %>+ <% end %>+ <div class="text-sm st-accordion__content" data-accordion-id="property_details">+ <div class="pt-4"><%= product.description %></div>+ </div>+ </div>+ <% end %>++ <% shipping_policy = current_store.customer_shipping_policy %>+ <% if shipping_policy.present? %>+ <div class="product-property py-4 border-b border-default">+ <%= link_to "#property_shipping_policy", class: 'text-sm uppercase tracking-widest inline-flex w-full justify-between !border-b-transparent', data: { action: 'accordion#toggle' } do %>+ <%= Spree.t(:shipping_policy) %>+ <%= render 'spree/shared/icons/chevron_down' %>+ <% end %>+ <div class="text-sm st-accordion__content" data-accordion-id="property_shipping_policy">+ <div class="pt-4"><%= shipping_policy %></div>+ </div>+ </div>+ <% end %>++ <% product.product_properties.joins(:property).merge(Spree::Property.available_on_front_end).sort_by_property_position.each do |product_property| %>+ <div class="product-property py-4 border-b border-default">++ <%= link_to "#property_#{product_property.id}", class: 'text-sm uppercase tracking-widest inline-flex w-full justify-between !border-b-transparent', data: { action: 'accordion#toggle' } do %>+ <%= product_property.property.presentation %>+ <%= render 'spree/shared/icons/chevron_down' %>+ <% end %>+ <div class="text-sm st-accordion__content" data-accordion-id="property_<%= product_property.id %>">+ <div class="pt-4"><%= simple_format(product_property.value) %></div>+ </div>+ </div>+ <% end %>+ </div>+<% end %>diff --git a/storefront/app/views/themes/default/spree/products/_filters.html.erb b/storefront/app/views/themes/default/spree/products/_filters.html.erbnew file mode 100644index 0000000000..86ed9eea7e--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_filters.html.erb@@ -0,0 +1,45 @@+<div+ id="slideover-filters"+ data-slideover-target="menu"+ class="sidebar-pane relative flex-1 !flex flex-col w-full pt-4 bg-background md:border-r border-default transition duration-300 -translate-x-full">+ <div class="flex-shrink-0 flex items-center justify-between pb-4 px-4 border-b border-default">+ <span class="text-xl uppercase font-medium"><%= Spree.t(:filter) %></span>+ <%= button_tag type: 'button',+ class: "flex items-center justify-center rounded-full focus:outline-none focus:bg-background",+ aria: { label: Spree.t(:close_sidebar) },+ data: { action: "slideover#toggle" } do %>+ <%= render 'spree/shared/icons/cross' %>+ <% end %>+ </div>+ <%= form_with url: canonical_path, method: :get, class: "pt-4 lg:pt-10 flex-1 h-0 overflow-y-auto" do |f| %>+ <%= f.hidden_field :q, value: params[:q] %>+ <%= f.hidden_field :sort_by, value: params[:sort_by] %>+ <nav class="flex flex-col justify-between h-full">+ <div class="flex flex-col gap-4">+ <%= render 'spree/products/filters/availability', f: f %>+ <%= render 'spree/products/filters/price', f: f %>++ <% current_store.taxonomies.order(:position).each do |taxonomy| %>+ <%= render 'spree/products/filters/taxons', taxonomy: taxonomy, f: f %>+ <% end %>++ <% Spree::OptionType.filterable.order(:position).includes(:option_values).each do |filter| %>+ <% if filter.name == 'color'%>+ <%= render 'spree/products/filters/colors', filter: filter, f: f %>+ <% else %>+ <%= render 'spree/products/filters/generic', filter: filter, f: f %>+ <% end %>+ <% end %>+ </div>+ <div class="bg-accent p-4 lg:py-6 lg:px-10 flex flex-row justify-between gap-8 sticky bottom-0 left-0 mt-4">+ <%= f.button Spree.t(:apply), class: "btn-primary block text-center flex-grow", type: "submit" %>+ <% if current_taxon || params[:filter].present? %>+ <%= link_to url_for(permitted_products_params.except(:page, :filter)), class: "inline-flex items-center justify-center gap-3 font-semibold text-sm tracking-widest", data: { turbo_method: :get, turbo_frame: "_top" } do %>+ <span><%= Spree.t(:clear_all) %></span>+ <%= render 'spree/shared/icons/cross', width: 20, height: 20 %>+ <% end %>+ <% end %>+ </div>+ </nav>+ <% end %>+</div>diff --git a/storefront/app/views/themes/default/spree/products/_json_ld.html.erb b/storefront/app/views/themes/default/spree/products/_json_ld.html.erbnew file mode 100644index 0000000000..131c2f51f8--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_json_ld.html.erb@@ -0,0 +1,38 @@+<script type="application/ld+json" data-test-id="product-json-ld">+ <% first_or_default_variant = product.first_or_default_variant(current_currency) %>+ {+ "@context": "https://schema.org/",+ "@type": "Product",+ "name": <%= product.name.to_json.html_safe %>,+ "url": <%= spree.product_url(product).to_json.html_safe %>,+ <% if product.featured_image %>+ "image": [+ <%= main_app.cdn_image_url(product.featured_image.variant(spree_image_variant_options(resize_to_limit: [1260, 1260]))).to_json.html_safe %>+ ],+ <% end %>+ <% if product.description.present? %>+ "description": <%= strip_tags(product.description).to_json.html_safe %>,+ <% end %>+ <% if !product.has_variants? %>+ <% if first_or_default_variant.sku.present? %>"sku": <%= first_or_default_variant.sku.to_json.html_safe %>,<% end %>+ <% elsif selected_variant %>+ <% if selected_variant.sku.present? %>"sku": <%= selected_variant.sku.to_json.html_safe %>,<% end %>+ <% end %>+ <% if product.brand %>+ "brand": {+ "@type": "Brand",+ "name": <%= product.brand_name.to_json.html_safe %>+ },+ <% end %>+ "offers": [+ <% if product.has_variants? %>+ <%= render partial: "spree/products/json_ld_variant", collection: product.variants, as: :variant, locals: { product: product }, cached: spree_base_cache_scope %>+ <% else %>+ <%= render "spree/products/json_ld_variant", product: product, variant: first_or_default_variant %>+ <% end %>+ ]+ }+</script>+<script type="application/ld+json">+ <%= product_json_ld_breadcrumbs(product).to_json.html_safe %>+</script>diff --git a/storefront/app/views/themes/default/spree/products/_json_ld_list.html.erb b/storefront/app/views/themes/default/spree/products/_json_ld_list.html.erbnew file mode 100644index 0000000000..2042d541fc--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_json_ld_list.html.erb@@ -0,0 +1,7 @@+<script type="application/ld+json" data-test-id="product-list-json-ld">+ {+ "@context": "https://schema.org",+ "@type": "ItemList",+ "itemListElement": <%= product_list_json_ld_elements(products.to_a.pluck(:slug)).to_json.html_safe %>+ }+</script>diff --git a/storefront/app/views/themes/default/spree/products/_json_ld_variant.html.erb b/storefront/app/views/themes/default/spree/products/_json_ld_variant.html.erbnew file mode 100644index 0000000000..d94a2c2d00--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_json_ld_variant.html.erb@@ -0,0 +1,10 @@+{+ "@type": "Offer",+ <% if variant.sku.present? %>+ "sku": <%= variant.sku.to_json.html_safe %>,+ <% end %>+ "availability": "http://schema.org/<%= variant.available? ? 'InStock' : 'OutOfStock' %>",+ "price": <%= variant.amount_in(current_currency).to_json.html_safe %>,+ "priceCurrency": <%= current_currency.to_json.html_safe %>,+ "url": <%= spree.product_url(product, variant_id: variant.id).to_json.html_safe %>+}diff --git a/storefront/app/views/themes/default/spree/products/_media_gallery.html.erb b/storefront/app/views/themes/default/spree/products/_media_gallery.html.erbnew file mode 100644index 0000000000..ec38e48a59--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_media_gallery.html.erb@@ -0,0 +1,94 @@+<% desktop ||= false %>++<% cache [*spree_base_cache_scope.call(product), images, desktop].compact do %>+ <% if desktop == true %>+ <div+ class="media-gallery w-full h-full media-gallery-desktop"+ id="media-gallery-<%= product.id %>-desktop"+ data-controller="lightbox pdp-desktop-gallery">+ <div class="grid grid-cols-[6.5rem,_1fr] grid-rows-1 gap-2 w-full media-gallery-desktop__wrapper">+ <div class="flex flex-col h-full w-full aspect-1 overflow-hidden">+ <%= button_tag class: "w-full bg-background py-2 flex justify-center items-center disabled:opacity-50 media-gallery-desktop-arrow", data: { pdp_desktop_gallery_target: "prevArrow" } do %>+ <span class="rotate-180">+ <%= render 'spree/shared/icons/chevron_down' %>+ </span>+ <% end %>+ <div class="swiper h-full w-full block" data-pdp-desktop-gallery-target="imagesThumbsSlider">+ <div class="swiper-wrapper w-full h-full block">+ <% images.each do |image| %>+ <div class="swiper-slide !h-min cursor-pointer w-full">+ <div+ class="relative aspect-1 w-full block "+ id="thumb-desktop-product-image-<%= image.id %>"+ data-turbo-permanent>+ <%= image_tag main_app.cdn_image_url(image.variant(spree_image_variant_options(resize_to_fill: [200, 200]))), alt: image_alt(image), class: 'w-full h-full' %>+ </div>+ </div>+ <% end %>+ </div>+ </div>+ <%= button_tag class: "w-full bg-background py-2 flex justify-center items-center disabled:opacity-50 media-gallery-desktop-arrow", data: { pdp_desktop_gallery_target: "nextArrow" } do %>+ <%= render 'spree/shared/icons/chevron_down' %>+ <% end %>+ </div>+ <div data-pdp-desktop-gallery-target="imagesSlider" class="overflow-hidden swiper relative w-full h-min">+ <div class="swiper-wrapper w-full h-min">+ <% images.each do |image| %>+ <div class="swiper-slide w-full">+ <div+ class="product-image relative w-full aspect-1"+ id="main-desktop-product-image-<%= image.id %>"+ data-turbo-permanent>+ <%= link_to main_app.cdn_image_url(image.variant(spree_image_variant_options(resize_to_fill: [2000, 2000]))), data: { pswp_width: "2000", pswp_height: "2000" } do %>+ <div class="zoom-icon hidden absolute bottom-2 right-2 p-4 bg-background rounded-full opacity-75 hover:opacity-100">+ <%= render 'spree/shared/icons/zoom' %>+ </div>+ <%= image_tag main_app.cdn_image_url(image.variant(spree_image_variant_options(resize_to_fill: [2000, 2000]))), alt: image_alt(image), class: 'w-full h-full' %>+ <% end %>+ </div>+ </div>+ <% end %>+ </div>+ <%= render 'spree/products/label', product: product %>+ <div data-pdp-desktop-gallery-target="imagesSliderPagination" class="swiper-pagination"></div>+ </div>+ </div>+ </div>+ <% else %>+ <!-- media gallery for mobile -->+ <% if images.any? %>+ <div+ id="media-gallery-<%= product.id %>-mobile"+ data-controller="lightbox carousel"+ class="media-gallery swiper-container relative overflow-hidden"+ data-carousel-options-value='{+ "slidesPerView": 1,+ "centeredSlides": true,+ "spaceBetween": 10,+ "grabCursor": true+ }'>+ <div class="swiper-wrapper">+ <% images.each do |image| %>+ <div class="swiper-slide aspect-1" id="swiper-slide-<%= image.id %>">+ <%= link_to main_app.cdn_image_url(image.variant(spree_image_variant_options(resize_to_fill: [2000, 2000]))), class: "absolute top-2 right-2 p-2 bg-background rounded-full opacity-75 hover:opacity-100", data: { pswp_width: "2000", pswp_height: "2000" } do %>+ <%= render 'spree/shared/icons/zoom' %>+ <% end %>+ <%= render 'spree/products/label', product: product, mobile_pdp: true %>+ <%= image_tag main_app.cdn_image_url(image.variant(spree_image_variant_options(resize_to_fill: [720, 720]))), alt: image_alt(image), class: 'h-full w-full object-cover object-center', style: 'min-height: 358px' %>+ </div>+ <% end %>+ </div>+ <% if images.length > 1 %>+ <div class="swiper-pagination-product-<%= product.id %> mt-3 items-center flex mx-auto align-center justify-center" data-carousel-target="pagination"></div>+ <% end %>+ </div>+ <div id='pinch-to-zoom' class='fixed top-0 left-0 p-4 bg-background z-50 flex justify-center items-center flex-col'>+ <div class='w-14 h-14'><%= render 'spree/shared/icons/pinch' %></div>+ <div class='text-sm uppercase pt-4 px-5 text-center !leading-tight'>+ Pinch to <br>+ zoom+ </div>+ </div>+ <% end %>+ <% end %>+<% end %>diff --git a/storefront/app/views/themes/default/spree/products/_product.html.erb b/storefront/app/views/themes/default/spree/products/_product.html.erbnew file mode 100644index 0000000000..fdd8325f38--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_product.html.erb@@ -0,0 +1,62 @@+<% image_height ||= nil %>+<% image_width ||= theme_setting('product_listing_image_width') %>+<% selected_variant ||= product.first_or_default_variant(current_currency) %>++<div class="swiper-slide w-full">+ <div+ class="product-card flex h-full flex-col w-full gap-2 relative"+ data-controller="plp-variant-picker"+ id="product-card-<%= product&.id %>">+ <%= link_to spree.product_path(product), id: "product-#{product&.id}", class: "group w-full flex flex-col", data: { turbo_frame: "_top", "plp-variant-picker-target": "link" } do %>+ <div+ class="mb-3 relative w-full product-card-featured-image"+ <% if image_height %>+ style="min-height: <%= image_height %>px;"+ <% end %>>+ <div class="overflow-hidden relative">+ <div data-plp-variant-picker-target="featuredImageContainer" class="h-full">+ <%= render 'spree/products/featured_image',+ object: product,+ height: image_height,+ width: image_width %>+ </div>+ </div>+ <%= render 'spree/products/label', product: product %>+ </div>+ <div class="product-card-inner">+ <% if product.brand_name.present? %>+ <h3 class="text-xs font-semibold uppercase inline-block product-card-brand">+ <%= product.brand_name %>+ </h3>+ <% end %>+ <h3 class="line-clamp-1 product-card-title">+ <% if product %>+ <%= product.name %>+ <% else %>+ <div class="grid grid-cols-3 gap-4">+ <div class="h-5 bg-accent rounded col-span-2"></div>+ </div>+ <% end %>+ </h3>++ <% if product %>+ <div data-plp-variant-picker-target="priceContainer">+ <%= render 'spree/products/price',+ product: product,+ selected_variant: selected_variant,+ use_variant: false,+ price_class: "mt-2 font-light product-card-price" %>+ </div>+ <% else %>+ <div class="mt-2 grid grid-cols-3 gap-4">+ <div class="h-7 bg-accent rounded col-span-1"></div>+ </div>+ <% end %>+ </div>+ <% end %>+ <div class="absolute right-1 top-1 z-10" data-plp-variant-picker-target="addToWishlist">+ <%= render 'spree/products/add_to_wishlist', variant: product.first_or_default_variant(current_currency) if product %>+ </div>+ <%= render 'spree/products/color_swatches', product: product if product && (defined?(show_variant_picker) ? show_variant_picker : true) %>+ </div>+</div>diff --git a/storefront/app/views/themes/default/spree/products/_quantity_selector.html.erb b/storefront/app/views/themes/default/spree/products/_quantity_selector.html.erbnew file mode 100644index 0000000000..896d09a7fa--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_quantity_selector.html.erb@@ -0,0 +1,32 @@+<% selected_variant ||= nil %>+<p class="quantity-selector-label text-sm tracking-widest uppercase py-2"><%= Spree.t(:quantity) %></p>+<div class="inline-block">+ <div class="quantity-picker" data-controller="quantity-picker">+ <%= button_tag class: 'decrease-quantity',+ type: 'button',+ data: { action: 'click->quantity-picker#decrease',+ 'quantity-picker-target': 'decrease' } do %>+ <%= render 'spree/shared/icons/minus' %>+ <% end %>+ <%= number_field_tag :quantity, 1,+ min: 1,+ max: selected_variant&.backorderable? ? nil : selected_variant&.total_on_hand,+ class: 'quantity-input',+ 'aria-label': 'Quantity',+ data: { 'quantity-picker-target': 'quantity' } %>+ <%= button_tag class: 'increase-quantity',+ type: 'button',+ data: { action: 'click->quantity-picker#increase',+ 'quantity-picker-target': 'increase' } do %>+ <%= render 'spree/shared/icons/plus' %>+ <% end %>+ </div>+</div>+<%= hidden_field_tag :variant_id, selected_variant&.id %>+<% if selected_variant && !selected_variant.backorderable? %>+ <% if selected_variant.total_on_hand.between?(1, 4) %>+ <p class="text-red-500 text-center text-sm mt-1" style="width: 117px">+ <%= Spree.t(:only_left, count: selected_variant.total_on_hand) %>+ </p>+ <% end %>+<% end %>diff --git a/storefront/app/views/themes/default/spree/products/_returns_policy_modal.html.erb b/storefront/app/views/themes/default/spree/products/_returns_policy_modal.html.erbnew file mode 100644index 0000000000..c3681fd90d--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_returns_policy_modal.html.erb@@ -0,0 +1,22 @@+<div+ data-modal-target="container"+ data-action="click->modal#closeBackground keyup@window->modal#closeWithKeyboard"+ class="hidden animate-fadeIn fixed inset-0 overflow-y-auto flex items-center justify-center z-[9999]"+ style="animation-duration: 150ms;">+ <div class="w-full lg:w-[800px] relative h-[100dvh] lg:h-auto lg:max-h-screen">+ <div class="mx-0 bg-background">+ <div class="px-8 py-6">+ <div class="flex justify-between uppercase mb-4">+ <%= Spree.t(:returns_policy) %>+ <button data-action="click->modal#close">+ <%= render 'spree/shared/icons/close' %>+ <span class="sr-only"><%= Spree.t(:close) %></span>+ </button>+ </div>+ <div class="text-sm overflow-auto">+ <%= returns_policy %>+ </div>+ </div>+ </div>+ </div>+</div>diff --git a/storefront/app/views/themes/default/spree/products/_show_more_button.html.erb b/storefront/app/views/themes/default/spree/products/_show_more_button.html.erbnew file mode 100644index 0000000000..17166295e4--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_show_more_button.html.erb@@ -0,0 +1,8 @@+<% unless storefront_products.last? %>+ <%= turbo_frame_tag "next_page", src: url_for(params.to_unsafe_h.merge(page: storefront_products.next_param, format: :turbo_stream)), class: "block relative w-full", data: { controller: "infinite-scroll", infinite_scroll_offset_value: "1350px" }, loading: "lazy" do %>+ <span class="flex justify-center gap-2 items-center py-4 left-0 w-full h-full">+ <%= render 'spree/shared/icons/spinner' %>+ <%= Spree.t(:loading) %>...+ </span>+ <% end %>+<% end %>\ No newline at end of filediff --git a/storefront/app/views/themes/default/spree/products/_sort.html.erb b/storefront/app/views/themes/default/spree/products/_sort.html.erbnew file mode 100644index 0000000000..a7122b13b5--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_sort.html.erb@@ -0,0 +1,45 @@+<div data-controller="dropdown" data-action="click->dropdown#toggle click@window->dropdown#hide">+ <div id="dropdown-button" class="relative inline-block">+ <%= button_tag type: 'button', role: 'button', tabindex: '0', data: { dropdown_target: 'button', test_id: 'sort-button' }, class: 'flex gap-2 text-sm items-center py-3' do %>+ <span class='hidden lg:inline opacity-50'><%= Spree.t(:sort_by) %>:</span>+ + <span class="font-semibold">+ <% taxons_sort_options.each do |option| %>+ <% if option[:value] == products_sort %>+ <%= option[:name] %>+ <% end %>+ <% end %>+ </span>++ <%= render 'spree/shared/icons/chevron_down' %>+ <% end %>+ <div data-dropdown-target="menu"+ data-transition-enter="transition ease-out"+ data-transition-enter-from="opacity-0 translate-y-1"+ data-transition-enter-to="opacity-100 translate-y-0"+ data-transition-leave="transition ease-in"+ data-transition-leave-from="opacity-100 translate-y-0"+ data-transition-leave-to="opacity-0 translate-y-1"+ class="hidden absolute top-7 right-0 z-[9999] mt-5 flex w-screen max-w-max">+ <div class="bg-background border-default border overflow-hidden w-72">+ <%= form_with url: canonical_path, method: :get, data: { controller: 'auto-submit' } do |f| %>+ <%= f.hidden_field :q, value: params[:q] %>+ <%= filter_form_fields %>+ <% taxons_sort_options.each do |option| %>+ <%= f.radio_button :sort_by, option[:value],+ id: "sort-#{option[:value]}",+ class: 'hidden',+ data: { action: 'change->auto-submit#submit' },+ checked: option[:value] == products_sort %>+ <%= f.label "sort-#{option[:value]}", class: 'text-sm cursor-pointer flex items-center justify-between px-4 py-2.5 hover:bg-accent focus:outline-none focus:bg-accent transition ease-in-out' do %>+ <%= option[:name] %>+ <% if option[:value] == products_sort %>+ <%= render 'spree/shared/icons/check' %>+ <% end %>+ <% end %>+ <% end %>+ <% end %>+ </div>+ </div>+ </div>+</div>diff --git a/storefront/app/views/themes/default/spree/products/_swiper.html.erb b/storefront/app/views/themes/default/spree/products/_swiper.html.erbnew file mode 100644index 0000000000..bf006841dd--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_swiper.html.erb@@ -0,0 +1,85 @@+<% desktop_slides ||= 4 %>+<% slides_per_view ||= desktop_slides %>+<% arrows_on_top ||= false %>+<% pagination ||= 'bottom' %>+<% layout ||= 'swiper' %>+<% heading ||= nil %>++<% heading_size = case section.try(:preferred_heading_size)+ when 'small'+ 'text-base font-medium'+ when 'medium'+ 'text-lg lg:text-xl font-medium'+ when 'large'+ 'text-xl lg:text-2xl font-medium'+ else+ heading_class || ''+ end %>++<% heading_alignment = case section.try(:preferred_heading_alignment)+ when 'left'+ 'text-left'+ when 'center'+ 'text-center'+ when 'right'+ 'text-right'+ else+ ''+ end %>++<% if heading.present? %>+ <h3 class='<%= "#{heading_size} font-medium uppercase #{heading_alignment}" %> pb-8'>+ <%= heading %>+ </h3>+<% end %>++<div class='flex h-full relative'>+ <div+ class='swiper-container overflow-hidden flex-1 pr-8 lg:pr-0 -mx-4 lg:mx-0 flex flex-col <%= pagination == 'bottom' ? 'lg:flex-col lg:justify-between lg:h-full' : 'lg:flex-col-reverse' %>'+ data-controller='carousel'+ data-carousel-options-value='{+ "slidesPerView": 2,+ "centeredSlides": false,+ "spaceBetween": 16,+ "grabCursor": true,+ "breakpoints": {+ "768": {+ "slidesPerView": <%= slides_per_view %>,+ "spaceBetween": 24+ }+ },+ "navigation": {+ "nextEl": ".swiper-custom-button-next-<%= section.id %>",+ "prevEl": ".swiper-custom-button-prev-<%= section.id %>"+ }+ }'>+ <div class='swiper-wrapper px-4 lg:px-0 h-auto'>+ <%= render 'spree/shared/products', products: products %>+ </div>+ <div class='-mr-8 lg:mr-0 flex <%= arrows_on_top ? 'hidden' : '' %> <%= pagination == 'bottom' ? 'justify-end lg:mt-6' : 'justify-between lg:mb-8 items-end' %> <%= section.try(:heading_alignment) == 'right' && pagination != 'bottom' ? 'lg:flex-row-reverse' : '' %>'>+ <div class="mt-8 mx-4 lg:m-0 lg:shrink-0 gap-2 w-full flex <%= arrows_on_top ? 'md:hidden' : '' %> items-center <%= section.try(:layout) == 'swiper' && section.try(:show_more_button) ? 'justify-between' : 'lg:w-auto justify-end' %>">+ <% if section.try(:preferred_layout) == 'swiper' && section.try(:preferred_show_more_button) %>+ <%= link_to section.try(:preferred_show_all_button_link), class: "#{section.try(:preferred_button_style) == 'primary' ? 'btn-primary' : 'btn-secondary'} w-full lg:w-72 block text-center", data: { turbo_frame: '_top' } do %>+ <%= section.button_text %>+ <% end %>+ <% end %>+ <% unless arrows_on_top %>+ <div class='justify-center items-center gap-4 md:flex hidden'>+ <%= button_tag class: "swiper-custom-button-prev-#{section.id} disabled:opacity-50" do %>+ <%= render 'spree/shared/icons/chevron' %>+ <% end %>+ <%= button_tag class: "swiper-custom-button-next-#{section.id} disabled:opacity-50" do %>+ <%= render 'spree/shared/icons/chevron_right' %>+ <% end %>+ </div>+ <% end %>+ </div>+ </div>+ <%= button_tag class: "absolute p-2 bg-white rounded-full z-10 border border-accent left-0 disabled:hidden hover:border-primary ml-2 lg:ml-0 swiper-custom-button-prev-#{section.id} block #{arrows_on_top ? '' : 'md:hidden'} top-[--top] lg:top-[--desktop-top]", aria: { hidden: true }, style: "--top: calc(#{theme_setting('product_listing_image_height_mobile')}px/2); --desktop-top: calc(#{theme_setting('product_listing_image_height')}px/2); transform: translate(-50%, -50%);" do %>+ <%= render 'spree/shared/icons/chevron' %>+ <% end %>+ <%= button_tag class: "absolute p-2 bg-white rounded-full z-10 border border-accent right-0 disabled:hidden hover:border-primary mr-2 lg:mr-0 swiper-custom-button-next-#{section.id} block #{arrows_on_top ? '' : 'md:hidden'} top-[--top] lg:top-[--desktop-top]", aria: { hidden: true }, style: "--top: calc(#{theme_setting('product_listing_image_height_mobile')}px/2); --desktop-top: calc(#{theme_setting('product_listing_image_height')}px/2); transform: translate(50%, -50%);" do %>+ <%= render 'spree/shared/icons/chevron_right' %>+ <% end %>+ </div>+</div>diff --git a/storefront/app/views/themes/default/spree/products/_tags.html.erb b/storefront/app/views/themes/default/spree/products/_tags.html.erbnew file mode 100644index 0000000000..e69de29bb2diff --git a/storefront/app/views/themes/default/spree/products/_variant_options.html.erb b/storefront/app/views/themes/default/spree/products/_variant_options.html.erbnew file mode 100644index 0000000000..26ada59ecb--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_variant_options.html.erb@@ -0,0 +1,61 @@+<% selected_option = product_selected_option_for_option(option_type, product: product, selected_variant: selected_variant, options_param_name: options_param_name) %>+<% variants_available_arr = product.variants.map { |v| v.purchasable? && v.price_in(current_currency).amount&.positive? } %>+<% variants_option1_arr = product.variants.map { |v| v.options.first&.dig(:value) } %>+<% variants_option2_arr = product.variants.map { |v| v.options.second&.dig(:value) } %>+<% variants_option3_arr = product.variants.map { |v| v.options.third&.dig(:value) } %>+<% product_option_values_for_option(option_type, product: product).each_with_index do |value, index| %>+ <% option_disabled = true %>+ <% variants_option1_arr.each_with_index do |option1_name, index| %>+ <% case position %>+ <% when 0 %>+ <% if option1_name == value.name && variants_available_arr[index] %>+ <% option_disabled = false %>+ <% end %>+ <% when 1 %>+ <% if product_selected_option_for_option(product.option_types[0], product: product, options_param_name: options_param_name)&.name == option1_name && variants_option2_arr[index] == value.name && variants_available_arr[index] %>+ <% option_disabled = false %>+ <% end %>+ <% when 2 %>+ <% if product_selected_option_for_option(product.option_types[0], product: product, options_param_name: options_param_name)&.name == option1_name && variants_option2_arr[index] == product_selected_option_for_option(product.option_types[1], product: product, options_param_name: options_param_name)&.name && variants_option3_arr[index] == value.name && variants_available_arr[index] %>+ <% option_disabled = false %>+ <% end %>+ <% end %>+ <% end %>+ <% if option_type.color? %>+ <li>+ <label class="cursor-pointer">+ <%= radio_button_tag option_type.presentation, value.name, selected_option == value,+ name: option_type.presentation,+ id: "product-option-#{product.id}-#{position}-#{index}",+ class: "sr-only peer color-input",+ data: {+ action: 'change->product-form#updateVariant',+ product_form_target: 'option',+ option_id: option_type.id+ }+ %>+ <%= render 'spree/products/color_picker', disabled: option_disabled %>+ </label>+ </li>+ <% else %>+ <%= radio_button_tag option_type.presentation, value.name, selected_option == value,+ class: class_names('hidden', {'peer/unavailable' => selected_variant.nil?, 'peer/available' => selected_variant.present?}),+ data: {+ action: 'change->product-form#updateVariant',+ product_form_target: 'option',+ option_id: option_type.id+ },+ name: option_type.presentation,+ id: "product-option-#{product.id}-#{position}-#{index}"+ %>+ <label+ for='product-option-<%= product.id %>-<%= position %>-<%= index %>'+ class='text-sm cursor-pointer flex items-center justify-between px-4 py-2.5 hover:bg-accent focus:outline-none focus:bg-accent transition duration-150 ease-in-out <%= option_disabled ? "opacity-50 cursor-not-allowed" : "hover:bg-accent" %>'+ >+ <p><%=h value.presentation %></p>+ <% if selected_option == value %>+ <%= render 'spree/shared/icons/check', size: 18 %>+ <% end %>+ </label>+ <% end %>+<% end %>diff --git a/storefront/app/views/themes/default/spree/products/_variant_picker.html.erb b/storefront/app/views/themes/default/spree/products/_variant_picker.html.erbnew file mode 100644index 0000000000..3cb6efc573--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/_variant_picker.html.erb@@ -0,0 +1,50 @@+<% options_param_name ||= :options %>+<% if product.has_variants? %>+ <div id='product-variant-picker' class="flex flex-col gap-y-4 mb-4 mt-2">+ <% product.option_types.each_with_index do |option_type, index| %>+ <% selected_option = product_selected_option_for_option(option_type, product: product, selected_variant: selected_variant, options_param_name: options_param_name) %>+ <% if option_type.color? %>+ <%= option_type.colors_preview_styles.html_safe %>+ <fieldset data-option-id="<%= option_type.id %>" class="flex flex-col gap-y-2">+ <span class="text-sm leading-4 uppercase tracking-widest"><%= option_type.presentation %>: <%= selected_option.presentation %></span>+ <ul class="flex items-center flex-wrap gap-1">+ <%= render 'spree/products/variant_options', product: product, option_type: option_type, position: index, selected_variant: selected_variant, options_param_name: options_param_name %>+ </ul>+ </fieldset>+ <% else %>+ <fieldset data-option-id="<%= option_type.id %>">+ <div data-controller="dropdown" class="relative mb-2">+ <div class="flex items-center justify-between">+ <button+ data-action="click->dropdown#toggle click@window->dropdown#hide"+ type='button'+ class='text-sm uppercase tracking-widest flex gap-2 items-center border border-default py-2 px-4 rounded-input dropdown-button'+ data-dropdown-target="button">+ <legend class="mr-2" id="option-<%= option_type.id %>-value">+ <% if selected_option %>+ <%= option_type.presentation %>: <span class="option-value-text"><%= selected_option.presentation %></span>+ <% else %>+ <%= Spree.t('variant_picker.please_choose', option_type: option_type.presentation) %>+ <% end %>+ </legend>+ <% render 'spree/shared/icons/chevron_down' %>+ </button>+ </div>+ <div data-dropdown-target="menu"+ data-transition-enter="transition ease-out"+ data-transition-enter-from="opacity-0 translate-y-1"+ data-transition-enter-to="opacity-100 translate-y-0"+ data-transition-leave="transition ease-in"+ data-transition-leave-from="opacity-100 translate-y-0"+ data-transition-leave-to="opacity-0 translate-y-1"+ class="hidden absolute top-11 left-0 z-[9999] flex w-screen max-w-max shadow-xs">+ <div class="bg-background border-default border overflow-hidden w-72">+ <%= render 'spree/products/variant_options', product: product, option_type: option_type, position: index, selected_variant: selected_variant, options_param_name: options_param_name %>+ </div>+ </div>+ </div>+ </fieldset>+ <% end %>+ <% end %>+ </div>+<% end %>diff --git a/storefront/app/views/themes/default/spree/products/filters/_availability.html.erb b/storefront/app/views/themes/default/spree/products/filters/_availability.html.erbnew file mode 100644index 0000000000..b234cad40d--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/filters/_availability.html.erb@@ -0,0 +1,32 @@+<div+ class="st-accordion"+ data-controller='accordion'+ data-accordion-close-others-value="false">+ <% availability_filter_opened = permitted_products_params.dig(:filter, :purchasable).present? || permitted_products_params.dig(:filter, :out_of_stock).present? %>+ <%= link_to "#availability_filter", class: "cursor-pointer uppercase flex items-center justify-between h-10 px-4 lg:px-10 text-sm tracking-widest focus:outline-none transition duration-150 ease-in-out #{'st-accordion__icon--opened' if availability_filter_opened}", data: { action: 'accordion#toggle:prevent' } do %>+ <%= Spree.t(:availability) %>+ <%= render 'spree/shared/icons/chevron_down' %>+ <% end %>+ <div class='st-accordion__content' data-accordion-id='availability_filter'>+ <ul class="flex flex-col px-4 lg:px-10">+ <li>+ <label class="flex items-center gap-2 cursor-pointer group text-sm h-10">+ <%= f.check_box "filter[purchasable]", { checked: permitted_products_params.dig(:filter, :purchasable).present?, class: "input-checkbox group-focus-within:outline", id: nil }, true, nil %>+ <%= Spree.t(:in_stock) %>+ <span class="opacity-50">+ (<%= filter_stock_count[:in_stock] %>)+ </span>+ </label>+ </li>+ <li>+ <label class="flex items-center gap-2 cursor-pointer group text-sm h-10">+ <%= f.check_box "filter[out_of_stock]", { checked: permitted_products_params.dig(:filter, :out_of_stock).present?, class: "input-checkbox group-focus-within:outline", id: nil }, true, nil %>+ <%= Spree.t(:out_of_stock) %>+ <span class="opacity-50">+ (<%= filter_stock_count[:out_of_stock] %>)+ </span>+ </label>+ </li>+ </ul>+ </div>+</div>diff --git a/storefront/app/views/themes/default/spree/products/filters/_colors.html.erb b/storefront/app/views/themes/default/spree/products/filters/_colors.html.erbnew file mode 100644index 0000000000..ce644a560f--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/filters/_colors.html.erb@@ -0,0 +1,23 @@+<% filter_values = filter_values_for_filter(filter) %>++<% if filter_values.any? %>+ <div class="st-accordion" data-controller='accordion' data-accordion-close-others-value="false">+ <%= link_to "#colors_filter", class: "cursor-pointer uppercase flex items-center justify-between h-10 px-4 lg:px-10 text-sm tracking-widest focus:outline-none transition duration-150 ease-in-out #{'st-accordion__icon--opened' if params.dig(:filter, :options, :color).present?}", data: { action: 'accordion#toggle:prevent' } do %>+ <%= Spree.t(:colors) %>+ <%= render 'spree/shared/icons/chevron_down' %>+ <% end %>+ <div class='st-accordion__content' data-accordion-id='colors_filter'>+ <%= Spree::ColorsPreviewStylesPresenter.new(filter_values.map { |v| v.name }).to_s.html_safe %>+ <ul class="flex items-center flex-wrap gap-2 px-4 lg:px-10">+ <% filter_values.each do |value| %>+ <li>+ <label class="cursor-pointer">+ <%= f.check_box 'filter[options][color][]', { class: 'sr-only peer color-input', id: nil, checked: params.dig(:filter, :options, :color)&.include?(value.name), value: value.name }, value.name, nil %>+ <%= render 'spree/products/color_picker', color: value.presentation, with_name: true %>+ </label>+ </li>+ <% end %>+ </ul>+ </div>+ </div>+<% end %>diff --git a/storefront/app/views/themes/default/spree/products/filters/_generic.html.erb b/storefront/app/views/themes/default/spree/products/filters/_generic.html.erbnew file mode 100644index 0000000000..0a8f560c0f--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/filters/_generic.html.erb@@ -0,0 +1,69 @@+<% filter_values = filter_values_for_filter(filter) %>++<% if filter_values.any? %>+ <div+ class="st-accordion"+ data-controller="accordion"+ data-accordion-close-others-value="false">+ <%= link_to "##{filter.id}", class: "cursor-pointer uppercase flex items-center justify-between h-10 px-4 lg:px-10 text-sm tracking-widest focus:outline-none transition duration-150 ease-in-out #{'st-accordion__icon--opened' if permitted_products_params.dig(:filter, :options, filter.name).present?}", data: { action: 'accordion#toggle:prevent' } do %>+ <%= filter.presentation %>+ <%= render 'spree/shared/icons/chevron_down' %>+ <% end %>+ <div+ class='st-accordion__content'+ data-accordion-id="<%= filter.id %>"+ data-controller="searchable-list">+ <div class="relative mt-3 mx-4 lg:mx-10">+ <%= f.search_field :search,+ class: "w-full bg-accent focus:ring-primary focus:border-primary pl-10 border-none",+ placeholder: Spree.t(:search),+ data: { searchable_list_target: "input" } %>+ <span class="absolute left-0 top-0 flex items-center h-full pl-3">+ <%= render 'spree/shared/icons/search' %>+ </span>+ </div>+ <% main_options, rest_of_the_options = filter_values.partition.with_index { |_, i| i < 5 } %>+ <ul class="flex flex-col mt-3 px-4 lg:px-10">+ <% main_options.each do |option| %>+ <li>+ <%= f.label "filter_options_#{filter.name}_#{option.name}", class: "flex items-center gap-2 cursor-pointer group text-sm h-10", data: { searchable_list_target: "item", text: option.name } do %>+ <%= f.check_box "filter[options][#{filter.name}][]",+ { checked: permitted_products_params.dig(:filter, :options, filter.name)&.include?(option.name),+ class: "input-checkbox group-focus-within:outline" },+ option.name,+ nil %>+ <%= option.presentation %>+ <span class="opacity-50">+ (<%= products_count_for_filter(filter.name, option.id) %>)+ </span>+ <% end %>+ </li>+ <% end %>+ </ul>+ <% if filter_values.size > 5 %>+ <ul class='st-accordion__content flex flex-col gap-3 pt-3' data-accordion-id="more_<%= filter.name %>">+ <% rest_of_the_options.each do |option| %>+ <li class="px-4 lg:px-10">+ <%= f.label "filter_options_#{filter.name}_#{option.name}", class: "flex items-center gap-2 cursor-pointer group text-sm h-10", data: { searchable_list_target: "item", text: option.name } do %>+ <%= f.check_box "filter[options][#{filter.name}][]",+ { checked: permitted_products_params.dig(:filter, :options, filter.name)&.include?(option.name),+ class: "input-checkbox group-focus-within:outline" },+ option.name,+ nil %>+ <%= option.presentation %>+ <span class="opacity-50">+ (<%= products_count_for_filter(filter.name, option.id) %>)+ </span>+ <% end %>+ </li>+ <% end %>+ </ul>+ <%= link_to Spree.t(:show_all), "#more_#{filter.name}",+ class: "flex justify-between w-full st-accordion__icon text-sm font-semibold uppercase px-4 lg:px-10 #{'st-accordion__icon--opened' if permitted_products_params.dig(:filter, filter.name)&.present?} mt-3",+ data: { action: 'accordion#toggle:prevent',+ accordion_opened_text_param: Spree.t(:show_less),+ accordion_closed_text_param: Spree.t(:show_all) } %>+ <% end %>+ </div>+ </div>+<% end %>diff --git a/storefront/app/views/themes/default/spree/products/filters/_price.html.erb b/storefront/app/views/themes/default/spree/products/filters/_price.html.erbnew file mode 100644index 0000000000..b0d000f32f--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/filters/_price.html.erb@@ -0,0 +1,35 @@+<div+ class="st-accordion"+ data-controller='accordion'+ data-accordion-close-others-value="false">+ <%= link_to "#price_filter", class: "cursor-pointer uppercase flex items-center justify-between h-10 px-4 lg:px-10 text-sm tracking-widest focus:outline-none transition duration-150 ease-in-out #{'st-accordion__icon--opened' if params.dig(:filter, :min_price).present? || params.dig(:filter, :max_price).present?}", data: { action: 'accordion#toggle:prevent' } do %>+ <%=Spree.t(:price) %>+ <%= render 'spree/shared/icons/chevron_down' %>+ <% end %>+ <% min_price_value = [params.dig(:filter, :min_price).presence&.to_f, filter_price_range[:min].floor].compact.max %>+ <% max_price_value = [params.dig(:filter, :max_price).presence&.to_f, filter_price_range[:max].ceil].compact.min %>+ <div+ class='st-accordion__content flex flex-col gap-2'+ data-accordion-id='price_filter'+ data-controller="no-ui-slider"+ data-no-ui-slider-start-value="[<%= min_price_value %>, <%= max_price_value %>]"+ data-no-ui-slider-range-value="[<%= filter_price_range[:min].floor %>,<%= filter_price_range[:max].ceil %>]">+ <div class="flex justify-between gap-6 px-4 lg:px-10 lg:text-sm">+ <div class="relative w-1/2">+ <%= f.number_field filter_price_range[:min].floor, class: "pl-16 without-arrows w-full peer focus:border-primary focus:ring-primary", inputmode: "numeric", name: "filter[min_price]", data: { no_ui_slider_target: "minInput" }, id: "price_from", value: params.dig(:filter, :min_price).present? ? min_price_value.to_i : nil, placeholder: filter_price_range[:min].floor %>+ <label class="absolute left-0 top-0 flex pl-3 items-center h-full text-input-text peer-placeholder-shown:opacity-50" for="price_from">+ from <%= currency_symbol(current_currency) %>+ </label>+ </div>+ <div class="relative w-1/2">+ <%= f.number_field filter_price_range[:max].ceil, class: "pl-[2.75rem] without-arrows w-full peer focus:border-primary focus:ring-primary", placeholder: filter_price_range[:max].ceil, inputmode: "numeric", name: "filter[max_price]", data: { no_ui_slider_target: "maxInput" }, id: "price_to", value: params.dig(:filter, :max_price).present? ? max_price_value.to_i : nil %>+ <label class="absolute left-0 top-0 flex pl-3 items-center h-full text-input-text peer-placeholder-shown:opacity-50" for="price_to">+ to <%= currency_symbol(current_currency) %>+ </label>+ </div>+ </div>+ <div class="px-4 lg:px-10 mt-[11px] h-[10px]">+ <div data-no-ui-slider-target="slider"></div>+ </div>+ </div>+</div>diff --git a/storefront/app/views/themes/default/spree/products/filters/_taxons.erb b/storefront/app/views/themes/default/spree/products/filters/_taxons.erbnew file mode 100644index 0000000000..34674ba660--- /dev/null+++ b/storefront/app/views/themes/default/spree/products/filters/_taxons.erb@@ -0,0 +1,76 @@+<% filter_taxons = filter_taxons_for_taxonomy(taxonomy) %>++<% if filter_taxons.any? %>+ <div+ class="st-accordion"+ data-controller='accordion'+ data-accordion-close-others-value="false">+ <%= link_to "#taxonomy_filter_#{taxonomy.id}", class: "cursor-pointer uppercase flex items-center justify-between h-10 px-4 lg:px-10 text-sm tracking-widest focus:outline-none transition duration-150 ease-in-out #{'st-accordion__icon--opened' if params[:filter].nil? || current_taxon.present? || permitted_products_params.dig(:filter, :taxon_ids)&.present?}", data: { action: 'accordion#toggle:prevent' } do %>+ <%= taxonomy.name.singularize %>+ <%= render 'spree/shared/icons/chevron_down' %>+ <% end %>+ <div+ class='st-accordion__content'+ data-accordion-id="taxonomy_filter_<%= taxonomy.id %>"+ data-controller="searchable-list">+ <div class="relative mt-3 mx-4 lg:mx-10">+ <%= f.search_field :search,+ class: "w-full bg-accent focus:ring-primary focus:border-primary pl-10 border-none",+ placeholder: Spree.t(:search),+ data: { searchable_list_target: "input" } %>+ <span class="absolute left-0 top-0 flex items-center h-full pl-3">+ <%= render 'spree/shared/icons/search' %>+ </span>+ </div>+ <% first_taxons, rest_of_the_taxons = filter_taxons.partition.with_index { |_, i| i < 5 } %>+ <ul class="flex flex-col px-4 lg:px-10 mt-3">+ <% first_taxons.each do |taxon| %>+ <li>+ <%= f.label "filter_taxon_#{taxon.id}", class: "flex items-center gap-2 cursor-pointer group text-sm h-10", data: { searchable_list_target: "item", text: taxon.name } do %>+ <%= f.check_box "filter[taxon_ids][]",+ {+ checked: permitted_products_params.dig(:filter, :taxon_ids)&.include?(taxon.id.to_s),+ class: "input-checkbox group-focus-within:outline"+ },+ taxon.id,+ nil %>+ <%= taxon.name %>+ <span class="opacity-50">+ (<%= products_count_for_taxon(taxon) %>)+ </span>+ <% end %>+ </li>+ <% end %>+ </ul>++ <% if filter_taxons.size > 5 %>+ <ul class='st-accordion__content flex flex-col' data-accordion-id="more_taxonomy_filter_<%= taxonomy.id %>">+ <% rest_of_the_taxons.each do |taxon| %>+ <li class="px-4 lg:px-10">+ <%= f.label "filter_taxon_#{taxon.id}", class: "flex items-center gap-2 cursor-pointer group text-sm h-10", data: { searchable_list_target: "item", text: taxon.name } do %>+ <%= f.check_box "filter[taxon_ids][]",+ {+ checked: permitted_products_params.dig(:filter, :taxon_ids)&.include?(taxon.id.to_s),+ class: "input-checkbox group-focus-within:outline"+ },+ taxon.id,+ nil %>+ <%= taxon.name %>+ <span class="opacity-50">+ (<%= products_count_for_taxon(taxon) %>)+ </span>+ <% end %>+ </li>+ <% end %>+ </ul>+ <%= link_to Spree.t(:show_all), "#more_taxonomy_filter_#{taxonomy.id}",+ class: "flex justify-between w-full st-accordion__icon text-sm font-semibold uppercase px-4 lg:px-10 #{'st-accordion__icon--opened' if permitted_products_params.dig(:filter, :taxon_ids)&.present?} mt-3",+ data: {+ action: 'accordion#toggle:prevent',+ accordion_opened_text_param: Spree.t(:show_less),+ accordion_closed_text_param: Spree.t(:show_all)+ } %>+ <% end %>+ </div>+ </div>+<% end %>diff --git a/storefront/app/views/themes/default/spree/shared/_account_pane.html.erb b/storefront/app/views/themes/default/spree/shared/_account_pane.html.erbnew file mode 100644index 0000000000..267fec3970--- /dev/null+++ b/storefront/app/views/themes/default/spree/shared/_account_pane.html.erb@@ -0,0 +1,28 @@+<div+ id='account-pane'+ data-turbo-permanent+ data-slideover-account-target='overlay'+ class='fixed inset-0 flex flex-row-reverse z-50 transition-opacity hidden'+>+ <div class='fixed inset-0'>+ <div data-action='click->slideover-account#toggle' class='absolute inset-0 bg-background opacity-75'></div>+ </div>+ <div+ id='slideover-account'+ data-slideover-account-target='menu'+ class='relative sidebar-pane flex-1 !flex flex-col w-full bg-background text-text md:border-l border-default transition ease-in-out duration-300 translate-x-full'+ >+ <div class='p-4 gap-4 flex-shrink-0 flex items-center justify-between border-b border-default z-50'>+ <button+ data-action='slideover-account#toggle'+ class='flex items-center justify-center rounded-full focus:outline-none focus:bg-background'+ aria-label='Close account sidebar'+ >+ <%= render 'spree/shared/icons/cross' %>+ </button>+ <span class='text-xl font-medium uppercase leading-loose'><%= Spree.t(:account) %></span>+ <span></span>+ </div>+ <%= turbo_frame_tag "login", src: spree_login_path, loading: "lazy" %>+ </div>+</div>diff --git a/storefront/lib/geared_pagination/recordset_decorator.rb b/storefront/lib/geared_pagination/recordset_decorator.rbnew file mode 100644index 0000000000..2fd8457795--- /dev/null+++ b/storefront/lib/geared_pagination/recordset_decorator.rb@@ -0,0 +1,13 @@+# TODO: Remove this file when this issue is resolved:+# https://github.com/basecamp/geared_pagination/issues/8+module GearedPagination+ module RecordsetDecorator+ def records_count+ return @records_count if defined?(@records_count)++ @records_count ||= records.unscope(:limit).unscope(:offset).unscope(:select).unscope(:order).unscope(:group).unscope(:includes).size+ end+ end++ Recordset.prepend(RecordsetDecorator)+enddiff --git a/storefront/lib/generators/spree/storefront/install/templates/tailwind.config.js b/storefront/lib/generators/spree/storefront/install/templates/tailwind.config.jsindex 8f50678599..1937547814 100644--- a/storefront/lib/generators/spree/storefront/install/templates/tailwind.config.js+++ b/storefront/lib/generators/spree/storefront/install/templates/tailwind.config.js@@ -4,7 +4,6 @@ module.exports = {content: ['app/views/spree/**/*.erb','app/views/devise/**/*.erb',- 'engines/spree/storefront/app/views/**/*.erb'],plugins: [require('@tailwindcss/typography'),diff --git a/storefront/lib/spree_storefront.rb b/storefront/lib/spree_storefront.rbindex a1997cffb3..d0410c7e2f 100644--- a/storefront/lib/spree_storefront.rb+++ b/storefront/lib/spree_storefront.rb@@ -1 +1,2 @@require 'spree/storefront'+require 'geared_pagination/recordset_decorator'