fix: resolve ESLint no-shadow errors in CallEmbedProvider
CI / Build & Quality Checks (push) Successful in 10m24s
CI / Build & Quality Checks (push) Successful in 10m24s
The rect variable in the onUp and onTouchEnd closures was shadowing the outer rect declaration in handlePipMouseDown and handlePipTouchStart. Renamed inner declarations to savedRect. Also renamed rect → elRect in handlePipDoubleClick for the same reason. Removed unused eslint-disable-next-line comment in MessageSearch.tsx. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -544,9 +544,9 @@ export function CallEmbedProvider({ children }: CallEmbedProviderProps) {
|
||||
const margin = 16;
|
||||
const w = el.offsetWidth;
|
||||
const h = el.offsetHeight;
|
||||
const rect = el.getBoundingClientRect();
|
||||
const cx = rect.left + w / 2;
|
||||
const cy = rect.top + h / 2;
|
||||
const elRect = el.getBoundingClientRect();
|
||||
const cx = elRect.left + w / 2;
|
||||
const cy = elRect.top + h / 2;
|
||||
const snapLeft = cx < window.innerWidth / 2 ? margin : window.innerWidth - w - margin;
|
||||
const snapTop = cy < window.innerHeight / 2 ? margin : window.innerHeight - h - margin;
|
||||
el.style.left = `${snapLeft}px`;
|
||||
@@ -600,8 +600,11 @@ export function CallEmbedProvider({ children }: CallEmbedProviderProps) {
|
||||
document.body.style.userSelect = '';
|
||||
activeDragCleanupRef.current = null;
|
||||
if (el && pipDragRef.current?.dragged) {
|
||||
const rect = el.getBoundingClientRect();
|
||||
localStorage.setItem('pip-position', JSON.stringify({ left: rect.left, top: rect.top }));
|
||||
const savedRect = el.getBoundingClientRect();
|
||||
localStorage.setItem(
|
||||
'pip-position',
|
||||
JSON.stringify({ left: savedRect.left, top: savedRect.top }),
|
||||
);
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (pipDragRef.current) pipDragRef.current.dragged = false;
|
||||
@@ -655,8 +658,11 @@ export function CallEmbedProvider({ children }: CallEmbedProviderProps) {
|
||||
document.removeEventListener('touchend', onTouchEnd);
|
||||
activeDragCleanupRef.current = null;
|
||||
if (el && pipDragRef.current?.dragged) {
|
||||
const rect = el.getBoundingClientRect();
|
||||
localStorage.setItem('pip-position', JSON.stringify({ left: rect.left, top: rect.top }));
|
||||
const savedRect = el.getBoundingClientRect();
|
||||
localStorage.setItem(
|
||||
'pip-position',
|
||||
JSON.stringify({ left: savedRect.left, top: savedRect.top }),
|
||||
);
|
||||
}
|
||||
setTimeout(() => {
|
||||
if (pipDragRef.current) pipDragRef.current.dragged = false;
|
||||
|
||||
Reference in New Issue
Block a user