Skip to content

fix: Discord embed polish — resize handles, gesture freeze, auto zoom, compact mode - #123

Merged
nishant merged 3 commits into
masterfrom
fix/discord-embed-polish
Jul 14, 2026
Merged

nishant merged 3 commits into
masterfrom
fix/discord-embed-polish

Conversation

@nishant

@nishant nishant commented Jul 14, 2026

Copy link
Copy Markdown
Owner

Summary

Phase A of the Discord-widget rework: three defects fixed on top of the (unchanged, load-bearing) app-lifetime DiscordHost architecture.

1. Dead resize handles → padded frame

RGL renders handle spans INSIDE each grid item; grid items are transform-created stacking contexts, so no handle could rise above the root-level fixed z-30 host — every handle under the webview (s/se/sw/e/w) was dead. The tile body now wraps a p-2 gutter and publishes the INNER div's rect, exposing RGL's edge/corner hit areas all around the webview and letting the tile chrome visibly frame the embed. Host corners: rounded-b-md → rounded-md (all four are visible inside the gutter).

2. Resize/drag jank → gesture freeze + settle debounce

New ephemeral discordStore.interacting, set/cleared by DashboardGrid's onDragStart/onResizeStart/onDragStop/onResizeStop (any tile's gesture — harmless when Discord isn't visible). While interacting: host position tracks per frame, width/height FREEZE at the last settled size, and the host goes pointer-events:none so grid mousemoves never hit the guest. Final size applies once on gesture end; out-of-gesture size changes (window resize) settle via a 120 ms trailing debounce. Decision logic is the pure helper nextHostStyle(rect, interacting, settledSize) in apps/renderer/src/widgets/discord/lib.ts — unit-tested.

3. Scaling — auto zoom + compact CSS + dark splash

  • zoomForWidth(width): ≥900px → 1.0, ≥700 → 0.9, ≥550 → 0.85, else 0.75 — applied on webview dom-ready, re-applied only on settled-width breakpoint crossings and after reload. setZoomFactor(factor): void / insertCSS(css): Promise<string> added to DiscordWebviewElement, pinned against electron@33.4.11 WebviewTag typings.
  • DISCORD_COMPACT_CSS hides the members list ([class*="membersWrap"]) on every dom-ready (inserted CSS doesn't survive navigation). FAIL-SOFT: selector rot = stock layout, nothing breaks. Server rail + channel sidebar deliberately kept.
  • Loading splash is now Discord's own dark (#313338) — no theme-colored flash.

Out of scope / follow-ups

  • No settings toggle for compact mode in this PR — Settings files are owned by another in-flight agent; a "hide members list" toggle can follow.
  • layoutStore, SettingsModal, IPC/preload untouched; DashboardGrid edits are limited to the gesture callbacks.

Gates

Verification for Nish (needs the running app — not covered by unit tests)

  1. All eight resize handles on the Discord tile should now respond (previously only n/ne/nw).
  2. Drag/resize any tile: the Discord webview should hold its size during the gesture (position follows), snap to final size on release — no per-mousemove relayout tearing.
  3. Shrink the tile below ~900/700/550px widths: Discord should step down in zoom; members list should be hidden at all widths (fail-soft if Discord renamed the class).
  4. Reload button: compact CSS + zoom re-apply after reload.
  5. Splash on first load is Discord-dark, not white.
  6. Regression check: layout switch away/back keeps you signed in + in voice (host architecture untouched).

🤖 Generated with Claude Code

nishant and others added 3 commits July 14, 2026 18:10
…, compact mode

- Padded frame: tile body gets a p-2 gutter and publishes the INNER rect,
  exposing RGL's edge/corner resize handles (previously covered by the
  fixed z-30 host - only n/ne/nw worked) and framing the embed with the
  tile chrome; host rounds all four corners now.
- Gesture freeze: discordStore.interacting (set by any grid drag/resize
  via DashboardGrid gesture callbacks) freezes the host's size at the
  last settled value and mutes its pointer events while position keeps
  tracking; final size applies once on gesture end. Out-of-gesture size
  changes settle via a 120ms debounce. Decision logic is a pure helper
  (nextHostStyle) with unit tests.
- Auto zoom: zoomForWidth steps the guest zoom (>=900 1.0 / >=700 0.9 /
  >=550 0.85 / else 0.75) on dom-ready and on settled-width breakpoint
  crossings; webview-tag setZoomFactor/insertCSS signatures pinned
  against electron@33.4.11 typings.
- Compact CSS: fail-soft [class*=membersWrap] hide injected on every
  dom-ready (inserted CSS doesn't survive reloads); server rail and
  channel sidebar deliberately kept.
- Loading splash now Discord dark (#313338) instead of theme surface.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@nishant
nishant merged commit 3d88793 into master Jul 14, 2026
1 check passed
@nishant
nishant deleted the fix/discord-embed-polish branch July 14, 2026 23:16
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