mirror of
https://github.com/we-promise/sure.git
synced 2026-04-09 15:24:48 +00:00
* **Add Coinbase integration with item and account management** - Creates migrations for `coinbase_items` and `coinbase_accounts`. - Adds models, controllers, views, and background tasks to support account linking, syncing, and transaction handling. - Implements Coinbase API client and adapter for seamless integration. - Supports ActiveRecord encryption for secure credential storage. - Adds UI components for provider setup, account management, and synchronization. * Localize Coinbase-related UI strings, refine account linking for security, and add timeouts to Coinbase API requests. * Localize Coinbase account handling to support native currencies (USD, EUR, GBP, etc.) across balances, trades, holdings, and transactions. * Improve Coinbase processing with timezone-safe parsing, native currency support, and immediate holdings updates. * Improve trend percentage formatting and enhance race condition handling for Coinbase account linking. * Fix log message wording for orphan cleanup * Ensure `selected_accounts` parameter is sanitized by rejecting blank entries. * Add tests for Coinbase integration: account, item, and controller coverage - Adds unit tests for `CoinbaseAccount` and `CoinbaseItem` models. - Adds integration tests for `CoinbaseItemsController`. - Introduces Stimulus `select-all` controller for UI checkbox handling. - Localizes UI strings and logging for Coinbase integration. * Update test fixtures to use consistent placeholder API keys and secrets * Refine `coinbase_item` tests to ensure deterministic ordering and improve scope assertions. * Integrate `SyncStats::Collector` into Coinbase syncer to streamline statistics collection and enhance consistency. * Localize Coinbase sync status messages and improve sync summary test coverage. * Update `CoinbaseItem` encryption: use deterministic encryption for `api_key` and standard for `api_secret`. * fix schema drift * Beta labels to lower expectations --------- Co-authored-by: luckyPipewrench <luckypipewrench@proton.me> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
84 lines
3.5 KiB
Plaintext
84 lines
3.5 KiB
Plaintext
<%# locals: (account:, return_to: nil) %>
|
|
|
|
<%= turbo_frame_tag dom_id(account) do %>
|
|
<div class="p-4 flex items-center justify-between gap-3 group/account hover:bg-surface-hover">
|
|
<div class="flex items-center gap-3">
|
|
<%= render "accounts/logo", account: account, size: "md" %>
|
|
|
|
<div>
|
|
<% if account.pending_deletion? %>
|
|
<p class="text-sm font-medium text-primary">
|
|
<span>
|
|
<%= account.name %>
|
|
</span>
|
|
<span class="text-red-500 animate-pulse">
|
|
(deletion in progress...)
|
|
</span>
|
|
</p>
|
|
<% else %>
|
|
<div>
|
|
<%= link_to account.name, account, class: [(account.active? ? "text-primary" : "text-subdued"), "text-sm font-medium hover:underline"], data: { turbo_frame: "_top" } %>
|
|
<% if account.institution_name %>
|
|
<span class="text-secondary">• <%= account.institution_name %></span>
|
|
<% end %>
|
|
</div>
|
|
<% if account.long_subtype_label %>
|
|
<p class="text-sm text-secondary truncate"><%= account.long_subtype_label %></p>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
|
|
<% unless account.pending_deletion? %>
|
|
<%= link_to edit_account_path(account, return_to: return_to), data: { turbo_frame: :modal }, class: "group-hover/account:flex hidden hover:opacity-80 items-center justify-center" do %>
|
|
<%= icon("pencil-line", size: "sm") %>
|
|
<% end %>
|
|
|
|
<% if !account.linked? && ["Depository", "CreditCard", "Investment", "Crypto"].include?(account.accountable_type) %>
|
|
<%= link_to select_provider_account_path(account),
|
|
data: { turbo_frame: :modal },
|
|
class: "group-hover/account:flex hidden hover:opacity-80 items-center justify-center gap-1",
|
|
title: t("accounts.account.link_provider") do %>
|
|
<%= icon("link", size: "sm") %>
|
|
<% end %>
|
|
<% elsif account.linked? %>
|
|
<%= link_to confirm_unlink_account_path(account),
|
|
data: { turbo_frame: :modal },
|
|
class: "group-hover/account:flex hidden hover:opacity-80 items-center justify-center gap-1",
|
|
title: t("accounts.account.unlink_provider") do %>
|
|
<%= icon("unlink", size: "sm") %>
|
|
<% end %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
<div class="flex items-center gap-8">
|
|
<% if account.draft? %>
|
|
<!-- Balance hidden for draft accounts -->
|
|
<% elsif account.syncing? %>
|
|
<div class="w-16 h-6 bg-loader rounded-full animate-pulse"></div>
|
|
<% else %>
|
|
<p class="text-sm font-medium <%= account.active? ? "text-primary" : "text-subdued" %>">
|
|
<%= format_money account.balance_money %>
|
|
</p>
|
|
<% end %>
|
|
|
|
<% if account.draft? %>
|
|
<%= render DS::Link.new(
|
|
text: "Complete setup",
|
|
href: edit_account_path(account, return_to: return_to),
|
|
variant: :outline,
|
|
frame: :modal
|
|
) %>
|
|
<% elsif account.active? || account.disabled? %>
|
|
<%= form_with model: account, url: toggle_active_account_path(account), method: :patch, data: { turbo_frame: "_top", controller: "auto-submit-form" } do |f| %>
|
|
<%= render DS::Toggle.new(
|
|
id: "account_#{account.id}_active",
|
|
name: "active",
|
|
checked: account.active?,
|
|
data: { auto_submit_form_target: "auto" }
|
|
) %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|