<% if @newly_created && @plain_key %> <%= content_for :page_title, t(".newly_created.page_title") %>
<%= render DS::FilledIcon.new( icon: "check-circle", rounded: true, size: "lg", variant: :success ) %>

<%= t(".newly_created.heading") %>

<%= t(".newly_created.key_ready", name: @current_api_key.name) %>

<%= t(".newly_created.your_api_key") %>

<%= t(".newly_created.copy_store_securely") %>

<%= @current_api_key.plain_key %> <%= render DS::Button.new( text: t(".newly_created.copy_api_key"), variant: "ghost", icon: "copy", data: { action: "clipboard#copy" } ) %>

<%= t(".newly_created.how_to_use") %>

<%= t(".current_api_key.usage_instructions", product_name: product_name) %>

curl -H "X-Api-Key: <%= @current_api_key.plain_key %>" <%= request.base_url %>/api/v1/accounts
<%= render DS::Link.new( text: t(".newly_created.continue"), href: settings_api_key_path, variant: "primary" ) %>
<% elsif @current_api_key %> <%= content_for :page_title, t(".current_api_key.title") %> <%= content_for :page_actions do %> <%= render DS::Link.new( text: t(".current_api_key.regenerate_key"), href: new_settings_api_key_path(regenerate: true), variant: "secondary" ) %> <% end %>
<%= render DS::FilledIcon.new( icon: "key", rounded: true, size: "lg" ) %>

<%= @current_api_key.name %>

<%= t(".current_api_key.created_ago", time: time_ago_in_words(@current_api_key.created_at)) %> <% if @current_api_key.last_used_at %> • <%= t(".current_api_key.last_used_ago", time: time_ago_in_words(@current_api_key.last_used_at)) %> <% else %> • <%= t(".current_api_key.never_used") %> <% end %>

<%= t(".current_api_key.active") %>

<%= t(".current_api_key.permissions") %>

<% @current_api_key.scopes.each do |scope| %> <%= icon("shield-check", class: "w-3 h-3") %> <%= case scope when "read" then t(".current_api_key.scope_read_only") when "read_write" then t(".current_api_key.scope_read_write") else scope.humanize end %> <% end %>

<%= t(".current_api_key.title") %>

<%= t(".current_api_key.copy_store_securely") %>

<%= @current_api_key.plain_key %> <%= render DS::Button.new( text: t(".current_api_key.copy_api_key"), variant: "ghost", icon: "copy", data: { action: "clipboard#copy" } ) %>

<%= t(".current_api_key.usage_instructions_title") %>

<%= t(".current_api_key.usage_instructions", product_name: product_name) %>

curl -H "X-Api-Key: <%= @current_api_key.plain_key %>" <%= request.base_url %>/api/v1/accounts
<%= render DS::Button.new( text: t(".current_api_key.revoke_key"), href: settings_api_key_path, method: :delete, variant: "destructive", data: { turbo_confirm: t(".current_api_key.revoke_confirmation") } ) %>
<% else %> <%= content_for :page_title, t(".no_api_key.title") %> <%= content_for :page_actions do %> <%= render DS::Link.new( text: t(".no_api_key.create_api_key"), href: new_settings_api_key_path, variant: "primary" ) %> <% end %>
<%= render DS::FilledIcon.new( icon: "key", rounded: true, size: "lg" ) %>

<%= t(".no_api_key.heading", product_name: product_name) %>

<%= t(".no_api_key.description") %>

<%= t(".no_api_key.what_you_can_do") %>

  • <%= icon("check", class: "w-4 h-4 text-primary mt-0.5") %> <%= t(".no_api_key.feature_1") %>
  • <%= icon("check", class: "w-4 h-4 text-primary mt-0.5") %> <%= t(".no_api_key.feature_2") %>
  • <%= icon("check", class: "w-4 h-4 text-primary mt-0.5") %> <%= t(".no_api_key.feature_3") %>

<%= t(".no_api_key.security_note_title") %>

<%= t(".no_api_key.security_note") %>

<% end %>