2021-09-10 00:28:53 -04:00
|
|
|
defmodule CanneryWeb.HomeLive do
|
2022-01-22 21:40:29 -05:00
|
|
|
@moduledoc """
|
|
|
|
Liveview for the home page
|
|
|
|
"""
|
|
|
|
|
2021-03-11 21:12:55 -05:00
|
|
|
use CanneryWeb, :live_view
|
2022-01-22 21:40:29 -05:00
|
|
|
alias Cannery.Accounts
|
2022-07-04 20:19:03 -04:00
|
|
|
alias CanneryWeb.Endpoint
|
2021-03-11 21:12:55 -05:00
|
|
|
|
2022-11-19 10:31:13 -05:00
|
|
|
@version Mix.Project.config()[:version]
|
|
|
|
|
2021-03-11 21:12:55 -05:00
|
|
|
@impl true
|
2022-05-05 23:26:29 -04:00
|
|
|
def mount(_params, _session, socket) do
|
2021-09-10 00:28:53 -04:00
|
|
|
admins = Accounts.list_users_by_role(:admin)
|
2022-11-19 10:31:13 -05:00
|
|
|
socket = socket |> assign(page_title: gettext("Home"), admins: admins, version: @version)
|
2022-02-19 00:31:17 -05:00
|
|
|
{:ok, socket}
|
2021-03-11 21:12:55 -05:00
|
|
|
end
|
|
|
|
|
2022-02-07 23:50:32 -05:00
|
|
|
@impl true
|
|
|
|
def render(assigns) do
|
|
|
|
~H"""
|
2022-04-19 20:08:12 -04:00
|
|
|
<div class="mx-auto px-8 sm:px-16 flex flex-col justify-center items-center text-center space-y-4 max-w-3xl">
|
2022-07-04 20:19:03 -04:00
|
|
|
<img
|
|
|
|
src={Routes.static_path(Endpoint, "/images/cannery.svg")}
|
|
|
|
alt={gettext("Cannery logo")}
|
|
|
|
class="inline-block w-32 hover:-mt-2 hover:mb-2 transition-all duration-500 ease-in-out"
|
|
|
|
title={gettext("isn't he cute >:3")}
|
|
|
|
/>
|
|
|
|
|
2022-02-17 22:29:01 -05:00
|
|
|
<h1 class="title text-primary-600 text-2xl">
|
2022-02-08 23:25:09 -05:00
|
|
|
<%= gettext("Welcome to %{name}", name: "Cannery") %>
|
2022-02-07 23:50:32 -05:00
|
|
|
</h1>
|
|
|
|
|
2022-02-17 22:29:01 -05:00
|
|
|
<h2 class="title text-primary-600 text-lg">
|
2022-02-08 23:25:09 -05:00
|
|
|
<%= gettext("The self-hosted firearm tracker website") %>
|
2022-02-07 23:50:32 -05:00
|
|
|
</h2>
|
|
|
|
|
|
|
|
<hr class="hr" />
|
|
|
|
|
|
|
|
<ul class="flex flex-col space-y-4 text-center">
|
2022-02-08 23:25:09 -05:00
|
|
|
<li class="flex flex-col justify-center items-center
|
|
|
|
space-y-2">
|
2022-02-07 23:50:32 -05:00
|
|
|
<b class="whitespace-nowrap">
|
2022-02-08 23:25:09 -05:00
|
|
|
<%= gettext("Easy to Use:") %>
|
2022-02-07 23:50:32 -05:00
|
|
|
</b>
|
2022-02-08 23:25:09 -05:00
|
|
|
<p>
|
2022-02-17 21:24:59 -05:00
|
|
|
<%= gettext(
|
|
|
|
"%{name} lets you easily keep an eye on your ammo levels before and after range day",
|
2022-02-08 23:25:09 -05:00
|
|
|
name: "Cannery"
|
|
|
|
) %>
|
|
|
|
</p>
|
2022-02-07 23:50:32 -05:00
|
|
|
</li>
|
2022-02-08 23:25:09 -05:00
|
|
|
<li class="flex flex-col justify-center items-center
|
|
|
|
space-y-2">
|
2022-02-07 23:50:32 -05:00
|
|
|
<b class="whitespace-nowrap">
|
2022-02-08 23:25:09 -05:00
|
|
|
<%= gettext("Secure:") %>
|
2022-02-07 23:50:32 -05:00
|
|
|
</b>
|
|
|
|
<p>
|
2022-02-08 23:25:09 -05:00
|
|
|
<%= gettext("Self-host your own instance, or use an instance from someone you trust.") %>
|
|
|
|
<%= gettext("Your data stays with you, period") %>
|
2022-02-07 23:50:32 -05:00
|
|
|
</p>
|
|
|
|
</li>
|
2022-02-08 23:25:09 -05:00
|
|
|
<li class="flex flex-col justify-center items-center
|
|
|
|
space-y-2">
|
2022-02-07 23:50:32 -05:00
|
|
|
<b class="whitespace-nowrap">
|
2022-02-08 23:25:09 -05:00
|
|
|
<%= gettext("Simple:") %>
|
2022-02-07 23:50:32 -05:00
|
|
|
</b>
|
2022-02-08 23:25:09 -05:00
|
|
|
<p>
|
|
|
|
<%= gettext("Access from any internet-capable device") %>
|
|
|
|
</p>
|
2022-02-07 23:50:32 -05:00
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
|
2022-02-17 21:24:59 -05:00
|
|
|
<hr class="hr" />
|
2022-02-07 23:50:32 -05:00
|
|
|
|
|
|
|
<ul class="flex flex-col space-y-2 text-center justify-center">
|
2022-02-17 22:29:01 -05:00
|
|
|
<h2 class="title text-primary-600 text-lg">
|
2022-02-08 23:25:09 -05:00
|
|
|
<%= gettext("Instance Information") %>
|
2022-02-07 23:50:32 -05:00
|
|
|
</h2>
|
|
|
|
|
|
|
|
<li class="flex flex-col justify-center space-x-2">
|
2022-02-08 23:25:09 -05:00
|
|
|
<b>
|
|
|
|
<%= gettext("Admins:") %>
|
|
|
|
</b>
|
2022-02-07 23:50:32 -05:00
|
|
|
<p>
|
|
|
|
<%= if @admins |> Enum.empty?() do %>
|
2022-11-07 22:36:38 -05:00
|
|
|
<.link
|
|
|
|
href={Routes.user_registration_path(CanneryWeb.Endpoint, :new)}
|
|
|
|
class="hover:underline"
|
|
|
|
>
|
|
|
|
<%= dgettext("prompts", "Register to setup %{name}", name: "Cannery") %>
|
|
|
|
</.link>
|
2022-02-07 23:50:32 -05:00
|
|
|
<% else %>
|
|
|
|
<div class="flex flex-wrap justify-center space-x-2">
|
|
|
|
<%= for admin <- @admins do %>
|
|
|
|
<a class="hover:underline" href={"mailto:#{admin.email}"}>
|
|
|
|
<%= admin.email %>
|
|
|
|
</a>
|
|
|
|
<% end %>
|
|
|
|
</div>
|
|
|
|
<% end %>
|
|
|
|
</p>
|
|
|
|
</li>
|
|
|
|
|
|
|
|
<li class="flex flex-row justify-center space-x-2">
|
|
|
|
<b>Registration:</b>
|
|
|
|
<p>
|
|
|
|
<%= Application.get_env(:cannery, CanneryWeb.Endpoint)[:registration]
|
|
|
|
|> case do
|
2022-02-08 23:25:09 -05:00
|
|
|
"public" -> gettext("Public Signups")
|
|
|
|
_ -> gettext("Invite Only")
|
2022-02-07 23:50:32 -05:00
|
|
|
end %>
|
|
|
|
</p>
|
|
|
|
</li>
|
2022-02-17 22:28:10 -05:00
|
|
|
|
2022-02-24 20:42:27 -05:00
|
|
|
<li class="flex flex-row justify-center items-center space-x-2">
|
2022-02-17 22:28:10 -05:00
|
|
|
<b>Version:</b>
|
2022-11-07 22:36:38 -05:00
|
|
|
<.link
|
|
|
|
href="https://gitea.bubbletea.dev/shibao/cannery/src/branch/stable/CHANGELOG.md"
|
|
|
|
class="flex flex-row justify-center items-center space-x-2 hover:underline"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
2022-11-19 10:31:13 -05:00
|
|
|
<p>
|
|
|
|
<%= @version %>
|
|
|
|
</p>
|
2022-02-24 20:42:27 -05:00
|
|
|
<i class="fas fa-md fa-info-circle"></i>
|
2022-11-07 22:36:38 -05:00
|
|
|
</.link>
|
2022-02-17 22:28:10 -05:00
|
|
|
</li>
|
2022-02-07 23:50:32 -05:00
|
|
|
</ul>
|
2022-05-05 23:59:31 -04:00
|
|
|
|
|
|
|
<hr class="hr" />
|
|
|
|
|
|
|
|
<ul class="flex flex-col space-y-2 text-center justify-center">
|
|
|
|
<h2 class="title text-primary-600 text-lg">
|
|
|
|
<%= gettext("Get involved!") %>
|
|
|
|
</h2>
|
|
|
|
|
|
|
|
<li class="flex flex-col justify-center space-x-2">
|
2022-11-07 22:36:38 -05:00
|
|
|
<.link
|
|
|
|
class="flex flex-row justify-center items-center space-x-2 hover:underline"
|
|
|
|
href="https://gitea.bubbletea.dev/shibao/cannery"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
2022-05-05 23:59:31 -04:00
|
|
|
<p><%= gettext("View the source code") %></p>
|
|
|
|
<i class="fas fa-md fa-code"></i>
|
2022-11-07 22:36:38 -05:00
|
|
|
</.link>
|
2022-05-05 23:59:31 -04:00
|
|
|
</li>
|
|
|
|
<li class="flex flex-col justify-center space-x-2">
|
2022-11-07 22:36:38 -05:00
|
|
|
<.link
|
|
|
|
class="flex flex-row justify-center items-center space-x-2 hover:underline"
|
|
|
|
href="https://weblate.bubbletea.dev/engage/cannery"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
2022-05-05 23:59:31 -04:00
|
|
|
<p><%= gettext("Help translate") %></p>
|
|
|
|
<i class="fas fa-md fa-language"></i>
|
2022-11-07 22:36:38 -05:00
|
|
|
</.link>
|
2022-05-05 23:59:31 -04:00
|
|
|
</li>
|
|
|
|
<li class="flex flex-col justify-center space-x-2">
|
2022-11-07 22:36:38 -05:00
|
|
|
<.link
|
|
|
|
class="flex flex-row justify-center items-center space-x-2 hover:underline"
|
|
|
|
href="https://gitea.bubbletea.dev/shibao/cannery/issues/new"
|
|
|
|
target="_blank"
|
|
|
|
rel="noopener noreferrer"
|
|
|
|
>
|
2022-05-05 23:59:31 -04:00
|
|
|
<p><%= gettext("Report bugs or request features") %></p>
|
|
|
|
<i class="fas fa-md fa-spider"></i>
|
2022-11-07 22:36:38 -05:00
|
|
|
</.link>
|
2022-05-05 23:59:31 -04:00
|
|
|
</li>
|
|
|
|
</ul>
|
2022-02-07 23:50:32 -05:00
|
|
|
</div>
|
|
|
|
"""
|
|
|
|
end
|
2021-03-11 21:12:55 -05:00
|
|
|
end
|