summaryrefslogblamecommitdiff
path: root/lib/lsg_web/components/event_component.ex
blob: 3b9cd3b3e54a9b23af8efbd3318f342930798a89 (plain) (tree)



































                                                                                                          
defmodule LSGWeb.EventComponent do
  use Phoenix.Component

  def content(assigns = %{event: %{type: :quit}}) do
    ~H"""
    <LSGWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
    has quit:
    <span class="reason"><%= @reason %></span>
    """
  end

  def content(assigns = %{event: %{type: :part}}) do
    ~H"""
    <LSGWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
    has left:
    <span class="reason"><%= @reason %></span>
    """
  end

  def content(assigns = %{event: %{type: :nick}}) do
    ~H"""
    <span class="old-nick"><%= @old_nick %></span>
    is now known as
    <LSGWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
    """
  end

  def content(assigns = %{event: %{type: :join}}) do
    ~H"""
    <LSGWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
    joined
    """
  end


end