Browse Source

feat: clean up a lot lot lot

main
Inhji Y. 3 months ago
parent
commit
d3fb2606af
  1. 30
      lib/mirage_web/live/inbox_live/index.html.leex
  2. 2
      lib/mirage_web/live/link_live/index.html.leex
  3. 15
      lib/mirage_web/live/list_live/index.html.leex
  4. 4
      lib/mirage_web/live/note_live/index.ex
  5. 24
      lib/mirage_web/live/note_live/index.html.leex
  6. 2
      lib/mirage_web/templates/layout/root.html.leex
  7. 13
      lib/mirage_web/templates/topic/index.html.eex

30
lib/mirage_web/live/inbox_live/index.html.leex

@ -2,22 +2,22 @@
<h1>Inbox</h1>
</header>
<section class="bg-content width-full">
<div class="cards list">
<%= for note <- @notes.today do %>
<%= live_component @socket, MirageWeb.InboxLive.ItemComponent, note: note, type: :today %>
<% end %>
<hr>
<%= for note <- @notes.at do %>
<%= live_component @socket, MirageWeb.InboxLive.ItemComponent, note: note, type: :at %>
<% end %>
<section>
<h3><i class="bi bi-link-45deg"></i> Unlinked</h3>
<%= for note <- @notes.unlinked do %>
<%= live_component @socket, MirageWeb.InboxLive.ItemComponent, note: note, type: :unlinked %>
<% end %>
<%= for note <- @notes.unlinked do %>
<%= live_component @socket, MirageWeb.InboxLive.ItemComponent, note: note, type: :unlinked %>
<% end %>
</section>
<%= for note <- @notes.untagged do %>
<%= live_component @socket, MirageWeb.InboxLive.ItemComponent, note: note, type: :untagged %>
<% end %>
</div>
<hr>
<section>
<h3><i class="bi bi-tag"></i> Untagged</h3>
<%= for note <- @notes.untagged do %>
<%= live_component @socket, MirageWeb.InboxLive.ItemComponent, note: note, type: :untagged %>
<% end %>
</section>

2
lib/mirage_web/live/link_live/index.html.leex

@ -2,6 +2,8 @@
<h1>Listing <%= Enum.count(@links) %> Links</h1>
</header>
<hr>
<%= if @live_action in [:new, :edit] do %>
<%= live_modal @socket, MirageWeb.LinkLive.FormComponent,
id: @link.id || :new,

15
lib/mirage_web/live/list_live/index.html.leex

@ -3,6 +3,8 @@
<%= live_patch "New List", to: Routes.list_index_path(@socket, :new), class: "button" %>
</header>
<hr>
<%= if @live_action in [:new, :edit] do %>
<%= live_modal @socket, MirageWeb.ListLive.FormComponent,
id: @list.id || :new,
@ -12,14 +14,13 @@
return_to: Routes.list_index_path(@socket, :index) %>
<% end %>
<div class="bg-content width-full">
<div class="cards">
<section>
<article>
<%= for list <- @lists do %>
<%= live_redirect to: Routes.list_show_path(@socket, :show, list) do %>
<div class="card">
<strong><%= list.name %></strong>
</div>
<h2><%= list.name %></h2>
<% end %>
<% end %>
</div>
</div>
</article>
</section>

4
lib/mirage_web/live/note_live/index.ex

@ -8,12 +8,14 @@ defmodule MirageWeb.NoteLive.Index do
def mount(_params, session, socket) do
last_edited = Mirage.Notes.list_notes(:last_edited)
most_viewed = Mirage.Notes.list_notes(:most_viewed)
today = Mirage.Notes.list_notes(:today)
{:ok,
socket
|> assign(:notes, %{
last_edited: last_edited,
most_viewed: most_viewed
most_viewed: most_viewed,
today: today
})
|> with_user(session)}
end

24
lib/mirage_web/live/note_live/index.html.leex

@ -16,8 +16,24 @@
<hr>
<section class="bg-content width-full">
<h3>✒️ Last Edited</h3>
<section>
<h3><i class="bi bi-calendar2-day"></i> Daily</h3>
<%= for note <- @notes.today do %>
<article>
<h4>
<%= link note.title, to: Routes.note_show_path(@socket, :show, note) %>
<time><%= note.updated_at |> Timex.from_now() %></time>
</h4>
<p><%= note.content |> String.slice(0..50) %></p>
</article>
<% end %>
</section>
<hr>
<section>
<h3><i class="bi bi-pencil"></i> Last Edited</h3>
<%= for note <- @notes.last_edited do %>
<article>
@ -32,8 +48,8 @@
<hr>
<section class="bg-content width-full">
<h3>🕶️ Most Viewed</h3>
<section>
<h3><i class="bi bi-eyeglasses"></i> Most Viewed</h3>
<%= for note <- @notes.most_viewed do %>
<article>

2
lib/mirage_web/templates/layout/root.html.leex

@ -37,6 +37,8 @@
<%= @inner_content %>
</main>
<hr>
<footer>
<p>
<%= raw @_s.footer_text.value_html %>

13
lib/mirage_web/templates/topic/index.html.eex

@ -1,13 +1,16 @@
<header class="hero">
<h1>Listing Topics</h1>
<p><%= Enum.count(@topics) %> Topics</p>
<h1>Listing <%= Enum.count(@topics) %> Topics</h1>
</header>
<hr>
<section class="bg-content width-full grid cards wrap">
<%= for topic <- @topics do %>
<%= link to: Routes.topic_path(@conn, :show, topic), class: "col card", id: "topic-#{topic.id}" do %>
<strong><%= topic.text %></strong>
<article>
<%= link to: Routes.topic_path(@conn, :show, topic), class: "col card", id: "topic-#{topic.id}" do %>
<h2><%= topic.text %></h2>
<% end %>
<p><%= Enum.count(topic.notes) %> Notes, <%= Enum.count(topic.links) %> links</p>
<% end %>
</article>
<% end %>
</section>
Loading…
Cancel
Save