Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

fix(panels): put CoinSpot/Kraken/Binance sync and menu buttons on the header row, as Wise does (#3980)

Febryand Nur Hidayat0e366764031a
diff --git a/app/views/binance_items/_binance_item.html.erb b/app/views/binance_items/_binance_item.html.erb
index 492af333c1..1c2ec3606f 100644
--- a/app/views/binance_items/_binance_item.html.erb
+++ b/app/views/binance_items/_binance_item.html.erb
@@ -3,83 +3,85 @@
<%= tag.div id: dom_id(binance_item) do %>
<%= render DS::Disclosure.new(variant: :card, open: true) do |disclosure| %>
<% disclosure.with_summary_content do %>
- <div class="flex items-center gap-2">
- <%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>
+ <div class="flex flex-wrap items-center justify-between gap-2">
+ <div class="flex items-center gap-2">
+ <%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>
- <%= render ProviderLogo.new(provider_key: :binance) %>
+ <%= render ProviderLogo.new(provider_key: :binance) %>
- <div class="pl-1 text-sm flex-1">
- <div class="flex items-center gap-2">
- <%= tag.p binance_item.institution_display_name, class: "font-medium text-primary" %>
- <% if binance_item.scheduled_for_deletion? %>
- <p class="text-destructive text-sm animate-pulse"><%= t(".deletion_in_progress") %></p>
- <% end %>
- </div>
- <p class="text-xs text-secondary"><%= t(".provider_name") %></p>
- <% if binance_item.syncing? %>
- <div class="text-secondary flex items-center gap-1">
- <%= icon "loader", size: "sm", class: "animate-spin" %>
- <%= tag.span t(".syncing") %>
- </div>
- <% elsif binance_item.requires_update? %>
- <div class="text-warning flex items-center gap-1">
- <%= icon "alert-triangle", size: "sm", color: "warning" %>
- <%= tag.span t(".reconnect") %>
+ <div class="pl-1 text-sm">
+ <div class="flex items-center gap-2">
+ <%= tag.p binance_item.institution_display_name, class: "font-medium text-primary" %>
+ <% if binance_item.scheduled_for_deletion? %>
+ <p class="text-destructive text-sm animate-pulse"><%= t(".deletion_in_progress") %></p>
+ <% end %>
</div>
- <% else %>
- <p class="text-secondary">
- <% if binance_item.last_synced_at %>
- <% if binance_item.sync_status_summary %>
- <%= t(".status_with_summary", timestamp: time_ago_in_words(binance_item.last_synced_at), summary: binance_item.sync_status_summary) %>
+ <p class="text-xs text-secondary"><%= t(".provider_name") %></p>
+ <% if binance_item.syncing? %>
+ <div class="text-secondary flex items-center gap-1">
+ <%= icon "loader", size: "sm", class: "animate-spin" %>
+ <%= tag.span t(".syncing") %>
+ </div>
+ <% elsif binance_item.requires_update? %>
+ <div class="text-warning flex items-center gap-1">
+ <%= icon "alert-triangle", size: "sm", color: "warning" %>
+ <%= tag.span t(".reconnect") %>
+ </div>
+ <% else %>
+ <p class="text-secondary">
+ <% if binance_item.last_synced_at %>
+ <% if binance_item.sync_status_summary %>
+ <%= t(".status_with_summary", timestamp: time_ago_in_words(binance_item.last_synced_at), summary: binance_item.sync_status_summary) %>
+ <% else %>
+ <%= t(".status", timestamp: time_ago_in_words(binance_item.last_synced_at)) %>
+ <% end %>
<% else %>
- <%= t(".status", timestamp: time_ago_in_words(binance_item.last_synced_at)) %>
+ <%= t(".status_never") %>
<% end %>
- <% else %>
- <%= t(".status_never") %>
- <% end %>
- </p>
- <% end %>
+ </p>
+ <% end %>
+ </div>
</div>
- </div>
- <% end %>
- <% if Current.user&.admin? %>
- <div class="flex items-center justify-end gap-2 mt-2">
- <% if binance_item.requires_update? %>
- <%= render DS::Link.new(
- text: t(".update_credentials"),
- icon: "refresh-cw",
- variant: "secondary",
- href: settings_providers_path,
- frame: "_top"
- ) %>
- <% else %>
- <%= icon(
- "refresh-cw",
- as_button: true,
- href: sync_binance_item_path(binance_item),
- disabled: binance_item.syncing?
- ) %>
- <% end %>
+ <% if Current.user&.admin? %>
+ <div class="ml-auto flex items-center gap-2">
+ <% if binance_item.requires_update? %>
+ <%= render DS::Link.new(
+ text: t(".update_credentials"),
+ icon: "refresh-cw",
+ variant: "secondary",
+ href: settings_providers_path,
+ frame: "_top"
+ ) %>
+ <% else %>
+ <%= icon(
+ "refresh-cw",
+ as_button: true,
+ href: sync_binance_item_path(binance_item),
+ disabled: binance_item.syncing?
+ ) %>
+ <% end %>
- <%= render DS::Menu.new do |menu| %>
- <% if binance_item.unlinked_accounts_count > 0 %>
- <% menu.with_item(
- variant: "link",
- text: t(".import_accounts_menu"),
- icon: "plus",
- href: setup_accounts_binance_item_path(binance_item),
- frame: :modal
- ) %>
- <% end %>
- <% menu.with_item(
- variant: "button",
- text: t(".delete"),
- icon: "trash-2",
- href: binance_item_path(binance_item),
- method: :delete,
- confirm: CustomConfirm.for_resource_deletion(binance_item.institution_display_name, high_severity: true)
- ) %>
+ <%= render DS::Menu.new do |menu| %>
+ <% if binance_item.unlinked_accounts_count > 0 %>
+ <% menu.with_item(
+ variant: "link",
+ text: t(".import_accounts_menu"),
+ icon: "plus",
+ href: setup_accounts_binance_item_path(binance_item),
+ frame: :modal
+ ) %>
+ <% end %>
+ <% menu.with_item(
+ variant: "button",
+ text: t(".delete"),
+ icon: "trash-2",
+ href: binance_item_path(binance_item),
+ method: :delete,
+ confirm: CustomConfirm.for_resource_deletion(binance_item.institution_display_name, high_severity: true)
+ ) %>
+ <% end %>
+ </div>
<% end %>
</div>
<% end %>
diff --git a/app/views/coinbase_items/_coinbase_item.html.erb b/app/views/coinbase_items/_coinbase_item.html.erb
index e07c0760c7..93dca0c22e 100644
--- a/app/views/coinbase_items/_coinbase_item.html.erb
+++ b/app/views/coinbase_items/_coinbase_item.html.erb
@@ -18,7 +18,7 @@
<%= render DS::Disclosure.new(variant: :card, open: true) do |disclosure| %>
<% disclosure.with_summary_content do %>
- <div class="flex items-center justify-between gap-2 focus-visible:outline-hidden">
+ <div class="flex flex-wrap items-center justify-between gap-2 focus-visible:outline-hidden">
<div class="flex items-center gap-2">
<%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>
@@ -59,7 +59,7 @@
</div>
<% if Current.user&.admin? %>
- <div class="flex items-center gap-2">
+ <div class="ml-auto flex items-center gap-2">
<% if coinbase_item.requires_update? %>
<%= render DS::Link.new(
text: t(".update_credentials"),
diff --git a/app/views/coinspot_items/_coinspot_item.html.erb b/app/views/coinspot_items/_coinspot_item.html.erb
index 598ab6f2ae..8e75832bc3 100644
--- a/app/views/coinspot_items/_coinspot_item.html.erb
+++ b/app/views/coinspot_items/_coinspot_item.html.erb
@@ -3,74 +3,76 @@
<%= tag.div id: dom_id(coinspot_item) do %>
<%= render DS::Disclosure.new(variant: :card, open: true) do |disclosure| %>
<% disclosure.with_summary_content do %>
- <div class="flex items-center gap-2 w-full">
- <%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>
+ <div class="flex items-center justify-between gap-2">
+ <div class="flex items-center gap-2">
+ <%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>
- <%= render ProviderLogo.new(provider_key: :coinspot) %>
+ <%= render ProviderLogo.new(provider_key: :coinspot) %>
- <div class="pl-1 text-sm flex-1">
- <div class="flex items-center gap-2">
- <%= tag.p coinspot_item.institution_display_name, class: "font-medium text-primary" %>
- <% if coinspot_item.scheduled_for_deletion? %>
- <p class="text-destructive text-sm animate-pulse"><%= t(".deletion_in_progress") %></p>
- <% end %>
- </div>
- <p class="text-xs text-secondary"><%= t(".provider_name") %></p>
-
- <% if coinspot_item.syncing? %>
- <div class="text-secondary flex items-center gap-1">
- <%= icon "loader", size: "sm", class: "animate-spin" %>
- <%= tag.span t(".syncing") %>
- </div>
- <% elsif coinspot_item.requires_update? %>
- <div class="text-warning flex items-center gap-1">
- <%= icon "alert-triangle", size: "sm", color: "warning" %>
- <%= tag.span t(".reconnect") %>
+ <div class="pl-1 text-sm">
+ <div class="flex items-center gap-2">
+ <%= tag.p coinspot_item.institution_display_name, class: "font-medium text-primary" %>
+ <% if coinspot_item.scheduled_for_deletion? %>
+ <p class="text-destructive text-sm animate-pulse"><%= t(".deletion_in_progress") %></p>
+ <% end %>
</div>
- <% else %>
- <p class="text-secondary">
- <% if coinspot_item.last_synced_at %>
- <% if coinspot_item.sync_status_summary %>
- <%= t(".status_with_summary", timestamp: time_ago_in_words(coinspot_item.last_synced_at), summary: coinspot_item.sync_status_summary) %>
+ <p class="text-xs text-secondary"><%= t(".provider_name") %></p>
+
+ <% if coinspot_item.syncing? %>
+ <div class="text-secondary flex items-center gap-1">
+ <%= icon "loader", size: "sm", class: "animate-spin" %>
+ <%= tag.span t(".syncing") %>
+ </div>
+ <% elsif coinspot_item.requires_update? %>
+ <div class="text-warning flex items-center gap-1">
+ <%= icon "alert-triangle", size: "sm", color: "warning" %>
+ <%= tag.span t(".reconnect") %>
+ </div>
+ <% else %>
+ <p class="text-secondary">
+ <% if coinspot_item.last_synced_at %>
+ <% if coinspot_item.sync_status_summary %>
+ <%= t(".status_with_summary", timestamp: time_ago_in_words(coinspot_item.last_synced_at), summary: coinspot_item.sync_status_summary) %>
+ <% else %>
+ <%= t(".status", timestamp: time_ago_in_words(coinspot_item.last_synced_at)) %>
+ <% end %>
<% else %>
- <%= t(".status", timestamp: time_ago_in_words(coinspot_item.last_synced_at)) %>
+ <%= t(".status_never") %>
<% end %>
- <% else %>
- <%= t(".status_never") %>
- <% end %>
- </p>
- <% end %>
+ </p>
+ <% end %>
+ </div>
</div>
- </div>
- <% end %>
-
- <% if Current.user&.admin? %>
- <div class="flex items-center justify-end gap-2 mt-2">
- <%= icon(
- "refresh-cw",
- as_button: true,
- href: sync_coinspot_item_path(coinspot_item),
- disabled: coinspot_item.syncing?
- ) %>
- <%= render DS::Menu.new do |menu| %>
- <% if unlinked_count.to_i > 0 %>
- <% menu.with_item(
- variant: "link",
- text: t(".import_accounts_menu"),
- icon: "plus",
- href: setup_accounts_coinspot_item_path(coinspot_item),
- frame: :modal
+ <% if Current.user&.admin? %>
+ <div class="flex items-center gap-2">
+ <%= icon(
+ "refresh-cw",
+ as_button: true,
+ href: sync_coinspot_item_path(coinspot_item),
+ disabled: coinspot_item.syncing?
) %>
- <% end %>
- <% menu.with_item(
- variant: "button",
- text: t(".delete"),
- icon: "trash-2",
- href: coinspot_item_path(coinspot_item),
- method: :delete,
- confirm: CustomConfirm.for_resource_deletion(coinspot_item.institution_display_name, high_severity: true)
- ) %>
+
+ <%= render DS::Menu.new do |menu| %>
+ <% if unlinked_count.to_i > 0 %>
+ <% menu.with_item(
+ variant: "link",
+ text: t(".import_accounts_menu"),
+ icon: "plus",
+ href: setup_accounts_coinspot_item_path(coinspot_item),
+ frame: :modal
+ ) %>
+ <% end %>
+ <% menu.with_item(
+ variant: "button",
+ text: t(".delete"),
+ icon: "trash-2",
+ href: coinspot_item_path(coinspot_item),
+ method: :delete,
+ confirm: CustomConfirm.for_resource_deletion(coinspot_item.institution_display_name, high_severity: true)
+ ) %>
+ <% end %>
+ </div>
<% end %>
</div>
<% end %>
diff --git a/app/views/kraken_items/_kraken_item.html.erb b/app/views/kraken_items/_kraken_item.html.erb
index 86c709b37c..fce833d660 100644
--- a/app/views/kraken_items/_kraken_item.html.erb
+++ b/app/views/kraken_items/_kraken_item.html.erb
@@ -3,74 +3,76 @@
<%= tag.div id: dom_id(kraken_item) do %>
<%= render DS::Disclosure.new(variant: :card, open: true) do |disclosure| %>
<% disclosure.with_summary_content do %>
- <div class="flex items-center gap-2">
- <%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>
+ <div class="flex items-center justify-between gap-2">
+ <div class="flex items-center gap-2">
+ <%= icon "chevron-right", class: "group-open:rotate-90 motion-safe:transition-transform motion-safe:duration-150" %>
- <%= render ProviderLogo.new(provider_key: :kraken) %>
+ <%= render ProviderLogo.new(provider_key: :kraken) %>
- <div class="pl-1 text-sm flex-1">
- <div class="flex items-center gap-2">
- <%= tag.p kraken_item.institution_display_name, class: "font-medium text-primary" %>
- <% if kraken_item.scheduled_for_deletion? %>
- <p class="text-destructive text-sm animate-pulse"><%= t(".deletion_in_progress") %></p>
- <% end %>
- </div>
- <p class="text-xs text-secondary"><%= t(".provider_name") %></p>
-
- <% if kraken_item.syncing? %>
- <div class="text-secondary flex items-center gap-1">
- <%= icon "loader", size: "sm", class: "animate-spin" %>
- <%= tag.span t(".syncing") %>
- </div>
- <% elsif kraken_item.requires_update? %>
- <div class="text-warning flex items-center gap-1">
- <%= icon "alert-triangle", size: "sm", color: "warning" %>
- <%= tag.span t(".reconnect") %>
+ <div class="pl-1 text-sm">
+ <div class="flex items-center gap-2">
+ <%= tag.p kraken_item.institution_display_name, class: "font-medium text-primary" %>
+ <% if kraken_item.scheduled_for_deletion? %>
+ <p class="text-destructive text-sm animate-pulse"><%= t(".deletion_in_progress") %></p>
+ <% end %>
</div>
- <% else %>
- <p class="text-secondary">
- <% if kraken_item.last_synced_at %>
- <% if kraken_item.sync_status_summary %>
- <%= t(".status_with_summary", timestamp: time_ago_in_words(kraken_item.last_synced_at), summary: kraken_item.sync_status_summary) %>
+ <p class="text-xs text-secondary"><%= t(".provider_name") %></p>
+
+ <% if kraken_item.syncing? %>
+ <div class="text-secondary flex items-center gap-1">
+ <%= icon "loader", size: "sm", class: "animate-spin" %>
+ <%= tag.span t(".syncing") %>
+ </div>
+ <% elsif kraken_item.requires_update? %>
+ <div class="text-warning flex items-center gap-1">
+ <%= icon "alert-triangle", size: "sm", color: "warning" %>
+ <%= tag.span t(".reconnect") %>
+ </div>
+ <% else %>
+ <p class="text-secondary">
+ <% if kraken_item.last_synced_at %>
+ <% if kraken_item.sync_status_summary %>
+ <%= t(".status_with_summary", timestamp: time_ago_in_words(kraken_item.last_synced_at), summary: kraken_item.sync_status_summary) %>
+ <% else %>
+ <%= t(".status", timestamp: time_ago_in_words(kraken_item.last_synced_at)) %>
+ <% end %>
<% else %>
- <%= t(".status", timestamp: time_ago_in_words(kraken_item.last_synced_at)) %>
+ <%= t(".status_never") %>
<% end %>
- <% else %>
- <%= t(".status_never") %>
- <% end %>
- </p>
- <% end %>
+ </p>
+ <% end %>
+ </div>
</div>
- </div>
- <% end %>
-
- <% if Current.user&.admin? %>
- <div class="flex items-center justify-end gap-2 mt-2">
- <%= icon(
- "refresh-cw",
- as_button: true,
- href: sync_kraken_item_path(kraken_item),
- disabled: kraken_item.syncing?
- ) %>
- <%= render DS::Menu.new do |menu| %>
- <% if unlinked_count.to_i > 0 %>
- <% menu.with_item(
- variant: "link",
- text: t(".import_accounts_menu"),
- icon: "plus",
- href: setup_accounts_kraken_item_path(kraken_item),
- frame: :modal
+ <% if Current.user&.admin? %>
+ <div class="flex items-center gap-2">
+ <%= icon(
+ "refresh-cw",
+ as_button: true,
+ href: sync_kraken_item_path(kraken_item),
+ disabled: kraken_item.syncing?
) %>
- <% end %>
- <% menu.with_item(
- variant: "button",
- text: t(".delete"),
- icon: "trash-2",
- href: kraken_item_path(kraken_item),
- method: :delete,
- confirm: CustomConfirm.for_resource_deletion(kraken_item.institution_display_name, high_severity: true)
- ) %>
+
+ <%= render DS::Menu.new do |menu| %>
+ <% if unlinked_count.to_i > 0 %>
+ <% menu.with_item(
+ variant: "link",
+ text: t(".import_accounts_menu"),
+ icon: "plus",
+ href: setup_accounts_kraken_item_path(kraken_item),
+ frame: :modal
+ ) %>
+ <% end %>
+ <% menu.with_item(
+ variant: "button",
+ text: t(".delete"),
+ icon: "trash-2",
+ href: kraken_item_path(kraken_item),
+ method: :delete,
+ confirm: CustomConfirm.for_resource_deletion(kraken_item.institution_display_name, high_severity: true)
+ ) %>
+ <% end %>
+ </div>
<% end %>
</div>
<% end %>