Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby
1.9 KB
Raw Blame
<%= turbo_stream_from account %>

<%= turbo_frame_tag id do %>
  <%= tag.div class: "space-y-4 pb-5 lg:pb-32" do %>
    <%= render "accounts/show/header", account: account, title: title, subtitle: subtitle, reconciliation_indicator: reconciliation_indicator %>

    <%= render UI::Account::HealthStatus.new(account: account) %>

    <%= render UI::Account::Chart.new(account: account, period: chart_period, view: chart_view, loan_chart: loan_chart,
                                     extra_repayment: extra_repayment, activity_filters: activity_filters) %>

    <% if (fx_coverage_start = fx_coverage_start_date).present? %>
      <div class="px-3">
        <%= render DS::Alert.new(
          message: t("accounts.show.limited_fx_history_warning", date: l(fx_coverage_start, format: :long)),
          variant: :warning
        ) %>
      </div>
    <% end %>

    <div data-testid="account-details">
      <% if tabs.count > 1 %>
        <%= render DS::Tabs.new(active_tab: active_tab, url_param_key: "tab") do |tabs_container| %>
          <%# As wide as its tabs and no wider than the column. A loan's five
              tabs can outgrow the column beside the side panels; the bar then
              scrolls on its own instead of wrapping labels or pushing the
              page sideways. %>
          <% tabs_container.with_nav(classes: "w-max max-w-full overflow-x-auto") do |nav| %>
            <% tabs.each do |tab| %>
              <% nav.with_btn(id: tab, label: t("accounts.show.tabs.#{tab}", default: tab.to_s.humanize), classes: "px-6 whitespace-nowrap") %>
            <% end %>
          <% end %>

          <% tabs.each do |tab| %>
            <% tabs_container.with_panel(tab_id: tab) do %>
              <%= tab_content_for(tab) %>
            <% end %>
          <% end %>
        <% end %>
      <% else %>
        <%= tab_content_for(tabs.first) %>
      <% end %>
    </div>
  <% end %>
<% end %>