diff options
Diffstat (limited to 'app/views/chat_messages')
-rw-r--r-- | app/views/chat_messages/_list.html.erb | 3 | ||||
-rw-r--r-- | app/views/chat_messages/_message.html.erb | 47 |
2 files changed, 50 insertions, 0 deletions
diff --git a/app/views/chat_messages/_list.html.erb b/app/views/chat_messages/_list.html.erb new file mode 100644 index 0000000..8b12fd2 --- /dev/null +++ b/app/views/chat_messages/_list.html.erb @@ -0,0 +1,3 @@ +<% @chat_messages.each do |chat_message| %> + <%= render "message", chat_message: chat_message %> +<% end %> diff --git a/app/views/chat_messages/_message.html.erb b/app/views/chat_messages/_message.html.erb new file mode 100644 index 0000000..e9663ec --- /dev/null +++ b/app/views/chat_messages/_message.html.erb @@ -0,0 +1,47 @@ +<% chat_room_text_class = case chat_message.chat_room.gid + when "cosmic" then "text-gray-400" + when "trade" then "text-blue-400" + when "help" then "text-pink-300" + when "system" then "text-red-500" + when "achievement" then "text-purple-400" + when "news" then "text-yellow-400" + else "text-gray-400" + end + + chat_room_prefix = case chat_message.chat_room.gid + when "cosmic" then "[C]" + when "trade" then "[T]" + when "help" then "[H]" + when "system" then "[S]" + when "achievement" then "[A]" + when "news" then "[N]" + else nil + end +%> +<p> + <span class="<%= chat_room_text_class %>"> + <span class="text-xs"><%= chat_message.created_at.strftime("%H:%M") %></span> + <%= chat_room_prefix %> + </span> + <% if chat_message.chat_room.gid == "system" %> + <span class="text-glow <%= chat_room_text_class %>"><%= chat_message.body %></span> + <% elsif chat_message.chat_room.gid == "news" %> + <span class="<%= chat_room_text_class %>"><%= chat_message.body %></span> + <% elsif chat_message.chat_room.gid == "achievement" %> + <%#= render "components/text/title", title: chat_message.target.current_title %> + <span class="<%= chat_room_text_class %>"> + <%# TODO: Sort out this subject/target stuff that I just half-blindly ported over from old Esoterra. %> + <%= chat_message.target&.name %> <%= chat_message.body %> + </span> + <% else %> + <% if chat_message.sender %> + <%#= render "components/text/title", title: chat_message.sender.current_title %> + <% end %> + <span class="<%= chat_room_text_class %>"> + <% if chat_message.sender %> + <span class="font-bold"><%= chat_message.sender.name %>:</span> + <% end %> + <%= chat_message.body %> + </span> + <% end %> +</p> |