<%= content_for :page_title, "Create New API Key" %> <%= settings_section title: "Create New API Key", subtitle: "Generate a new API key to access your Maybe data programmatically." do %> <%= styled_form_with model: @api_key, url: settings_api_key_path, class: "space-y-4" do |form| %> <%= form.text_field :name, placeholder: "e.g., My Budget App, Portfolio Tracker", label: "API Key Name", help_text: "Choose a descriptive name to help you identify this key later." %>
<%= form.label :scopes, "Permissions", class: "block text-sm font-medium text-primary mb-2" %>

Select the permissions this API key should have:

<% [ ["read", "Read Only", "View your accounts, transactions, and balances"], ["read_write", "Read/Write", "View your data and create new transactions"] ].each do |value, label, description| %>
<% end %>
<%= icon("alert-triangle", class: "w-5 h-5 text-warning-600 mt-0.5") %>

Security Warning

Your API key will be displayed only once after creation. Make sure to copy and store it securely. Anyone with access to this key can access your data according to the permissions you select.

<%= render DS::Link.new( text: "Cancel", href: settings_api_key_path, variant: "ghost" ) %> <%= render DS::Button.new( text: "Create API Key", variant: "primary", type: "submit" ) %>
<% end %> <% end %>