Class: DaisyUI::Chat
- Inherits:
-
BaseComponent
- Object
- ViewComponent::Base
- BaseComponent
- DaisyUI::Chat
- Includes:
- ActionView::Helpers::TagHelper
- Defined in:
- app/components/daisy_ui/data_display/chat.rb
Overview
Chat component for displaying a list of chat messages
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(messages: [], current_user_id: nil, **system_arguments) ⇒ Chat
constructor
A new instance of Chat.
Constructor Details
#initialize(messages: [], current_user_id: nil, **system_arguments) ⇒ Chat
Returns a new instance of Chat.
46 47 48 49 50 51 52 53 |
# File 'app/components/daisy_ui/data_display/chat.rb', line 46 def initialize(messages: [], current_user_id: nil, **system_arguments) = @current_user_id = current_user_id super(**system_arguments) # Pre-populate bubbles from messages array if provided .each { || add_bubble() } end |
Instance Method Details
#call ⇒ Object
55 56 57 58 59 60 61 |
# File 'app/components/daisy_ui/data_display/chat.rb', line 55 def call return unless bubbles.any? content_tag(:div, class: 'w-full') do safe_join(bubbles) end end |