diff --git a/app/components/DS/tooltip.html.erb b/app/components/DS/tooltip.html.erb index a5bc1b75..3afe320c 100644 --- a/app/components/DS/tooltip.html.erb +++ b/app/components/DS/tooltip.html.erb @@ -1,9 +1,9 @@ -
+ <%= helpers.icon icon_name, size: size, color: color %> - \ No newline at end of file + \ No newline at end of file diff --git a/app/javascript/controllers/ds_tooltip_controller.js b/app/components/DS/tooltip_controller.js similarity index 83% rename from app/javascript/controllers/ds_tooltip_controller.js rename to app/components/DS/tooltip_controller.js index 8f8760d8..8f198bae 100644 --- a/app/javascript/controllers/ds_tooltip_controller.js +++ b/app/components/DS/tooltip_controller.js @@ -37,20 +37,21 @@ export default class extends Controller { } show = () => { - this.tooltipTarget.style.display = "block"; + this.tooltipTarget.classList.remove("hidden"); this.startAutoUpdate(); this.update(); }; hide = () => { - this.tooltipTarget.style.display = "none"; + this.tooltipTarget.classList.add("hidden"); this.stopAutoUpdate(); }; startAutoUpdate() { if (!this._cleanup) { + const reference = this.element.querySelector("[data-icon]"); this._cleanup = autoUpdate( - this.element.firstElementChild, // Use the icon as the reference element + reference || this.element, this.tooltipTarget, this.boundUpdate ); @@ -65,7 +66,8 @@ export default class extends Controller { } update() { - computePosition(this.element.firstElementChild, this.tooltipTarget, { + const reference = this.element.querySelector("[data-icon]"); + computePosition(reference || this.element, this.tooltipTarget, { placement: this.placementValue, middleware: [ offset({ diff --git a/app/components/UI/account/activity_feed.html.erb b/app/components/UI/account/activity_feed.html.erb index 894e25e7..c12abf0b 100644 --- a/app/components/UI/account/activity_feed.html.erb +++ b/app/components/UI/account/activity_feed.html.erb @@ -4,7 +4,7 @@ <%= tag.h2 t(".title"), class: "font-medium text-lg" %> <% if account.manual? %> - <%= render MenuComponent.new(variant: "button") do |menu| %> + <%= render DS::Menu.new(variant: "button") do |menu| %> <% menu.with_button(text: "New", variant: "secondary", icon: "plus") %> <% menu.with_item( diff --git a/app/components/UI/account/entries_date_group.html.erb b/app/components/UI/account/entries_date_group.html.erb index afad3436..e7f5b05e 100644 --- a/app/components/UI/account/entries_date_group.html.erb +++ b/app/components/UI/account/entries_date_group.html.erb @@ -1,5 +1,5 @@ <%= tag.div id: id, data: { bulk_select_target: "group" }, class: "bg-container-inset rounded-xl p-1 w-full" do %> -
+
@@ -16,9 +16,9 @@
-
+
<%= balance_trend.current.format %> - <%= render DS::Tooltip.new(text: "The end of day balance, after all transactions and adjustments") %> + <%= render DS::Tooltip.new(text: "The end of day balance, after all transactions and adjustments", placement: "left", size: "sm") %>
<%= helpers.icon "chevron-down", class: "group-open:rotate-180" %>
@@ -29,48 +29,48 @@
Start of day balance

-
<%= start_balance_money.format %>
+
<%= start_balance_money.format %>
<% if account.balance_type == :investment %>
Cash Δ

-
<%= transaction_totals_money.format %>
+
<%= transaction_totals_money.format %>
Holdings Δ

-
<%= holding_change_money.format %>
+
<%= holding_change_money.format %>
<% else %>
Transaction totals

-
<%= transaction_totals_money.format %>
+
<%= transaction_totals_money.format %>
<% end %>
End of day balance

-
<%= end_balance_before_adjustments_money.format %>
+
<%= end_balance_before_adjustments_money.format %>
-
-
-
Value adjustments Δ
-
-
<%= adjustments_money.format %>
-
+
-
-
Closing balance (incl. adjustments)
-
-
<%= end_balance_money.format %>
-
-
+
+
Value adjustments Δ
+
+
<%= adjustments_money.format %>
+
+ +
+
Closing balance (incl. adjustments)
+
+
<%= end_balance_money.format %>
+
diff --git a/app/models/account/activity_feed_data.rb b/app/models/account/activity_feed_data.rb index 24971149..1854e327 100644 --- a/app/models/account/activity_feed_data.rb +++ b/app/models/account/activity_feed_data.rb @@ -12,7 +12,7 @@ class Account::ActivityFeedData def trend_for_date(date) start_balance = start_balance_for_date(date) end_balance = end_balance_for_date(date) - + Trend.new( current: end_balance.balance_money, previous: start_balance.balance_money