Skip to content

armgit / sure

Public Imported from GitHub
0

The personal finance app for everyone (by everyone)

Ruby

fix(ds): .table-scroll — wide tables scroll instead of clipping (#2148)

Guillem Arias Faustef499a3db0179
diff --git a/app/assets/tailwind/sure-design-system/components.css b/app/assets/tailwind/sure-design-system/components.css
index 21a133c06b..0d9103300b 100644
--- a/app/assets/tailwind/sure-design-system/components.css
+++ b/app/assets/tailwind/sure-design-system/components.css
@@ -159,4 +159,28 @@
fill: var(--color-white);
}
}
+
+ /*
+ Horizontally scrollable table wrapper (#2137). `overflow-x: auto` so wide
+ tables scroll instead of clipping (the LLM-usage table was `overflow-hidden`
+ and pushed columns off-screen) or wrapping money mid-digit. The pure-CSS
+ "scroll shadow" gives the missing affordance: the cover gradients
+ (`--table-scroll-bg`, default container-inset) scroll WITH the content
+ (`background-attachment: local`) and hide the fixed shadow gradients at the
+ edges, so a soft edge-shadow only appears when there is more to scroll.
+ Theme-aware via `--color-shadow`. Set `--table-scroll-bg` to match the wrapper.
+ */
+ .table-scroll {
+ --table-scroll-bg: var(--color-container-inset);
+ overflow-x: auto;
+ background:
+ linear-gradient(to right, var(--table-scroll-bg) 30%, transparent),
+ linear-gradient(to left, var(--table-scroll-bg) 30%, transparent) 100% 0,
+ radial-gradient(farthest-side at 0 50%, var(--color-shadow), transparent),
+ radial-gradient(farthest-side at 100% 50%, var(--color-shadow), transparent) 100% 0;
+ background-repeat: no-repeat;
+ background-color: var(--table-scroll-bg);
+ background-size: 32px 100%, 32px 100%, 12px 100%, 12px 100%;
+ background-attachment: local, local, scroll, scroll;
+ }
}
diff --git a/app/views/settings/llm_usages/show.html.erb b/app/views/settings/llm_usages/show.html.erb
index 39929a55b5..d0b8e5967e 100644
--- a/app/views/settings/llm_usages/show.html.erb
+++ b/app/views/settings/llm_usages/show.html.erb
@@ -103,7 +103,7 @@
<!-- Recent Usage Table -->
<div>
<h2 class="text-lg font-semibold text-primary mb-3"><%= t(".recent_usage") %></h2>
- <div class="bg-container-inset rounded-lg overflow-hidden">
+ <div class="table-scroll rounded-lg" tabindex="0" role="region" aria-label="<%= t(".recent_usage") %>">
<% if @llm_usages.any? %>
<table class="w-full">
<thead class="bg-surface-default border-b border-primary">