From 75a05cf83d6ba1617052d28e836e1af5a652440f Mon Sep 17 00:00:00 2001 From: root Date: Thu, 14 May 2026 22:50:20 -0400 Subject: [PATCH] feat: draggable PiP call window Drag the PiP window anywhere on screen to move it out of the way. Click (without dragging) still navigates back to the call room. 5px movement threshold distinguishes drag from click. Mouse and touch both supported. Cursor shows grab/grabbing cues. --- README.md | 39 +---- src/app/components/CallEmbedProvider.tsx | 187 ++++++++++++++++++++++- 2 files changed, 184 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index f6595f700..fc88444e5 100644 --- a/README.md +++ b/README.md @@ -59,41 +59,4 @@ A full custom theme engine layered on top of Cinny's vanilla-extract theming: - Implemented via `CallControl.setMicrophone()` public method on the widget bridge - **Noise suppression toggle**: Settings > General > Calls — passes `noiseSuppression` URL parameter to the embedded Element Call widget - **DM calls**: Phone button in DM room header starts a 1-on-1 call via `useCallStart(true)`. `Room.tsx` switches to CallView layout when the DM has an active call embed. Standard voice rooms were already supported; this extends call support to all direct messages. -- **Picture-in-picture (PiP)**: When navigating away from a call room while in an active call, the call embed shrinks to a 280×158px floating window in the bottom-right corner (above the message composer). Clicking it navigates back to the call room. Implemented via `useEffect` that imperatively overrides inline styles on `callEmbedRef.current` — a wrapper div cannot be used because `useCallEmbedPlacementSync` writes `top/left/width/height` directly onto that element. - -### GIF Picker - -- **Giphy integration**: GIF button appears in the message composer next to Send when `gifApiKey` is present in `config.json` -- Uses Giphy JS/React SDK (`@giphy/react-components`, `@giphy/js-fetch-api`, `styled-components`) -- Selected GIF is fetched as a blob, uploaded via `mx.uploadContent`, and sent as `m.image` — appears inline in the timeline like any image -- `FocusTrap` wraps the picker: clicking outside or pressing Escape closes it -- **Terminal theme**: When LotusGuild TDS is active the picker switches to: dark navy background (`#060c14`), orange dim border, 4px angular radius, `// GIF_SEARCH` header in JetBrains Mono, Giphy SearchBar input overridden (dark bg, orange border/focus ring, JetBrains Mono font), custom orange scrollbar -- API key set in root `config.json` → `gifApiKey` (the root file is what vite copies to dist — `public/config.json` is not used) - -### Settings Additions - -**Settings > General > Calls** (new section): -- Camera on join: toggle whether camera starts enabled -- Noise suppression: toggle noise suppression in calls (default: on) -- Push to Talk: enable PTT mode and configure the keybind - -### Editor - -- Editor toolbar visibility is user-configurable (toggle added to message composer settings) - -### Technical - -- All upstream Cinny URLs replaced (cinny.in → lotusguild.org, Cinny Matrix room → Lotus Guild room) -- Version string is dynamically read from `package.json` at build time — no hardcoded version strings -- `useCallEmbed.ts`: noise suppression setting wired through `createCallEmbed` → `CallEmbed.getWidget()` → Element Call URL params -- `CallControl.ts`: `setMicrophone(enabled: boolean)` public method for PTT mic control; `onControlMutation()` patched to detect screenshare start and auto-revert spotlight to grid -- `callPreferences` atom: never persists `video: true` to localStorage; camera state always resets to OFF on page load -- `CallEmbedProvider.tsx`: `pipMode` logic and `useEffect` for imperative style overrides; `navigateRoom` hook for PiP click-to-return -- `GifPicker.tsx`: `useSetting(settingsAtom, 'lotusTerminal')` drives conditional terminal styling; injected `