Merge pull request 'devel' (#51) from devel into main

Reviewed-on: #51
This commit is contained in:
inhji 2023-04-08 09:58:23 +02:00
commit 418854f6bd
10 changed files with 32 additions and 21 deletions

View file

@ -84,8 +84,8 @@ const ResultItem = React.forwardRef(
className={classNames(
"flex justify-between items-center cursor-pointer px-4 py-3 dark:text-white",
{
"bg-emerald-50 dark:bg-emerald-900": active,
"border-l-2 border-emerald-300": active
"bg-gray-300 dark:bg-gray-600": active,
"border-l-2 border-gray-300": active
})}
>
<div className="flex gap-3 items-center text-sm dark:text-white">
@ -257,7 +257,7 @@ export default function KBar() {
<KBarPortal>
<KBarPositioner>
<KBarAnimator style={animatorStyle} className="bg-gray-50 border border-gray-100 shadow-sm dark:bg-gray-900 dark:border-gray-800">
<KBarSearch style={searchStyle} className="bg-gray-50 dark:bg-gray-900 border-b border-gray-100" />
<KBarSearch style={searchStyle} className="bg-gray-50 dark:bg-gray-900 border-b border-gray-100 text-gray-900 dark:text-gray-100" />
<RenderResults />
</KBarAnimator>
</KBarPositioner>

View file

@ -27,4 +27,12 @@ defmodule Chiya.Channels.Channel do
|> validate_required([:name, :content, :visibility, :slug, :layout])
|> validate_exclusion(:slug, ~w(admin user dev))
end
def icon(%Chiya.Channels.Channel{visibility: vis}) do
case(vis) do
:public -> "🌍"
:private -> "🔒"
:unlisted -> "👁️"
end
end
end

View file

@ -510,8 +510,8 @@ defmodule ChiyaWeb.CoreComponents do
end
~H"""
<div class="overflow-y-auto px-4 sm:overflow-visible sm:px-0">
<table class="mt-11 w-[40rem] sm:w-full">
<div class="overflow-y-auto px-4 sm:overflow-visible bg-white dark:bg-gray-950 pt-1 mt-10 rounded shadow">
<table class="mt-4 w-[40rem] sm:w-full">
<thead class="text-left text-[0.8125rem] leading-6 text-gray-500">
<tr>
<th :for={col <- @col} class="p-0 pb-4 pr-6 font-normal"><%= col[:label] %></th>
@ -574,7 +574,7 @@ defmodule ChiyaWeb.CoreComponents do
def list(assigns) do
~H"""
<div class="mt-14">
<div class="mt-10 bg-white dark:bg-gray-950 rounded shadow px-4">
<dl class="-my-4 divide-y divide-gray-100 dark:divide-gray-800">
<div :for={item <- @item} class="flex gap-4 py-4 sm:gap-8">
<dt class="w-1/4 flex-none text-[0.8125rem] leading-6 text-gray-500 dark:text-gray-300">

View file

@ -5,7 +5,7 @@ defmodule ChiyaWeb.ChannelController do
alias Chiya.Channels.Channel
def index(conn, _params) do
channels = Channels.list_channels()
channels = Channels.list_channels() |> Channels.preload_channel()
render(conn, :index, channels: channels)
end

View file

@ -1,5 +1,6 @@
<.header>
Listing Channels
<.icon name="hero-speaker-wave" /> Channels
<:subtitle>Channels are collections for your notes.</:subtitle>
<:actions>
<.link href={~p"/admin/channels/new"}>
<.button>New Channel</.button>
@ -9,7 +10,8 @@
<.table id="channels" rows={@channels} row_click={&JS.navigate(~p"/admin/channels/#{&1}")}>
<:col :let={channel} label="Name"><%= channel.name %></:col>
<:col :let={channel} label="Visibility"><%= channel.visibility %></:col>
<:col :let={channel} label="Visibility"><%= Chiya.Channels.Channel.icon(channel) %> <%= channel.visibility %></:col>
<:col :let={channel} label="Notes"><%= Enum.count(channel.notes) %></:col>
<:col :let={channel} label="Slug"><%= channel.slug %></:col>
<:action :let={channel}>
<div class="sr-only">

View file

@ -1,5 +1,5 @@
<.header>
Listing Identities
<.icon name="hero-user" /> Identities
<:actions>
<.link href={~p"/admin/identities/new"}>
<.button>New Identity</.button>

View file

@ -147,5 +147,8 @@ defmodule ChiyaWeb.NoteController do
end
defp to_channel_options(items \\ nil),
do: Enum.map(items || Chiya.Channels.list_channels(), fn c -> {c.name, c.id} end)
do:
Enum.map(items || Chiya.Channels.list_channels(), fn c ->
{Chiya.Channels.Channel.icon(c) <> " " <> c.name, c.id}
end)
end

View file

@ -1,5 +1,6 @@
<.header>
Listing Notes
<.icon name="hero-document-text" /> Notes
<:subtitle>Notes are the content, the heart of your site.</:subtitle>
<:actions>
<.link href={~p"/admin/notes/new"}>
<.button>New Note</.button>

View file

@ -1,5 +1,5 @@
<.header>
Settings
<.icon name="hero-wrench-screwdriver" /> Settings
<:subtitle>These are your site's settings.</:subtitle>
<:actions>
<%= if @setting == nil do %>

View file

@ -11,8 +11,8 @@ defmodule ChiyaWeb.NoteShowLive do
~H"""
<.header>
Note <%= @note.id %>
<:subtitle>This is a note record from your database.</:subtitle>
<%= @note.name %>
<:subtitle><%= @note.slug %></:subtitle>
<:actions>
<.link href={~p"/admin/notes/#{@note}/edit"}>
<.button>Edit note</.button>
@ -27,19 +27,16 @@ defmodule ChiyaWeb.NoteShowLive do
</.header>
<.list>
<:item title="Name"><%= @note.name %></:item>
<:item title="Content"><%= @note.content %></:item>
<:item title="Slug"><%= @note.slug %></:item>
<:item title="Published at"><%= @note.published_at %></:item>
<:item title="Published at"><%= pretty_date(@note.published_at) %> <span>(<%= from_now(@note.published_at) %>)</span></:item>
<:item title="Channels"><%= @channels %></:item>
<:item title="Kind"><%= @note.kind %></:item>
<:item title="Url"><%= @note.url %></:item>
<:item title="Channels"><%= @channels %></:item>
</.list>
<.line />
<details>
<summary>File Content</summary>
<summary class="text-gray-900 dark:text-gray-100">File Content</summary>
<section class="prose">
<%= raw ChiyaWeb.Markdown.render(@note.content) %>
</section>