mirror of
https://github.com/we-promise/sure.git
synced 2026-05-30 07:49:01 +00:00
Per the design review's §07. - Drop the trailing "Configured / Not configured" footer status from every provider panel (binance, coinbase, coinstats, indexa_capital, lunchflow, mercury, simplefin, snaptrade, sophtron, provider_form). The parent details section's status pill already carries that signal; the footer was redundant — and the copy/styling was inconsistent across panels (free-text vs. dot pill, "configured" vs. "not connected"). - Connect drawer gets a header lock-up: small logo chip + provider name + maturity badge, mirroring the available-card layout. Implemented as _drawer_header partial; connect_form passes custom_header: true to DS::Dialog so we own the row. - Drawer footer trust statement: "Read-only — Sure can never move money. Stored encrypted." A single-line reassurance covering all panels. - Sentence-case the hardcoded primary buttons that were Title Case: "Save Configuration" -> "Save and connect" "Update Configuration" -> "Update connection" "Connect Bank" -> "Connect bank" Affects simplefin, lunchflow, enable_banking, provider_form. The i18n'd panels (binance, coinbase, coinstats, indexa_capital, mercury, snaptrade, sophtron) keep their existing keys.
77 lines
2.8 KiB
Plaintext
77 lines
2.8 KiB
Plaintext
<%
|
|
# Parameters:
|
|
# - configuration: Provider::Configurable::Configuration object
|
|
%>
|
|
|
|
<div class="space-y-4">
|
|
<div>
|
|
<% if configuration.provider_description.present? %>
|
|
<div class="text-sm text-secondary mb-4 prose prose-sm">
|
|
<%= markdown(configuration.provider_description).html_safe %>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% env_configured = configuration.fields.any? { |f| f.env_key && ENV[f.env_key].present? } %>
|
|
<% if env_configured %>
|
|
<p class="text-sm text-secondary">
|
|
Configuration can be set via environment variables or overridden below.
|
|
</p>
|
|
<% end %>
|
|
|
|
<% if configuration.fields.any? { |f| f.description.present? } %>
|
|
<p class="text-secondary text-sm mb-4">Field descriptions:</p>
|
|
<ul class="text-sm text-secondary mb-4 list-disc ml-6 space-y-2">
|
|
<% configuration.fields.each do |field| %>
|
|
<% if field.description.present? %>
|
|
<li><strong><%= field.label %>:</strong> <%= field.description %></li>
|
|
<% end %>
|
|
<% end %>
|
|
</ul>
|
|
<% end %>
|
|
</div>
|
|
|
|
<%= styled_form_with model: Setting.new,
|
|
url: settings_providers_path,
|
|
method: :patch do |form| %>
|
|
<div class="space-y-4">
|
|
<% configuration.fields.each do |field| %>
|
|
<%
|
|
env_value = ENV[field.env_key] if field.env_key
|
|
# Use dynamic hash-style access - works without explicit field declaration
|
|
setting_value = Setting[field.setting_key]
|
|
|
|
# Show the setting value if it exists, otherwise show ENV value
|
|
# This allows users to see what they've overridden
|
|
current_value = setting_value.presence || env_value
|
|
|
|
# Mask secret values if they exist
|
|
display_value = if field.secret && current_value.present?
|
|
"********"
|
|
else
|
|
current_value
|
|
end
|
|
|
|
# Determine input type
|
|
input_type = field.secret ? "password" : "text"
|
|
|
|
# Don't disable fields - allow overriding ENV variables
|
|
disabled = false
|
|
%>
|
|
|
|
<%= form.text_field field.setting_key,
|
|
label: field.label,
|
|
type: input_type,
|
|
placeholder: field.default || (field.required ? "" : "Optional"),
|
|
value: display_value,
|
|
disabled: disabled %>
|
|
<% end %>
|
|
|
|
<div class="flex justify-end">
|
|
<%= form.submit "Save and connect",
|
|
class: "inline-flex items-center justify-center rounded-lg px-4 py-2 text-sm font-medium text-inverse button-bg-primary hover:button-bg-primary-hover focus:outline-none focus:ring-2 focus:ring-gray-900 theme-dark:focus:ring-white focus:ring-offset-2 transition-colors" %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
|
|
</div>
|