Compare commits
2
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5c31715211 | ||
|
|
2e023fa2f7 |
@@ -546,8 +546,8 @@ defmodule DecentralisedBookIndexWeb.CoreComponents do
|
|||||||
|
|
||||||
~H"""
|
~H"""
|
||||||
<div class="overflow-y-auto px-4 sm:overflow-visible sm:px-0 ">
|
<div class="overflow-y-auto px-4 sm:overflow-visible sm:px-0 ">
|
||||||
<table class="w-full text-sm text-left text-gray-500 dark:text-gray-400 bg-white dark:bg-gray-800 relative shadow-md sm:rounded-lg overflow-hidden">
|
<table class="w-full text-sm text-left text-gray-500 dark:text-gray-400 bg-slate-100 dark:bg-gray-800 relative shadow-md sm:rounded-lg overflow-hidden">
|
||||||
<thead class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400">
|
<thead class="text-xs text-gray-700 uppercase bg-slate-200 dark:bg-gray-700 dark:text-gray-400">
|
||||||
<tr>
|
<tr>
|
||||||
<th :for={col <- @col} class="p-4 font-normal">{col[:label]}</th>
|
<th :for={col <- @col} class="p-4 font-normal">{col[:label]}</th>
|
||||||
<th :if={@action != []} class="relative p-0 pb-4">
|
<th :if={@action != []} class="relative p-0 pb-4">
|
||||||
@@ -560,7 +560,11 @@ defmodule DecentralisedBookIndexWeb.CoreComponents do
|
|||||||
phx-update={match?(%Phoenix.LiveView.LiveStream{}, @rows) && "stream"}
|
phx-update={match?(%Phoenix.LiveView.LiveStream{}, @rows) && "stream"}
|
||||||
class="relative divide-zinc-100 text-sm leading-6 text-zinc-700"
|
class="relative divide-zinc-100 text-sm leading-6 text-zinc-700"
|
||||||
>
|
>
|
||||||
<tr :for={row <- @rows} id={@row_id && @row_id.(row)} class=" bg-white shadow-md dark:bg-gray-800 hover:bg-gray-100 dark:bg-gray-850 dark:hover:bg-gray-700">
|
<tr
|
||||||
|
:for={row <- @rows}
|
||||||
|
id={@row_id && @row_id.(row)}
|
||||||
|
class="bg-slate-100 shadow-md dark:bg-gray-800 hover:bg-slate-300 dark:bg-gray-850 dark:hover:bg-gray-700"
|
||||||
|
>
|
||||||
<td
|
<td
|
||||||
:for={{col, i} <- Enum.with_index(@col)}
|
:for={{col, i} <- Enum.with_index(@col)}
|
||||||
phx-click={@row_click && @row_click.(row)}
|
phx-click={@row_click && @row_click.(row)}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ 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-slate-100 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) and is_nil(@author.dbi_server) 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
|
<button
|
||||||
@@ -32,7 +32,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.AuthorCard do
|
|||||||
<!-- Dropdown menu -->
|
<!-- Dropdown menu -->
|
||||||
<div
|
<div
|
||||||
id={"dropdown#{@author.id}"}
|
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"
|
class="z-10 hidden text-base list-none bg-slate-200 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>
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.BookCard do
|
|||||||
|
|
||||||
def book_card(assigns) do
|
def book_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-slate-100 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) and is_nil(@book.dbi_server) do %>
|
<%= if @current_user != nil and Role.can_moderate?(@current_user.role) and is_nil(@book.dbi_server) do %>
|
||||||
<div class="flex justify-end px-4 pt-4">
|
<div class="flex justify-end px-4 pt-4">
|
||||||
<button
|
<button
|
||||||
@@ -32,7 +32,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.BookCard do
|
|||||||
<!-- Dropdown menu -->
|
<!-- Dropdown menu -->
|
||||||
<div
|
<div
|
||||||
id={"dropdown#{@book.id}"}
|
id={"dropdown#{@book.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"
|
class="z-10 hidden text-base list-none bg-slate-200 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>
|
||||||
|
|||||||
@@ -14,37 +14,69 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.BookSearch do
|
|||||||
|
|
||||||
def book_search(assigns) do
|
def book_search(assigns) do
|
||||||
~H"""
|
~H"""
|
||||||
<div class="bg-white shadow-md dark:bg-gray-800 sm:rounded-lg">
|
<div class="bg-slate-100 shadow-md dark:bg-gray-800 sm:rounded-lg">
|
||||||
<div class="flex items-center justify-center p-4 flex-row space-y-0 space-x-4">
|
<div class="flex items-center justify-center p-4 flex-row space-y-0 space-x-4">
|
||||||
<div class="w-full grow">
|
<div class="w-full grow">
|
||||||
<form class="flex items-center" phx-change="search" phx-submit="search">
|
<form class="flex items-center" phx-change="search" phx-submit="search">
|
||||||
<label for="simple-search" class="sr-only">Search</label>
|
<label for="simple-search" class="sr-only">Search</label>
|
||||||
<div class="relative w-full">
|
<div class="relative w-full">
|
||||||
<div class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
|
<div class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
|
||||||
<svg aria-hidden="true" class="w-5 h-5 text-gray-500 dark:text-gray-400" fill="currentColor" viewbox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
<svg
|
||||||
<path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" />
|
aria-hidden="true"
|
||||||
|
class="w-5 h-5 text-gray-500 dark:text-gray-400"
|
||||||
|
fill="currentColor"
|
||||||
|
viewbox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill-rule="evenodd"
|
||||||
|
d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z"
|
||||||
|
clip-rule="evenodd"
|
||||||
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<input name="query" type="text" phx-debounce="300" autocomplete="off" id="simple-search" class="block w-full p-2 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-primary-500 focus:border-primary-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500" placeholder="Search" value={@search_query}>
|
<input
|
||||||
|
name="query"
|
||||||
|
type="text"
|
||||||
|
phx-debounce="300"
|
||||||
|
autocomplete="off"
|
||||||
|
id="simple-search"
|
||||||
|
class="block w-full p-2 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-primary-500 focus:border-primary-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500"
|
||||||
|
placeholder="Search"
|
||||||
|
value={@search_query}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<%= if @current_user != nil and Role.can_moderate?(@current_user.role) do %>
|
<%= if @current_user != nil and Role.can_moderate?(@current_user.role) do %>
|
||||||
<.link patch={~p"/books/new"} class="flex-shrink-0 my-auto">
|
<.link patch={~p"/books/new"} class="flex-shrink-0 my-auto">
|
||||||
<button type="button" class="flex items-center justify-between px-4 py-2 text-sm font-medium text-black dark:text-white rounded-lg bg-primary-700 hover:bg-primary-800 focus:ring-4 focus:ring-primary-300 dark:bg-primary-600 dark:hover:bg-primary-700 focus:outline-none dark:focus:ring-primary-800">
|
<button
|
||||||
<svg class="h-3.5 w-3.5 mr-2" fill="currentColor" viewbox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
type="button"
|
||||||
<path clip-rule="evenodd" fill-rule="evenodd" d="M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z" />
|
class="flex items-center justify-between px-4 py-2 text-sm font-medium text-black dark:text-white rounded-lg bg-primary-700 hover:bg-primary-800 focus:ring-4 focus:ring-primary-300 dark:bg-primary-600 dark:hover:bg-primary-700 focus:outline-none dark:focus:ring-primary-800"
|
||||||
</svg>
|
>
|
||||||
Add book
|
<svg
|
||||||
</button>
|
class="h-3.5 w-3.5 mr-2"
|
||||||
</.link>
|
fill="currentColor"
|
||||||
<% end %>
|
viewbox="0 0 20 20"
|
||||||
<.dropdown_settings
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
search_mode={@search_mode}
|
aria-hidden="true"
|
||||||
search_mode_options={@search_mode_options}
|
>
|
||||||
select_options={@select_options}
|
<path
|
||||||
selected_option={@selected_option}
|
clip-rule="evenodd"
|
||||||
/>
|
fill-rule="evenodd"
|
||||||
|
d="M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
Add book
|
||||||
|
</button>
|
||||||
|
</.link>
|
||||||
|
<% end %>
|
||||||
|
<.dropdown_settings
|
||||||
|
search_mode={@search_mode}
|
||||||
|
search_mode_options={@search_mode_options}
|
||||||
|
select_options={@select_options}
|
||||||
|
selected_option={@selected_option}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
@@ -58,17 +90,42 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.BookSearch do
|
|||||||
def dropdown_settings(assigns) do
|
def dropdown_settings(assigns) do
|
||||||
~H"""
|
~H"""
|
||||||
<div class="flex justify-end px-4">
|
<div class="flex justify-end px-4">
|
||||||
<button id="dropdownButtonSearchBook" data-dropdown-toggle="dropdownSearchBook" 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
|
||||||
<span class="sr-only">Open dropdown</span>
|
id="dropdownButtonSearchBook"
|
||||||
<svg class="w-5 h-5 text-gray-800 dark:text-white" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24">
|
data-dropdown-toggle="dropdownSearchBook"
|
||||||
<path stroke="currentColor" stroke-linecap="round" stroke-width="2" d="M20 6H10m0 0a2 2 0 1 0-4 0m4 0a2 2 0 1 1-4 0m0 0H4m16 6h-2m0 0a2 2 0 1 0-4 0m4 0a2 2 0 1 1-4 0m0 0H4m16 6H10m0 0a2 2 0 1 0-4 0m4 0a2 2 0 1 1-4 0m0 0H4"/>
|
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"
|
||||||
</svg>
|
type="button"
|
||||||
</button>
|
>
|
||||||
<!-- Dropdown menu -->
|
<span class="sr-only">Open dropdown</span>
|
||||||
<div id="dropdownSearchBook" class="z-10 hidden text-base list-none bg-white rounded-lg shadow-sm w-64 dark:bg-gray-700 p-2 flex flex-col gap-2">
|
<svg
|
||||||
<div class="flex items-center space-x-3 md:w-auto">
|
class="w-5 h-5 text-gray-800 dark:text-white"
|
||||||
<form phx-change="change-search-mode" class="w-full">
|
aria-hidden="true"
|
||||||
<select name="search_mode" id="search_mode" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
width="24"
|
||||||
|
height="24"
|
||||||
|
fill="none"
|
||||||
|
viewBox="0 0 24 24"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-linecap="round"
|
||||||
|
stroke-width="2"
|
||||||
|
d="M20 6H10m0 0a2 2 0 1 0-4 0m4 0a2 2 0 1 1-4 0m0 0H4m16 6h-2m0 0a2 2 0 1 0-4 0m4 0a2 2 0 1 1-4 0m0 0H4m16 6H10m0 0a2 2 0 1 0-4 0m4 0a2 2 0 1 1-4 0m0 0H4"
|
||||||
|
/>
|
||||||
|
</svg>
|
||||||
|
</button>
|
||||||
|
<!-- Dropdown menu -->
|
||||||
|
<div
|
||||||
|
id="dropdownSearchBook"
|
||||||
|
class="z-10 hidden text-base list-none bg-slate-200 rounded-lg shadow-sm w-64 dark:bg-gray-700 p-2 flex flex-col gap-2"
|
||||||
|
>
|
||||||
|
<div class="flex items-center space-x-3 md:w-auto">
|
||||||
|
<form phx-change="change-search-mode" class="w-full">
|
||||||
|
<select
|
||||||
|
name="search_mode"
|
||||||
|
id="search_mode"
|
||||||
|
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
|
||||||
|
>
|
||||||
<%= for {name, value} <- @search_mode_options do %>
|
<%= for {name, value} <- @search_mode_options do %>
|
||||||
<%= if value == @search_mode do %>
|
<%= if value == @search_mode do %>
|
||||||
<option value={value} selected>{name}</option>
|
<option value={value} selected>{name}</option>
|
||||||
@@ -77,11 +134,15 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.BookSearch do
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</select>
|
</select>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex items-center space-x-3 md:w-auto">
|
<div class="flex items-center space-x-3 md:w-auto">
|
||||||
<form phx-change="change-sort" class="w-full">
|
<form phx-change="change-sort" class="w-full">
|
||||||
<select name="sort_by" id="sort_by" class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
<select
|
||||||
|
name="sort_by"
|
||||||
|
id="sort_by"
|
||||||
|
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
|
||||||
|
>
|
||||||
<%= for {name, value} <- @select_options do %>
|
<%= for {name, value} <- @select_options do %>
|
||||||
<%= if value == @selected_option do %>
|
<%= if value == @selected_option do %>
|
||||||
<option value={value} selected>{name}</option>
|
<option value={value} selected>{name}</option>
|
||||||
@@ -90,9 +151,9 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.BookSearch do
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</select>
|
</select>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
"""
|
"""
|
||||||
end
|
end
|
||||||
|
|||||||
+35
-12
@@ -11,33 +11,56 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.JustSearchResources
|
|||||||
|
|
||||||
def just_search_resources(assigns) do
|
def just_search_resources(assigns) do
|
||||||
~H"""
|
~H"""
|
||||||
<div class="relative bg-white shadow-md dark:bg-gray-800 sm:rounded-lg">
|
<div class="relative bg-slate-100 shadow-md dark:bg-gray-800 sm:rounded-lg">
|
||||||
<div class="flex flex-col items-center justify-between p-4 space-y-3 md:flex-row md:space-y-0 md:space-x-4">
|
<div class="flex flex-col items-center justify-between p-4 space-y-3 md:flex-row md:space-y-0 md:space-x-4">
|
||||||
<div class="w-full grow">
|
<div class="w-full grow">
|
||||||
<form class="flex items-center" phx-change="search" phx-submit="search">
|
<form class="flex items-center" phx-change="search" phx-submit="search">
|
||||||
<label for="simple-search" class="sr-only">Search</label>
|
<label for="simple-search" class="sr-only">Search</label>
|
||||||
<div class="relative w-full">
|
<div class="relative w-full">
|
||||||
<div class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
|
<div class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
|
||||||
<svg aria-hidden="true" class="w-5 h-5 text-gray-500 dark:text-gray-400" fill="currentColor" viewbox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
<svg
|
||||||
<path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" />
|
aria-hidden="true"
|
||||||
|
class="w-5 h-5 text-gray-500 dark:text-gray-400"
|
||||||
|
fill="currentColor"
|
||||||
|
viewbox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill-rule="evenodd"
|
||||||
|
d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z"
|
||||||
|
clip-rule="evenodd"
|
||||||
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<input name="query" type="text" phx-debounce="300" autocomplete="off" id="simple-search" class="block w-full p-2 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-primary-500 focus:border-primary-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500" placeholder={@search_placeholder} value={@search_query}>
|
<input
|
||||||
|
name="query"
|
||||||
|
type="text"
|
||||||
|
phx-debounce="300"
|
||||||
|
autocomplete="off"
|
||||||
|
id="simple-search"
|
||||||
|
class="block w-full p-2 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-primary-500 focus:border-primary-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500"
|
||||||
|
placeholder={@search_placeholder}
|
||||||
|
value={@search_query}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col items-stretch justify-end flex-shrink-0 w-full space-y-2 md:w-auto md:flex-row md:space-y-0 md:items-center md:space-x-3">
|
<div class="flex flex-col items-stretch justify-end flex-shrink-0 w-full space-y-2 md:w-auto md:flex-row md:space-y-0 md:items-center md:space-x-3">
|
||||||
<div class="flex items-center w-full space-x-3 md:w-auto">
|
<div class="flex items-center w-full space-x-3 md:w-auto">
|
||||||
<form phx-change="change-sort" class="w-full">
|
<form phx-change="change-sort" class="w-full">
|
||||||
<select name="sort_by" id="sort_by" class="grow bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
<select
|
||||||
<%= for {name, value} <- @select_options do %>
|
name="sort_by"
|
||||||
<%= if value == @selected_option do %>
|
id="sort_by"
|
||||||
<option value={value} selected>{name}</option>
|
class="grow bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
|
||||||
<% else %>
|
>
|
||||||
<option value={value}>{name}</option>
|
<%= for {name, value} <- @select_options do %>
|
||||||
|
<%= if value == @selected_option do %>
|
||||||
|
<option value={value} selected>{name}</option>
|
||||||
|
<% else %>
|
||||||
|
<option value={value}>{name}</option>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
</select>
|
||||||
</select>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.Pagination do
|
|||||||
kind="primary"
|
kind="primary"
|
||||||
inverse
|
inverse
|
||||||
patch={"#{@endpoint}?#{page_params_which(@page, @params, "prev")}"}
|
patch={"#{@endpoint}?#{page_params_which(@page, @params, "prev")}"}
|
||||||
class="flex items-center justify-center px-4 h-10 ms-0 leading-tight text-gray-500 bg-white border border-e-0 border-gray-300 rounded-s-lg hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white"
|
class="flex items-center justify-center px-4 h-10 ms-0 leading-tight text-gray-500 bg-slate-100 border border-e-0 border-gray-300 rounded-s-lg hover:bg-slate-300 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white"
|
||||||
disabled={!AshPhoenix.LiveView.prev_page?(@page)}
|
disabled={!AshPhoenix.LiveView.prev_page?(@page)}
|
||||||
>
|
>
|
||||||
Previous
|
Previous
|
||||||
@@ -32,7 +32,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.Pagination do
|
|||||||
<a
|
<a
|
||||||
href={"#{@endpoint}?#{page_params_number(@page_params, @params, number)}"}
|
href={"#{@endpoint}?#{page_params_number(@page_params, @params, number)}"}
|
||||||
aria-current="page"
|
aria-current="page"
|
||||||
class="flex items-center justify-center px-4 h-10 text-blue-600 border border-gray-300 bg-blue-50 hover:bg-blue-100 hover:text-blue-700 dark:border-gray-700 dark:bg-gray-700 dark:text-white"
|
class="flex items-center justify-center px-4 h-10 text-blue-600 border border-gray-300 bg-blue-100 hover:bg-blue-200 hover:text-blue-700 dark:border-gray-700 dark:bg-gray-700 dark:text-white"
|
||||||
>
|
>
|
||||||
{number}
|
{number}
|
||||||
</a>
|
</a>
|
||||||
@@ -41,7 +41,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.Pagination do
|
|||||||
<li>
|
<li>
|
||||||
<a
|
<a
|
||||||
href={"#{@endpoint}?#{page_params_number(@page_params, @params, number)}"}
|
href={"#{@endpoint}?#{page_params_number(@page_params, @params, number)}"}
|
||||||
class="flex items-center justify-center px-4 h-10 leading-tight text-gray-500 bg-white border border-gray-300 hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white"
|
class="flex items-center justify-center px-4 h-10 leading-tight text-gray-500 bg-slate-100 border border-gray-300 hover:bg-slate-300 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white"
|
||||||
>
|
>
|
||||||
{number}
|
{number}
|
||||||
</a>
|
</a>
|
||||||
@@ -54,7 +54,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.Pagination do
|
|||||||
kind="primary"
|
kind="primary"
|
||||||
inverse
|
inverse
|
||||||
patch={"#{@endpoint}?#{page_params_which(@page, @params, "next")}"}
|
patch={"#{@endpoint}?#{page_params_which(@page, @params, "next")}"}
|
||||||
class="flex items-center justify-center px-4 h-10 leading-tight text-gray-500 bg-white border border-gray-300 rounded-e-lg hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white"
|
class="flex items-center justify-center px-4 h-10 leading-tight text-gray-500 bg-slate-100 border border-gray-300 rounded-e-lg hover:bg-slate-300 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white"
|
||||||
disabled={!AshPhoenix.LiveView.next_page?(@page)}
|
disabled={!AshPhoenix.LiveView.next_page?(@page)}
|
||||||
>
|
>
|
||||||
Next
|
Next
|
||||||
|
|||||||
@@ -17,27 +17,59 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.SearchResources do
|
|||||||
|
|
||||||
def search_resources(assigns) do
|
def search_resources(assigns) do
|
||||||
~H"""
|
~H"""
|
||||||
<div class="relative bg-white shadow-md dark:bg-gray-800 sm:rounded-lg">
|
<div class="relative bg-slate-100 shadow-md dark:bg-gray-800 sm:rounded-lg">
|
||||||
<div class="flex flex-col items-center justify-between p-4 space-y-3 md:flex-row md:space-y-0 md:space-x-4">
|
<div class="flex flex-col items-center justify-between p-4 space-y-3 md:flex-row md:space-y-0 md:space-x-4">
|
||||||
<div class="w-full grow">
|
<div class="w-full grow">
|
||||||
<form class="flex items-center" phx-change="search" phx-submit="search">
|
<form class="flex items-center" phx-change="search" phx-submit="search">
|
||||||
<label for="simple-search" class="sr-only">Search</label>
|
<label for="simple-search" class="sr-only">Search</label>
|
||||||
<div class="relative w-full">
|
<div class="relative w-full">
|
||||||
<div class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
|
<div class="absolute inset-y-0 left-0 flex items-center pl-3 pointer-events-none">
|
||||||
<svg aria-hidden="true" class="w-5 h-5 text-gray-500 dark:text-gray-400" fill="currentColor" viewbox="0 0 20 20" xmlns="http://www.w3.org/2000/svg">
|
<svg
|
||||||
<path fill-rule="evenodd" d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z" clip-rule="evenodd" />
|
aria-hidden="true"
|
||||||
|
class="w-5 h-5 text-gray-500 dark:text-gray-400"
|
||||||
|
fill="currentColor"
|
||||||
|
viewbox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
fill-rule="evenodd"
|
||||||
|
d="M8 4a4 4 0 100 8 4 4 0 000-8zM2 8a6 6 0 1110.89 3.476l4.817 4.817a1 1 0 01-1.414 1.414l-4.816-4.816A6 6 0 012 8z"
|
||||||
|
clip-rule="evenodd"
|
||||||
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<input name="query" type="text" phx-debounce="300" autocomplete="off" id="simple-search" class="block w-full p-2 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-primary-500 focus:border-primary-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500" placeholder={@search_placeholder} value={@search_query}>
|
<input
|
||||||
|
name="query"
|
||||||
|
type="text"
|
||||||
|
phx-debounce="300"
|
||||||
|
autocomplete="off"
|
||||||
|
id="simple-search"
|
||||||
|
class="block w-full p-2 pl-10 text-sm text-gray-900 border border-gray-300 rounded-lg bg-gray-50 focus:ring-primary-500 focus:border-primary-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-primary-500 dark:focus:border-primary-500"
|
||||||
|
placeholder={@search_placeholder}
|
||||||
|
value={@search_query}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
<div class="flex flex-col items-stretch justify-end flex-shrink-0 w-full space-y-2 md:w-auto md:flex-row md:space-y-0 md:items-center md:space-x-3">
|
<div class="flex flex-col items-stretch justify-end flex-shrink-0 w-full space-y-2 md:w-auto md:flex-row md:space-y-0 md:items-center md:space-x-3">
|
||||||
<%= if can_add?(@current_user, @moderator_role) do %>
|
<%= if can_add?(@current_user, @moderator_role) do %>
|
||||||
<.link patch={@resource_new_url}>
|
<.link patch={@resource_new_url}>
|
||||||
<button type="button" class="grow w-full flex items-center justify-left px-4 py-2 text-sm font-medium text-black dark:text-white rounded-lg bg-primary-700 hover:bg-primary-800 focus:ring-4 focus:ring-primary-300 dark:bg-primary-600 dark:hover:bg-primary-700 focus:outline-none dark:focus:ring-primary-800">
|
<button
|
||||||
<svg class="h-3.5 w-3.5 mr-2" fill="currentColor" viewbox="0 0 20 20" xmlns="http://www.w3.org/2000/svg" aria-hidden="true">
|
type="button"
|
||||||
<path clip-rule="evenodd" fill-rule="evenodd" d="M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z" />
|
class="grow w-full flex items-center justify-left px-4 py-2 text-sm font-medium text-black dark:text-white rounded-lg bg-primary-700 hover:bg-primary-800 focus:ring-4 focus:ring-primary-300 dark:bg-primary-600 dark:hover:bg-primary-700 focus:outline-none dark:focus:ring-primary-800"
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
class="h-3.5 w-3.5 mr-2"
|
||||||
|
fill="currentColor"
|
||||||
|
viewbox="0 0 20 20"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
aria-hidden="true"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
clip-rule="evenodd"
|
||||||
|
fill-rule="evenodd"
|
||||||
|
d="M10 3a1 1 0 011 1v5h5a1 1 0 110 2h-5v5a1 1 0 11-2 0v-5H4a1 1 0 110-2h5V4a1 1 0 011-1z"
|
||||||
|
/>
|
||||||
</svg>
|
</svg>
|
||||||
Add {@resource_type}
|
Add {@resource_type}
|
||||||
</button>
|
</button>
|
||||||
@@ -45,15 +77,19 @@ defmodule DecentralisedBookIndexWeb.Components.MyComponents.SearchResources do
|
|||||||
<% end %>
|
<% end %>
|
||||||
<div class="flex items-center w-full space-x-3 md:w-auto">
|
<div class="flex items-center w-full space-x-3 md:w-auto">
|
||||||
<form phx-change="change-sort" class="w-full">
|
<form phx-change="change-sort" class="w-full">
|
||||||
<select name="sort_by" id="sort_by" class="grow bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500">
|
<select
|
||||||
<%= for {name, value} <- @select_options do %>
|
name="sort_by"
|
||||||
<%= if value == @selected_option do %>
|
id="sort_by"
|
||||||
<option value={value} selected>{name}</option>
|
class="grow bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
|
||||||
<% else %>
|
>
|
||||||
<option value={value}>{name}</option>
|
<%= for {name, value} <- @select_options do %>
|
||||||
|
<%= if value == @selected_option do %>
|
||||||
|
<option value={value} selected>{name}</option>
|
||||||
|
<% else %>
|
||||||
|
<option value={value}>{name}</option>
|
||||||
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
</select>
|
||||||
</select>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyPartials.Navbar do
|
|||||||
|
|
||||||
def partial_navbar(assigns) do
|
def partial_navbar(assigns) do
|
||||||
~H"""
|
~H"""
|
||||||
<nav class="bg-white border-gray-200 px-4 lg:px-6 py-2.5 dark:bg-gray-800">
|
<nav class="bg-slate-100 border-gray-200 px-4 lg:px-6 py-2.5 dark:bg-gray-800">
|
||||||
<div class="flex flex-wrap justify-between items-center mx-auto max-w-screen-xl">
|
<div class="flex flex-wrap justify-between items-center mx-auto max-w-screen-xl">
|
||||||
<.link patch={~p"/books"} class="flex items-center">
|
<.link patch={~p"/books"} class="flex items-center">
|
||||||
<svg
|
<svg
|
||||||
@@ -153,7 +153,7 @@ defmodule DecentralisedBookIndexWeb.Components.MyPartials.Navbar do
|
|||||||
<!-- Dropdown menu -->
|
<!-- Dropdown menu -->
|
||||||
<div
|
<div
|
||||||
id="dropdown-user-info"
|
id="dropdown-user-info"
|
||||||
class="z-10 hidden text-base list-none bg-white rounded-lg shadow-sm w-40 dark:bg-gray-700 flex flex-col items-center pt-2 border dark:border-gray-600"
|
class="z-10 hidden text-base list-none bg-slate-100 rounded-lg shadow-sm w-40 dark:bg-gray-700 flex flex-col items-center pt-2 border dark:border-gray-600"
|
||||||
>
|
>
|
||||||
<%= if @current_user.role != :user do %>
|
<%= if @current_user.role != :user do %>
|
||||||
<p class="text-zinc-700 dark:text-white">
|
<p class="text-zinc-700 dark:text-white">
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Show do
|
|||||||
</:actions>
|
</:actions>
|
||||||
</.header>
|
</.header>
|
||||||
|
|
||||||
<div class="flex flex-col items-start gap-6 max-w-6xl mx-auto p-4 bg-gray-900 rounded-lg transition-all duration-300 md:prose md:block">
|
<div class="flex flex-col items-start gap-6 max-w-6xl mx-auto p-4 rounded-lg transition-all duration-300 md:prose md:block">
|
||||||
<%= if @author.avatar_url != nil do %>
|
<%= if @author.avatar_url != nil do %>
|
||||||
<img
|
<img
|
||||||
class="w-36 h-36 mb-3 rounded-full shadow-lg mx-auto md:float-left md:mr-4"
|
class="w-36 h-36 mb-3 rounded-full shadow-lg mx-auto md:float-left md:mr-4"
|
||||||
@@ -54,7 +54,7 @@ defmodule DecentralisedBookIndexWeb.AuthorLive.Show do
|
|||||||
|
|
||||||
<div class="flex-1 pt-2 lg:pt-0 min-h-36">
|
<div class="flex-1 pt-2 lg:pt-0 min-h-36">
|
||||||
<h2 class="mb-2 font-semibold leading-none text-gray-900 dark:text-white">Description</h2>
|
<h2 class="mb-2 font-semibold leading-none text-gray-900 dark:text-white">Description</h2>
|
||||||
<p class="text-gray-300 leading-relaxed">
|
<p class="text-zinc-800 dark:text-gray-400 leading-relaxed">
|
||||||
{@author.description}
|
{@author.description}
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user