Reusable LiveComponent for displaying and managing comments on any resource.
Usage
<.live_component
module={PhoenixKit.Modules.Comments.Web.CommentsComponent}
id={"comments-#{@post.uuid}"}
resource_type="post"
resource_uuid={@post.uuid}
current_user={@current_user}
/>Required Attrs
resource_type- String identifying the resource type (e.g., "post")resource_uuid- UUID of the resourcecurrent_user- Current authenticated user structid- Unique component ID
Optional Attrs
enabled- Whether comments are enabled (default: true)show_likes- Show like/dislike buttons (default: false)title- Section title (default: "Comments")
Parent Notifications
After create/delete, sends to the parent LiveView:
{:comments_updated, %{resource_type: "post", resource_uuid: uuid, action: :created | :deleted}}
Summary
Functions
Callback implementation for Phoenix.LiveComponent.render/1.
Functions
Callback implementation for Phoenix.LiveComponent.render/1.
Attributes
comment(:map) (required)current_user(:map) (required)myself(:any) (required)