analytics/lib/plausible_web/components/generic.ex

259 lines
7.3 KiB
Elixir
Raw Normal View History

Funnel site settings (#3039) * Update formatter config * Install LiveView JS integration & hooks * Temporarily update endpoint/session config * Optionally allow preloading funnels for goals * Site controller * Implement funnel settings lib/plausible_web/live/funnel_settings/combo_box.ex - restored from: 054de6e2 Fix the tab/blur bug again 20da4c89 Rename InputPicker to ComboBox lib/plausible_web/live/funnel_settings/form.ex - restored from: 9bedda3b Remove potential FIXME 20da4c89 Rename InputPicker to ComboBox 028036ad Review comments aea4ebc4 Access Funnel min/max steps via the __using__/1 macro 0dde27fd Remove inspect call eed588a7 Start testing the funnel editor 0e95228b Extract funnel settings test module 7b16ace5 Leverage aplinejs to deal with the tyranny 8dc6a3e7 wip cf228630 wip 30a43fd1 wip 89f10ecb wip 950a18d9 Dirty funnel save 298a6a53 wip 7690d50f wip 639c6238 fixup aa59adeb wip ff75c00b wip lib/plausible_web/live/funnel_settings/list.ex - restored from: 4eae122c Fix data-confirm attr interpolation 51f0397d Implement deleting funnels 1f6fe25d Add number of steps to funnels list 298a6a53 wip ff75c00b wip test/plausible_web/live/funnel_settings/funnel_settings/combo_box_test.exs - restored from: 20da4c89 Rename InputPicker to ComboBox test/plausible_web/live/funnel_settings/funnel_settings_test.exs - restored from: 34822ff4 Bootstrap InputPicker tests lib/plausible_web/live/funnel_settings.ex - restored from: 028036ad Review comments acd9c4f2 Prepare ephemeral funnel definitions so that users can test funnels 51f0397d Implement deleting funnels 0e95228b Extract funnel settings test module 8dc6a3e7 wip 89f10ecb wip 950a18d9 Dirty funnel save 298a6a53 wip aa59adeb wip ff75c00b wip test/plausible_web/controllers/error_report_controller_test.exs - restored from: 34822ff4 Bootstrap InputPicker tests test/support/html.ex - restored from: 0a53979d Improve InputPicker tests - include AlpineJS assertions 34822ff4 Bootstrap InputPicker tests lib/plausible_web/views/layout_view.ex - restored from: b490403b !ifxup lib/plausible_web/templates/site/settings_funnels.html.eex - restored from: 51f0397d Implement deleting funnels ea1315f3 Test funnels list in settings 7b16ace5 Leverage aplinejs to deal with the tyranny ff75c00b wip 4da25c35 Fixup lib/plausible_web/templates/layout/app.html.eex - restored from: ff75c00b wip * Add funnel settings route * Warn about funnels deletion when deleting goals lib/plausible_web/templates/site/settings_goals.html.eex - restored from: fdd9bcd0 Fixup f1e6364d Merge remote-tracking branch 'origin/master' into funnels-rebase 9d0b7c6d Fix markup error 4a4ddbdc Optionally preload funnels for goals and stub funnel-goal deletion ebdc4333 Extend the prompt in case of funnel-goal deletion 639c6238 fixup aa59adeb wip * Split new JS LiveView additions * Put funnels behind a feature flag * Integrate dashboard feature toggle * Update signing salt for live view * Update moduledocs * Update live reloader config * Use Phoenix.HTML.Safe for goal names * Workaround to get flashes working in embedded liveview * Keep feature toggles idempotent, rename property to setting We'll still retain the ability to flip bools on a lower level. * Update moduledocs * Make live flash disappear after 5s * Tailwind: purge .heex files too * Update docs link * Add live components to tailwind purge config * Update another flaky test Ref f0bdf872 cc @vinibrsl * Fix combobox input length w/ WebKit * Intoduce generic notice component * Revert "Fix combobox input length w/ WebKit" This reverts commit 3c653a6d85d5000167631e10ef45a93c13b41ed1. * Fix combobox input length on webkit * Make whole combobox item clickable, not only text * Fix glitch moving Save button on activation * Tweak dark mode * Show funnel form without waiting for funnel name input * Tweak dark mode * Include static Phoenix components in tailwind purge * Tune funnels form into a liveview of its own This is so that ComboBoxes can publish their selections and unavailable choices can be propagated to other siblings. * Push less data over websocket * Undo Lsp/formatter race condition * Fixup typespecs * Bust CI cache
2023-06-22 10:00:07 +03:00
defmodule PlausibleWeb.Components.Generic do
@moduledoc """
Generic reusable components
"""
use Phoenix.Component
Limit grandfathering to *active* subscribers and trials (#3524) * refactor asserting plan generation in plans_test.exs * stop grandfathering old expired trials For users who registered before the business tiers release, we want to offer a chance to subscribe to a grandfathered plan. However, if they let their trial expire and don't subscribe in the next 10 days, they'll lose that opportunity. * stop grandfathering expired subscriptions * remove default title and icon from Generic.notice * fix bug with dismissable notice classList is null when dismissable_id is not given * alias Plausible.Auth.User * Refactor Generic.notice component Make it easy to apply different colors * move subscription_cancelled_notice across the app And remove from user settings > subscription box. Also, include a note about losing grandfathered status when letting the subscription expire. * allow full width in Generic.notice * use Generic.notice for subscription_past_due_notice * use Generic.notice for subscription_paused_notice * prevent two notices clashing into each other with gap-y-2 * define attrs for phx components * optimize for light mode * make subscription cancelled notice dismissable but if it's dismiss, show it in the place where it was before in the account settings > subscription box * make function private * replace function doc with regular comment to avoid compile warning * use array for classnames Co-authored-by: Vinicius Brasil <vini@hey.com> * fix typos in function doc --------- Co-authored-by: Vinicius Brasil <vini@hey.com>
2023-11-16 18:40:50 +03:00
@notice_themes %{
yellow: %{
bg: "bg-yellow-50 dark:bg-yellow-100",
icon: "text-yellow-400",
title_text: "text-yellow-800 dark:text-yellow-900",
body_text: "text-yellow-700 dark:text-yellow-800"
},
red: %{
bg: "bg-red-100",
icon: "text-red-700",
title_text: "text-red-800 dark:text-red-900",
body_text: "text-red-700 dark:text-red-800"
}
}
attr(:type, :string, default: "button")
attr(:class, :string, default: "")
attr(:disabled, :boolean, default: false)
attr(:rest, :global)
slot(:inner_block)
def button(assigns) do
~H"""
<button
type={@type}
disabled={@disabled}
class={[
"inline-flex items-center justify-center gap-x-2 rounded-md bg-indigo-600 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 disabled:bg-gray-400",
@class
]}
{@rest}
>
<%= render_slot(@inner_block) %>
</button>
"""
end
attr(:href, :string, required: true)
attr(:class, :string, default: "")
attr(:rest, :global)
slot(:inner_block)
def button_link(assigns) do
~H"""
<.link
href={@href}
class={[
"inline-flex items-center justify-center gap-x-2 rounded-md bg-indigo-600 px-3.5 py-2.5 text-sm font-semibold text-white shadow-sm hover:bg-indigo-700 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600 disabled:bg-gray-400",
@class
]}
{@rest}
>
<%= render_slot(@inner_block) %>
</.link>
"""
end
Integrations Settings section (#3427) * Extend the Tokens context module * Extract GA Import to separate component * Extract Search Console settings to separate component * Remove Search Console from the router * Stop counting imported pageviews in general settings * Remove search console controller action * Add settings_integrations controller action * Fix remaining redirects * Add Integrations route * Replace SC sidebar item with Integrations * Update site controller tests * Implement Plugins API Tokens LV * Apply universal heroicon to docs info links * Add flash on token creation * Update CHANGELOG * Redirect to integrations upon forgetting GA import * Update moduledocs * Remove unnecessary wildcards * WIP: attempt at fixing broken oauth flow * Fix post-import redirect * Fixup missing attribute * Format * Seed random google auth * Use example.com for seeded e-mails * Tweak Google integrations layout * Remove dangling IO.inspect * Bugfix: copy to clipboard breaking LV form bindings * Update lib/plausible/plugins/api/tokens.ex Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com> * Update lib/plausible_web/controllers/site_controller.ex Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com> * Update lib/plausible_web/live/plugins/api/settings.ex Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com> * Update test/plausible/plugins/api/tokens_test.exs Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com> --------- Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
2023-10-18 15:01:17 +03:00
attr(:slug, :string, required: true)
def docs_info(assigns) do
~H"""
<a href={"https://plausible.io/docs/#{@slug}"} rel="noreferrer" target="_blank">
<Heroicons.information_circle class="text-gray-400 w-6 h-6 absolute top-0 right-0 text-gray-400" />
</a>
"""
end
Limit grandfathering to *active* subscribers and trials (#3524) * refactor asserting plan generation in plans_test.exs * stop grandfathering old expired trials For users who registered before the business tiers release, we want to offer a chance to subscribe to a grandfathered plan. However, if they let their trial expire and don't subscribe in the next 10 days, they'll lose that opportunity. * stop grandfathering expired subscriptions * remove default title and icon from Generic.notice * fix bug with dismissable notice classList is null when dismissable_id is not given * alias Plausible.Auth.User * Refactor Generic.notice component Make it easy to apply different colors * move subscription_cancelled_notice across the app And remove from user settings > subscription box. Also, include a note about losing grandfathered status when letting the subscription expire. * allow full width in Generic.notice * use Generic.notice for subscription_past_due_notice * use Generic.notice for subscription_paused_notice * prevent two notices clashing into each other with gap-y-2 * define attrs for phx components * optimize for light mode * make subscription cancelled notice dismissable but if it's dismiss, show it in the place where it was before in the account settings > subscription box * make function private * replace function doc with regular comment to avoid compile warning * use array for classnames Co-authored-by: Vinicius Brasil <vini@hey.com> * fix typos in function doc --------- Co-authored-by: Vinicius Brasil <vini@hey.com>
2023-11-16 18:40:50 +03:00
attr(:title, :any, default: nil)
Integrations Settings section (#3427) * Extend the Tokens context module * Extract GA Import to separate component * Extract Search Console settings to separate component * Remove Search Console from the router * Stop counting imported pageviews in general settings * Remove search console controller action * Add settings_integrations controller action * Fix remaining redirects * Add Integrations route * Replace SC sidebar item with Integrations * Update site controller tests * Implement Plugins API Tokens LV * Apply universal heroicon to docs info links * Add flash on token creation * Update CHANGELOG * Redirect to integrations upon forgetting GA import * Update moduledocs * Remove unnecessary wildcards * WIP: attempt at fixing broken oauth flow * Fix post-import redirect * Fixup missing attribute * Format * Seed random google auth * Use example.com for seeded e-mails * Tweak Google integrations layout * Remove dangling IO.inspect * Bugfix: copy to clipboard breaking LV form bindings * Update lib/plausible/plugins/api/tokens.ex Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com> * Update lib/plausible_web/controllers/site_controller.ex Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com> * Update lib/plausible_web/live/plugins/api/settings.ex Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com> * Update test/plausible/plugins/api/tokens_test.exs Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com> --------- Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
2023-10-18 15:01:17 +03:00
attr(:size, :atom, default: :sm)
Limit grandfathering to *active* subscribers and trials (#3524) * refactor asserting plan generation in plans_test.exs * stop grandfathering old expired trials For users who registered before the business tiers release, we want to offer a chance to subscribe to a grandfathered plan. However, if they let their trial expire and don't subscribe in the next 10 days, they'll lose that opportunity. * stop grandfathering expired subscriptions * remove default title and icon from Generic.notice * fix bug with dismissable notice classList is null when dismissable_id is not given * alias Plausible.Auth.User * Refactor Generic.notice component Make it easy to apply different colors * move subscription_cancelled_notice across the app And remove from user settings > subscription box. Also, include a note about losing grandfathered status when letting the subscription expire. * allow full width in Generic.notice * use Generic.notice for subscription_past_due_notice * use Generic.notice for subscription_paused_notice * prevent two notices clashing into each other with gap-y-2 * define attrs for phx components * optimize for light mode * make subscription cancelled notice dismissable but if it's dismiss, show it in the place where it was before in the account settings > subscription box * make function private * replace function doc with regular comment to avoid compile warning * use array for classnames Co-authored-by: Vinicius Brasil <vini@hey.com> * fix typos in function doc --------- Co-authored-by: Vinicius Brasil <vini@hey.com>
2023-11-16 18:40:50 +03:00
attr(:theme, :atom, default: :yellow)
attr(:dismissable_id, :any, default: nil)
attr(:class, :string, default: "")
Integrations Settings section (#3427) * Extend the Tokens context module * Extract GA Import to separate component * Extract Search Console settings to separate component * Remove Search Console from the router * Stop counting imported pageviews in general settings * Remove search console controller action * Add settings_integrations controller action * Fix remaining redirects * Add Integrations route * Replace SC sidebar item with Integrations * Update site controller tests * Implement Plugins API Tokens LV * Apply universal heroicon to docs info links * Add flash on token creation * Update CHANGELOG * Redirect to integrations upon forgetting GA import * Update moduledocs * Remove unnecessary wildcards * WIP: attempt at fixing broken oauth flow * Fix post-import redirect * Fixup missing attribute * Format * Seed random google auth * Use example.com for seeded e-mails * Tweak Google integrations layout * Remove dangling IO.inspect * Bugfix: copy to clipboard breaking LV form bindings * Update lib/plausible/plugins/api/tokens.ex Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com> * Update lib/plausible_web/controllers/site_controller.ex Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com> * Update lib/plausible_web/live/plugins/api/settings.ex Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com> * Update test/plausible/plugins/api/tokens_test.exs Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com> --------- Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
2023-10-18 15:01:17 +03:00
attr(:rest, :global)
slot(:inner_block)
Funnel site settings (#3039) * Update formatter config * Install LiveView JS integration & hooks * Temporarily update endpoint/session config * Optionally allow preloading funnels for goals * Site controller * Implement funnel settings lib/plausible_web/live/funnel_settings/combo_box.ex - restored from: 054de6e2 Fix the tab/blur bug again 20da4c89 Rename InputPicker to ComboBox lib/plausible_web/live/funnel_settings/form.ex - restored from: 9bedda3b Remove potential FIXME 20da4c89 Rename InputPicker to ComboBox 028036ad Review comments aea4ebc4 Access Funnel min/max steps via the __using__/1 macro 0dde27fd Remove inspect call eed588a7 Start testing the funnel editor 0e95228b Extract funnel settings test module 7b16ace5 Leverage aplinejs to deal with the tyranny 8dc6a3e7 wip cf228630 wip 30a43fd1 wip 89f10ecb wip 950a18d9 Dirty funnel save 298a6a53 wip 7690d50f wip 639c6238 fixup aa59adeb wip ff75c00b wip lib/plausible_web/live/funnel_settings/list.ex - restored from: 4eae122c Fix data-confirm attr interpolation 51f0397d Implement deleting funnels 1f6fe25d Add number of steps to funnels list 298a6a53 wip ff75c00b wip test/plausible_web/live/funnel_settings/funnel_settings/combo_box_test.exs - restored from: 20da4c89 Rename InputPicker to ComboBox test/plausible_web/live/funnel_settings/funnel_settings_test.exs - restored from: 34822ff4 Bootstrap InputPicker tests lib/plausible_web/live/funnel_settings.ex - restored from: 028036ad Review comments acd9c4f2 Prepare ephemeral funnel definitions so that users can test funnels 51f0397d Implement deleting funnels 0e95228b Extract funnel settings test module 8dc6a3e7 wip 89f10ecb wip 950a18d9 Dirty funnel save 298a6a53 wip aa59adeb wip ff75c00b wip test/plausible_web/controllers/error_report_controller_test.exs - restored from: 34822ff4 Bootstrap InputPicker tests test/support/html.ex - restored from: 0a53979d Improve InputPicker tests - include AlpineJS assertions 34822ff4 Bootstrap InputPicker tests lib/plausible_web/views/layout_view.ex - restored from: b490403b !ifxup lib/plausible_web/templates/site/settings_funnels.html.eex - restored from: 51f0397d Implement deleting funnels ea1315f3 Test funnels list in settings 7b16ace5 Leverage aplinejs to deal with the tyranny ff75c00b wip 4da25c35 Fixup lib/plausible_web/templates/layout/app.html.eex - restored from: ff75c00b wip * Add funnel settings route * Warn about funnels deletion when deleting goals lib/plausible_web/templates/site/settings_goals.html.eex - restored from: fdd9bcd0 Fixup f1e6364d Merge remote-tracking branch 'origin/master' into funnels-rebase 9d0b7c6d Fix markup error 4a4ddbdc Optionally preload funnels for goals and stub funnel-goal deletion ebdc4333 Extend the prompt in case of funnel-goal deletion 639c6238 fixup aa59adeb wip * Split new JS LiveView additions * Put funnels behind a feature flag * Integrate dashboard feature toggle * Update signing salt for live view * Update moduledocs * Update live reloader config * Use Phoenix.HTML.Safe for goal names * Workaround to get flashes working in embedded liveview * Keep feature toggles idempotent, rename property to setting We'll still retain the ability to flip bools on a lower level. * Update moduledocs * Make live flash disappear after 5s * Tailwind: purge .heex files too * Update docs link * Add live components to tailwind purge config * Update another flaky test Ref f0bdf872 cc @vinibrsl * Fix combobox input length w/ WebKit * Intoduce generic notice component * Revert "Fix combobox input length w/ WebKit" This reverts commit 3c653a6d85d5000167631e10ef45a93c13b41ed1. * Fix combobox input length on webkit * Make whole combobox item clickable, not only text * Fix glitch moving Save button on activation * Tweak dark mode * Show funnel form without waiting for funnel name input * Tweak dark mode * Include static Phoenix components in tailwind purge * Tune funnels form into a liveview of its own This is so that ComboBoxes can publish their selections and unavailable choices can be propagated to other siblings. * Push less data over websocket * Undo Lsp/formatter race condition * Fixup typespecs * Bust CI cache
2023-06-22 10:00:07 +03:00
def notice(assigns) do
Limit grandfathering to *active* subscribers and trials (#3524) * refactor asserting plan generation in plans_test.exs * stop grandfathering old expired trials For users who registered before the business tiers release, we want to offer a chance to subscribe to a grandfathered plan. However, if they let their trial expire and don't subscribe in the next 10 days, they'll lose that opportunity. * stop grandfathering expired subscriptions * remove default title and icon from Generic.notice * fix bug with dismissable notice classList is null when dismissable_id is not given * alias Plausible.Auth.User * Refactor Generic.notice component Make it easy to apply different colors * move subscription_cancelled_notice across the app And remove from user settings > subscription box. Also, include a note about losing grandfathered status when letting the subscription expire. * allow full width in Generic.notice * use Generic.notice for subscription_past_due_notice * use Generic.notice for subscription_paused_notice * prevent two notices clashing into each other with gap-y-2 * define attrs for phx components * optimize for light mode * make subscription cancelled notice dismissable but if it's dismiss, show it in the place where it was before in the account settings > subscription box * make function private * replace function doc with regular comment to avoid compile warning * use array for classnames Co-authored-by: Vinicius Brasil <vini@hey.com> * fix typos in function doc --------- Co-authored-by: Vinicius Brasil <vini@hey.com>
2023-11-16 18:40:50 +03:00
assigns = assign(assigns, :theme, Map.fetch!(@notice_themes, assigns.theme))
Funnel site settings (#3039) * Update formatter config * Install LiveView JS integration & hooks * Temporarily update endpoint/session config * Optionally allow preloading funnels for goals * Site controller * Implement funnel settings lib/plausible_web/live/funnel_settings/combo_box.ex - restored from: 054de6e2 Fix the tab/blur bug again 20da4c89 Rename InputPicker to ComboBox lib/plausible_web/live/funnel_settings/form.ex - restored from: 9bedda3b Remove potential FIXME 20da4c89 Rename InputPicker to ComboBox 028036ad Review comments aea4ebc4 Access Funnel min/max steps via the __using__/1 macro 0dde27fd Remove inspect call eed588a7 Start testing the funnel editor 0e95228b Extract funnel settings test module 7b16ace5 Leverage aplinejs to deal with the tyranny 8dc6a3e7 wip cf228630 wip 30a43fd1 wip 89f10ecb wip 950a18d9 Dirty funnel save 298a6a53 wip 7690d50f wip 639c6238 fixup aa59adeb wip ff75c00b wip lib/plausible_web/live/funnel_settings/list.ex - restored from: 4eae122c Fix data-confirm attr interpolation 51f0397d Implement deleting funnels 1f6fe25d Add number of steps to funnels list 298a6a53 wip ff75c00b wip test/plausible_web/live/funnel_settings/funnel_settings/combo_box_test.exs - restored from: 20da4c89 Rename InputPicker to ComboBox test/plausible_web/live/funnel_settings/funnel_settings_test.exs - restored from: 34822ff4 Bootstrap InputPicker tests lib/plausible_web/live/funnel_settings.ex - restored from: 028036ad Review comments acd9c4f2 Prepare ephemeral funnel definitions so that users can test funnels 51f0397d Implement deleting funnels 0e95228b Extract funnel settings test module 8dc6a3e7 wip 89f10ecb wip 950a18d9 Dirty funnel save 298a6a53 wip aa59adeb wip ff75c00b wip test/plausible_web/controllers/error_report_controller_test.exs - restored from: 34822ff4 Bootstrap InputPicker tests test/support/html.ex - restored from: 0a53979d Improve InputPicker tests - include AlpineJS assertions 34822ff4 Bootstrap InputPicker tests lib/plausible_web/views/layout_view.ex - restored from: b490403b !ifxup lib/plausible_web/templates/site/settings_funnels.html.eex - restored from: 51f0397d Implement deleting funnels ea1315f3 Test funnels list in settings 7b16ace5 Leverage aplinejs to deal with the tyranny ff75c00b wip 4da25c35 Fixup lib/plausible_web/templates/layout/app.html.eex - restored from: ff75c00b wip * Add funnel settings route * Warn about funnels deletion when deleting goals lib/plausible_web/templates/site/settings_goals.html.eex - restored from: fdd9bcd0 Fixup f1e6364d Merge remote-tracking branch 'origin/master' into funnels-rebase 9d0b7c6d Fix markup error 4a4ddbdc Optionally preload funnels for goals and stub funnel-goal deletion ebdc4333 Extend the prompt in case of funnel-goal deletion 639c6238 fixup aa59adeb wip * Split new JS LiveView additions * Put funnels behind a feature flag * Integrate dashboard feature toggle * Update signing salt for live view * Update moduledocs * Update live reloader config * Use Phoenix.HTML.Safe for goal names * Workaround to get flashes working in embedded liveview * Keep feature toggles idempotent, rename property to setting We'll still retain the ability to flip bools on a lower level. * Update moduledocs * Make live flash disappear after 5s * Tailwind: purge .heex files too * Update docs link * Add live components to tailwind purge config * Update another flaky test Ref f0bdf872 cc @vinibrsl * Fix combobox input length w/ WebKit * Intoduce generic notice component * Revert "Fix combobox input length w/ WebKit" This reverts commit 3c653a6d85d5000167631e10ef45a93c13b41ed1. * Fix combobox input length on webkit * Make whole combobox item clickable, not only text * Fix glitch moving Save button on activation * Tweak dark mode * Show funnel form without waiting for funnel name input * Tweak dark mode * Include static Phoenix components in tailwind purge * Tune funnels form into a liveview of its own This is so that ComboBoxes can publish their selections and unavailable choices can be propagated to other siblings. * Push less data over websocket * Undo Lsp/formatter race condition * Fixup typespecs * Bust CI cache
2023-06-22 10:00:07 +03:00
~H"""
<div id={@dismissable_id} class={@dismissable_id && "hidden"}>
Limit grandfathering to *active* subscribers and trials (#3524) * refactor asserting plan generation in plans_test.exs * stop grandfathering old expired trials For users who registered before the business tiers release, we want to offer a chance to subscribe to a grandfathered plan. However, if they let their trial expire and don't subscribe in the next 10 days, they'll lose that opportunity. * stop grandfathering expired subscriptions * remove default title and icon from Generic.notice * fix bug with dismissable notice classList is null when dismissable_id is not given * alias Plausible.Auth.User * Refactor Generic.notice component Make it easy to apply different colors * move subscription_cancelled_notice across the app And remove from user settings > subscription box. Also, include a note about losing grandfathered status when letting the subscription expire. * allow full width in Generic.notice * use Generic.notice for subscription_past_due_notice * use Generic.notice for subscription_paused_notice * prevent two notices clashing into each other with gap-y-2 * define attrs for phx components * optimize for light mode * make subscription cancelled notice dismissable but if it's dismiss, show it in the place where it was before in the account settings > subscription box * make function private * replace function doc with regular comment to avoid compile warning * use array for classnames Co-authored-by: Vinicius Brasil <vini@hey.com> * fix typos in function doc --------- Co-authored-by: Vinicius Brasil <vini@hey.com>
2023-11-16 18:40:50 +03:00
<div class={["rounded-md p-4 relative", @theme.bg, @class]} {@rest}>
<button
:if={@dismissable_id}
Limit grandfathering to *active* subscribers and trials (#3524) * refactor asserting plan generation in plans_test.exs * stop grandfathering old expired trials For users who registered before the business tiers release, we want to offer a chance to subscribe to a grandfathered plan. However, if they let their trial expire and don't subscribe in the next 10 days, they'll lose that opportunity. * stop grandfathering expired subscriptions * remove default title and icon from Generic.notice * fix bug with dismissable notice classList is null when dismissable_id is not given * alias Plausible.Auth.User * Refactor Generic.notice component Make it easy to apply different colors * move subscription_cancelled_notice across the app And remove from user settings > subscription box. Also, include a note about losing grandfathered status when letting the subscription expire. * allow full width in Generic.notice * use Generic.notice for subscription_past_due_notice * use Generic.notice for subscription_paused_notice * prevent two notices clashing into each other with gap-y-2 * define attrs for phx components * optimize for light mode * make subscription cancelled notice dismissable but if it's dismiss, show it in the place where it was before in the account settings > subscription box * make function private * replace function doc with regular comment to avoid compile warning * use array for classnames Co-authored-by: Vinicius Brasil <vini@hey.com> * fix typos in function doc --------- Co-authored-by: Vinicius Brasil <vini@hey.com>
2023-11-16 18:40:50 +03:00
class={"absolute right-0 top-0 m-2 #{@theme.title_text}"}
onclick={"localStorage['notice_dismissed__#{@dismissable_id}'] = 'true'; document.getElementById('#{@dismissable_id}').classList.add('hidden')"}
>
<Heroicons.x_mark class="h-4 w-4 hover:stroke-2" />
</button>
<div class="flex">
Limit grandfathering to *active* subscribers and trials (#3524) * refactor asserting plan generation in plans_test.exs * stop grandfathering old expired trials For users who registered before the business tiers release, we want to offer a chance to subscribe to a grandfathered plan. However, if they let their trial expire and don't subscribe in the next 10 days, they'll lose that opportunity. * stop grandfathering expired subscriptions * remove default title and icon from Generic.notice * fix bug with dismissable notice classList is null when dismissable_id is not given * alias Plausible.Auth.User * Refactor Generic.notice component Make it easy to apply different colors * move subscription_cancelled_notice across the app And remove from user settings > subscription box. Also, include a note about losing grandfathered status when letting the subscription expire. * allow full width in Generic.notice * use Generic.notice for subscription_past_due_notice * use Generic.notice for subscription_paused_notice * prevent two notices clashing into each other with gap-y-2 * define attrs for phx components * optimize for light mode * make subscription cancelled notice dismissable but if it's dismiss, show it in the place where it was before in the account settings > subscription box * make function private * replace function doc with regular comment to avoid compile warning * use array for classnames Co-authored-by: Vinicius Brasil <vini@hey.com> * fix typos in function doc --------- Co-authored-by: Vinicius Brasil <vini@hey.com>
2023-11-16 18:40:50 +03:00
<div :if={@title} class="flex-shrink-0">
<svg
Limit grandfathering to *active* subscribers and trials (#3524) * refactor asserting plan generation in plans_test.exs * stop grandfathering old expired trials For users who registered before the business tiers release, we want to offer a chance to subscribe to a grandfathered plan. However, if they let their trial expire and don't subscribe in the next 10 days, they'll lose that opportunity. * stop grandfathering expired subscriptions * remove default title and icon from Generic.notice * fix bug with dismissable notice classList is null when dismissable_id is not given * alias Plausible.Auth.User * Refactor Generic.notice component Make it easy to apply different colors * move subscription_cancelled_notice across the app And remove from user settings > subscription box. Also, include a note about losing grandfathered status when letting the subscription expire. * allow full width in Generic.notice * use Generic.notice for subscription_past_due_notice * use Generic.notice for subscription_paused_notice * prevent two notices clashing into each other with gap-y-2 * define attrs for phx components * optimize for light mode * make subscription cancelled notice dismissable but if it's dismiss, show it in the place where it was before in the account settings > subscription box * make function private * replace function doc with regular comment to avoid compile warning * use array for classnames Co-authored-by: Vinicius Brasil <vini@hey.com> * fix typos in function doc --------- Co-authored-by: Vinicius Brasil <vini@hey.com>
2023-11-16 18:40:50 +03:00
class={"h-5 w-5 #{@theme.icon}"}
viewBox="0 0 20 20"
fill="currentColor"
aria-hidden="true"
>
<path
fill-rule="evenodd"
d="M8.485 2.495c.673-1.167 2.357-1.167 3.03 0l6.28 10.875c.673 1.167-.17 2.625-1.516 2.625H3.72c-1.347 0-2.189-1.458-1.515-2.625L8.485 2.495zM10 5a.75.75 0 01.75.75v3.5a.75.75 0 01-1.5 0v-3.5A.75.75 0 0110 5zm0 9a1 1 0 100-2 1 1 0 000 2z"
clip-rule="evenodd"
/>
</svg>
</div>
Limit grandfathering to *active* subscribers and trials (#3524) * refactor asserting plan generation in plans_test.exs * stop grandfathering old expired trials For users who registered before the business tiers release, we want to offer a chance to subscribe to a grandfathered plan. However, if they let their trial expire and don't subscribe in the next 10 days, they'll lose that opportunity. * stop grandfathering expired subscriptions * remove default title and icon from Generic.notice * fix bug with dismissable notice classList is null when dismissable_id is not given * alias Plausible.Auth.User * Refactor Generic.notice component Make it easy to apply different colors * move subscription_cancelled_notice across the app And remove from user settings > subscription box. Also, include a note about losing grandfathered status when letting the subscription expire. * allow full width in Generic.notice * use Generic.notice for subscription_past_due_notice * use Generic.notice for subscription_paused_notice * prevent two notices clashing into each other with gap-y-2 * define attrs for phx components * optimize for light mode * make subscription cancelled notice dismissable but if it's dismiss, show it in the place where it was before in the account settings > subscription box * make function private * replace function doc with regular comment to avoid compile warning * use array for classnames Co-authored-by: Vinicius Brasil <vini@hey.com> * fix typos in function doc --------- Co-authored-by: Vinicius Brasil <vini@hey.com>
2023-11-16 18:40:50 +03:00
<div class={["w-full", @title && "ml-3"]}>
<h3 :if={@title} class={"text-#{@size} font-medium #{@theme.title_text} mb-2"}>
<%= @title %>
</h3>
Limit grandfathering to *active* subscribers and trials (#3524) * refactor asserting plan generation in plans_test.exs * stop grandfathering old expired trials For users who registered before the business tiers release, we want to offer a chance to subscribe to a grandfathered plan. However, if they let their trial expire and don't subscribe in the next 10 days, they'll lose that opportunity. * stop grandfathering expired subscriptions * remove default title and icon from Generic.notice * fix bug with dismissable notice classList is null when dismissable_id is not given * alias Plausible.Auth.User * Refactor Generic.notice component Make it easy to apply different colors * move subscription_cancelled_notice across the app And remove from user settings > subscription box. Also, include a note about losing grandfathered status when letting the subscription expire. * allow full width in Generic.notice * use Generic.notice for subscription_past_due_notice * use Generic.notice for subscription_paused_notice * prevent two notices clashing into each other with gap-y-2 * define attrs for phx components * optimize for light mode * make subscription cancelled notice dismissable but if it's dismiss, show it in the place where it was before in the account settings > subscription box * make function private * replace function doc with regular comment to avoid compile warning * use array for classnames Co-authored-by: Vinicius Brasil <vini@hey.com> * fix typos in function doc --------- Co-authored-by: Vinicius Brasil <vini@hey.com>
2023-11-16 18:40:50 +03:00
<div class={"text-#{@size} #{@theme.body_text}"}>
<p>
<%= render_slot(@inner_block) %>
</p>
</div>
Funnel site settings (#3039) * Update formatter config * Install LiveView JS integration & hooks * Temporarily update endpoint/session config * Optionally allow preloading funnels for goals * Site controller * Implement funnel settings lib/plausible_web/live/funnel_settings/combo_box.ex - restored from: 054de6e2 Fix the tab/blur bug again 20da4c89 Rename InputPicker to ComboBox lib/plausible_web/live/funnel_settings/form.ex - restored from: 9bedda3b Remove potential FIXME 20da4c89 Rename InputPicker to ComboBox 028036ad Review comments aea4ebc4 Access Funnel min/max steps via the __using__/1 macro 0dde27fd Remove inspect call eed588a7 Start testing the funnel editor 0e95228b Extract funnel settings test module 7b16ace5 Leverage aplinejs to deal with the tyranny 8dc6a3e7 wip cf228630 wip 30a43fd1 wip 89f10ecb wip 950a18d9 Dirty funnel save 298a6a53 wip 7690d50f wip 639c6238 fixup aa59adeb wip ff75c00b wip lib/plausible_web/live/funnel_settings/list.ex - restored from: 4eae122c Fix data-confirm attr interpolation 51f0397d Implement deleting funnels 1f6fe25d Add number of steps to funnels list 298a6a53 wip ff75c00b wip test/plausible_web/live/funnel_settings/funnel_settings/combo_box_test.exs - restored from: 20da4c89 Rename InputPicker to ComboBox test/plausible_web/live/funnel_settings/funnel_settings_test.exs - restored from: 34822ff4 Bootstrap InputPicker tests lib/plausible_web/live/funnel_settings.ex - restored from: 028036ad Review comments acd9c4f2 Prepare ephemeral funnel definitions so that users can test funnels 51f0397d Implement deleting funnels 0e95228b Extract funnel settings test module 8dc6a3e7 wip 89f10ecb wip 950a18d9 Dirty funnel save 298a6a53 wip aa59adeb wip ff75c00b wip test/plausible_web/controllers/error_report_controller_test.exs - restored from: 34822ff4 Bootstrap InputPicker tests test/support/html.ex - restored from: 0a53979d Improve InputPicker tests - include AlpineJS assertions 34822ff4 Bootstrap InputPicker tests lib/plausible_web/views/layout_view.ex - restored from: b490403b !ifxup lib/plausible_web/templates/site/settings_funnels.html.eex - restored from: 51f0397d Implement deleting funnels ea1315f3 Test funnels list in settings 7b16ace5 Leverage aplinejs to deal with the tyranny ff75c00b wip 4da25c35 Fixup lib/plausible_web/templates/layout/app.html.eex - restored from: ff75c00b wip * Add funnel settings route * Warn about funnels deletion when deleting goals lib/plausible_web/templates/site/settings_goals.html.eex - restored from: fdd9bcd0 Fixup f1e6364d Merge remote-tracking branch 'origin/master' into funnels-rebase 9d0b7c6d Fix markup error 4a4ddbdc Optionally preload funnels for goals and stub funnel-goal deletion ebdc4333 Extend the prompt in case of funnel-goal deletion 639c6238 fixup aa59adeb wip * Split new JS LiveView additions * Put funnels behind a feature flag * Integrate dashboard feature toggle * Update signing salt for live view * Update moduledocs * Update live reloader config * Use Phoenix.HTML.Safe for goal names * Workaround to get flashes working in embedded liveview * Keep feature toggles idempotent, rename property to setting We'll still retain the ability to flip bools on a lower level. * Update moduledocs * Make live flash disappear after 5s * Tailwind: purge .heex files too * Update docs link * Add live components to tailwind purge config * Update another flaky test Ref f0bdf872 cc @vinibrsl * Fix combobox input length w/ WebKit * Intoduce generic notice component * Revert "Fix combobox input length w/ WebKit" This reverts commit 3c653a6d85d5000167631e10ef45a93c13b41ed1. * Fix combobox input length on webkit * Make whole combobox item clickable, not only text * Fix glitch moving Save button on activation * Tweak dark mode * Show funnel form without waiting for funnel name input * Tweak dark mode * Include static Phoenix components in tailwind purge * Tune funnels form into a liveview of its own This is so that ComboBoxes can publish their selections and unavailable choices can be propagated to other siblings. * Push less data over websocket * Undo Lsp/formatter race condition * Fixup typespecs * Bust CI cache
2023-06-22 10:00:07 +03:00
</div>
</div>
</div>
</div>
Limit grandfathering to *active* subscribers and trials (#3524) * refactor asserting plan generation in plans_test.exs * stop grandfathering old expired trials For users who registered before the business tiers release, we want to offer a chance to subscribe to a grandfathered plan. However, if they let their trial expire and don't subscribe in the next 10 days, they'll lose that opportunity. * stop grandfathering expired subscriptions * remove default title and icon from Generic.notice * fix bug with dismissable notice classList is null when dismissable_id is not given * alias Plausible.Auth.User * Refactor Generic.notice component Make it easy to apply different colors * move subscription_cancelled_notice across the app And remove from user settings > subscription box. Also, include a note about losing grandfathered status when letting the subscription expire. * allow full width in Generic.notice * use Generic.notice for subscription_past_due_notice * use Generic.notice for subscription_paused_notice * prevent two notices clashing into each other with gap-y-2 * define attrs for phx components * optimize for light mode * make subscription cancelled notice dismissable but if it's dismiss, show it in the place where it was before in the account settings > subscription box * make function private * replace function doc with regular comment to avoid compile warning * use array for classnames Co-authored-by: Vinicius Brasil <vini@hey.com> * fix typos in function doc --------- Co-authored-by: Vinicius Brasil <vini@hey.com>
2023-11-16 18:40:50 +03:00
<script :if={@dismissable_id} data-key={@dismissable_id}>
const dismissId = document.currentScript.dataset.key
const localStorageKey = `notice_dismissed__${dismissId}`
if (localStorage[localStorageKey] !== 'true') {
document.getElementById(dismissId).classList.remove('hidden')
}
</script>
Funnel site settings (#3039) * Update formatter config * Install LiveView JS integration & hooks * Temporarily update endpoint/session config * Optionally allow preloading funnels for goals * Site controller * Implement funnel settings lib/plausible_web/live/funnel_settings/combo_box.ex - restored from: 054de6e2 Fix the tab/blur bug again 20da4c89 Rename InputPicker to ComboBox lib/plausible_web/live/funnel_settings/form.ex - restored from: 9bedda3b Remove potential FIXME 20da4c89 Rename InputPicker to ComboBox 028036ad Review comments aea4ebc4 Access Funnel min/max steps via the __using__/1 macro 0dde27fd Remove inspect call eed588a7 Start testing the funnel editor 0e95228b Extract funnel settings test module 7b16ace5 Leverage aplinejs to deal with the tyranny 8dc6a3e7 wip cf228630 wip 30a43fd1 wip 89f10ecb wip 950a18d9 Dirty funnel save 298a6a53 wip 7690d50f wip 639c6238 fixup aa59adeb wip ff75c00b wip lib/plausible_web/live/funnel_settings/list.ex - restored from: 4eae122c Fix data-confirm attr interpolation 51f0397d Implement deleting funnels 1f6fe25d Add number of steps to funnels list 298a6a53 wip ff75c00b wip test/plausible_web/live/funnel_settings/funnel_settings/combo_box_test.exs - restored from: 20da4c89 Rename InputPicker to ComboBox test/plausible_web/live/funnel_settings/funnel_settings_test.exs - restored from: 34822ff4 Bootstrap InputPicker tests lib/plausible_web/live/funnel_settings.ex - restored from: 028036ad Review comments acd9c4f2 Prepare ephemeral funnel definitions so that users can test funnels 51f0397d Implement deleting funnels 0e95228b Extract funnel settings test module 8dc6a3e7 wip 89f10ecb wip 950a18d9 Dirty funnel save 298a6a53 wip aa59adeb wip ff75c00b wip test/plausible_web/controllers/error_report_controller_test.exs - restored from: 34822ff4 Bootstrap InputPicker tests test/support/html.ex - restored from: 0a53979d Improve InputPicker tests - include AlpineJS assertions 34822ff4 Bootstrap InputPicker tests lib/plausible_web/views/layout_view.ex - restored from: b490403b !ifxup lib/plausible_web/templates/site/settings_funnels.html.eex - restored from: 51f0397d Implement deleting funnels ea1315f3 Test funnels list in settings 7b16ace5 Leverage aplinejs to deal with the tyranny ff75c00b wip 4da25c35 Fixup lib/plausible_web/templates/layout/app.html.eex - restored from: ff75c00b wip * Add funnel settings route * Warn about funnels deletion when deleting goals lib/plausible_web/templates/site/settings_goals.html.eex - restored from: fdd9bcd0 Fixup f1e6364d Merge remote-tracking branch 'origin/master' into funnels-rebase 9d0b7c6d Fix markup error 4a4ddbdc Optionally preload funnels for goals and stub funnel-goal deletion ebdc4333 Extend the prompt in case of funnel-goal deletion 639c6238 fixup aa59adeb wip * Split new JS LiveView additions * Put funnels behind a feature flag * Integrate dashboard feature toggle * Update signing salt for live view * Update moduledocs * Update live reloader config * Use Phoenix.HTML.Safe for goal names * Workaround to get flashes working in embedded liveview * Keep feature toggles idempotent, rename property to setting We'll still retain the ability to flip bools on a lower level. * Update moduledocs * Make live flash disappear after 5s * Tailwind: purge .heex files too * Update docs link * Add live components to tailwind purge config * Update another flaky test Ref f0bdf872 cc @vinibrsl * Fix combobox input length w/ WebKit * Intoduce generic notice component * Revert "Fix combobox input length w/ WebKit" This reverts commit 3c653a6d85d5000167631e10ef45a93c13b41ed1. * Fix combobox input length on webkit * Make whole combobox item clickable, not only text * Fix glitch moving Save button on activation * Tweak dark mode * Show funnel form without waiting for funnel name input * Tweak dark mode * Include static Phoenix components in tailwind purge * Tune funnels form into a liveview of its own This is so that ComboBoxes can publish their selections and unavailable choices can be propagated to other siblings. * Push less data over websocket * Undo Lsp/formatter race condition * Fixup typespecs * Bust CI cache
2023-06-22 10:00:07 +03:00
"""
end
Refactor enterprise plan upgrade and change-plan actions (#3397) * rename enterprise?/1 function * change link text to Upgrade when subscription deleted * extract paddle_button and paddle_script components * create a new upgrade-to-enterprise-plan page * extract upgrade_link component * rename function * link to enterprise plan upgrade page from settings ...if the user has an enterprise plan configured * fetch enterprise plan price on the new page * add change_enterprise_plan functionality on the new page * render existing change_enterprise_plan_contact_us.html ...when subscribed to latest configured enterprise plan * rename vars and extract resumable? fn * remove dead billing route * small test refactor: extract convenience fn * add tests for... ...restricting paused and past_due subscription access to the new enterprise plan page. 1. redirect to /settings from the controller action 2. hiding the change-plan link from the user settings * implement redirect to /settings * hide the enterprise upgrade/change-plan link * add tests for a deleted enterprise subscription * plug in the new controller action and delete dead code * optimize for dark mode * fix compile warning * credo fix * display N/A instead of crash when price nil * change subscription.status type to Ecto.Enum Also, create a new `Subscription.Status` module that exposes macros to return the used atom values (prevent typos at compiletime). * fix bug (@conn not available anymore) * use Routes.billing_path where applicable * add a status() type * silence credo * refactor suggestion from review Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com> * Remove the __using__ macro from Subscription.Status ... instead be explicit about requires and aliases and also order the use, import, require, and alias clauses according to https://github.com/christopheradams/elixir_style_guide#module-attribute-ordering * drop the virtual Enteprise 'price_per_interval' field * apply review suggestion to make the code more DRY * use dot syntax to fetch current user in new controller actions * fix formatting --------- Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
2023-10-10 20:35:17 +03:00
attr :id, :any, default: nil
attr :href, :string, required: true
attr :new_tab, :boolean, default: false
attr :class, :string, default: ""
slot :inner_block
def styled_link(assigns) do
~H"""
<.unstyled_link
new_tab={@new_tab}
href={@href}
class="text-indigo-600 hover:text-indigo-700 dark:text-indigo-500 dark:hover:text-indigo-600"
>
<%= render_slot(@inner_block) %>
</.unstyled_link>
"""
end
slot :button, required: true do
attr :class, :string
end
slot :panel, required: true do
attr :class, :string
end
def dropdown(assigns) do
~H"""
<div class="flex justify-center">
<div
x-data="dropdown"
x-on:keydown.escape.prevent.stop="close($refs.button)"
x-on:focusin.window="! $refs.panel.contains($event.target) && close()"
x-id="['dropdown-button']"
class="relative"
>
<button
x-ref="button"
x-on:click="toggle()"
x-bind:aria-expanded="open"
x-bind:aria-controls="$id('dropdown-button')"
type="button"
class={List.first(@button).class}
>
<%= render_slot(List.first(@button)) %>
</button>
<div
x-ref="panel"
x-show="open"
x-transition.origin.top.left
x-on:click.outside="close($refs.button)"
x-on:click="onPanelClick"
x-bind:id="$id('dropdown-button')"
style="display: none;"
class={List.first(@panel).class}
>
<%= render_slot(List.first(@panel)) %>
</div>
</div>
</div>
"""
end
attr :href, :string, required: true
attr :new_tab, :boolean, default: false
slot :inner_block, required: true
def dropdown_link(assigns) do
~H"""
<.unstyled_link
new_tab={@new_tab}
href={@href}
class="w-full justify-between text-gray-700 dark:text-gray-300 block px-3.5 py-1.5 hover:bg-gray-100 dark:hover:bg-gray-700 hover:text-gray-900 dark:hover:text-gray-100"
>
<%= render_slot(@inner_block) %>
</.unstyled_link>
"""
end
attr :href, :string, required: true
attr :new_tab, :boolean, default: false
attr :class, :string, default: ""
2023-10-17 13:16:04 +03:00
attr :id, :any, default: nil
Implement pinned sites (#3469) * Revert "Remove site pins for now" This reverts commit 5eccf4eaf62508432d53c7557f79650ced0e6516. * Implement basic site pin schema level logic within user specific preferences * Add vertical ellipsis menu markup * Implement basic changesets for user preferences * Implement pin toggling * Try to fix pin sorting * Implement pin toggling in LV * Adjust moduledocs for new schema(s) * Remove unnecessary `distinct` from query * Use `button` for pin/unpin action * Generalize preference setting * Rename schema and fields for clarity * Rename `list_type` -> `entry_type` * Safeguard setting options * Test `set_option/4` and `toggle_pin/2` * Add test for listing pinned sites via `Sites.list` * Disallow pinning sites outside page explicitly * Test pinning in LV * Test conditional rendering of site settings in /sites * Remove unnecessary TODO comment * Safeguard `Sites.set_option/4` against invalid user/site combo * Handle pinned sites in dashboard site picker * Clear flashes upon (un)pinning sites * Update CHANGELOG * Prevent blinking of hamburger menu items on first paint * Highlight hamburger handle on hover in /sites * Start showing hotkeys in site picker again * Sort pinned sites in the order they were pinned * Update sites list order immediately after pin/unpin toggle * Refactor and split `Sites.list/3`, extracting `Sites.list_with_invitations/3` * Cap number of pinned sites at 9 per user * First pass on visual indication of site cards (dis)appearing * Apply ellipsis gradient+shadow on card hover * Fix responsive padding of site cards * Sort by invitations first, pinned sites second and then the rest * Revert "Apply ellipsis gradient+shadow on card hover" This reverts commit 0608796612639030ccbb12df639709f78edc1434. * Apply more subtle hover effect on the ellipsis menu * Make error and success flash LV boxes use separate component containers * Promote `pinned_at` in table migration to a column * Switch logic to using `pinned_at` as a standard schema field * Refactor `Sites.list*` getting rid of subquery (h/t @ukutaht) * Remove migration which is already merged upstream --------- Co-authored-by: Adam Rutkowski <hq@mtod.org>
2023-11-13 11:08:26 +03:00
attr :rest, :global
slot :inner_block
def unstyled_link(assigns) do
if assigns[:new_tab] do
assigns = assign(assigns, :icon_class, icon_class(assigns))
~H"""
<.link
Refactor enterprise plan upgrade and change-plan actions (#3397) * rename enterprise?/1 function * change link text to Upgrade when subscription deleted * extract paddle_button and paddle_script components * create a new upgrade-to-enterprise-plan page * extract upgrade_link component * rename function * link to enterprise plan upgrade page from settings ...if the user has an enterprise plan configured * fetch enterprise plan price on the new page * add change_enterprise_plan functionality on the new page * render existing change_enterprise_plan_contact_us.html ...when subscribed to latest configured enterprise plan * rename vars and extract resumable? fn * remove dead billing route * small test refactor: extract convenience fn * add tests for... ...restricting paused and past_due subscription access to the new enterprise plan page. 1. redirect to /settings from the controller action 2. hiding the change-plan link from the user settings * implement redirect to /settings * hide the enterprise upgrade/change-plan link * add tests for a deleted enterprise subscription * plug in the new controller action and delete dead code * optimize for dark mode * fix compile warning * credo fix * display N/A instead of crash when price nil * change subscription.status type to Ecto.Enum Also, create a new `Subscription.Status` module that exposes macros to return the used atom values (prevent typos at compiletime). * fix bug (@conn not available anymore) * use Routes.billing_path where applicable * add a status() type * silence credo * refactor suggestion from review Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com> * Remove the __using__ macro from Subscription.Status ... instead be explicit about requires and aliases and also order the use, import, require, and alias clauses according to https://github.com/christopheradams/elixir_style_guide#module-attribute-ordering * drop the virtual Enteprise 'price_per_interval' field * apply review suggestion to make the code more DRY * use dot syntax to fetch current user in new controller actions * fix formatting --------- Co-authored-by: Adrian Gruntkowski <adrian.gruntkowski@gmail.com>
2023-10-10 20:35:17 +03:00
id={@id}
class={[
"inline-flex items-center gap-x-0.5",
@class
]}
href={@href}
target="_blank"
rel="noopener noreferrer"
Implement pinned sites (#3469) * Revert "Remove site pins for now" This reverts commit 5eccf4eaf62508432d53c7557f79650ced0e6516. * Implement basic site pin schema level logic within user specific preferences * Add vertical ellipsis menu markup * Implement basic changesets for user preferences * Implement pin toggling * Try to fix pin sorting * Implement pin toggling in LV * Adjust moduledocs for new schema(s) * Remove unnecessary `distinct` from query * Use `button` for pin/unpin action * Generalize preference setting * Rename schema and fields for clarity * Rename `list_type` -> `entry_type` * Safeguard setting options * Test `set_option/4` and `toggle_pin/2` * Add test for listing pinned sites via `Sites.list` * Disallow pinning sites outside page explicitly * Test pinning in LV * Test conditional rendering of site settings in /sites * Remove unnecessary TODO comment * Safeguard `Sites.set_option/4` against invalid user/site combo * Handle pinned sites in dashboard site picker * Clear flashes upon (un)pinning sites * Update CHANGELOG * Prevent blinking of hamburger menu items on first paint * Highlight hamburger handle on hover in /sites * Start showing hotkeys in site picker again * Sort pinned sites in the order they were pinned * Update sites list order immediately after pin/unpin toggle * Refactor and split `Sites.list/3`, extracting `Sites.list_with_invitations/3` * Cap number of pinned sites at 9 per user * First pass on visual indication of site cards (dis)appearing * Apply ellipsis gradient+shadow on card hover * Fix responsive padding of site cards * Sort by invitations first, pinned sites second and then the rest * Revert "Apply ellipsis gradient+shadow on card hover" This reverts commit 0608796612639030ccbb12df639709f78edc1434. * Apply more subtle hover effect on the ellipsis menu * Make error and success flash LV boxes use separate component containers * Promote `pinned_at` in table migration to a column * Switch logic to using `pinned_at` as a standard schema field * Refactor `Sites.list*` getting rid of subquery (h/t @ukutaht) * Remove migration which is already merged upstream --------- Co-authored-by: Adam Rutkowski <hq@mtod.org>
2023-11-13 11:08:26 +03:00
{@rest}
>
<%= render_slot(@inner_block) %>
<Heroicons.arrow_top_right_on_square class={["opacity-60", @icon_class]} />
</.link>
"""
else
~H"""
<.link class={@class} href={@href}>
<%= render_slot(@inner_block) %>
</.link>
"""
end
end
defp icon_class(link_assigns) do
if String.contains?(link_assigns[:class], "text-sm") do
["w-3 h-3"]
else
["w-4 h-4"]
end
end
Funnel site settings (#3039) * Update formatter config * Install LiveView JS integration & hooks * Temporarily update endpoint/session config * Optionally allow preloading funnels for goals * Site controller * Implement funnel settings lib/plausible_web/live/funnel_settings/combo_box.ex - restored from: 054de6e2 Fix the tab/blur bug again 20da4c89 Rename InputPicker to ComboBox lib/plausible_web/live/funnel_settings/form.ex - restored from: 9bedda3b Remove potential FIXME 20da4c89 Rename InputPicker to ComboBox 028036ad Review comments aea4ebc4 Access Funnel min/max steps via the __using__/1 macro 0dde27fd Remove inspect call eed588a7 Start testing the funnel editor 0e95228b Extract funnel settings test module 7b16ace5 Leverage aplinejs to deal with the tyranny 8dc6a3e7 wip cf228630 wip 30a43fd1 wip 89f10ecb wip 950a18d9 Dirty funnel save 298a6a53 wip 7690d50f wip 639c6238 fixup aa59adeb wip ff75c00b wip lib/plausible_web/live/funnel_settings/list.ex - restored from: 4eae122c Fix data-confirm attr interpolation 51f0397d Implement deleting funnels 1f6fe25d Add number of steps to funnels list 298a6a53 wip ff75c00b wip test/plausible_web/live/funnel_settings/funnel_settings/combo_box_test.exs - restored from: 20da4c89 Rename InputPicker to ComboBox test/plausible_web/live/funnel_settings/funnel_settings_test.exs - restored from: 34822ff4 Bootstrap InputPicker tests lib/plausible_web/live/funnel_settings.ex - restored from: 028036ad Review comments acd9c4f2 Prepare ephemeral funnel definitions so that users can test funnels 51f0397d Implement deleting funnels 0e95228b Extract funnel settings test module 8dc6a3e7 wip 89f10ecb wip 950a18d9 Dirty funnel save 298a6a53 wip aa59adeb wip ff75c00b wip test/plausible_web/controllers/error_report_controller_test.exs - restored from: 34822ff4 Bootstrap InputPicker tests test/support/html.ex - restored from: 0a53979d Improve InputPicker tests - include AlpineJS assertions 34822ff4 Bootstrap InputPicker tests lib/plausible_web/views/layout_view.ex - restored from: b490403b !ifxup lib/plausible_web/templates/site/settings_funnels.html.eex - restored from: 51f0397d Implement deleting funnels ea1315f3 Test funnels list in settings 7b16ace5 Leverage aplinejs to deal with the tyranny ff75c00b wip 4da25c35 Fixup lib/plausible_web/templates/layout/app.html.eex - restored from: ff75c00b wip * Add funnel settings route * Warn about funnels deletion when deleting goals lib/plausible_web/templates/site/settings_goals.html.eex - restored from: fdd9bcd0 Fixup f1e6364d Merge remote-tracking branch 'origin/master' into funnels-rebase 9d0b7c6d Fix markup error 4a4ddbdc Optionally preload funnels for goals and stub funnel-goal deletion ebdc4333 Extend the prompt in case of funnel-goal deletion 639c6238 fixup aa59adeb wip * Split new JS LiveView additions * Put funnels behind a feature flag * Integrate dashboard feature toggle * Update signing salt for live view * Update moduledocs * Update live reloader config * Use Phoenix.HTML.Safe for goal names * Workaround to get flashes working in embedded liveview * Keep feature toggles idempotent, rename property to setting We'll still retain the ability to flip bools on a lower level. * Update moduledocs * Make live flash disappear after 5s * Tailwind: purge .heex files too * Update docs link * Add live components to tailwind purge config * Update another flaky test Ref f0bdf872 cc @vinibrsl * Fix combobox input length w/ WebKit * Intoduce generic notice component * Revert "Fix combobox input length w/ WebKit" This reverts commit 3c653a6d85d5000167631e10ef45a93c13b41ed1. * Fix combobox input length on webkit * Make whole combobox item clickable, not only text * Fix glitch moving Save button on activation * Tweak dark mode * Show funnel form without waiting for funnel name input * Tweak dark mode * Include static Phoenix components in tailwind purge * Tune funnels form into a liveview of its own This is so that ComboBoxes can publish their selections and unavailable choices can be propagated to other siblings. * Push less data over websocket * Undo Lsp/formatter race condition * Fixup typespecs * Bust CI cache
2023-06-22 10:00:07 +03:00
end