mirror of
https://github.com/we-promise/sure.git
synced 2026-04-07 22:34:47 +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>
60 lines
1.4 KiB
Ruby
60 lines
1.4 KiB
Ruby
class UI::AccountPage < ApplicationComponent
|
|
attr_reader :account, :chart_view, :chart_period
|
|
|
|
renders_one :activity_feed, ->(feed_data:, pagy:, search:) { UI::Account::ActivityFeed.new(feed_data: feed_data, pagy: pagy, search: search) }
|
|
|
|
def initialize(account:, chart_view: nil, chart_period: nil, active_tab: nil)
|
|
@account = account
|
|
@chart_view = chart_view
|
|
@chart_period = chart_period
|
|
@active_tab = active_tab
|
|
end
|
|
|
|
def id
|
|
dom_id(account, :container)
|
|
end
|
|
|
|
def broadcast_channel
|
|
account
|
|
end
|
|
|
|
def broadcast_refresh!
|
|
Turbo::StreamsChannel.broadcast_replace_to(broadcast_channel, target: id, renderable: self, layout: false)
|
|
end
|
|
|
|
def title
|
|
account.name
|
|
end
|
|
|
|
def subtitle
|
|
return nil unless account.property?
|
|
|
|
account.property.address
|
|
end
|
|
|
|
def active_tab
|
|
tabs.find { |tab| tab == @active_tab&.to_sym } || tabs.first
|
|
end
|
|
|
|
def tabs
|
|
case account.accountable_type
|
|
when "Investment", "Crypto"
|
|
[ :activity, :holdings ]
|
|
when "Property", "Vehicle", "Loan"
|
|
[ :activity, :overview ]
|
|
else
|
|
[ :activity ]
|
|
end
|
|
end
|
|
|
|
def tab_content_for(tab)
|
|
case tab
|
|
when :activity
|
|
activity_feed
|
|
when :holdings, :overview
|
|
# Accountable is responsible for implementing the partial in the correct folder
|
|
render "#{account.accountable_type.downcase.pluralize}/tabs/#{tab}", account: account
|
|
end
|
|
end
|
|
end
|