Skip to content
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions app/views/layouts/settings.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
</div>
</div>

<main class="grow flex h-full">
<div class="relative max-w-4xl mx-auto flex flex-col w-full h-full">
<div class="grow flex flex-col overflow-y-auto overflow-x-hidden overscroll-contain [-webkit-overflow-scrolling:touch]">
<main class="grow flex h-full min-w-0">
<div class="relative max-w-4xl mx-auto flex flex-col w-full h-full min-w-0">
<div class="grow flex flex-col overflow-y-auto overflow-x-hidden overscroll-contain [-webkit-overflow-scrolling:touch] min-w-0">
<div class="sticky top-0 z-10 px-3 md:px-10 pt-1.5 md:pt-3 pb-3 bg-surface border-b border-tertiary shrink-0">
<% if content_for?(:breadcrumbs) %>
<%= yield :breadcrumbs %>
<% else %>
<%= render "layouts/shared/breadcrumbs", breadcrumbs: @breadcrumbs %>
<% end %>

<div class="flex items-center justify-between gap-4 mt-1.5 min-h-9">
<div class="flex flex-wrap items-center justify-between gap-3 mt-1.5 min-h-9">
<% if content_for?(:page_title) %>
<h1 class="text-primary text-xl font-medium">
<%= content_for :page_title %>
Expand All @@ -25,7 +25,7 @@
<div></div>
<% end %>
<% if content_for?(:page_actions) %>
<div class="flex items-center gap-2 shrink-0">
<div class="flex items-center gap-2 max-w-full">
<%= yield :page_actions %>
</div>
<% end %>
Expand Down
23 changes: 13 additions & 10 deletions app/views/settings/api_keys/created.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,17 @@
<p class="text-secondary text-sm mb-3">Copy and store this key securely. You'll need it to authenticate your API requests.</p>

<div class="bg-container rounded-lg p-3 border border-primary" data-controller="clipboard">
<div class="flex items-center justify-between gap-3">
<code id="api-key-display" class="font-mono text-sm text-primary break-all" data-clipboard-target="source"><%= @api_key.plain_key %></code>
<%= render DS::Button.new(
text: "Copy API Key",
variant: "ghost",
icon: "copy",
data: { action: "clipboard#copy" }
) %>
<div class="w-full overflow-hidden">
<code id="api-key-display" class="block w-full min-w-0 overflow-x-auto font-mono text-sm text-primary break-all whitespace-pre-wrap" data-clipboard-target="source"><%= @api_key.plain_key %></code>
<div class="mt-2 flex justify-end">
<%= render DS::Button.new(
text: "Copy API Key",
variant: "ghost",
icon: "copy",
class: "shrink-0",
data: { action: "clipboard#copy" }
) %>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -78,8 +81,8 @@
<div class="bg-surface-inset rounded-xl p-4">
<h4 class="font-medium text-primary mb-3">How to use your API key</h4>
<p class="text-secondary text-sm mb-3"><%= t("settings.api_keys.show.current_api_key.usage_instructions", product_name: product_name) %></p>
<div class="bg-container rounded-lg p-3 font-mono text-sm text-primary border border-primary">
curl -H "X-Api-Key: <%= @api_key.plain_key %>" <%= request.base_url %>/api/v1/accounts
<div class="bg-container rounded-lg p-3 font-mono text-sm text-primary border border-primary max-w-full overflow-x-auto break-all">
curl -H "X-Api-Key: &lt;YOUR_API_KEY&gt;" <%= request.base_url %>/api/v1/accounts
</div>
</div>

Expand Down
23 changes: 13 additions & 10 deletions app/views/settings/api_keys/created.turbo_stream.erb
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,17 @@
<p class="text-secondary text-sm mb-3">Copy and store this key securely. You'll need it to authenticate your API requests.</p>

<div class="bg-container rounded-lg p-3 border border-primary" data-controller="clipboard">
<div class="flex items-center justify-between gap-3">
<code id="api-key-display" class="font-mono text-sm text-primary break-all" data-clipboard-target="source"><%= @api_key.plain_key %></code>
<%= render DS::Button.new(
text: "Copy API Key",
variant: "ghost",
icon: "copy",
data: { action: "clipboard#copy" }
) %>
<div class="w-full overflow-hidden">
<code id="api-key-display" class="block w-full min-w-0 overflow-x-auto font-mono text-sm text-primary break-all whitespace-pre-wrap" data-clipboard-target="source"><%= @api_key.plain_key %></code>
<div class="mt-2 flex justify-end">
<%= render DS::Button.new(
text: "Copy API Key",
variant: "ghost",
icon: "copy",
class: "shrink-0",
data: { action: "clipboard#copy" }
) %>
</div>
</div>
</div>
</div>
Expand Down Expand Up @@ -83,8 +86,8 @@
<div class="bg-surface-inset rounded-xl p-4">
<h4 class="font-medium text-primary mb-3">How to use your API key</h4>
<p class="text-secondary text-sm mb-3">Include your API key in the X-Api-Key header when making requests:</p>
<div class="bg-container rounded-lg p-3 font-mono text-sm text-primary border border-primary">
curl -H "X-Api-Key: <%= @api_key.plain_key %>" <%= request.base_url %>/api/v1/accounts
<div class="bg-container rounded-lg p-3 font-mono text-sm text-primary border border-primary max-w-full overflow-x-auto break-all">
curl -H "X-Api-Key: &lt;YOUR_API_KEY&gt;" <%= request.base_url %>/api/v1/accounts
</div>
</div>

