mirror of
https://github.com/we-promise/sure.git
synced 2026-04-14 01:24:06 +00:00
* Add lookbook + viewcomponent, organize design system file * Build menu component * Button updates * More button fixes * Replace all menus with new ViewComponent * Checkpoint: fix tests, all buttons and menus converted * Split into Link and Button components for clarity * Button cleanup * Simplify custom confirmation configuration in views * Finalize button, link component API * Add toggle field to custom form builder + Component * Basic tabs component * Custom tabs, convert all menu / tab instances in app * Gem updates * Centralized icon helper * Update all icon usage to central helper * Lint fixes * Centralize all disclosure instances * Dialog replacements * Consolidation of all dialog styles * Test fixes * Fix app layout issues, move to component with slots * Layout simplification * Flakey test fix * Fix dashboard mobile issues * Finalize homepage * Lint fixes * Fix shadows and borders in dark mode * Fix tests * Remove stale class * Fix filled icon logic * Move transparent? to public interface
131 lines
5.2 KiB
Plaintext
131 lines
5.2 KiB
Plaintext
<%# locals: (plaid_item:) %>
|
|
|
|
<%= tag.div id: dom_id(plaid_item) do %>
|
|
<details open class="group bg-container p-4 shadow-border-xs rounded-xl">
|
|
<summary class="flex items-center justify-between gap-2 focus-visible:outline-hidden">
|
|
<div class="flex items-center gap-2">
|
|
<%= icon "chevron-right", class: "group-open:transform group-open:rotate-90" %>
|
|
|
|
<div class="flex items-center justify-center h-8 w-8 bg-blue-600/10 rounded-full">
|
|
<% if plaid_item.logo.attached? %>
|
|
<%= image_tag plaid_item.logo, class: "rounded-full h-full w-full", loading: "lazy" %>
|
|
<% else %>
|
|
<div class="flex items-center justify-center">
|
|
<%= tag.p plaid_item.name.first.upcase, class: "text-blue-600 text-xs font-medium" %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
|
|
<div class="pl-1 text-sm">
|
|
<div class="flex items-center gap-2">
|
|
<%= tag.p plaid_item.name, class: "font-medium text-primary" %>
|
|
<% if plaid_item.scheduled_for_deletion? %>
|
|
<p class="text-destructive text-sm animate-pulse">(deletion in progress...)</p>
|
|
<% end %>
|
|
</div>
|
|
<% if plaid_item.syncing? %>
|
|
<div class="text-secondary flex items-center gap-1">
|
|
<%= icon "loader", size: "sm", class: "animate-pulse" %>
|
|
<%= tag.span t(".syncing") %>
|
|
</div>
|
|
<% elsif plaid_item.requires_update? %>
|
|
<div class="text-warning flex items-center gap-1">
|
|
<%= icon "alert-triangle", size: "sm" %>
|
|
<%= tag.span t(".requires_update") %>
|
|
</div>
|
|
<% elsif plaid_item.sync_error.present? %>
|
|
<div class="text-secondary flex items-center gap-1">
|
|
<%= icon "alert-circle", size: "sm", color: "destructive" %>
|
|
<%= tag.span t(".error"), class: "text-destructive" %>
|
|
</div>
|
|
<% else %>
|
|
<p class="text-secondary">
|
|
<%= plaid_item.last_synced_at ? t(".status", timestamp: time_ago_in_words(plaid_item.last_synced_at)) : t(".status_never") %>
|
|
</p>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex items-center gap-2">
|
|
<% if plaid_item.requires_update? %>
|
|
<% begin %>
|
|
<% link_token = plaid_item.get_update_link_token(webhooks_url: plaid_webhooks_url(plaid_item.plaid_region), redirect_url: accounts_url) %>
|
|
|
|
<%= render ButtonComponent.new(
|
|
text: t(".update"),
|
|
icon: "refresh-cw",
|
|
variant: "secondary",
|
|
data: {
|
|
controller: "plaid",
|
|
action: "plaid#open",
|
|
plaid_region_value: plaid_item.plaid_region,
|
|
plaid_link_token_value: link_token,
|
|
plaid_is_update_value: true,
|
|
plaid_item_id_value: plaid_item.id
|
|
}
|
|
) %>
|
|
<% rescue PlaidItem::PlaidConnectionLostError %>
|
|
<div class="flex flex-col gap-2">
|
|
<div class="text-warning flex items-center gap-1">
|
|
<%= icon "alert-triangle", size: "sm", color: "warning" %>
|
|
<%= tag.span t(".connection_lost") %>
|
|
</div>
|
|
|
|
<p class="text-sm text-secondary"><%= t(".connection_lost_description") %></p>
|
|
|
|
<div class="flex items-center gap-2">
|
|
<%= render ButtonComponent.new(
|
|
text: t(".delete"),
|
|
icon: "trash-2",
|
|
variant: "destructive",
|
|
href: plaid_item_path(plaid_item),
|
|
method: :delete,
|
|
confirm: CustomConfirm.for_resource_deletion(plaid_item.name, high_severity: true)
|
|
) %>
|
|
|
|
<%= render LinkComponent.new(
|
|
text: t(".add_new"),
|
|
icon: "plus",
|
|
variant: "secondary",
|
|
href: new_account_path
|
|
) %>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
<% else %>
|
|
<%= icon(
|
|
"refresh-cw",
|
|
as_button: true,
|
|
href: sync_plaid_item_path(plaid_item),
|
|
disabled: plaid_item.syncing? || plaid_item.scheduled_for_deletion?
|
|
) %>
|
|
<% end %>
|
|
|
|
<%= render MenuComponent.new do |menu| %>
|
|
<% menu.with_item(
|
|
variant: "button",
|
|
text: t(".delete"),
|
|
icon: "trash-2",
|
|
href: plaid_item_path(plaid_item),
|
|
method: :delete,
|
|
confirm: CustomConfirm.for_resource_deletion(plaid_item.name, high_severity: true)
|
|
) %>
|
|
<% end %>
|
|
</div>
|
|
</summary>
|
|
|
|
<% unless plaid_item.scheduled_for_deletion? %>
|
|
<div class="space-y-4 mt-4">
|
|
<% if plaid_item.accounts.any? %>
|
|
<%= render "accounts/index/account_groups", accounts: plaid_item.accounts %>
|
|
<% else %>
|
|
<div class="p-4 flex flex-col gap-3 items-center justify-center">
|
|
<p class="text-primary font-medium text-sm"><%= t(".no_accounts_title") %></p>
|
|
<p class="text-secondary text-sm"><%= t(".no_accounts_description") %></p>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% end %>
|
|
</details>
|
|
<% end %>
|