mirror of
https://github.com/we-promise/sure.git
synced 2026-09-09 08:34:26 +00:00
* feat(bills): the bills pages, calendar feed and in-page AI helpers Second of three chunks carved out of #3083, stacked on the schema and domain core. This is everything a user sees and clicks. The whole surface sits behind the preview flag, so it is unreachable until someone opts in. Pages, all under one nav entry: - the pay run, a month calendar, the full bills table, and the paycheck planner - a detail drawer per bill, with payment history, price changes and cost analytics - create and edit flows for bills, subscriptions, installment plans and income The overview marks pay periods inside the month, so a weekly paycheck no longer reads as one undifferentiated month of bills. Markers appear only when income actually subdivides the month, which means monthly and undeclared income render exactly as before and there is no new setting to configure. Navigation and design system: - one preview-gated nav item shared by the desktop rail and the mobile bar - DS::Sparkline for payment-history charts, replacing raw SVG in views - status badges render through DS::Pill rather than hand-rolled spans - the suggestions panel is a disclosure that remembers being collapsed, per device, the way privacy mode and the sidebar width already do - every surface reflows to phone widths without horizontal scroll Calendar feed: a signed ICS feed per family, served sessionless by token, with a reset that revokes previously shared URLs. In-page AI helpers: smart fill on the bill form and a smart configuration proposal on an existing bill, each reading a bounded slice of charge history. Provider-side prompt assembly sits behind the existing LlmConcept interface, with an implementation for each of the two providers. These belong here rather than with the assistant tools because they are buttons on these pages and lean on the provider suggester, not on the tool registry. Suite 7,776 runs green apart from the pre-existing passkey-session flake, which passes standalone. Rubocop clean, eager loading verified. The hosting guide for the feature ships here rather than with the schema, since its instructions walk pages this PR introduces. * Render the suggested strip through DS::Disclosure The hand-rolled details pair predates the component. The card_inset variant is the same shape, so the strip now inherits the design system chrome, and the persisted-disclosure controller rides along unchanged. * Route the remaining hand-rolled chips through the design system The subscription-state chips, rule-match chips and match-reason chips become DS::Pill, with the state chips extracted to one shared partial so the drawer and the summary tab stop carrying copy-pasted markup. The AI prompt chips become DS::Button and the bills-index filter becomes DS::SearchInput, both of which this PR already uses elsewhere for the same shapes. * Fix erb_lint whitespace offenses in bills views * Address the post-ready review round * Require a writable destination account and gate the feed on preview * Reject an unresolvable declared account out loud
51 lines
2.6 KiB
ERB
51 lines
2.6 KiB
ERB
<%# locals: (active:) %>
|
|
<%# Page title and primary action in the header, view switcher beneath, matching
|
|
transactions/index. Bills was the only top-level destination in the app with
|
|
no heading at all, which also left screen readers with no outline to navigate. %>
|
|
<%# Both halves are addable from every view, but only the one this view is
|
|
about earns a header button: Add income on the Income plan, Add bill
|
|
everywhere else. The other half and the AI review live in the overflow
|
|
menu, so the header carries one action instead of a toolbar of three. %>
|
|
<% income_first = active == "paycheck" %>
|
|
<header class="flex justify-between items-center gap-2 text-primary font-medium">
|
|
<h1 class="text-xl"><%= t("bills.index.title") %></h1>
|
|
|
|
<div class="flex items-center gap-2 shrink-0">
|
|
<%= render DS::Link.new(
|
|
text: income_first ? t("bills.index.add_income") : t("bills.index.add_bill"),
|
|
icon: "plus",
|
|
variant: "primary",
|
|
href: income_first ? new_recurring_transaction_path(income: true) : new_recurring_transaction_path,
|
|
frame: :modal
|
|
) %>
|
|
<%= render DS::Menu.new do |menu| %>
|
|
<% menu.with_item(
|
|
variant: "link",
|
|
text: income_first ? t("bills.index.add_bill") : t("bills.index.add_income"),
|
|
icon: "plus",
|
|
href: income_first ? new_recurring_transaction_path : new_recurring_transaction_path(income: true),
|
|
data: { turbo_frame: :modal }) %>
|
|
<%# Seeds a chat with the server-owned review prompt into the sidebar
|
|
frame; the audit tool grounds the findings. Needs AI consent plus a
|
|
configured provider, or the item leads to a dead chat. %>
|
|
<% if bills_one_shot_ai_available? %>
|
|
<% menu.with_item(
|
|
variant: "button",
|
|
text: t("bills.index.review_with_ai"),
|
|
icon: "sparkles",
|
|
href: ai_review_bills_path,
|
|
method: :post,
|
|
frame: chat_frame,
|
|
data: { action: "app-layout#openRightSidebar" }) %>
|
|
<% end %>
|
|
<% end %>
|
|
</div>
|
|
</header>
|
|
|
|
<%= render DS::SegmentedControl.new(aria_label: t("bills.views.aria_label")) do |control| %>
|
|
<% control.with_segment(t("bills.views.overview"), active: active == "overview", href: bills_path) %>
|
|
<% control.with_segment(t("bills.views.calendar"), active: active == "calendar", href: bills_path(view: "calendar")) %>
|
|
<% control.with_segment(t("bills.views.paycheck"), active: active == "paycheck", href: bills_path(view: "paycheck")) %>
|
|
<% control.with_segment(t("bills.views.all"), active: active == "all", href: bills_path(view: "all")) %>
|
|
<% end %>
|