- <.link navigate={@navigate} class="text-sm font-semibold leading-6 text-zinc-900 hover:text-zinc-700">
+ <.link href={@href} class="text-sm font-semibold leading-6 text-zinc-900 hover:text-zinc-700">
<.icon name="hero-arrow-left-solid" class="h-3 w-3" />
<%= render_slot(@inner_block) %>
@@ -685,7 +697,6 @@ defmodule PinchflatWeb.CoreComponents do
)
|> show("##{id}-container")
|> JS.add_class("overflow-hidden", to: "body")
- |> JS.focus_first(to: "##{id}-content")
end
def hide_modal(js \\ %JS{}, id) do
@@ -697,7 +708,6 @@ defmodule PinchflatWeb.CoreComponents do
|> hide("##{id}-container")
|> JS.hide(to: "##{id}", transition: {"block", "block", "hidden"})
|> JS.remove_class("overflow-hidden", to: "body")
- |> JS.pop_focus()
end
@doc """
diff --git a/lib/pinchflat_web/components/custom_components/button_components.ex b/lib/pinchflat_web/components/custom_components/button_components.ex
index a278577..304e280 100644
--- a/lib/pinchflat_web/components/custom_components/button_components.ex
+++ b/lib/pinchflat_web/components/custom_components/button_components.ex
@@ -14,7 +14,9 @@ defmodule PinchflatWeb.CustomComponents.ButtonComponents do
attr :color, :string, default: "bg-primary"
attr :rounding, :string, default: "rounded-sm"
attr :class, :string, default: ""
+ attr :type, :string, default: "submit"
attr :disabled, :boolean, default: false
+ attr :rest, :global
slot :inner_block, required: true
@@ -26,9 +28,11 @@ defmodule PinchflatWeb.CustomComponents.ButtonComponents do
"#{@rounding} inline-flex items-center justify-center px-8 py-4",
"#{@color}",
"hover:bg-opacity-90 lg:px-8 xl:px-10",
+ "disabled:bg-opacity-50 disabled:cursor-not-allowed disabled:text-gray-2",
@class
]}
disabled={@disabled}
+ {@rest}
>
<%= render_slot(@inner_block) %>
diff --git a/lib/pinchflat_web/components/layouts.ex b/lib/pinchflat_web/components/layouts.ex
index 42172ec..0efadc1 100644
--- a/lib/pinchflat_web/components/layouts.ex
+++ b/lib/pinchflat_web/components/layouts.ex
@@ -6,14 +6,16 @@ defmodule PinchflatWeb.Layouts do
attr :icon, :string, required: true
attr :text, :string, required: true
- attr :navigate, :any, required: true
+ attr :href, :any, required: true
+ attr :target, :any, default: "_self"
def sidebar_item(assigns) do
# I'm testing out grouping classes here. Tentative order: font, layout, color, animation, state-modifiers
~H"""
<.link
- navigate={@navigate}
+ href={@href}
+ target={@target}
class={[
"font-medium text-bodydark1",
"group relative flex items-center gap-2.5 rounded-sm px-4 py-2 duration-300 ease-in-out",
diff --git a/lib/pinchflat_web/components/layouts/partials/donate_modal.heex b/lib/pinchflat_web/components/layouts/partials/donate_modal.heex
new file mode 100644
index 0000000..a74d089
--- /dev/null
+++ b/lib/pinchflat_web/components/layouts/partials/donate_modal.heex
@@ -0,0 +1,26 @@
+<.modal id="donate-modal" allow_close={true}>
+
+ Donate
+ Thank you for your support :)
+
+ If you find the project valuable and want to support its development, a
+ <.inline_link href="https://www.paypal.me/kieraneglin">donation
+ would be greatly appreciated.
+
+
+ Plus, $5 USD from any donation over $10 USD will be donated to
+ <.inline_link href="https://www.eff.org/">The Electronic Frontier Foundation
+ who defend your online liberties and backed
+ <.inline_code>youtube-dl
+ when Google took them down<.inline_link href="https://github.com/github/dmca/blob/9a85e0f021f7967af80e186b890776a50443f06c/2020/11/2020-11-16-RIAA-reversal-effletter.pdf">
+ <.icon name="hero-arrow-top-right-on-square" class="h-3 w-3" />
+ .
+
+
+ <.link href="https://www.paypal.me/kieraneglin" target="_blank">
+ <.button color="bg-primary" class="w-full mt-8">
+ Donate
+
+
+
+
diff --git a/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex b/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex
index 13b72e1..b116ddc 100644
--- a/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex
+++ b/lib/pinchflat_web/components/layouts/partials/sidebar.html.heex
@@ -1,31 +1,58 @@
diff --git a/lib/pinchflat_web/components/layouts/partials/upgrade_button_live.ex b/lib/pinchflat_web/components/layouts/partials/upgrade_button_live.ex
new file mode 100644
index 0000000..89c205b
--- /dev/null
+++ b/lib/pinchflat_web/components/layouts/partials/upgrade_button_live.ex
@@ -0,0 +1,40 @@
+defmodule Pinchflat.UpgradeButtonLive do
+ use PinchflatWeb, :live_view
+
+ def render(assigns) do
+ ~H"""
+
+
+ <.button
+ class="w-full mt-4"
+ type="button"
+ disabled={@button_disabled}
+ phx-click={hide_modal("upgrade-modal")}
+ x-on:click="setTimeout(() => { proEnabled = true }, 200)"
+ >
+ Unlock Pro
+
+ """
+ end
+
+ def mount(_params, _session, socket) do
+ {:ok, assign(socket, :button_disabled, true)}
+ end
+
+ def handle_event("check_matching_text", %{"unlock-pro-textbox" => text}, socket) do
+ normalized_text =
+ text
+ |> String.trim()
+ |> String.downcase()
+
+ if normalized_text == "got it!" do
+ Settings.set!(:pro_enabled, true)
+
+ {:noreply, update(socket, :button_disabled, fn _ -> false end)}
+ else
+ {:noreply, update(socket, :button_disabled, fn _ -> true end)}
+ end
+ end
+end
diff --git a/lib/pinchflat_web/components/layouts/partials/upgrade_modal.heex b/lib/pinchflat_web/components/layouts/partials/upgrade_modal.heex
new file mode 100644
index 0000000..e517855
--- /dev/null
+++ b/lib/pinchflat_web/components/layouts/partials/upgrade_modal.heex
@@ -0,0 +1,28 @@
+<.modal id="upgrade-modal" allow_close={false}>
+
+ Pro Mode
+ Don't worry - Pinchflat is completely free :)
+
+ If you find the project valuable and want to support its development, a
+ <.inline_link href="https://www.paypal.me/kieraneglin">donation
+ would be greatly appreciated.
+
+
+ Plus, $5 USD from any donation over $10 USD will be donated to
+ <.inline_link href="https://www.eff.org/">The Electronic Frontier Foundation
+ who defend your online liberties and backed
+ <.inline_code>youtube-dl
+ when Google took them down<.inline_link href="https://github.com/github/dmca/blob/9a85e0f021f7967af80e186b890776a50443f06c/2020/11/2020-11-16-RIAA-reversal-effletter.pdf">
+ <.icon name="hero-arrow-top-right-on-square" class="h-3 w-3" />
+ . You do not need to donate to unlock Pro. It's just a way to say thanks!
+
+
+
+ To unlock Pro, simply type
+ <.inline_code>got it!
+ into the text box and press the button.
+
+
+ <%= live_render(@conn, Pinchflat.UpgradeButtonLive) %>
+
+
diff --git a/lib/pinchflat_web/components/layouts/root.html.heex b/lib/pinchflat_web/components/layouts/root.html.heex
index c562aa7..1e3fd03 100644
--- a/lib/pinchflat_web/components/layouts/root.html.heex
+++ b/lib/pinchflat_web/components/layouts/root.html.heex
@@ -12,7 +12,15 @@
-
+
<%= @inner_content %>
+
+ <.donate_modal conn={@conn} />
+
+ <.upgrade_modal conn={@conn} />
+
diff --git a/lib/pinchflat_web/controllers/media_items/media_item_html/show.html.heex b/lib/pinchflat_web/controllers/media_items/media_item_html/show.html.heex
index 8056359..00bcb54 100644
--- a/lib/pinchflat_web/controllers/media_items/media_item_html/show.html.heex
+++ b/lib/pinchflat_web/controllers/media_items/media_item_html/show.html.heex
@@ -1,6 +1,6 @@
- <.link navigate={~p"/sources/#{@media_item.source_id}"}>
+ <.link href={~p"/sources/#{@media_item.source_id}"}>
<.icon name="hero-arrow-left" class="w-10 h-10 hover:dark:text-white" />
diff --git a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/edit.html.heex b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/edit.html.heex
index 6570b9b..3022c54 100644
--- a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/edit.html.heex
+++ b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/edit.html.heex
@@ -1,5 +1,5 @@
- <.link navigate={~p"/media_profiles"}>
+ <.link href={~p"/media_profiles"}>
<.icon name="hero-arrow-left" class="w-10 h-10 hover:dark:text-white" />
Edit Media Profile
diff --git a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/index.html.heex b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/index.html.heex
index 7ba4ad8..c0443d2 100644
--- a/lib/pinchflat_web/controllers/media_profiles/media_profile_html/index.html.heex
+++ b/lib/pinchflat_web/controllers/media_profiles/media_profile_html/index.html.heex
@@ -3,7 +3,7 @@
Media Profiles