Class: Www::RequestSmartplanSectionComponent

Inherits:
ApplicationComponent show all
Includes:
ActionView::Helpers::TagHelper, ActionView::Helpers::UrlHelper
Defined in:
app/components/www/request_smartplan_section_component.rb

Overview

ViewComponent: renders the request smartplan section block.

Constant Summary collapse

PRODUCT_CONFIGS =

Product type configurations

{
  floor_heating: {
    title: 'Free SmartPlan',
    icon: 'ruler-combined',
    application_type: 'Floor Heating',
    smartplan_link: '/floor-heating/smartplan',
    rae_avatar: 'rae-radiant-floor-heating-guide-kppkd5',
    rae_quote: "I'll create a custom installation layout showing exactly where your heating elements go, plus a complete materials list with pricing.",
    carousel_slides: [
      { image: 'smartplan-installation-master-bathroom-tile-f1965d', alt: 'SmartPlan Installation Layout' },
      { image: 'smartplan-heated-area-master-bathroom-ef6148', alt: 'SmartPlan Heated Area Plan' },
      { image: 'smartplan-itemized-product-quote-master-bathroom-a9d64f', alt: 'SmartPlan Itemized Quote' }
    ]
  },
  snow_melting: {
    title: 'Free SmartPlan',
    icon: 'snowflake',
    application_type: 'Snow Melting',
    smartplan_link: '/snow-melting/smartplan',
    rae_avatar: 'rae-radiant-floor-heating-guide-kppkd5',
    rae_quote: "I'll design a custom snow melting layout for your project, complete with cable spacing, electrical requirements, and a full quote.",
    carousel_slides: [
      { image: 'patio-snow-melting-example-design-mockup-beae21', alt: 'Patio Snow Melting SmartPlan Layout' },
      { image: 'snow-melting-cable-example-design-mockup-7e8f47', alt: 'Snow Melting Cable Design Layout' }
    ]
  }
}.freeze

Instance Method Summary collapse

Methods inherited from ApplicationComponent

#cms_link, #fetch_or_fallback, #image_asset_tag, #image_tag, #number_to_currency, #number_with_delimiter, #post_path, #post_url, #strip_tags

Constructor Details

#initialize(product_type: :floor_heating, area_name: nil, project_link: nil, border: nil) ⇒ RequestSmartplanSectionComponent

Returns a new instance of RequestSmartplanSectionComponent.

Parameters:

  • product_type (Symbol) (defaults to: :floor_heating)

    :floor_heating or :snow_melting

  • area_name (String) (defaults to: nil)

    The room/area name (e.g., "bathroom", "driveway")

  • project_link (String) (defaults to: nil)

    Link to view projects for this area

  • border (Symbol, nil) (defaults to: nil)

    Border style: :top, :bottom, or :both



41
42
43
44
45
46
47
48
# File 'app/components/www/request_smartplan_section_component.rb', line 41

def initialize(product_type: :floor_heating, area_name: nil, project_link: nil, border: nil)
  super()
  @product_type = product_type.to_sym
  @config = PRODUCT_CONFIGS[@product_type] || PRODUCT_CONFIGS[:floor_heating]
  @area_name = area_name || 'project'
  @project_link = project_link
  @border = border
end

Instance Method Details

#application_typeString

Returns human-readable application type (e.g., "Floor Heating").

Returns:

  • (String)

    human-readable application type (e.g., "Floor Heating")



70
71
72
# File 'app/components/www/request_smartplan_section_component.rb', line 70

def application_type
  @config[:application_type]
end

#border_classesString?

Returns Bootstrap border classes for the configured border style.

Returns:

  • (String, nil)

    Bootstrap border classes for the configured border style



51
52
53
54
55
56
57
# File 'app/components/www/request_smartplan_section_component.rb', line 51

def border_classes
  case @border
  when :top then 'border-top'
  when :bottom then 'border-bottom'
  when :both then 'border-top border-bottom'
  end
end

Returns Splide carousel options passed to the carousel element.

Returns:

  • (Hash)

    Splide carousel options passed to the carousel element



95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'app/components/www/request_smartplan_section_component.rb', line 95

def carousel_options
  {
    type: 'fade',
    perPage: 1,
    perMove: 1,
    arrows: true,
    pagination: true,
    autoplay: true,
    interval: 4000,
    pauseOnHover: true,
    rewind: true,
    speed: 600
  }
end

Returns carousel slide definitions (:image and :alt keys).

Returns:

  • (Array<Hash>)

    carousel slide definitions (:image and :alt keys)



90
91
92
# File 'app/components/www/request_smartplan_section_component.rb', line 90

def carousel_slides
  @config[:carousel_slides]
end

#iconString

Returns Font Awesome icon name for the configured product type.

Returns:

  • (String)

    Font Awesome icon name for the configured product type



65
66
67
# File 'app/components/www/request_smartplan_section_component.rb', line 65

def icon
  @config[:icon]
end

#rae_avatarString

Returns image key for Rae's avatar.

Returns:

  • (String)

    image key for Rae's avatar



80
81
82
# File 'app/components/www/request_smartplan_section_component.rb', line 80

def rae_avatar
  @config[:rae_avatar]
end

#rae_quoteString

Returns Rae's pitch quote for the configured product type.

Returns:

  • (String)

    Rae's pitch quote for the configured product type



85
86
87
# File 'app/components/www/request_smartplan_section_component.rb', line 85

def rae_quote
  @config[:rae_quote]
end

#show_project_link?Boolean

Returns whether the "view projects" link should be rendered.

Returns:

  • (Boolean)

    whether the "view projects" link should be rendered



111
112
113
# File 'app/components/www/request_smartplan_section_component.rb', line 111

def show_project_link?
  @project_link.present?
end

Returns path to the SmartPlan request page for this product type.

Returns:

  • (String)

    path to the SmartPlan request page for this product type



75
76
77
# File 'app/components/www/request_smartplan_section_component.rb', line 75

def smartplan_link
  @config[:smartplan_link]
end

#titleString

Returns section title for the configured product type.

Returns:

  • (String)

    section title for the configured product type



60
61
62
# File 'app/components/www/request_smartplan_section_component.rb', line 60

def title
  @config[:title]
end