This commit is contained in:
Adam Rutkowski 2023-05-16 17:09:45 +02:00
parent 265d21efc8
commit 85f5cbbdae
3 changed files with 11 additions and 9 deletions

View File

@ -29,12 +29,12 @@ defmodule PlausibleWeb.Live.FunnelSettings.Form do
options={Enum.map(@goals, fn goal -> {goal.id, Plausible.Goal.display_name(goal)} end)} options={Enum.map(@goals, fn goal -> {goal.id, Plausible.Goal.display_name(goal)} end)}
/> />
<a :if={@step_count < 5} class="underline text-indigo-600 cursor-pointer" phx-click="add-step" phx-target={@myself}>Add another step</a> <a :if={@step_count < 5} class="underline text-indigo-600 text-sm cursor-pointer" phx-click="add-step" phx-target={@myself}>+ Add another step</a>
<br/><hr/>
<div class="mt-6">
<button type="submit" class="button mt-6">Save</button> <button type="submit" class="button mt-6">Save</button>
<button type="button" class="button mt-6" phx-click="cancel_add_funnel">Cancel</button> <button type="button" class="inline-block mt-4 ml-2 px-4 py-2 border border-gray-300 dark:border-gray-500 text-sm leading-5 font-medium rounded-md text-red-700 bg-white dark:bg-gray-800 hover:text-red-500 dark:hover:text-red-400 focus:outline-none focus:border-blue-300 focus:ring active:text-red-800 active:bg-gray-50 transition ease-in-out duration-150 " phx-click="cancel_add_funnel">Cancel</button>
</div>
</.form> </.form>
</div> </div>
</div> </div>
@ -45,7 +45,7 @@ defmodule PlausibleWeb.Live.FunnelSettings.Form do
def input(assigns) do def input(assigns) do
~H""" ~H"""
<input type="text" id={@field.id} name={@field.name} value={@field.value} phx-debounce="300" class="focus:ring-indigo-500 focus:border-indigo-500 dark:bg-gray-900 dark:text-gray-300 block w-full rounded-md sm:text-sm border-gray-300 dark:border-gray-500" /> <input autofocus type="text" id={@field.id} name={@field.name} value={@field.value} phx-debounce="300" class="focus:ring-indigo-500 focus:border-indigo-500 dark:bg-gray-900 dark:text-gray-300 block w-full rounded-md sm:text-sm border-gray-300 dark:border-gray-500" />
""" """
end end

View File

@ -10,13 +10,15 @@ defmodule PlausibleWeb.Live.FunnelSettings.InputPicker do
attr :goal_id, :string, default: "" attr :goal_id, :string, default: ""
attr :higlighted, :integer, default: nil attr :higlighted, :integer, default: nil
## XXX handle phx-blur properly on tab
def render(assigns) do def render(assigns) do
~H""" ~H"""
<div class="mb-3"> <div class="mb-3">
<div class="relative w-full"> <div class="relative w-full">
<div class="pl-2 pr-8 py-1 w-full dark:bg-gray-900 dark:text-gray-300 rounded-md shadow-sm border border-gray-300 dark:border-gray-700 focus-within:border-indigo-500 focus-within:ring-1 focus-within:ring-indigo-500 "> <div class="pl-2 pr-8 py-1 w-full dark:bg-gray-900 dark:text-gray-300 rounded-md shadow-sm border border-gray-300 dark:border-gray-700 focus-within:border-indigo-500 focus-within:ring-1 focus-within:ring-indigo-500 ">
<input autocomplete="off" phx-debounce="10" phx-keyup="keypress" phx-target={@myself} name={@id} id={@id} class="border-none py-1 px-1 p-0 w-full inline-block rounded-md focus:outline-none focus:ring-0 text-sm" style="background-color: inherit;" placeholder={@placeholder} type="text" value={@value}>
<input autocomplete="off" phx-debounce="10" phx-keyup="keypress" phx-click="show-picker" phx-target={@myself} name={@id} id={@id} class="border-none py-1 px-1 p-0 w-full inline-block rounded-md focus:outline-none focus:ring-0 text-sm" style="background-color: inherit;" placeholder={@placeholder} type="text" value={@value}>
<div phx-click="show-picker" phx-target={@myself} class="cursor-pointer absolute inset-y-0 right-0 flex items-center pr-2"> <div phx-click="show-picker" phx-target={@myself} class="cursor-pointer absolute inset-y-0 right-0 flex items-center pr-2">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="h-4 w-4 text-gray-500"><path fill-rule="evenodd" d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z" clip-rule="evenodd"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true" class="h-4 w-4 text-gray-500"><path fill-rule="evenodd" d="M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z" clip-rule="evenodd"></path></svg>

View File

@ -24,6 +24,6 @@
<%= link("+ Add goal", to: "/#{URI.encode_www_form(@site.domain)}/goals/new", class: "button mt-6") %> <%= link("+ Add goal", to: "/#{URI.encode_www_form(@site.domain)}/goals/new", class: "button mt-6") %>
<%= if Enum.count(@goals) >= 2 do %> <%= if Enum.count(@goals) >= 2 do %>
<%= link("Set up funnels", to: Routes.site_path(@conn, :settings_funnels, @site.domain), class: "button mt-6 ml-2") %> <%= link("Set up funnels", to: Routes.site_path(@conn, :settings_funnels, @site.domain), class: "mt-6 ml-2 text-indigo-600 underline text-sm") %>
<% end %> <% end %>
</div> </div>