Skip to content

feat(share-pnl): polish meta row, PnL hero, timestamp#159

Merged
kostovster merged 1 commit into
mainfrom
feat/share-pnl-polish
May 8, 2026
Merged

feat(share-pnl): polish meta row, PnL hero, timestamp#159
kostovster merged 1 commit into
mainfrom
feat/share-pnl-polish

Conversation

@kostovster
Copy link
Copy Markdown
Member

Summary

Follow-up polish on the Share PnL dialog after #158. The colored pill + arrow + separate asset row are replaced with a compact meta row, the PnL percent grows into the dominant element, and the timestamp is localized.

Changes

  • Meta row: drops the colored pill, the up/down arrow, and the standalone asset row in favor of a single line — small asset icon (40 px), then Long or Short colored by direction (positive palette tone for Long, negative for Short), separator, ticker. Direction coloring is independent of PnL sign.
  • PnL hero: per-cover palette now carries pnlPositive and pnlNegative. Cover 3 (orange) gets deeper wine and forest tones — the brand red on bright orange had poor contrast and that was already the failure case before the hero was scaled up. Hero font sizes 72/58 → 96/80.
  • Timestamp: Intl.DateTimeFormat(i18n.locale.value, ...) with month: "long" for the date and hour12: false for the time. Drops the Timestamp: prefix. Renders as e.g. May 8, 2026 · 16:52 and follows the active locale.
  • Font preload fix: ctx.font = ... does not wait for @font-face loading, so the first paint after dialog open silently fell back to the system font. New ensureFonts() awaits document.fonts.load() for every Garet weight/size combo we paint, called once and memoized; the catch on the memoized promise means a load failure degrades to the system fallback rather than blanking every subsequent render.
  • Cleanup: orphaned i18n keys message.buy-position and message.timestamp removed from en.json — their only consumers were the deleted pill text and the prior timestamp formatter.

Verification

  • npm run lint clean
  • npm run format:check clean
  • npm run build clean
  • npm test 760/760 passing

Follow-ups

  • Server-side: refresh /opt/deploy/builds/{app,app-dev}/config/locales/en.json to drop the two now-orphaned keys, then restart webapp-prod and webapp-dev so the in-memory cache reflects the change.
  • Cover assets: the next round (PR-B) will canvas-render the Nolus logo and tint per palette. Requires the four cover assets re-exported without the baked-in logo.

Drop the colored pill + arrow icon in favor of a compact meta row:
small asset icon, then "Long" or "Short" colored by direction (palette
positive tone for Long, negative for Short), separator, ticker. Frees
vertical space and makes the PnL percent the dominant element of the
card — sized up from 72/58 to 96/80 to match.

Per-cover PnL palette so the percent and the direction word stay
readable on every cover. The orange cover (#3) was the failure case
under the prior shared brand red — the wine/forest tones it gets now
have real contrast.

Replace the manual "Timestamp: YYYY-MM-DD HH:MM" with localized
formatting via Intl.DateTimeFormat using the active i18n locale and a
24-hour clock. Drops the "Timestamp:" label entirely; renders as e.g.
"May 8, 2026 · 16:52".

Force the Garet font into the document's font set up front via
document.fonts.load(), called once and memoized. ctx.font assignment
does not wait for @font-face loading, which was producing a fallback
serif on the first paint after dialog open until the cover was
switched. The memoized promise catches load rejections so a 404 or CSP
block degrades to the system fallback rather than blanking every
subsequent render.

Remove now-orphaned i18n keys message.buy-position and message.timestamp
from en.json — their only consumers were the deleted pill text and the
old timestamp formatter.
@kostovster kostovster merged commit b9df09a into main May 8, 2026
2 checks passed
@kostovster kostovster deleted the feat/share-pnl-polish branch May 8, 2026 14:30
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.

1 participant