<%= gettext("notes") %>

<.form :let={f} for={%{}} as={:search} phx-change="search" phx-submit="search" class="self-stretch flex flex-col items-stretch" > <%= text_input(f, :search_term, class: "input input-primary", value: @search, role: "search", phx_debounce: 300, placeholder: gettext("search") ) %> <%= if @notes |> Enum.empty?() do %>

<%= gettext("no notes found") %>

<% else %> <.live_component module={MemexWeb.Components.NotesTableComponent} id="notes-index-table" current_user={@current_user} notes={@notes} > <:actions :let={note}> <.link :if={Notes.owner?(note, @current_user)} patch={~p"/notes/#{note}/edit"} aria-label={dgettext("actions", "edit %{note_slug}", note_slug: note.slug)} > <%= dgettext("actions", "edit") %> <.link :if={Notes.owner_or_admin?(note, @current_user)} href="#" phx-click="delete" phx-value-id={note.id} data-confirm={dgettext("prompts", "are you sure?")} aria-label={dgettext("actions", "delete %{note_slug}", note_slug: note.slug)} > <%= dgettext("actions", "delete") %> <% end %> <.link :if={@current_user} patch={~p"/notes/new"} class="self-end btn btn-primary"> <%= dgettext("actions", "new note") %>
<.modal :if={@live_action in [:new, :edit]} return_to={~p"/notes"}> <.live_component module={MemexWeb.NoteLive.FormComponent} id={@note.id || :new} current_user={@current_user} title={@page_title} action={@live_action} note={@note} return_to={~p"/notes"} />