From e1a5be8ef3ed7748c4e10ff46b99926f2ae29004 Mon Sep 17 00:00:00 2001 From: Kieran Date: Sun, 10 Mar 2024 14:31:45 -0700 Subject: [PATCH] Add support modals (#65) * Added fast indexing upgrade modal * Improved modal on smaller screens * Updated links to work again * Added donation modal * Reverted source fast index to 15 minutes * Removed unneeded HTML attributes from old alpine approach --- lib/pinchflat/startup_tasks.ex | 1 + lib/pinchflat_web.ex | 7 +- .../components/core_components.ex | 50 ++++++++------ .../custom_components/button_components.ex | 4 ++ lib/pinchflat_web/components/layouts.ex | 6 +- .../layouts/partials/donate_modal.heex | 26 +++++++ .../layouts/partials/sidebar.html.heex | 67 +++++++++++++------ .../layouts/partials/upgrade_button_live.ex | 40 +++++++++++ .../layouts/partials/upgrade_modal.heex | 28 ++++++++ .../components/layouts/root.html.heex | 10 ++- .../media_item_html/show.html.heex | 2 +- .../media_profile_html/edit.html.heex | 2 +- .../media_profile_html/index.html.heex | 2 +- .../media_profile_html/new.html.heex | 2 +- .../media_profile_html/show.html.heex | 4 +- .../page_html/onboarding_checklist.html.heex | 6 +- .../searches/search_html/show.html.heex | 2 +- .../sources/source_html/edit.html.heex | 2 +- .../sources/source_html/index.html.heex | 4 +- .../sources/source_html/new.html.heex | 2 +- .../sources/source_html/show.html.heex | 4 +- .../sources/source_html/source_form.html.heex | 15 +++-- 22 files changed, 218 insertions(+), 68 deletions(-) create mode 100644 lib/pinchflat_web/components/layouts/partials/donate_modal.heex 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..3b81cdb 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" > -