Skip to content

Commit 9ccce04

Browse files
committed
Updated empty states across settings
1 parent b624f39 commit 9ccce04

File tree

20 files changed

+726
-482
lines changed

20 files changed

+726
-482
lines changed

extra/lib/plausible_web/live/funnel_settings.ex

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,15 +70,15 @@ defmodule PlausibleWeb.Live.FunnelSettings do
7070
/>
7171
</div>
7272
73-
<div :if={@goal_count < Funnel.min_steps()} class="flex flex-col items-center">
74-
<h1 class="mt-4 text-center">
73+
<div :if={@goal_count < Funnel.min_steps()} class="flex flex-col items-center justify-center pt-5 pb-6 max-w-md mx-auto">
74+
<h3 class="text-center text-base font-medium text-gray-900 dark:text-gray-100 leading-7">
7575
Ready to dig into user flows?
76-
</h1>
77-
<p class="mt-4 mb-6 max-w-lg text-sm text-gray-500 dark:text-gray-400 leading-5 text-center">
78-
Set up a few goals first (e.g. <b>"Signup"</b>, <b>"Visit /"</b>, or <b>"Scroll 50% on /blog/*"</b>) and return here to build your first funnel!
76+
</h3>
77+
<p class="text-center text-sm mt-1 text-gray-500 dark:text-gray-400 leading-5 text-pretty">
78+
Set up a few goals like <span class="font-medium text-indigo-600 dark:text-gray-100">Signup</span>, <span class="font-medium text-indigo-600 dark:text-gray-100">Visit /</span>, or <span class="font-medium text-indigo-600 dark:text-gray-100">Scroll 50% on /blog/*</span> first, then return here to build your first funnel.
7979
</p>
8080
<.button_link
81-
class="mb-2"
81+
class="mt-4"
8282
href={PlausibleWeb.Router.Helpers.site_path(@socket, :settings_goals, @domain)}
8383
>
8484
Set up goals →

extra/lib/plausible_web/live/funnel_settings/list.ex

Lines changed: 27 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ defmodule PlausibleWeb.Live.FunnelSettings.List do
1212
def render(assigns) do
1313
~H"""
1414
<div>
15-
<.filter_bar filter_text={@filter_text} placeholder="Search Funnels">
16-
<.button id="add-funnel-button" phx-click="add-funnel" mt?={false}>
17-
Add funnel
18-
</.button>
19-
</.filter_bar>
15+
<%= if String.trim(@filter_text) != "" || Enum.count(@funnels) > 0 do %>
16+
<.filter_bar filter_text={@filter_text} placeholder="Search Funnels">
17+
<.button id="add-funnel-button" phx-click="add-funnel" mt?={false}>
18+
Add funnel
19+
</.button>
20+
</.filter_bar>
21+
<% end %>
2022
2123
<%= if Enum.count(@funnels) > 0 do %>
2224
<.table rows={@funnels}>
@@ -42,17 +44,30 @@ defmodule PlausibleWeb.Live.FunnelSettings.List do
4244
</:tbody>
4345
</.table>
4446
<% else %>
45-
<p class="mt-12 mb-8 text-sm text-center">
46-
<span :if={String.trim(@filter_text) != ""}>
47+
<%= if String.trim(@filter_text) != "" do %>
48+
<p class="mt-12 mb-8 text-sm text-center">
4749
No funnels found for this site. Please refine or
4850
<.styled_link phx-click="reset-filter-text" id="reset-filter-hint">
4951
reset your search.
5052
</.styled_link>
51-
</span>
52-
<span :if={String.trim(@filter_text) == "" && Enum.empty?(@funnels)}>
53-
No funnels configured for this site.
54-
</span>
55-
</p>
53+
</p>
54+
<% else %>
55+
<div class="flex flex-col items-center justify-center pt-5 pb-6 max-w-md mx-auto">
56+
<h3 class="text-center text-base font-medium text-gray-900 dark:text-gray-100 leading-7">
57+
Create your first funnel
58+
</h3>
59+
<p class="text-center text-sm mt-1 text-gray-500 dark:text-gray-400 leading-5 text-pretty">
60+
Compose goals into funnels to track user flows and conversion rates. <.styled_link href="https://plausible.io/docs/funnel-analysis" target="_blank">Learn more</.styled_link>
61+
</p>
62+
<.button
63+
id="add-funnel-button"
64+
phx-click="add-funnel"
65+
class="mt-4"
66+
>
67+
Add funnel
68+
</.button>
69+
</div>
70+
<% end %>
5671
<% end %>
5772
</div>
5873
"""

lib/plausible_web/components/site/feature.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ defmodule PlausibleWeb.Components.Site.Feature do
2626
class={@class}
2727
>
2828
<.toggle_submit set_to={@current_setting} disabled?={@disabled?}>
29-
Show {String.downcase(@feature_mod.display_name())} in the dashboard
29+
Show in dashboard
3030
</.toggle_submit>
3131
</.form>
3232

lib/plausible_web/controllers/site_controller.ex

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,36 +163,75 @@ defmodule PlausibleWeb.SiteController do
163163
def settings_visibility(conn, _params) do
164164
site = conn.assigns[:site]
165165

166+
has_shared_links? =
167+
Repo.exists?(
168+
from(l in Plausible.Site.SharedLink,
169+
where:
170+
l.site_id == ^site.id and
171+
l.name not in ^Plausible.Sites.shared_link_special_names()
172+
)
173+
)
174+
166175
conn
167176
|> render("settings_visibility.html",
168177
site: site,
178+
has_shared_links?: has_shared_links?,
169179
dogfood_page_path: "/:dashboard/settings/visibility",
170180
connect_live_socket: true,
171181
layout: {PlausibleWeb.LayoutView, "site_settings.html"}
172182
)
173183
end
174184

175185
def settings_goals(conn, _params) do
186+
site = conn.assigns[:site]
187+
188+
has_goals? =
189+
Repo.exists?(
190+
from(g in Plausible.Goal,
191+
where: g.site_id == ^site.id
192+
)
193+
)
194+
176195
conn
177196
|> render("settings_goals.html",
197+
site: site,
198+
has_goals?: has_goals?,
178199
dogfood_page_path: "/:dashboard/settings/goals",
179200
connect_live_socket: true,
180201
layout: {PlausibleWeb.LayoutView, "site_settings.html"}
181202
)
182203
end
183204

184205
def settings_funnels(conn, _params) do
206+
site = conn.assigns[:site]
207+
208+
has_funnels? =
209+
Repo.exists?(
210+
from(f in Plausible.Funnel,
211+
where: f.site_id == ^site.id
212+
)
213+
)
214+
185215
conn
186216
|> render("settings_funnels.html",
217+
site: site,
218+
has_funnels?: has_funnels?,
187219
dogfood_page_path: "/:dashboard/settings/funnels",
188220
connect_live_socket: true,
189221
layout: {PlausibleWeb.LayoutView, "site_settings.html"}
190222
)
191223
end
192224

193225
def settings_props(conn, _params) do
226+
site = conn.assigns[:site]
227+
228+
has_props? =
229+
site.allowed_event_props && length(site.allowed_event_props) > 0
230+
194231
conn
195232
|> render("settings_props.html",
233+
site: site,
234+
has_props?: has_props?,
196235
dogfood_page_path: "/:dashboard/settings/properties",
197236
layout: {PlausibleWeb.LayoutView, "site_settings.html"},
198237
connect_live_socket: true
@@ -267,9 +306,17 @@ defmodule PlausibleWeb.SiteController do
267306
def settings_imports_exports(conn, _params) do
268307
site = conn.assigns.site
269308

309+
has_imports? =
310+
Repo.exists?(
311+
from(i in Plausible.Imported.SiteImport,
312+
where: i.site_id == ^site.id
313+
)
314+
)
315+
270316
conn
271317
|> render("settings_imports_exports.html",
272318
site: site,
319+
has_imports?: has_imports?,
273320
dogfood_page_path: "/:dashboard/settings/imports-exports",
274321
connect_live_socket: true,
275322
layout: {PlausibleWeb.LayoutView, "site_settings.html"}

lib/plausible_web/live/goal_settings/list.ex

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,19 @@ defmodule PlausibleWeb.Live.GoalSettings.List do
1616

1717
~H"""
1818
<div>
19-
<.filter_bar filter_text={@filter_text} placeholder="Search Goals">
20-
<.button
21-
id="add-goal-button"
22-
phx-click="add-goal"
23-
mt?={false}
24-
x-data
25-
x-on:click={Modal.JS.preopen("goals-form-modal")}
26-
>
27-
Add goal
28-
</.button>
29-
</.filter_bar>
19+
<%= if String.trim(@filter_text) != "" || Enum.count(@goals) > 0 do %>
20+
<.filter_bar filter_text={@filter_text} placeholder="Search Goals">
21+
<.button
22+
id="add-goal-button"
23+
phx-click="add-goal"
24+
mt?={false}
25+
x-data
26+
x-on:click={Modal.JS.preopen("goals-form-modal")}
27+
>
28+
Add goal
29+
</.button>
30+
</.filter_bar>
31+
<% end %>
3032
3133
<%= if Enum.count(@goals) > 0 do %>
3234
<.table rows={@goals}>
@@ -89,17 +91,32 @@ defmodule PlausibleWeb.Live.GoalSettings.List do
8991
</:tbody>
9092
</.table>
9193
<% else %>
92-
<p class="mt-12 mb-8 text-center text-sm">
93-
<span :if={String.trim(@filter_text) != ""}>
94+
<%= if String.trim(@filter_text) != "" do %>
95+
<p class="mt-12 mb-8 text-center text-sm">
9496
No goals found for this site. Please refine or
9597
<.styled_link phx-click="reset-filter-text" id="reset-filter-hint">
9698
reset your search.
9799
</.styled_link>
98-
</span>
99-
<span :if={String.trim(@filter_text) == "" && Enum.empty?(@goals)}>
100-
No goals configured for this site.
101-
</span>
102-
</p>
100+
</p>
101+
<% else %>
102+
<div class="flex flex-col items-center justify-center pt-5 pb-6 max-w-md mx-auto">
103+
<h3 class="text-center text-base font-medium text-gray-900 dark:text-gray-100 leading-7">
104+
Create your first goal
105+
</h3>
106+
<p class="text-center text-sm mt-1 text-gray-500 dark:text-gray-400 leading-5 text-pretty">
107+
Define actions that you want your users to take, like visiting a certain page, submitting a form, etc. <.styled_link href="https://plausible.io/docs/goal-conversions" target="_blank">Learn more</.styled_link>
108+
</p>
109+
<.button
110+
id="add-goal-button"
111+
phx-click="add-goal"
112+
x-data
113+
x-on:click={Modal.JS.preopen("goals-form-modal")}
114+
class="mt-4"
115+
>
116+
Add goal
117+
</.button>
118+
</div>
119+
<% end %>
103120
<% end %>
104121
</div>
105122
"""

lib/plausible_web/live/imports_exports_settings.ex

Lines changed: 59 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -74,35 +74,63 @@ defmodule PlausibleWeb.Live.ImportsExportsSettings do
7474
{@import_warning}
7575
</.notice>
7676
77-
<div class="flex gap-x-4">
78-
<.button_link
79-
theme="secondary"
80-
href={Plausible.Google.API.import_authorize_url(@site.id)}
81-
disabled={@import_in_progress? or @at_maximum?}
82-
mt?={false}
83-
>
84-
Import from
85-
<img
86-
src="/images/icon/google_analytics_logo.svg"
87-
alt="Google Analytics import"
88-
class="h-6 w-12 -my-1"
89-
/>
90-
</.button_link>
91-
<.button_link
92-
disabled={@import_in_progress? or @at_maximum?}
93-
href={"/#{URI.encode_www_form(@site.domain)}/settings/import"}
94-
mt?={false}
95-
>
96-
Import from CSV
97-
</.button_link>
98-
</div>
99-
100-
<p :if={Enum.empty?(@site_imports)} class="text-center text-sm mt-8 mb-12">
101-
There are no imports yet for this site.
102-
</p>
103-
104-
<div class="mt-6">
105-
<.table :if={not Enum.empty?(@site_imports)} rows={@site_imports}>
77+
<%= if Enum.empty?(@site_imports) do %>
78+
<div class="flex flex-col items-center justify-center pt-5 pb-6 max-w-md mx-auto">
79+
<h3 class="text-center text-base font-medium text-gray-900 dark:text-gray-100 leading-7">
80+
Import your first data
81+
</h3>
82+
<p class="text-center text-sm mt-1 text-gray-500 dark:text-gray-400 leading-5 text-pretty">
83+
Import data from external sources. Up to {Plausible.Imported.max_complete_imports()} imports are allowed at a time.
84+
</p>
85+
<div class="flex gap-x-4 mt-4">
86+
<.button_link
87+
theme="secondary"
88+
href={Plausible.Google.API.import_authorize_url(@site.id)}
89+
disabled={@import_in_progress? or @at_maximum?}
90+
mt?={false}
91+
>
92+
Import from
93+
<img
94+
src="/images/icon/google_analytics_logo.svg"
95+
alt="Google Analytics import"
96+
class="h-6 w-12 -my-1"
97+
/>
98+
</.button_link>
99+
<.button_link
100+
disabled={@import_in_progress? or @at_maximum?}
101+
href={"/#{URI.encode_www_form(@site.domain)}/settings/import"}
102+
mt?={false}
103+
>
104+
Import from CSV
105+
</.button_link>
106+
</div>
107+
</div>
108+
<% else %>
109+
<div class="flex gap-x-4">
110+
<.button_link
111+
theme="secondary"
112+
href={Plausible.Google.API.import_authorize_url(@site.id)}
113+
disabled={@import_in_progress? or @at_maximum?}
114+
mt?={false}
115+
>
116+
Import from
117+
<img
118+
src="/images/icon/google_analytics_logo.svg"
119+
alt="Google Analytics import"
120+
class="h-6 w-12 -my-1"
121+
/>
122+
</.button_link>
123+
<.button_link
124+
disabled={@import_in_progress? or @at_maximum?}
125+
href={"/#{URI.encode_www_form(@site.domain)}/settings/import"}
126+
mt?={false}
127+
>
128+
Import from CSV
129+
</.button_link>
130+
</div>
131+
132+
<div class="mt-6">
133+
<.table rows={@site_imports}>
106134
<:thead>
107135
<.th>Import</.th>
108136
<.th hide_on_mobile>Date Range</.th>
@@ -164,7 +192,8 @@ defmodule PlausibleWeb.Live.ImportsExportsSettings do
164192
</.td>
165193
</:tbody>
166194
</.table>
167-
</div>
195+
</div>
196+
<% end %>
168197
"""
169198
end
170199

lib/plausible_web/live/plugins/api/settings.ex

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,29 @@ defmodule PlausibleWeb.Live.Plugins.API.Settings do
5050
)}
5151
<% end %>
5252
53-
<div>
53+
<%= if Enum.empty?(@displayed_tokens) do %>
54+
<div class="flex flex-col items-center justify-center pt-5 pb-6 max-w-md mx-auto">
55+
<h3 class="text-center text-base font-medium text-gray-900 dark:text-gray-100 leading-7">
56+
Create your first plugin token
57+
</h3>
58+
<p class="text-center text-sm mt-1 text-gray-500 dark:text-gray-400 leading-5 text-pretty">
59+
Control plugin access by creating tokens for third-party integrations.
60+
</p>
61+
<.button
62+
phx-click="create-token"
63+
class="mt-4"
64+
>
65+
New plugin token
66+
</.button>
67+
</div>
68+
<% else %>
5469
<.filter_bar filtering_enabled?={false}>
5570
<.button phx-click="create-token" mt?={false}>
5671
Create plugin token
5772
</.button>
5873
</.filter_bar>
5974
60-
<.table :if={not Enum.empty?(@displayed_tokens)} rows={@displayed_tokens}>
75+
<.table rows={@displayed_tokens}>
6176
<:thead>
6277
<.th>Description</.th>
6378
<.th hide_on_mobile>Hint</.th>
@@ -86,7 +101,7 @@ defmodule PlausibleWeb.Live.Plugins.API.Settings do
86101
</.td>
87102
</:tbody>
88103
</.table>
89-
</div>
104+
<% end %>
90105
</div>
91106
"""
92107
end

0 commit comments

Comments
 (0)