diff --git a/config/runtime.exs b/config/runtime.exs index 1bc702fe..c677da6a 100644 --- a/config/runtime.exs +++ b/config/runtime.exs @@ -12,6 +12,9 @@ if System.get_env("PHX_SERVER") && System.get_env("RELEASE_NAME") do config :cannery, CanneryWeb.Endpoint, server: true end +config :cannery, CanneryWeb.ViewHelpers, + shibao_mode: System.get_env("SHIBAO_MODE") == "true" + # Set locale Gettext.put_locale(System.get_env("LOCALE") || "en_US") diff --git a/lib/cannery_web/components/move_ammo_group_component.html.heex b/lib/cannery_web/components/move_ammo_group_component.html.heex index c30eb1e1..8796e984 100644 --- a/lib/cannery_web/components/move_ammo_group_component.html.heex +++ b/lib/cannery_web/components/move_ammo_group_component.html.heex @@ -5,7 +5,7 @@ <%= if @containers |> Enum.empty?() do %>

- <%= gettext("No other containers") %> 😔 + <%= gettext("No other containers") %> <%= display_emoji("😔") %>

<%= live_patch(dgettext("actions", "Add another container!"), diff --git a/lib/cannery_web/live/ammo_group_live/index.html.heex b/lib/cannery_web/live/ammo_group_live/index.html.heex index 03de1d4e..2151d6cc 100644 --- a/lib/cannery_web/live/ammo_group_live/index.html.heex +++ b/lib/cannery_web/live/ammo_group_live/index.html.heex @@ -5,7 +5,7 @@ <%= if @ammo_groups |> Enum.empty?() do %>

- <%= gettext("No Ammo") %> 😔 + <%= gettext("No Ammo") %> <%= display_emoji("😔") %>

<%= live_patch(dgettext("actions", "Add your first box!"), diff --git a/lib/cannery_web/live/ammo_type_live/index.html.heex b/lib/cannery_web/live/ammo_type_live/index.html.heex index 278b8657..c5e5a2c5 100644 --- a/lib/cannery_web/live/ammo_type_live/index.html.heex +++ b/lib/cannery_web/live/ammo_type_live/index.html.heex @@ -5,7 +5,7 @@ <%= if @ammo_types |> Enum.empty?() do %>

- <%= gettext("No Ammo Types") %> 😔 + <%= gettext("No Ammo Types") %> <%= display_emoji("😔") %>

<%= live_patch(dgettext("actions", "Add your first type!"), diff --git a/lib/cannery_web/live/container_live/index.html.heex b/lib/cannery_web/live/container_live/index.html.heex index 13c78fac..8a5a92fd 100644 --- a/lib/cannery_web/live/container_live/index.html.heex +++ b/lib/cannery_web/live/container_live/index.html.heex @@ -5,7 +5,7 @@ <%= if @containers |> Enum.empty?() do %>

- <%= gettext("No containers") %> 😔 + <%= gettext("No containers") %> <%= display_emoji("😔") %>

<%= live_patch(dgettext("actions", "Add your first container!"), diff --git a/lib/cannery_web/live/container_live/show.html.heex b/lib/cannery_web/live/container_live/show.html.heex index 5a99191c..d756a4bf 100644 --- a/lib/cannery_web/live/container_live/show.html.heex +++ b/lib/cannery_web/live/container_live/show.html.heex @@ -44,7 +44,7 @@ <%= if @container.tags |> Enum.empty?() do %>

- <%= gettext("No tags for this container") %> 😔 + <%= gettext("No tags for this container") %> <%= display_emoji("😔") %>

<%= live_patch(dgettext("actions", "Why not add one?"), diff --git a/lib/cannery_web/live/invite_live/index.html.heex b/lib/cannery_web/live/invite_live/index.html.heex index 7fb0773c..28519c7d 100644 --- a/lib/cannery_web/live/invite_live/index.html.heex +++ b/lib/cannery_web/live/invite_live/index.html.heex @@ -5,7 +5,7 @@ <%= if @invites |> Enum.empty?() do %>

- <%= gettext("No invites") %> 😔 + <%= gettext("No invites") %> <%= display_emoji("😔") %>

<%= live_patch(dgettext("actions", "Invite someone new!"), diff --git a/lib/cannery_web/live/range_live/index.html.heex b/lib/cannery_web/live/range_live/index.html.heex index 4ebf4775..e7c6a668 100644 --- a/lib/cannery_web/live/range_live/index.html.heex +++ b/lib/cannery_web/live/range_live/index.html.heex @@ -5,7 +5,7 @@ <%= if @ammo_groups |> Enum.empty?() do %>

- <%= gettext("No ammo staged") %> 😔 + <%= gettext("No ammo staged") %> <%= display_emoji("😔") %>

<%= live_patch(dgettext("actions", "Why not get some ready to shoot?"), @@ -42,7 +42,7 @@ <%= if @shot_groups |> Enum.empty?() do %>

- <%= gettext("No shots recorded") %> 😔 + <%= gettext("No shots recorded") %> <%= display_emoji("😔") %>

<% else %>

diff --git a/lib/cannery_web/live/tag_live/index.html.heex b/lib/cannery_web/live/tag_live/index.html.heex index 2b45d445..a3313839 100644 --- a/lib/cannery_web/live/tag_live/index.html.heex +++ b/lib/cannery_web/live/tag_live/index.html.heex @@ -7,7 +7,7 @@

<%= if @tags |> Enum.empty?() do %>

- <%= gettext("No tags") %> 😔 + <%= gettext("No tags") %> <%= display_emoji("😔") %>

<%= live_patch(dgettext("actions", "Make your first tag!"), diff --git a/lib/cannery_web/views/view_helpers.ex b/lib/cannery_web/views/view_helpers.ex index f1a75055..70095394 100644 --- a/lib/cannery_web/views/view_helpers.ex +++ b/lib/cannery_web/views/view_helpers.ex @@ -53,4 +53,11 @@ defmodule CanneryWeb.ViewHelpers do """ end + + @doc """ + Displays emoji as text emoji if SHIBAO_MODE is set to true :) + """ + @spec display_emoji(String.t()) :: String.t() + def display_emoji("😔"), do: if Application.get_env(:cannery, CanneryWeb.ViewHelpers)[:shibao_mode], do: "q_q", else: "😔" + def display_emoji(other_emoji), do: other_emoji end