|
|
@ -10,24 +10,51 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.AuthorCard do
|
|
|
|
def author_card(assigns) do
|
|
|
|
def author_card(assigns) do
|
|
|
|
~H"""
|
|
|
|
~H"""
|
|
|
|
<div class="w-full max-w-sm bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700 mx-auto my-3">
|
|
|
|
<div class="w-full max-w-sm bg-white border border-gray-200 rounded-lg shadow-sm dark:bg-gray-800 dark:border-gray-700 mx-auto my-3">
|
|
|
|
<%= if @current_user != nil and Role.can_moderate?(@current_user.role) do %>
|
|
|
|
<%= if @current_user != nil and Role.can_moderate?(@current_user.role) and is_nil(@author.dbi_server) do %>
|
|
|
|
<div class="flex justify-end px-4 pt-4">
|
|
|
|
<div class="flex justify-end px-4 pt-4">
|
|
|
|
<button id={"dropdownButton#{@author.id}"} data-dropdown-toggle={"dropdown#{@author.id}"} class="inline-block text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:ring-4 focus:outline-none focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-1.5" type="button">
|
|
|
|
<button
|
|
|
|
|
|
|
|
id={"dropdownButton#{@author.id}"}
|
|
|
|
|
|
|
|
data-dropdown-toggle={"dropdown#{@author.id}"}
|
|
|
|
|
|
|
|
class="inline-block text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 focus:ring-4 focus:outline-none focus:ring-gray-200 dark:focus:ring-gray-700 rounded-lg text-sm p-1.5"
|
|
|
|
|
|
|
|
type="button"
|
|
|
|
|
|
|
|
>
|
|
|
|
<span class="sr-only">Open dropdown</span>
|
|
|
|
<span class="sr-only">Open dropdown</span>
|
|
|
|
<svg class="w-5 h-5" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 16 3">
|
|
|
|
<svg
|
|
|
|
|
|
|
|
class="w-5 h-5"
|
|
|
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
|
|
|
fill="currentColor"
|
|
|
|
|
|
|
|
viewBox="0 0 16 3"
|
|
|
|
|
|
|
|
>
|
|
|
|
<path d="M2 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm6.041 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM14 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Z" />
|
|
|
|
<path d="M2 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Zm6.041 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3ZM14 0a1.5 1.5 0 1 1 0 3 1.5 1.5 0 0 1 0-3Z" />
|
|
|
|
</svg>
|
|
|
|
</svg>
|
|
|
|
</button>
|
|
|
|
</button>
|
|
|
|
<!-- Dropdown menu -->
|
|
|
|
<!-- Dropdown menu -->
|
|
|
|
<div id={"dropdown#{@author.id}"} class="z-10 hidden text-base list-none bg-white divide-y divide-gray-100 rounded-lg shadow-sm w-44 dark:bg-gray-700">
|
|
|
|
<div
|
|
|
|
|
|
|
|
id={"dropdown#{@author.id}"}
|
|
|
|
|
|
|
|
class="z-10 hidden text-base list-none bg-white divide-y divide-gray-100 rounded-lg shadow-sm w-44 dark:bg-gray-700"
|
|
|
|
|
|
|
|
>
|
|
|
|
<ul class="py-2" aria-labelledby="dropdownButton">
|
|
|
|
<ul class="py-2" aria-labelledby="dropdownButton">
|
|
|
|
<li>
|
|
|
|
<li>
|
|
|
|
<.link navigate={~p"/authors/#{@author.id}/edit"}
|
|
|
|
<.link
|
|
|
|
|
|
|
|
navigate={~p"/authors/#{@author.id}/edit"}
|
|
|
|
class="flex items-center block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white"
|
|
|
|
class="flex items-center block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white"
|
|
|
|
>
|
|
|
|
>
|
|
|
|
<svg xmlns="http://www.w3.org/2000/svg" class="h-4 w-4 mr-2 -ml-0.5" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
|
|
|
<svg
|
|
|
|
<path d="M17.414 2.586a2 2 0 00-2.828 0L7 10.172V13h2.828l7.586-7.586a2 2 0 000-2.828z"></path>
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
<path fill-rule="evenodd" d="M2 6a2 2 0 012-2h4a1 1 0 010 2H4v10h10v-4a1 1 0 112 0v4a2 2 0 01-2 2H4a2 2 0 01-2-2V6z" clip-rule="evenodd"></path>
|
|
|
|
class="h-4 w-4 mr-2 -ml-0.5"
|
|
|
|
|
|
|
|
viewBox="0 0 20 20"
|
|
|
|
|
|
|
|
fill="currentColor"
|
|
|
|
|
|
|
|
aria-hidden="true"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<path d="M17.414 2.586a2 2 0 00-2.828 0L7 10.172V13h2.828l7.586-7.586a2 2 0 000-2.828z">
|
|
|
|
|
|
|
|
</path>
|
|
|
|
|
|
|
|
<path
|
|
|
|
|
|
|
|
fill-rule="evenodd"
|
|
|
|
|
|
|
|
d="M2 6a2 2 0 012-2h4a1 1 0 010 2H4v10h10v-4a1 1 0 112 0v4a2 2 0 01-2 2H4a2 2 0 01-2-2V6z"
|
|
|
|
|
|
|
|
clip-rule="evenodd"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
</path>
|
|
|
|
</svg>
|
|
|
|
</svg>
|
|
|
|
Edit
|
|
|
|
Edit
|
|
|
|
</.link>
|
|
|
|
</.link>
|
|
|
@ -39,10 +66,26 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.AuthorCard do
|
|
|
|
<div class="flex flex-col items-center py-5 text-center">
|
|
|
|
<div class="flex flex-col items-center py-5 text-center">
|
|
|
|
<.link navigate={~p"/authors/#{@author.id}"}>
|
|
|
|
<.link navigate={~p"/authors/#{@author.id}"}>
|
|
|
|
<%= if @author.avatar_url != nil do %>
|
|
|
|
<%= if @author.avatar_url != nil do %>
|
|
|
|
<img class="w-36 h-36 mb-3 rounded-full shadow-lg" src={@author.avatar_url} alt={"#{@author.name} image"} />
|
|
|
|
<img
|
|
|
|
|
|
|
|
class="w-36 h-36 mb-3 rounded-full shadow-lg"
|
|
|
|
|
|
|
|
src={@author.avatar_url}
|
|
|
|
|
|
|
|
alt={"#{@author.name} image"}
|
|
|
|
|
|
|
|
/>
|
|
|
|
<% else %>
|
|
|
|
<% else %>
|
|
|
|
<div class="relative w-36 h-36 overflow-hidden bg-gray-100 rounded-full dark:bg-gray-600">
|
|
|
|
<div class="relative w-36 h-36 overflow-hidden bg-gray-100 rounded-full dark:bg-gray-600">
|
|
|
|
<svg class="absolute w-36 h-36 text-gray-400" fill="currentColor" viewBox="0 0 20 20" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z" clip-rule="evenodd"></path></svg>
|
|
|
|
<svg
|
|
|
|
|
|
|
|
class="absolute w-36 h-36 text-gray-400"
|
|
|
|
|
|
|
|
fill="currentColor"
|
|
|
|
|
|
|
|
viewBox="0 0 20 20"
|
|
|
|
|
|
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
<path
|
|
|
|
|
|
|
|
fill-rule="evenodd"
|
|
|
|
|
|
|
|
d="M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z"
|
|
|
|
|
|
|
|
clip-rule="evenodd"
|
|
|
|
|
|
|
|
>
|
|
|
|
|
|
|
|
</path>
|
|
|
|
|
|
|
|
</svg>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
<% end %>
|
|
|
|
</.link>
|
|
|
|
</.link>
|
|
|
@ -50,7 +93,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.AuthorCard do
|
|
|
|
<.link navigate={~p"/authors/#{@author.id}"}>
|
|
|
|
<.link navigate={~p"/authors/#{@author.id}"}>
|
|
|
|
<h5 class="mb-1 text-xl font-medium text-gray-900 dark:text-white">{@author.name}</h5>
|
|
|
|
<h5 class="mb-1 text-xl font-medium text-gray-900 dark:text-white">{@author.name}</h5>
|
|
|
|
</.link>
|
|
|
|
</.link>
|
|
|
|
<span class="text-sm text-gray-500 dark:text-gray-400">{@author.description}</span>
|
|
|
|
<span class="text-sm text-gray-500 dark:text-gray-400">{@author.brief_description}</span>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|