Fix tabs in mobile view

This commit is contained in:
Uku Taht 2020-11-20 11:57:33 +02:00
parent a530aef73e
commit cb8424b441
2 changed files with 22 additions and 25 deletions

View File

@ -6,35 +6,19 @@
Settings for <%= @site.domain %>
</h2>
</div>
<div class="lg:grid lg:grid-cols-12 lg:gap-x-5 mt-6">
<div class="py-6 px-2 sm:px-6 lg:py-0 lg:px-0 lg:col-span-3">
<div class="lg:hidden">
<select class="mt-1 form-select block w-full pl-3 pr-10 py-2 text-base leading-6 border-gray-300 focus:outline-none focus:ring focus:border-blue-300 sm:text-sm sm:leading-5 transition ease-in-out duration-150">
<option selected>General</option>
<option>Password</option>
<option>Notifications</option>
<option>Plan</option>
<option>Billing</option>
<option>Team Members</option>
</select>
</div>
<div class="lg:grid lg:grid-cols-12 lg:gap-x-5 lg:mt-4">
<div class="py-6 g:py-0 lg:col-span-3">
<%= form_for @conn, "/sites/#{URI.encode_www_form(@site.domain)}/monthly-report/recipients", [class: "lg:hidden"], fn f -> %>
<%= select f, :tab, settings_tabs(), class: "mt-1 block w-full pl-3 pr-10 py-2 text-base border-gray-300 focus:outline-none focus:ring-indigo-500 focus:border-indigo-500 sm:text-sm rounded-md", onchange: "location.href = location.href.replace(/[^\/\/]*$/, event.target.value)", selected: List.last(@conn.path_info) %>
<% end %>
<div class="hidden lg:block">
<%= render("_settings_tab.html", this_tab: "general", text: "General", site: @site, conn: @conn) %>
<%= render("_settings_tab.html", this_tab: "visibility", text: "Visibility", site: @site, conn: @conn) %>
<%= render("_settings_tab.html", this_tab: "goals", text: "Goals", site: @site, conn: @conn) %>
<%= render("_settings_tab.html", this_tab: "search-console", text: "Search Console", site: @site, conn: @conn) %>
<%= render("_settings_tab.html", this_tab: "email-reports", text: "Email reports", site: @site, conn: @conn) %>
<%= render("_settings_tab.html", this_tab: "custom-domain", text: "Custom domain", site: @site, conn: @conn) %>
<%= render("_settings_tab.html", this_tab: "danger-zone", text: "Danger zone", site: @site, conn: @conn) %>
<%= for [key: key, value: val] <- settings_tabs() do %>
<%= render("_settings_tab.html", this_tab: val, text: key, site: @site, conn: @conn) %>
<% end %>
</div>
</div>
<div class="space-y-6 sm:px-6 lg:px-0 lg:col-span-9">
<div class="space-y-6 lg:col-span-9 lg:mt-4">
<%= render @view_module, @view_template, assigns %>
</div>
</div>

View File

@ -21,6 +21,19 @@ defmodule PlausibleWeb.LayoutView do
end
end
def settings_tabs() do
[
[key: "General", value: "general"],
[key: "Visibility", value: "visibility"],
[key: "Goals", value: "goals"],
[key: "Search Console", value: "search-console"],
[key: "Email reports", value: "email-reports"],
[key: "Custom domain", value: "custom-domain"],
[key: "Danger zone", value: "danger-zone"],
]
end
def trial_notificaton(user) do
case Plausible.Billing.trial_days_left(user) do
days when days > 1 ->