refactor(charts): unify on Chart.js, remove Chartist #10
Reference in New Issue
Block a user
Delete Branch "integreat-unify-charts"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
The codebase had two charting libraries. The dashboard and expense report already use Chart.js, while the admin page was the sole remaining consumer of Chartist. This unifies everything on Chart.js.
Changes
admin.clj— converted both admin charts from Chartist to Chart.js, using the same Alpinex-data/x-init<canvas>pattern as the dashboard:barline{:labels … :series [[…]]}to Chart.js's{:labels … :data …}.[hiccup2.core :as hiccup]require (only used for the Chartist<script>tags).ui.clj— removed the global Chartist CSS/JS CDN includes from the base page.Verification
chartistreferences remain insrc/clj.lein cljfmt checkpasses./dev-login, and confirmed both admin charts render via live Chart.js instances (screenshot below).When a transaction is saved via the edit modal, return the updated row HTML with {:flash? true} instead of an empty div. This makes the row flash with the live-added animation, matching the behavior of other pages like invoices and accounts. Uses hx-retarget to swap the specific row in the table while also triggering modalclose to close the modal.When editing a transaction manually, users can now toggle between viewing account amounts as dollar values or percentages. The toggle appears in the table header as a radio button group ($ / %). Key features: - Global toggle switches all accounts simultaneously - $→%: amounts are converted to percentages of the transaction total - %→$: uses percentages->dollars with spread-cents for accurate cent distribution - Form state preserves vendor, memo, approval status when toggling - Save handler converts % back to $ before persisting to Datomic - Uses HTMX to re-render only the account grid body on toggle New route: /toggle-amount-mode New functions: ->percentage, percentages->dollars, convert-accounts-mode, account-grid-body*, toggle-amount-modeWhen a transaction is pre-coded, the snapshot stores :transaction-account/account as a Datomic ref map {:db/id N} rather than a bare integer. simple-mode-fields* and the simpleAccountId Alpine initializer both need the integer id, not the map, to correctly populate the account typeahead value and the x-hx-val binding.Pull request closed