Skip to content

Commit

Permalink
hide billing on self-host
Browse files Browse the repository at this point in the history
  • Loading branch information
yujonglee committed Oct 10, 2024
1 parent 25f0851 commit 4f17386
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 34 deletions.
2 changes: 2 additions & 0 deletions core/config/runtime.exs
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,8 @@ config :canary, :github,
client_secret: System.get_env("GITHUB_CLIENT_SECRET"),
redirect_uri: System.get_env("GITHUB_REDIRECT_URI")

config :canary, :self_host, System.get_env("SELF_HOST") in ~w(true 1)

config :canary, :fly_api_key, System.get_env("FLY_API_KEY")
config :canary, :fly_app_name, System.get_env("FLY_APP_NAME")

Expand Down
18 changes: 11 additions & 7 deletions core/lib/canary_web/components/layouts.ex
Original file line number Diff line number Diff line change
Expand Up @@ -126,13 +126,17 @@ defmodule CanaryWeb.Layouts do
icon_inactive: "hero-cog-6-tooth",
icon_active: "hero-cog-6-tooth-solid"
},
%{
url: "/settings/billing",
name: "Billing",
tab: :billing,
icon_inactive: "hero-credit-card",
icon_active: "hero-credit-card-solid"
}
if(Application.get_env(:canary, :self_host)) do
nil
else
%{
url: "/settings/billing",
name: "Billing",
tab: :billing,
icon_inactive: "hero-credit-card",
icon_active: "hero-credit-card-solid"
}
end
]
}
class={[if(@active_tab == tab, do: "bg-blue-50 text-blue-800 rounded-md", else: "")]}
Expand Down
55 changes: 28 additions & 27 deletions core/lib/canary_web/live/settings_live/projects.ex
Original file line number Diff line number Diff line change
Expand Up @@ -31,36 +31,37 @@ defmodule CanaryWeb.SettingsLive.Projects do
<:row :for={project <- @projects}>
<div class="flex flex-row items-center justify-between">
<span><%= project.name %></span>
<div class="flex flex-row items-center gap-2">
<Primer.text_input
value={project.public_key}
disabled
caption={fn -> "project key" end}
<div class="flex flex-row items-center gap-12">
<div class="flex flex-row items-center gap-2">
<span class="text-gray-500">project_key: </span>
<div class="flex flex-row items-center gap-2 max-w-[150px]">
<Primer.text_input value={project.public_key} disabled is_small is_full_width>
<:group_button>
<Primer.button
aria-label="Copy"
id={"project-key-#{project.public_key}"}
phx-hook="Clipboard"
data-clipboard-text={project.public_key}
is_small
>
<Primer.octicon name="paste-16" />
</Primer.button>
</:group_button>
</Primer.text_input>
</div>
</div>
<Primer.button
type="button"
phx-click="destroy"
phx-value-item={project.id}
is_danger
is_small
>
<:group_button>
<Primer.button
aria-label="Copy"
id={"project-key-#{project.public_key}"}
phx-hook="Clipboard"
data-clipboard-text={project.public_key}
is_small
>
<Primer.octicon name="paste-16" />
</Primer.button>
</:group_button>
</Primer.text_input>
Delete
</Primer.button>
</div>
<Primer.button
type="button"
phx-click="destroy"
phx-value-item={project.id}
is_danger
is_small
>
Delete
</Primer.button>
</div>
</:row>
</Primer.box>
Expand Down

0 comments on commit 4f17386

Please sign in to comment.