diff options
author | href <href@random.sh> | 2021-09-03 04:04:21 +0200 |
---|---|---|
committer | href <href@random.sh> | 2021-09-03 04:04:21 +0200 |
commit | 5399fc818cf821c75f9f19fd00bf7905ba7fe7e3 (patch) | |
tree | 00408724f9778cc7323b1459782a762626d39b6a /lib/lsg_web/components/event_component.ex | |
parent | assets.. (diff) |
various fixes, web client wip, pubsub events
Diffstat (limited to '')
-rw-r--r-- | lib/lsg_web/components/event_component.ex | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/lib/lsg_web/components/event_component.ex b/lib/lsg_web/components/event_component.ex new file mode 100644 index 0000000..3b9cd3b --- /dev/null +++ b/lib/lsg_web/components/event_component.ex @@ -0,0 +1,36 @@ +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 |