Browse Source

feat: declutter inbox (a lot)

main
Inhji Y. 6 months ago
parent
commit
a6fec0c0e0
  1. 20
      lib/mirage_web/live/inbox_live/item_component.ex
  2. 8
      lib/mirage_web/live/inbox_live/item_component.html.leex

20
lib/mirage_web/live/inbox_live/item_component.ex

@ -1,26 +1,6 @@
defmodule MirageWeb.InboxLive.ItemComponent do
use MirageWeb, :live_component
def render(assigns) do
~L"""
<%= live_patch to: Routes.note_show_path(MirageWeb.Endpoint, :show, @note), class: "card" do %>
<span>
<i class="bi <%= type_icon(@type) %>"></i>
</span>
<span>
<strong><%= @note.title %></strong>
<p><%= @note.content |> String.slice(0..50) %>..</p>
<p class="tags">
<span class="tag">Views: <%= @note.views %></span>
<%= for topic <- @note.topics do %>
<span class="tag"><%= topic.text %></span>
<% end %>
</p>
</span>
<% end %>
"""
end
defp type_icon(:at), do: "bi-dice-4"
defp type_icon(:today), do: "bi-calendar-date"
defp type_icon(:untagged), do: "bi-tag"

8
lib/mirage_web/live/inbox_live/item_component.html.leex

@ -0,0 +1,8 @@
<article>
<h2>
<%= live_patch @note.title, to: Routes.note_show_path(MirageWeb.Endpoint, :show, @note) %>
</h2>
<p>
<time><%= @note.inserted_at |> Timex.from_now() %></time>
</p>
</article>
Loading…
Cancel
Save