Skip to content

feat: plain-language acronym tooltips and target-HF input#207

Open
amandasmyths wants to merge 1 commit into
Dgetsylver:mainfrom
amandasmyths:main
Open

feat: plain-language acronym tooltips and target-HF input#207
amandasmyths wants to merge 1 commit into
Dgetsylver:mainfrom
amandasmyths:main

Conversation

@amandasmyths
Copy link
Copy Markdown

Summary

  • Issue A6: Plain-language tooltips on every acronym #8 — Plain-language tooltips on every acronym: Added a centralized GLOSSARY dictionary in main.ts as 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 via data-term attributes resolved at runtime. All tooltip spans now receive tabindex="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, updated initTooltips() with keyboard support and HTML popover, leverageFromHf() function, target-HF event listener, HF sync in updatePreview()
  • frontend/index.htmldata-term attributes on acronym instances, new Collateral/Debt/HF/APY/rate-model tooltip spans, target-HF input row
  • frontend/src/style.css — tooltip focus ring, pointer-events on popover, "Learn more" link style, .target-hf-row and .apr-rate-params layout rules

Test plan

  • Hover each tagged term (HF, APY, c_factor, util_target, r_base/r_one/r_two/r_three, b_token, d_token) — popover shows one-sentence description and "Learn more →" link
  • Tab to a tooltip ? span — popover appears on focus; disappears on blur
  • Press Enter/Space on a focused tooltip — popover toggles
  • Click "Learn more →" inside the popover — navigates to docs.blend.capital
  • Type 1.8 in Target HF — leverage slider moves to match; all preview numbers update; HF preview shows ≈ 1.8000
  • Drag slider — Target HF input syncs to 4 decimal places
  • Type HF below 1.0 — error "HF must be at least 1.0"
  • Type HF at or below asset floor (c·l) — error showing the floor value
  • Type HF requiring leverage above pool max — appropriate error

Closes #8
Closes #5

## 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
@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented May 29, 2026

@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! 🚀

Learn more about application limits

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

A6: Plain-language tooltips on every acronym A3: "Target HF" input that auto-solves leverage

1 participant