diff --git a/lib/decentralised_book_index_web/components/my_components/author_card.ex b/lib/decentralised_book_index_web/components/my_components/author_card.ex index 0142273..dbc3b50 100644 --- a/lib/decentralised_book_index_web/components/my_components/author_card.ex +++ b/lib/decentralised_book_index_web/components/my_components/author_card.ex @@ -2,35 +2,40 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.AuthorCard do use Phoenix.Component use DecentralisedBookIndexWeb, :verified_routes + alias DecentralisedBookIndex.Accounts.Role + attr(:author, :map, required: true) + attr :current_user, :map, default: nil def author_card(assigns) do ~H"""
-
- - - + <% end %>
<.link navigate={~p"/authors/#{@author.id}"}> <%= if @author.avatar_url != nil do %> diff --git a/lib/decentralised_book_index_web/components/my_components/author_search.ex b/lib/decentralised_book_index_web/components/my_components/author_search.ex index 40b6ebc..02a0af8 100644 --- a/lib/decentralised_book_index_web/components/my_components/author_search.ex +++ b/lib/decentralised_book_index_web/components/my_components/author_search.ex @@ -2,9 +2,12 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.AuthorSearch do use Phoenix.Component use DecentralisedBookIndexWeb, :verified_routes + alias DecentralisedBookIndex.Accounts.Role + attr :search_query, :string, default: "" attr :select_options, :list, required: true attr :selected_option, :string, required: true + attr :current_user, :map, default: nil def author_search(assigns) do ~H""" @@ -24,14 +27,16 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.AuthorSearch do
- <.link patch={~p"/authors/new"}> - - + <%= if @current_user != nil and Role.can_moderate?(@current_user.role) do %> + <.link patch={~p"/authors/new"}> + + + <% end %>