From 56730540b7e9b5ddc33748337a473d4449dbd9bf Mon Sep 17 00:00:00 2001 From: sloane <git@sloanelybutsurely.com> Date: Sat, 22 Feb 2025 07:17:51 -0500 Subject: [PATCH] add placeholder admin page --- lib/cms_web/components/layouts/admin.html.heex | 17 +++++++++++++++++ lib/cms_web/components/layouts/app.html.heex | 2 +- lib/cms_web/live/admin_live.ex | 15 +++++++++++++++ lib/cms_web/router.ex | 9 +++++++++ 4 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 lib/cms_web/components/layouts/admin.html.heex create mode 100644 lib/cms_web/live/admin_live.ex diff --git a/lib/cms_web/components/layouts/admin.html.heex b/lib/cms_web/components/layouts/admin.html.heex new file mode 100644 index 0000000..ef11a28 --- /dev/null +++ b/lib/cms_web/components/layouts/admin.html.heex @@ -0,0 +1,17 @@ +<div class="flex flex-row py-1 px-3 mb-2 border-b border-slate-100"> + admin mode +</div> +<div class="flex flex-col md:flex-row mx-auto max-w-3xl"> + <section class="flex flex-col p-2 gap-y-1 border-slate-100 border-b md:border-b-0"> + <.link navigate={~p"/"} class="font-bold hover:underline">sloanelybutsurely.com</.link> + <nav> + <ul> + <li><.link navigate={~p"/writing"} class="hover:underline">writing</.link></li> + <li><.link navigate={~p"/microblog"} class="hover:underline">microblog</.link></li> + </ul> + </nav> + </section> + <main class="p-2"> + {@inner_content} + </main> +</div> diff --git a/lib/cms_web/components/layouts/app.html.heex b/lib/cms_web/components/layouts/app.html.heex index 710ffa1..e737f45 100644 --- a/lib/cms_web/components/layouts/app.html.heex +++ b/lib/cms_web/components/layouts/app.html.heex @@ -8,7 +8,7 @@ </ul> </nav> </section> - <main> + <main class="p-2"> {@inner_content} </main> </div> diff --git a/lib/cms_web/live/admin_live.ex b/lib/cms_web/live/admin_live.ex new file mode 100644 index 0000000..3bf9f74 --- /dev/null +++ b/lib/cms_web/live/admin_live.ex @@ -0,0 +1,15 @@ +defmodule CMSWeb.AdminLive do + use CMSWeb, :live_view + + @impl true + def mount(_params, _session, socket) do + {:ok, socket} + end + + @impl true + def render(assigns) do + ~H""" + <h1>AdminLive</h1> + """ + end +end diff --git a/lib/cms_web/router.ex b/lib/cms_web/router.ex index 0275435..3878b7e 100644 --- a/lib/cms_web/router.ex +++ b/lib/cms_web/router.ex @@ -1,4 +1,5 @@ defmodule CMSWeb.Router do + alias CMSWeb.Layouts use CMSWeb, :router pipeline :browser do @@ -22,6 +23,14 @@ defmodule CMSWeb.Router do get "/microblog", PageController, :microblog end + live_session :admin, layout: {Layouts, :admin} do + scope "/admin", CMSWeb do + pipe_through :browser + + live "/", AdminLive + end + end + # Other scopes may use custom stacks. # scope "/api", CMSWeb do # pipe_through :api