summaryrefslogtreecommitdiff
path: root/lib/lsg_web/components
diff options
context:
space:
mode:
authorhref <href@random.sh>2021-09-07 08:14:33 +0200
committerhref <href@random.sh>2021-09-07 08:14:33 +0200
commitb10f9797cb15d0e8a4e4b5014138dc5bfd875d88 (patch)
tree67877b6b91db23f768720245d0b5754a2670d87b /lib/lsg_web/components
parentalcoolog: fix ets (diff)
live fixes/improvements
Diffstat (limited to 'lib/lsg_web/components')
-rw-r--r--lib/lsg_web/components/component.ex4
-rw-r--r--lib/lsg_web/components/event_component.ex7
-rw-r--r--lib/lsg_web/components/message_component.ex2
3 files changed, 13 insertions, 0 deletions
diff --git a/lib/lsg_web/components/component.ex b/lib/lsg_web/components/component.ex
index 37d75e3..d504129 100644
--- a/lib/lsg_web/components/component.ex
+++ b/lib/lsg_web/components/component.ex
@@ -3,6 +3,10 @@ defmodule LSGWeb.Component do
@date_time_default_format "%F %H:%M"
@date_time_formats %{"time-24-with-seconds" => "%H:%M:%S"}
+ def naive_date_time_utc(assigns = %{at: nil}) do
+ ""
+ end
+
def naive_date_time_utc(assigns = %{format: format}) do
assigns = assign(assigns, :format, Map.get(@date_time_formats, format, format))
~H"""
diff --git a/lib/lsg_web/components/event_component.ex b/lib/lsg_web/components/event_component.ex
index 3b9cd3b..fa81d19 100644
--- a/lib/lsg_web/components/event_component.ex
+++ b/lib/lsg_web/components/event_component.ex
@@ -1,6 +1,13 @@
defmodule LSGWeb.EventComponent do
use Phoenix.Component
+ def content(assigns = %{event: %{type: :day_changed}}) do
+ ~H"""
+ Day changed:
+ <span class="reason"><%= Date.to_string(@date) %></span>
+ """
+ end
+
def content(assigns = %{event: %{type: :quit}}) do
~H"""
<LSGWeb.Component.nick self={@self} nick={@user.nick} user_id={@user.id} account_id={@user.account} />
diff --git a/lib/lsg_web/components/message_component.ex b/lib/lsg_web/components/message_component.ex
index 2381411..5997754 100644
--- a/lib/lsg_web/components/message_component.ex
+++ b/lib/lsg_web/components/message_component.ex
@@ -3,6 +3,8 @@ defmodule LSGWeb.MessageComponent do
def content(assigns) do
~H"""
+ <LSGWeb.Component.naive_date_time_utc datetime={@message.at} format="time-24-with-seconds" />
+ <div class="inline-block font-bold flex-none cursor-default"><%= @message.sender.nick %></div>
<div class="inline-block flex-grow cursor-default"><%= @text %></div>
"""
end