Skip to content

Commit 7d6bebd

Browse files
committed
add help message when groups are empty
1 parent 969c45e commit 7d6bebd

1 file changed

Lines changed: 33 additions & 7 deletions

File tree

lib/wik_web/components/components.ex

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -84,13 +84,39 @@ defmodule WikWeb.Components do
8484

8585
def groups_list(assigns) do
8686
~H"""
87-
<ul class="space-y-2 text-center mx-auto">
88-
<li :for={group <- @groups} value={group.id}>
89-
<a href={~p"/#{group.slug}"} class="btn btn-primary block">
90-
{group.name}
91-
</a>
92-
</li>
93-
</ul>
87+
<%= if Enum.empty?(@groups) do %>
88+
<div class="space-y-4 bg-slate-100 rounded-lg p-6 text-slate-700">
89+
<p>Ooops... can't see your groups?</p>
90+
<p class="text-sm text-slate-500">
91+
Telegram's auth sometimes works in mysterious ways, but there is an easy fix:
92+
</p>
93+
<ol class="list-decimal list-inside text-sm">
94+
<li>
95+
<span>Send a PM to</span>
96+
<a
97+
class="text-blue-600 hover:underline"
98+
href={"https://t.me/" <> Application.get_env(:wik, :bot_username)}
99+
>
100+
@{Application.get_env(:wik, :bot_username)}
101+
</a>
102+
</li>
103+
<li>
104+
<.link navigate={~p"/auth/logout"} class="text-blue-600 hover:underline">Logout</.link>
105+
</li>
106+
<li>
107+
Login
108+
</li>
109+
</ol>
110+
</div>
111+
<% else %>
112+
<ul class="space-y-2 text-center mx-auto">
113+
<li :for={group <- @groups} value={group.id}>
114+
<a href={~p"/#{group.slug}"} class="btn btn-primary block">
115+
{group.name}
116+
</a>
117+
</li>
118+
</ul>
119+
<% end %>
94120
"""
95121
end
96122

0 commit comments

Comments
 (0)