Expand Down
46 changes: 26 additions & 20 deletions app/views/settings/api_keys/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,26 @@
<p class="text-secondary text-sm mb-3">Copy and store this key securely. You'll need it to authenticate your API requests.</p>

<div class="bg-container rounded-lg p-3 border border-primary" data-controller="clipboard">
<div class="flex items-center justify-between gap-3">
<code id="api-key-display" class="font-mono text-sm text-primary break-all" data-clipboard-target="source"><%= @current_api_key.plain_key %></code>
<%= render DS::Button.new(
text: "Copy API Key",
variant: "ghost",
icon: "copy",
data: { action: "clipboard#copy" }
) %>
<div class="w-full overflow-hidden">
<code id="api-key-display" class="block w-full min-w-0 overflow-x-auto font-mono text-sm text-primary break-all whitespace-pre-wrap" data-clipboard-target="source"><%= @current_api_key.plain_key %></code>
<div class="mt-2 flex justify-end">
<%= render DS::Button.new(
text: "Copy API Key",
variant: "ghost",
icon: "copy",
class: "shrink-0",
data: { action: "clipboard#copy" }
) %>
</div>
</div>
</div>
</div>

<div class="bg-surface-inset rounded-xl p-4">
<h4 class="font-medium text-primary mb-3">How to use your API key</h4>
<p class="text-secondary text-sm mb-3"><%= t(".current_api_key.usage_instructions", product_name: product_name) %></p>
<div class="bg-container rounded-lg p-3 font-mono text-sm text-primary border border-primary">
curl -H "X-Api-Key: <%= @current_api_key.plain_key %>" <%= request.base_url %>/api/v1/accounts
<div class="bg-container rounded-lg p-3 font-mono text-sm text-primary border border-primary max-w-full overflow-x-auto break-all">
curl -H "X-Api-Key: &lt;YOUR_API_KEY&gt;" <%= request.base_url %>/api/v1/accounts
</div>
</div>

Expand Down Expand Up @@ -111,23 +114,26 @@
<p class="text-secondary text-sm mb-3">Copy and store this key securely. You'll need it to authenticate your API requests.</p>

<div class="bg-container rounded-lg p-3 border border-primary" data-controller="clipboard">
<div class="flex items-center justify-between gap-3">
<code id="api-key-display" class="font-mono text-sm text-primary break-all" data-clipboard-target="source"><%= @current_api_key.plain_key %></code>
<%= render DS::Button.new(
text: "Copy API Key",
variant: "ghost",
icon: "copy",
data: { action: "clipboard#copy" }
) %>
<div class="w-full overflow-hidden">
<code id="api-key-display" class="block w-full min-w-0 overflow-x-auto font-mono text-sm text-primary break-all whitespace-pre-wrap" data-clipboard-target="source"><%= @current_api_key.plain_key %></code>
<div class="mt-2 flex justify-end">
<%= render DS::Button.new(
text: "Copy API Key",
variant: "ghost",
icon: "copy",
class: "shrink-0",
data: { action: "clipboard#copy" }
) %>
</div>
</div>
</div>
</div>

<div class="bg-surface-inset rounded-xl p-4">
<h4 class="font-medium text-primary mb-3">How to use your API key</h4>
<p class="text-secondary text-sm mb-3"><%= t(".current_api_key.usage_instructions", product_name: product_name) %></p>
<div class="bg-container rounded-lg p-3 font-mono text-sm text-primary border border-primary">
curl -H "X-Api-Key: <%= @current_api_key.plain_key %>" <%= request.base_url %>/api/v1/accounts
<div class="bg-container rounded-lg p-3 font-mono text-sm text-primary border border-primary max-w-full overflow-x-auto break-all">
curl -H "X-Api-Key: &lt;YOUR_API_KEY&gt;" <%= request.base_url %>/api/v1/accounts
</div>
</div>

Expand Down
2 changes: 1 addition & 1 deletion test/system/settings/api_keys_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class Settings::ApiKeysTest < ApplicationSystemTestCase
visit settings_api_key_path

assert_text "How to use your API key"
assert_text "curl -H \"X-Api-Key: test_key_123\""
assert_text "curl -H \"X-Api-Key: <YOUR_API_KEY>\""
assert_text "/api/v1/accounts"
end

Expand Down