diff --git a/lib/chiya/channels/channel.ex b/lib/chiya/channels/channel.ex
index 5447108..b02bca5 100644
--- a/lib/chiya/channels/channel.ex
+++ b/lib/chiya/channels/channel.ex
@@ -9,6 +9,7 @@ defmodule Chiya.Channels.Channel do
field :name, :string
field :slug, ChannelSlug.Type
field :visibility, Ecto.Enum, values: [:public, :private, :unlisted]
+ field :layout, Ecto.Enum, values: [:default, :gallery]
many_to_many :notes, Chiya.Notes.Note,
join_through: "channels_notes",
@@ -20,10 +21,10 @@ defmodule Chiya.Channels.Channel do
@doc false
def changeset(channel, attrs) do
channel
- |> cast(attrs, [:name, :content, :visibility, :slug])
+ |> cast(attrs, [:name, :content, :visibility, :slug, :layout])
|> ChannelSlug.maybe_generate_slug()
|> ChannelSlug.unique_constraint()
- |> validate_required([:name, :content, :visibility, :slug])
+ |> validate_required([:name, :content, :visibility, :slug, :layout])
|> validate_exclusion(:slug, ~w(admin user dev))
end
end
diff --git a/lib/chiya_web/components/admin_components.ex b/lib/chiya_web/components/admin_components.ex
index 0898d6d..c824db1 100644
--- a/lib/chiya_web/components/admin_components.ex
+++ b/lib/chiya_web/components/admin_components.ex
@@ -107,7 +107,7 @@ defmodule ChiyaWeb.AdminComponents do
href={~p"/admin"}
class="text-xs leading-6 text-gray-900 dark:text-gray-100 font-semibold dark:hover:text-gray-300 hover:text-gray-700"
>
- Admin
+ <.icon name="hero-star-mini" class="w-4 h-4" /> Admin
diff --git a/lib/chiya_web/components/layouts/app.html.heex b/lib/chiya_web/components/layouts/app.html.heex
index a359e41..7c67fd8 100644
--- a/lib/chiya_web/components/layouts/app.html.heex
+++ b/lib/chiya_web/components/layouts/app.html.heex
@@ -5,25 +5,25 @@
href={~p"/admin/notes"}
class="text-xs font-semibold leading-6 text-gray-900 hover:text-gray-700 dark:text-gray-200"
>
- Notes
+ <.icon name="hero-document-text" class="w-4 h-4" /> Notes
<.link
href={~p"/admin/channels"}
class="text-xs font-semibold leading-6 text-gray-900 hover:text-gray-700 dark:text-gray-200"
>
- Channels
+ <.icon name="hero-speaker-wave" class="w-4 h-4" /> Channels
<.link
href={~p"/admin/identities"}
class="text-xs font-semibold leading-6 text-gray-900 hover:text-gray-700 dark:text-gray-200"
>
- Identities
+ <.icon name="hero-user" class="w-4 h-4" /> Identities
<.link
href={~p"/admin/settings"}
class="text-xs font-semibold leading-6 text-gray-900 hover:text-gray-700 dark:text-gray-200"
>
- Settings
+ <.icon name="hero-wrench-screwdriver" class="w-4 h-4" /> Settings
diff --git a/lib/chiya_web/controllers/channel_html/channel_form.html.heex b/lib/chiya_web/controllers/channel_html/channel_form.html.heex
index 9b3f577..c79604f 100644
--- a/lib/chiya_web/controllers/channel_html/channel_form.html.heex
+++ b/lib/chiya_web/controllers/channel_html/channel_form.html.heex
@@ -11,6 +11,13 @@
prompt="Choose a value"
options={Ecto.Enum.values(Chiya.Channels.Channel, :visibility)}
/>
+ <.input
+ field={f[:layout]}
+ type="select"
+ label="Layout"
+ prompt="Choose a value"
+ options={Ecto.Enum.values(Chiya.Channels.Channel, :layout)}
+ />
<.input field={f[:slug]} type="text" label="Slug" />
<:actions>
<.button>Save Channel
diff --git a/priv/repo/migrations/20230407194659_add_layout_to_channel.exs b/priv/repo/migrations/20230407194659_add_layout_to_channel.exs
new file mode 100644
index 0000000..a529cb4
--- /dev/null
+++ b/priv/repo/migrations/20230407194659_add_layout_to_channel.exs
@@ -0,0 +1,9 @@
+defmodule Chiya.Repo.Migrations.AddLayoutToChannel do
+ use Ecto.Migration
+
+ def change do
+ alter table(:channels) do
+ add :layout, :string, default: "default"
+ end
+ end
+end