From 17633cc07263f2b04959e012ef057f16181f6ea5 Mon Sep 17 00:00:00 2001 From: Kieran Eglin Date: Sun, 10 Mar 2024 11:57:00 -0700 Subject: [PATCH] Added fast indexing upgrade modal --- lib/pinchflat/startup_tasks.ex | 1 + lib/pinchflat_web.ex | 7 ++-- .../components/core_components.ex | 25 ++++++------ .../custom_components/button_components.ex | 4 ++ .../layouts/partials/upgrade_button_live.ex | 40 +++++++++++++++++++ .../layouts/partials/upgrade_modal.heex | 28 +++++++++++++ .../components/layouts/root.html.heex | 9 ++++- .../sources/source_html/source_form.html.heex | 14 ++++--- 8 files changed, 105 insertions(+), 23 deletions(-) create mode 100644 lib/pinchflat_web/components/layouts/partials/upgrade_button_live.ex create mode 100644 lib/pinchflat_web/components/layouts/partials/upgrade_modal.heex diff --git a/lib/pinchflat/startup_tasks.ex b/lib/pinchflat/startup_tasks.ex index 41d0597..e4b1aec 100644 --- a/lib/pinchflat/startup_tasks.ex +++ b/lib/pinchflat/startup_tasks.ex @@ -32,5 +32,6 @@ defmodule Pinchflat.StartupTasks do defp apply_default_settings do Settings.fetch!(:onboarding, true) + Settings.fetch!(:pro_enabled, false) end end diff --git a/lib/pinchflat_web.ex b/lib/pinchflat_web.ex index b9b303a..e7fbc32 100644 --- a/lib/pinchflat_web.ex +++ b/lib/pinchflat_web.ex @@ -54,8 +54,9 @@ defmodule PinchflatWeb do def live_view do quote do - use Phoenix.LiveView, - layout: {PinchflatWeb.Layouts, :app} + use Phoenix.Component, global_prefixes: ~w(x-) + + use Phoenix.LiveView alias Pinchflat.Settings @@ -75,7 +76,7 @@ defmodule PinchflatWeb do def html do quote do - use Phoenix.Component + use Phoenix.Component, global_prefixes: ~w(x-) # Import convenience functions from controllers import Phoenix.Controller, diff --git a/lib/pinchflat_web/components/core_components.ex b/lib/pinchflat_web/components/core_components.ex index 3bd8486..67693c6 100644 --- a/lib/pinchflat_web/components/core_components.ex +++ b/lib/pinchflat_web/components/core_components.ex @@ -40,6 +40,7 @@ defmodule PinchflatWeb.CoreComponents do """ attr :id, :string, required: true attr :show, :boolean, default: false + attr :allow_close, :boolean, default: true attr :on_cancel, JS, default: %JS{} slot :inner_block, required: true @@ -50,9 +51,9 @@ defmodule PinchflatWeb.CoreComponents do phx-mounted={@show && show_modal(@id)} phx-remove={hide_modal(@id)} data-cancel={JS.exec(@on_cancel, "phx-remove")} - class="relative z-50 hidden" + class="relative z-99999 hidden" > -