mirror of
https://github.com/we-promise/sure.git
synced 2026-04-08 23:04:49 +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>
75 lines
2.5 KiB
Plaintext
75 lines
2.5 KiB
Plaintext
<%# locals: (entry:) %>
|
|
|
|
<div id="<%= dom_id(entry, :header) %>">
|
|
<%= tag.header class: "mb-4 space-y-1" do %>
|
|
<span class="text-secondary text-sm">
|
|
<%= entry.amount.negative? ? t(".buy") : t(".sell") %>
|
|
</span>
|
|
|
|
<div class="flex items-center gap-4">
|
|
<h3 class="font-medium">
|
|
<span class="text-2xl text-primary">
|
|
<%= format_money entry.amount_money %>
|
|
</span>
|
|
|
|
<span class="text-lg text-secondary">
|
|
<%= entry.currency %>
|
|
</span>
|
|
</h3>
|
|
|
|
<% if entry.linked? %>
|
|
<span title="Linked with Plaid">
|
|
<%= icon("refresh-ccw", size: "sm") %>
|
|
</span>
|
|
<% end %>
|
|
</div>
|
|
|
|
<span class="text-sm text-secondary">
|
|
<%= I18n.l(entry.date, format: :long) %>
|
|
</span>
|
|
<% end %>
|
|
|
|
<% trade = entry.trade %>
|
|
|
|
<div class="mb-2">
|
|
<%= render DS::Disclosure.new(title: t(".overview"), open: true) do %>
|
|
<div class="pb-4">
|
|
<dl class="space-y-3 px-3 py-2">
|
|
<div class="flex items-center justify-between text-sm">
|
|
<dt class="text-secondary"><%= t(".symbol_label") %></dt>
|
|
<dd class="text-primary"><%= trade.security.ticker %></dd>
|
|
</div>
|
|
|
|
<% if trade.qty.positive? %>
|
|
<div class="flex items-center justify-between text-sm">
|
|
<dt class="text-secondary"><%= t(".purchase_qty_label") %></dt>
|
|
<dd class="text-primary"><%= trade.qty.abs %></dd>
|
|
</div>
|
|
|
|
<div class="flex items-center justify-between text-sm">
|
|
<dt class="text-secondary"><%= t(".purchase_price_label") %></dt>
|
|
<dd class="text-primary"><%= format_money trade.price_money %></dd>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% if trade.security.current_price.present? %>
|
|
<div class="flex items-center justify-between text-sm">
|
|
<dt class="text-secondary"><%= t(".current_market_price_label") %></dt>
|
|
<dd class="text-primary"><%= format_money trade.security.current_price %></dd>
|
|
</div>
|
|
<% end %>
|
|
|
|
<% if trade.qty.positive? && trade.unrealized_gain_loss.present? %>
|
|
<div class="flex items-center justify-between text-sm">
|
|
<dt class="text-secondary"><%= t(".total_return_label") %></dt>
|
|
<dd style="color: <%= trade.unrealized_gain_loss.color %>;">
|
|
<%= render "shared/trend_change", trend: trade.unrealized_gain_loss %>
|
|
</dd>
|
|
</div>
|
|
<% end %>
|
|
</dl>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|