From 826e900c1bb548176b34b446bc8d0367c1a0d8e2 Mon Sep 17 00:00:00 2001 From: Uku Taht Date: Mon, 11 Apr 2022 19:09:39 +0300 Subject: [PATCH] Make import date range look non-clickable Because they aren't --- lib/plausible_web/controllers/site_controller.ex | 3 ++- .../email/google_analytics_import.html.eex | 8 ++++---- .../site/import_from_google_confirm.html.eex | 15 ++++++--------- lib/plausible_web/views/form_helpers.ex | 2 +- 4 files changed, 13 insertions(+), 15 deletions(-) diff --git a/lib/plausible_web/controllers/site_controller.ex b/lib/plausible_web/controllers/site_controller.ex index 53f70ffa8..537b67760 100644 --- a/lib/plausible_web/controllers/site_controller.ex +++ b/lib/plausible_web/controllers/site_controller.ex @@ -706,14 +706,15 @@ defmodule PlausibleWeb.SiteController do Plausible.Stats.Clickhouse.pageview_start_date_local(site) || Timex.today(site.timezone) {:ok, view_ids} = Plausible.Google.Api.get_analytics_view_ids(access_token) + {view_id_name, _} = Enum.find(view_ids, fn {k, v} -> v == view_id end) conn |> assign(:skip_plausible_tracking, true) |> render("import_from_google_confirm.html", access_token: access_token, site: site, - view_ids: view_ids, selected_view_id: view_id, + selected_view_id_name: view_id_name, start_date: start_date, end_date: end_date, layout: {PlausibleWeb.LayoutView, "focus.html"} diff --git a/lib/plausible_web/templates/email/google_analytics_import.html.eex b/lib/plausible_web/templates/email/google_analytics_import.html.eex index d56f3f0cf..eaadd1b40 100644 --- a/lib/plausible_web/templates/email/google_analytics_import.html.eex +++ b/lib/plausible_web/templates/email/google_analytics_import.html.eex @@ -1,11 +1,11 @@ Hey <%= user_salutation(@user) %>,

<%= if @success do %> - Your Google Analytics import has completed. -

- View dashboard: @link + Your Google Analytics import has completed successfully. The Plausible dashboard for <%= @site.domain %> now contains historical imported data from <%= date_format(@site.imported_data.start_date) %> to <%= date_format(@site.imported_data.end_date) %> +

+<%= link("Click here", to: @link) %> to view your dashboard. <% else %> - Unfortunately, your Google Analytics import failed. + Unfortunately, your Google Analytics import for <%= @site.domain %> did not complete successfully. Please try again <%= if !Application.get_env(:plausible, :is_selfhost) do %>or <%= link("contact support", to: "https://plausible.io/contact") %><% end %>. <% end %>

-- diff --git a/lib/plausible_web/templates/site/import_from_google_confirm.html.eex b/lib/plausible_web/templates/site/import_from_google_confirm.html.eex index 7b243ede3..072d998d1 100644 --- a/lib/plausible_web/templates/site/import_from_google_confirm.html.eex +++ b/lib/plausible_web/templates/site/import_from_google_confirm.html.eex @@ -7,27 +7,24 @@ <% {:ok, start_date} -> %>
- Confirm the view and dates in your Google Analytics account to be imported to the Plausible dashboard + Stats from this property and time period will be imported from your Google Analytics account to your Plausible dashboard
-
+
<%= styled_label(f, :view_id, "Google Analytics view") %> - <%= styled_select f, :view_display, @view_ids, disabled: "true", selected: @selected_view_id %> + <%= @selected_view_id_name %> <%= hidden_input f, :view_id, readonly: "true", value: @selected_view_id %>
-
- Historical data will be imported from your first Google Analytics visitor to your first Plausible visitor -
<%= styled_label f, :start_date, "From" %> - <%= styled_text_input f, :start_date, value: PlausibleWeb.EmailView.date_format(start_date), readonly: "true" %> + <%= PlausibleWeb.EmailView.date_format(start_date) %> <%= hidden_input f, :start_date, value: start_date, readonly: "true" %>
-
→
+
→
<%= styled_label f, :end_date, "To" %> - <%= styled_text_input f, :end_date, value: PlausibleWeb.EmailView.date_format(@end_date), readonly: "true" %> + <%= PlausibleWeb.EmailView.date_format(@end_date) %> <%= hidden_input f, :end_date, value: @end_date, readonly: "true" %>
diff --git a/lib/plausible_web/views/form_helpers.ex b/lib/plausible_web/views/form_helpers.ex index 97cb24ccc..1dc16f75b 100644 --- a/lib/plausible_web/views/form_helpers.ex +++ b/lib/plausible_web/views/form_helpers.ex @@ -10,7 +10,7 @@ defmodule PlausibleWeb.FormHelpers do "mt-1 block w-full px-3 py-2 text-base dark:text-gray-100 dark:border-gray-500 border-gray-300 focus:outline-none sm:text-sm rounded-md" ] @active_text_input_class "dark:bg-gray-900 focus:ring-indigo-500 focus:border-indigo-500" - @disabled_text_input_class "bg-gray-100 dark:bg-gray-800 select-none" + @disabled_text_input_class "bg-gray-100 dark:bg-gray-800 select-none cursor-default" def styled_text_input(form, field, opts \\ []) do opts = merge_opts(@text_input_opts, opts)