feat: plain-language acronym tooltips and target-HF input#207
Open
amandasmyths wants to merge 1 commit into
Open
feat: plain-language acronym tooltips and target-HF input#207amandasmyths wants to merge 1 commit into
amandasmyths wants to merge 1 commit into
Conversation
## Issue Dgetsylver#8 — Plain-language tooltips on every acronym - Added a centralized GLOSSARY constant in main.ts as the single source of truth for all acronym definitions (HF, APY, c_factor, util_target, r_base, r_one, r_two, r_three, b_token, d_token). Every entry includes a one-sentence plain-language description plus a "Learn more →" link to docs.blend.capital. - Updated initTooltips() to resolve data-term attributes against the GLOSSARY at runtime, setting data-tip (plain text) and data-tip-html (HTML with link). - The tooltip popover now renders HTML so the "Learn more" link is clickable. pointer-events switched to auto; the popover stays visible while hovering over it so the link can be reached before the popover fades. - All .tooltip spans now receive tabindex="0", role="button", and aria-label, making them keyboard-focusable. Focus shows the popover; blur hides it; Enter/Space toggles it. A :focus-visible outline ring is added in CSS. - New data-term wiring across index.html: • c_factor stat card → data-term="c_factor" • Utilization stat card → data-term="util_target" • Supply "Interest APY" label → APY tooltip on the abbreviation • Borrow APR card → new "Rate model" row with individual r_base, r_one, r_two, r_three tooltip spans (each shows its definition on hover/focus) • Position "Collateral" label → data-term="b_token" • Position "Debt" label → data-term="d_token" • Asset HF and Pool HF labels → data-term="HF" ## Issue Dgetsylver#5 — "Target HF" input that auto-solves leverage - Added leverageFromHf(hf, c, l) utility: lev = HF / (HF − c·l), the algebraic inverse of the existing hfForLeverage formula. - Added a "or target HF" number input directly below the leverage slider in the action card. Typing a value instantly recomputes leverage and drives the slider and all derived preview numbers (supply, borrow, headroom, APY, liquidation days). - Validation rejects: • HF < 1.0 (liquidatable immediately) • HF ≤ c·l (below the asymptotic floor; no finite leverage can achieve it) • Resulting leverage > pool maximum (would exceed slider range) Clear inline error messages are shown for each case. - updatePreview() now syncs the Target HF input whenever the slider moves, keeping both controls in sync bidirectionally. Closes Dgetsylver#8 Closes Dgetsylver#5
|
@amandasmyths 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
Issue A6: Plain-language tooltips on every acronym #8 — Plain-language tooltips on every acronym: Added a centralized
GLOSSARYdictionary inmain.tsas the single source of truth for ten terms (HF, APY, c_factor, util_target, r_base, r_one, r_two, r_three, b_token, d_token). Every entry has a one-sentence plain-language description plus a clickable "Learn more →" link to docs.blend.capital. Tooltips are wired across the UI viadata-termattributes resolved at runtime. All tooltip spans now receivetabindex="0",role="button", and keyboard event handlers (Enter/Space to toggle, focus/blur to show/hide), satisfying the keyboard-focusability requirement.Issue A3: "Target HF" input that auto-solves leverage #5 — "Target HF" input that auto-solves leverage: Added a numeric input directly below the leverage slider. Typing a target HF value (e.g. 1.8) instantly computes the required leverage via
leverageFromHf(hf, c, l) = hf / (hf − c·l)and drives the slider and all derived preview numbers (supply, borrow, net APY, liquidation days). The slider bidirectionally syncs back to the HF input. Rejects HF values below 1.0 (liquidatable) or at/below the asset's asymptotic floor (c·l), and values that would require leverage above the pool maximum — each with a clear inline error message.Changes
frontend/src/main.ts— GLOSSARY constant, updatedinitTooltips()with keyboard support and HTML popover,leverageFromHf()function, target-HF event listener, HF sync inupdatePreview()frontend/index.html—data-termattributes on acronym instances, new Collateral/Debt/HF/APY/rate-model tooltip spans, target-HF input rowfrontend/src/style.css— tooltip focus ring, pointer-events on popover, "Learn more" link style,.target-hf-rowand.apr-rate-paramslayout rulesTest plan
?span — popover appears on focus; disappears on blurCloses #8
Closes #5