analytics/lib/plausible_web/views/billing_view.ex
ruslandoga 0b7870dc4d
improve first launch experience for self-hosters (#2357)
* first launch

* dynamic children, wait for repo

* remove wait_for_repo and app env manipulations

* don't mention free trial in self-hosted pages

* add changelog

* assigns[:is_selfhost] -> @is_selfhost

* better changelog wording

* rm admin_user, admin_email, admin_pwd from app env

* rm DISABLE_AUTH

* redirect / to /login when not authenticated

* remove TODO

* Update lib/plausible_web/controllers/page_controller.ex

Co-authored-by: Uku Taht <Uku.taht@gmail.com>

* format

Co-authored-by: Uku Taht <Uku.taht@gmail.com>
2022-11-10 12:42:22 +01:00

37 lines
643 B
Elixir

defmodule PlausibleWeb.BillingView do
use PlausibleWeb, :view
def base_domain do
PlausibleWeb.Endpoint.host()
end
def plausible_url do
PlausibleWeb.Endpoint.url()
end
def present_date(date) do
Date.from_iso8601!(date)
|> Timex.format!("{D} {Mshort} {YYYY}")
end
def present_currency("USD"), do: "$"
def present_currency("EUR"), do: ""
def present_currency("GBP"), do: "£"
def reccommended_plan(usage) do
cond do
usage < 9000 ->
"10k / mo"
usage < 90_000 ->
"100k / mo"
usage < 900_000 ->
"1m / mo"
true ->
"custom"
end
end
end