Refactor dashboard static assets into ES modules (#674, #675, #676, #677) - #835
Merged
graceuvala-collab merged 5 commits intoOct 2, 2026
Merged
Conversation
|
@Raven062 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Refactor dashboard static assets into ES modules (#674, #675, #676, #677)
What was solved
#674 — Dashboard: switch
dashboard.jsfrom an IIFE to an ES module entry pointConvert static/dashboard.js from an IIFE with a DOMContentLoaded guard into an ES module entry point (main.js) loaded via <script type="module">, using const/let throughout, while preserving all existing dashboard behavior and the no-API-key-in-URL/log/console guarantee.
Addressed:
#675 — Dashboard: extract the API client into
api.jsExtract the dashboard's inline
api()fetch helper (static/dashboard.js:96) into a dedicatedstatic/api.jsES module exposing async per-endpoint functions (listPayments,getPayment,listDeliveries,redeliver) that always target/v1/...paths, then updatestatic/dashboard.jsto import and use them.Addressed:
static/api.jswith async functions per endpoint:listPayments,getPayment,listDeliveries,redeliverapi()instatic/dashboard.js:96into the new module/v1/...paths#676 — Dashboard: extract DOM helpers into
dom.jsExtract the dashboard DOM helper functions
$,el,show,clear, andsetErrorfromstatic/dashboard.jsinto a newstatic/dom.jsmodule, then update all call sites (including the dashboard HTML script loading and any other static JS modules that use these helpers) to consume the new module. This is a mechanical refactor scoped to the dashboard frontend assets, part of the larger #627 effort.Addressed:
static/dom.jscontaining the$,el,show,clear, andsetErrorhelpersstatic/dashboard.js(and any other static JS that references these helpers) to use the extracted module#677 — Dashboard: extract formatting helpers into
format.jsExtract the pure formatting helpers
fmtTime,shortId, andpillClassfrom the dashboard code into a new DOM-freestatic/format.jsmodule, then update all call sites (primarilystatic/dashboard.js) to consume them from the new module. This is a refactor-only change scoped to the dashboard frontend, enabling unit testing of these helpers via the existingstatic/tests/format.test.jsharness.Addressed:
static/format.jscontainingfmtTime,shortId, andpillClasswith no DOM access (pure functions only)static/dashboard.js) to import/use them fromformat.jsChanges
static/dashboard.html(modify)static/api.js(create)static/dom.js(create)static/format.js(modify)Approach
dashboard.jsfrom an IIFE to an ES module entry point #674 — Dashboard: switchdashboard.jsfrom an IIFE to an ES module entry point (Changed: static/dashboard.html)api.js#675 — Dashboard: extract the API client intoapi.js(Changed: static/api.js, static/api.js)dom.js#676 — Dashboard: extract DOM helpers intodom.js(Changed: static/dom.js, static/dom.js, static/dom.js, static/dashboard.html)format.js#677 — Dashboard: extract formatting helpers intoformat.js(Changed: static/format.js, static/format.js)Issues
Closes #674
Closes #675
Closes #676
Closes #677