Open source, privacy-first web analytics. Lightweight, cookie-free Google Analytics alternative. Self-hosted or cloud.
TypeScript analyticsanalytics-dashboardclickhouseelixirgoogle-analyticsmarketingopen-source-analyticsphoenixplausible-analyticspostgresqlprivacyprivacy-friendlyself-hostedsimple-analyticsstatisticstailwindcssweb-analyticswebsite-analyticswebsite-statswebsite-tracking
CRM: UX tweaks (#5481)
hq11e03374544a2
diff --git a/extra/lib/plausible_web/live/customer_support/live/team.ex b/extra/lib/plausible_web/live/customer_support/live/team.exindex c5db35b740..2ab8de6156 100644--- a/extra/lib/plausible_web/live/customer_support/live/team.ex+++ b/extra/lib/plausible_web/live/customer_support/live/team.ex@@ -99,12 +99,6 @@ defmodule PlausibleWeb.CustomerSupport.Live.Team do~H"""<div><script type="text/javascript">- const numberFormatCallback = function(e) {- const numeric = Number(e.target.value.replace(/[^0-9]/g, ''))- const value = numeric > 0 ? new Intl.NumberFormat("en-GB").format(numeric) : ''- e.target.value = value- }-const featureChangeCallback = function(e) {const value = e.target.valueconst checked = e.target.checked@@ -293,32 +287,43 @@ defmodule PlausibleWeb.CustomerSupport.Live.Team doautocomplete="off"/>- <.input- x-init="numberFormatCallback({target: $el})"- x-on:input="numberFormatCallback(event)"- field={f[:monthly_pageview_limit]}- label="Monthly Pageview Limit"- autocomplete="off"- />- <.input- x-init="numberFormatCallback({target: $el})"- x-on:input="numberFormatCallback(event)"- field={f[:site_limit]}- label="Site Limit"- autocomplete="off"- />- <.input- field={f[:team_member_limit]}- label="Team Member Limit (-1/unlimited for unlimited)"- autocomplete="off"- />- <.input- x-init="numberFormatCallback({target: $el})"- x-on:input="numberFormatCallback(event)"- field={f[:hourly_api_request_limit]}- label="Hourly API Request Limit"- autocomplete="off"- />+ <div class="flex items-center gap-x-4">+ <.input+ field={f[:monthly_pageview_limit]}+ label="Monthly Pageview Limit"+ autocomplete="off"+ width="w-[500]"+ />++ <.preview for={f[:monthly_pageview_limit]} />+ </div>+ <div class="flex items-center gap-x-4">+ <.input width="w-[500]" field={f[:site_limit]} label="Site Limit" autocomplete="off" />++ <.preview for={f[:site_limit]} />+ </div>++ <div class="flex items-center gap-x-4">+ <.input+ field={f[:team_member_limit]}+ label="Team Member Limit"+ autocomplete="off"+ width="w-[500]"+ />++ <.preview for={f[:team_member_limit]} />+ </div>++ <div class="flex items-center gap-x-4">+ <.input+ field={f[:hourly_api_request_limit]}+ label="Hourly API Request Limit"+ autocomplete="off"+ width="w-[500]"+ />++ <.preview for={f[:hourly_api_request_limit]} />+ </div><.input:for={@@ -375,8 +380,8 @@ defmodule PlausibleWeb.CustomerSupport.Live.Team do<div :if={@tab == "overview"} class="mt-8"><.form :let={f} for={@form} phx-submit="save-team" phx-target={@myself}>- <.input field={f[:trial_expiry_date]} label="Trial Expiry Date" />- <.input field={f[:accept_traffic_until]} label="Accept traffic Until" />+ <.input field={f[:trial_expiry_date]} type="date" label="Trial Expiry Date" />+ <.input field={f[:accept_traffic_until]} type="date" label="Accept traffic Until" /><.inputtype="checkbox"field={f[:allow_next_upgrade_override]}@@ -809,15 +814,6 @@ defmodule PlausibleWeb.CustomerSupport.Live.Team dodefp number_format(other), do: other- @numeric_fields [- "team_id",- "paddle_plan_id",- "monthly_pageview_limit",- "site_limit",- "team_member_limit",- "hourly_api_request_limit"- ]-defp sanitize_params(params) doparams|> Enum.map(&clear_param/1)@@ -825,20 +821,6 @@ defmodule PlausibleWeb.CustomerSupport.Live.Team do|> Map.new()end- defp clear_param({key, value}) when key in @numeric_fields do- if value in ["unlimited", "-1"] do- {key, value}- else- value =- value- |> to_string()- |> String.replace(~r/[^0-9-]/, "")- |> String.trim()-- {key, value}- end- end-defp clear_param({key, value}) when is_binary(value) do{key, String.trim(value)}end@@ -860,4 +842,30 @@ defmodule PlausibleWeb.CustomerSupport.Live.Team dodefp update_features_to_list(params) doMap.put(params, "features", Enum.reject(params["features[]"], &(&1 == "false" or &1 == "")))end++ defp preview_number(n) do+ case Integer.parse("#{n}") do+ {n, ""} ->+ number_format(n) <> " (#{PlausibleWeb.StatsView.large_number_format(n)})"++ _ ->+ "0"+ end+ end++ attr :for, :any, required: true++ defp preview(assigns) do+ ~H"""+ <.input+ name={"#{@for.name}-preview"}+ label="Preview (read-only)"+ autocomplete="off"+ width="w-[500]"+ readonly+ value={preview_number(@for.value)}+ class="bg-transparent border-0 p-0 m-0 text-sm w-full"+ />+ """+ endenddiff --git a/test/plausible_web/live/customer_support/teams_test.exs b/test/plausible_web/live/customer_support/teams_test.exsindex 1685737511..f6a3ccd803 100644--- a/test/plausible_web/live/customer_support/teams_test.exs+++ b/test/plausible_web/live/customer_support/teams_test.exs@@ -92,10 +92,10 @@ defmodule PlausibleWeb.Live.CustomerSupport.TeamsTest do|> render_change(%{"enterprise_plan" => %{"billing_interval" => "yearly",- "monthly_pageview_limit" => "20,000,000",- "site_limit" => "1,000",+ "monthly_pageview_limit" => "20000000",+ "site_limit" => "1000","team_member_limit" => "30",- "hourly_api_request_limit" => "1,000",+ "hourly_api_request_limit" => "1000","features[]" => ["false","false",@@ -125,10 +125,10 @@ defmodule PlausibleWeb.Live.CustomerSupport.TeamsTest do"enterprise_plan" => %{"paddle_plan_id" => "1111","billing_interval" => "yearly",- "monthly_pageview_limit" => "20,000,000",- "site_limit" => "1,000",+ "monthly_pageview_limit" => "20000000",+ "site_limit" => "1000","team_member_limit" => "30",- "hourly_api_request_limit" => "1,000",+ "hourly_api_request_limit" => "1000","features[]" => ["false","false",@@ -182,10 +182,10 @@ defmodule PlausibleWeb.Live.CustomerSupport.TeamsTest do"enterprise_plan" => %{"paddle_plan_id" => "1111","billing_interval" => "yearly",- "monthly_pageview_limit" => "20,000,000",- "site_limit" => "1,000",+ "monthly_pageview_limit" => "20000000",+ "site_limit" => "1000","team_member_limit" => "unlimited",- "hourly_api_request_limit" => "1,000"+ "hourly_api_request_limit" => "1000"}})