Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: spotlights #438

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions lib/safira_web/live/backoffice/spotlights_live/form_component.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
defmodule SafiraWeb.Backoffice.SpotlightLive.FormComponent do
use SafiraWeb, :live_component

@impl true
def render(assigns) do
~H"""
<div>
<.page title={@title}>
<h1><%= @title %></h1>
</.page>
</div>
"""
end
end
25 changes: 25 additions & 0 deletions lib/safira_web/live/backoffice/spotlights_live/index.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
defmodule SafiraWeb.Backoffice.SpotlightLive.Index do
use SafiraWeb, :backoffice_view

@impl true
def mount(_params, _session, socket) do
{:ok, assign(socket, show_form: false, title: "Spotlights")}
end

@impl true
def handle_params(params, _url, socket) do
{:noreply,
socket
|> apply_action(socket.assigns.live_action, params)}
end

defp apply_action(socket, :config, _params) do
socket
|> assign(:page_title, "Config")
end

defp apply_action(socket, :index, _params) do
socket
|> assign(:page_title, "Spotlights")
end
end
26 changes: 26 additions & 0 deletions lib/safira_web/live/backoffice/spotlights_live/index.html.heex
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<.page title="Spotlights">
<:actions>
<div>
<.link patch={~p"/dashboard/spotlights/config"}>
<.button>
<.icon name="hero-cog-6-tooth" class="w-5 h-5" />
</.button>
</.link>
</div>
</:actions>
</.page>

<.modal
:if={@live_action in [:config]}
id="spotlight-config"
show
on_cancel={JS.patch(~p"/dashboard/spotlights")}
>
<.live_component
id="spotlight-config"
show
module={SafiraWeb.Backoffice.SpotlightLive.FormComponent}
title={@page_title}
patch={~p"/dashboard/spotlights"}
/>
</.modal>
5 changes: 5 additions & 0 deletions lib/safira_web/router.ex
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,11 @@ defmodule SafiraWeb.Router do
scope "/dashboard", Backoffice do
pipe_through :require_staff_user

scope "/spotlights", SpotlightLive do
live "/", Index, :index
live "/config", Index, :config
end

scope "/attendees", AttendeeLive do
live "/", Index, :index
live "/:id", Show, :show
Expand Down
Loading