Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp

fix(app): lift call corner buttons above a crowded control bar

Hampuse6dde557bb33
diff --git a/fluxer_app/src/features/voice/components/CompactVoiceCallView.module.css b/fluxer_app/src/features/voice/components/CompactVoiceCallView.module.css
index 4f381e916..b3678a0e2 100644
--- a/fluxer_app/src/features/voice/components/CompactVoiceCallView.module.css
+++ b/fluxer_app/src/features/voice/components/CompactVoiceCallView.module.css
@@ -138,7 +138,6 @@
calc(min(var(--compact-call-width, 640px), var(--compact-call-content-height, 320px)) * 0.18),
88px
);
- --avatar-voice-indicator-cutout-surface: #000;
--voice-participant-avatar-gap: clamp(8px, calc(var(--compact-call-height, 320px) * 0.024), 16px);
}
@@ -161,16 +160,16 @@
box-sizing: border-box;
align-items: center;
justify-content: center;
- padding-left: var(--voice-call-horizontal-padding);
- padding-right: var(--voice-call-horizontal-padding);
+ padding-inline-start: var(--voice-call-horizontal-padding);
+ padding-inline-end: var(--voice-call-horizontal-padding);
overflow-x: hidden;
overflow-y: hidden;
}
.layoutHostFullHeightGrid {
--voice-call-horizontal-padding: 0px;
- padding-left: 0;
- padding-right: 0;
+ padding-inline-start: 0;
+ padding-inline-end: 0;
padding-top: var(--compact-call-content-safe-top);
padding-bottom: var(--compact-call-content-safe-bottom);
}
@@ -178,14 +177,14 @@
.layoutHostFullHeightFocus {
--voice-call-horizontal-padding: 0px;
--voice-participants-toggle-bottom: calc(var(--compact-call-control-reserve) + 0.5rem);
- padding-left: 0;
- padding-right: 0;
+ padding-inline-start: 0;
+ padding-inline-end: 0;
}
.controlBarSection {
position: absolute;
- left: 0;
- right: 0;
+ inset-inline-start: 0;
+ inset-inline-end: 0;
bottom: 0;
display: flex;
justify-content: center;
@@ -208,6 +207,7 @@
position: absolute;
right: max(0.75rem, env(safe-area-inset-right, 0px));
bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
+ margin-bottom: var(--voice-call-corner-lift, 0px);
z-index: 13;
display: flex;
align-items: center;
@@ -219,6 +219,7 @@
position: absolute;
left: max(0.75rem, env(safe-area-inset-left, 0px));
bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
+ margin-bottom: var(--voice-call-corner-lift, 0px);
z-index: 13;
display: flex;
align-items: center;
@@ -294,7 +295,7 @@
.heightToggleUnreadBadge {
position: absolute;
top: -0.4rem;
- right: -0.4rem;
+ inset-inline-end: -0.4rem;
z-index: 2;
display: flex;
align-items: center;
@@ -315,8 +316,8 @@
.resizeHandle {
position: absolute;
- left: 0;
- right: 0;
+ inset-inline-start: 0;
+ inset-inline-end: 0;
bottom: 0;
height: 1rem;
display: flex;
diff --git a/fluxer_app/src/features/voice/components/VoiceCallCornerControls.tsx b/fluxer_app/src/features/voice/components/VoiceCallCornerControls.tsx
index ee34c5919..d5975cb95 100644
--- a/fluxer_app/src/features/voice/components/VoiceCallCornerControls.tsx
+++ b/fluxer_app/src/features/voice/components/VoiceCallCornerControls.tsx
@@ -52,7 +52,7 @@ export const VoiceCallCornerControls: React.FC<VoiceCallCornerControlsProps> = (
return BoldIcon;
}, []);
return (
- <div className={wrapClassName} data-flx="voice.voice-call-corner-controls.wrap">
+ <div className={wrapClassName} data-voice-call-corner data-flx="voice.voice-call-corner-controls.wrap">
{volumeControl}
{showPopout && onPopOut && (
<ChannelHeaderIcon
diff --git a/fluxer_app/src/features/voice/components/VoiceCallView.module.css b/fluxer_app/src/features/voice/components/VoiceCallView.module.css
index 096f0230c..1e25837e0 100644
--- a/fluxer_app/src/features/voice/components/VoiceCallView.module.css
+++ b/fluxer_app/src/features/voice/components/VoiceCallView.module.css
@@ -6,42 +6,22 @@
--voice-surface-2: #1c1c1e;
--voice-surface-3: #232326;
--voice-surface-4: #2a2a2d;
- --voice-surface-5: #353539;
- --voice-overlay-base: #000;
--voice-overlay-strong: rgba(0, 0, 0, 0.78);
--voice-overlay: rgba(0, 0, 0, 0.62);
--voice-overlay-soft: rgba(0, 0, 0, 0.46);
- --voice-overlay-subtle: rgba(0, 0, 0, 0.32);
--voice-overlay-light: rgba(255, 255, 255, 0.12);
--voice-overlay-light-strong: rgba(255, 255, 255, 0.2);
- --voice-overlay-light-bold: rgba(255, 255, 255, 0.48);
--voice-text-strong: #fff;
--voice-text-muted: rgba(255, 255, 255, 0.72);
- --voice-text-subtle: rgba(255, 255, 255, 0.52);
--voice-shadow-base: #000;
--voice-shadow-strong: color-mix(in srgb, var(--voice-shadow-base) 40%, transparent);
--voice-shadow-medium: color-mix(in srgb, var(--voice-shadow-base) 30%, transparent);
--voice-shadow-soft: color-mix(in srgb, var(--voice-shadow-base) 20%, transparent);
--voice-status-success: var(--status-online);
- --voice-status-success-bg: color-mix(in srgb, var(--voice-status-success) 20%, transparent);
- --voice-status-success-bg-solid: color-mix(in srgb, var(--voice-status-success) 20%, var(--voice-surface-2));
- --voice-status-success-bg-strong: color-mix(in srgb, var(--voice-status-success) 30%, transparent);
- --voice-status-success-bg-strong-solid: color-mix(in srgb, var(--voice-status-success) 30%, var(--voice-surface-2));
--voice-status-warning: var(--status-warning);
- --voice-status-warning-alt: var(--status-idle);
- --voice-status-caution: var(--alert-caution-color);
- --voice-status-warning-bg: color-mix(in srgb, var(--voice-status-warning-alt) 20%, transparent);
--voice-status-danger: var(--status-danger);
- --voice-status-danger-bg: color-mix(in srgb, var(--voice-status-danger) 20%, transparent);
- --voice-status-danger-bg-solid: color-mix(in srgb, var(--voice-status-danger) 20%, var(--voice-surface-2));
- --voice-status-danger-bg-strong: color-mix(in srgb, var(--voice-status-danger) 30%, transparent);
- --voice-status-danger-bg-strong-solid: color-mix(in srgb, var(--voice-status-danger) 30%, var(--voice-surface-2));
- --voice-hud-material-top: #000;
- --voice-hud-material-bottom: #000;
- --voice-hud-material-highlight: transparent;
--voice-hud-material-border: rgba(255, 255, 255, 0.1);
--voice-hud-material-shadow: 0 0.125rem 0.375rem rgba(0, 0, 0, 0.24);
- --voice-hud-material-blur: none;
--voice-hud-button-bg: #000;
--voice-hud-button-bg-hover: #111;
--voice-edge-gradient-extension: 2.5rem;
@@ -151,17 +131,17 @@
overflow: hidden;
white-space: nowrap;
max-width: var(--participant-metadata-max-width);
- margin-left: 0;
+ margin-inline-start: 0;
line-height: 1.2;
}
.participantName {
- margin-left: 0.1875rem;
+ margin-inline-start: 0.1875rem;
line-height: 1.2;
}
.participantConn {
- margin-left: 0;
+ margin-inline-start: 0;
line-height: 1.2;
}
@@ -194,7 +174,8 @@
justify-content: center;
width: 1.25rem;
height: 1.25rem;
- margin: -0.125rem 0.1875rem -0.125rem -0.1875rem;
+ margin-block: -0.125rem;
+ margin-inline: -0.1875rem 0.1875rem;
border-radius: 0.4375rem;
color: rgba(255, 255, 255, 0.78);
cursor: pointer;
@@ -225,7 +206,7 @@
.lkParticipantMetadataItem:first-child {
position: absolute;
- left: 0;
+ inset-inline-start: 0;
bottom: 0;
flex: 0 1 auto;
min-width: 0;
@@ -235,7 +216,7 @@
.tileControlPill {
position: absolute;
top: 0.375rem;
- left: 0.375rem;
+ inset-inline-start: 0.375rem;
display: inline-flex;
align-items: stretch;
height: 1.5rem;
@@ -272,7 +253,7 @@
}
.tileControlPillSlot + .tileControlPillSlot {
- border-left: 0.0625rem solid var(--voice-hud-material-border);
+ border-inline-start: 0.0625rem solid var(--voice-hud-material-border);
}
.tileControlPillSlot:hover {
@@ -489,8 +470,8 @@
.focusLayoutMembersRow {
position: absolute;
- left: 0;
- right: 0;
+ inset-inline-start: 0;
+ inset-inline-end: 0;
bottom: var(--voice-focus-members-row-bottom, 0px);
width: 100%;
height: var(--voice-focus-members-row-height, 7.25rem);
@@ -827,18 +808,11 @@
padding-bottom: 0;
}
-.focusLayoutContentAppFullscreen.focusLayoutContentFullscreenMembersVisible {
- --voice-focus-safe-bottom: calc(
- var(--voice-focus-members-row-height, 7.25rem) +
- var(--voice-focus-control-clearance)
- );
-}
-
.focusLayoutContentFullscreenMembersVisible::after {
content: '';
position: absolute;
- left: 0;
- right: 0;
+ inset-inline-start: 0;
+ inset-inline-end: 0;
bottom: 0;
height: calc(var(--voice-focus-members-row-bottom, 0px) + var(--voice-focus-members-row-height, 7.25rem) + 2.5rem);
z-index: 1;
@@ -971,12 +945,12 @@
.participantMetadataMenuButton {
width: 1.125rem;
height: 1.125rem;
- margin-right: 0.125rem;
+ margin-inline-end: 0.125rem;
}
.tileControlPill {
top: 0.3125rem;
- left: 0.3125rem;
+ inset-inline-start: 0.3125rem;
height: 1.375rem;
border-radius: 0.4375rem;
}
@@ -1023,8 +997,8 @@
.voiceEdgeFadeBottom::before {
content: '';
position: absolute;
- left: 0;
- right: 0;
+ inset-inline-start: 0;
+ inset-inline-end: 0;
background: var(--voice-edge-gradient);
pointer-events: none;
}
@@ -1086,8 +1060,8 @@
@media (max-width: 768px) {
.mainContent {
--voice-call-horizontal-padding: 1rem;
- padding-left: 1rem;
- padding-right: 1rem;
+ padding-inline-start: 1rem;
+ padding-inline-end: 1rem;
justify-content: flex-start;
align-items: stretch;
gap: 0.5rem;
@@ -1103,7 +1077,6 @@
}
.focusMiniGrid {
- --focus-mini-tile-size: clamp(var(--focus-mini-tile-min-width), 24vw, var(--focus-mini-tile-max-width));
--focus-mini-grid-gap: 0.5rem;
}
@@ -1137,7 +1110,7 @@
.fullscreenButtonWrap {
bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
- right: 1rem;
+ inset-inline-end: 1rem;
}
}
@@ -1163,8 +1136,6 @@
height: 100%;
width: 100%;
background-color: #000;
- --voice-focus-safe-top: 4rem;
- --voice-focus-safe-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}
.rootFocused .mainContent {
@@ -1190,8 +1161,8 @@
align-items: center;
gap: 0.5rem;
border-radius: 62.4375rem;
- padding-left: 0.75rem;
- padding-right: 0.75rem;
+ padding-inline-start: 0.75rem;
+ padding-inline-end: 0.75rem;
padding-top: 0.25rem;
padding-bottom: 0.25rem;
border: 0.0625rem solid color-mix(in srgb, currentColor 18%, transparent);
@@ -1259,8 +1230,8 @@
clamp(1.25rem, 3.5dvh, 2.25rem),
calc(var(--voice-edge-gradient-extension) + 0.5rem)
);
- padding-left: var(--voice-call-horizontal-padding);
- padding-right: var(--voice-call-horizontal-padding);
+ padding-inline-start: var(--voice-call-horizontal-padding);
+ padding-inline-end: var(--voice-call-horizontal-padding);
padding-top: var(--voice-call-safe-top-padding);
padding-bottom: var(--voice-call-safe-bottom-padding);
min-height: 0;
@@ -1295,7 +1266,6 @@
}
.audioAvatarFallbackList {
- --avatar-voice-indicator-cutout-surface: #000;
max-width: 56rem;
}
@@ -1321,17 +1291,18 @@
--voice-control-horizontal-padding: 1.5rem;
--voice-control-top-padding: 0.5rem;
--voice-control-bottom-padding: calc(0.75rem + env(safe-area-inset-bottom, 0px));
- padding-left: var(--voice-control-horizontal-padding);
- padding-right: var(--voice-control-horizontal-padding);
- padding-top: var(--voice-control-top-padding);
+ padding-inline-start: var(--voice-control-horizontal-padding);
+ padding-inline-end: var(--voice-control-horizontal-padding);
+ padding-top: calc(var(--voice-control-top-padding) + var(--voice-call-corner-lift, 0px));
padding-bottom: var(--voice-control-bottom-padding);
pointer-events: none;
}
.fullscreenButtonWrap {
position: absolute;
- right: clamp(1rem, 2vw, 2rem);
+ inset-inline-end: clamp(1rem, 2vw, 2rem);
bottom: calc(0.75rem + env(safe-area-inset-bottom, 0px));
+ margin-bottom: var(--voice-call-corner-lift, 0px);
z-index: 35;
display: flex;
align-items: center;
diff --git a/fluxer_app/src/features/voice/components/VoiceCallView.tsx b/fluxer_app/src/features/voice/components/VoiceCallView.tsx
index 0975169d1..071e30ef7 100644
--- a/fluxer_app/src/features/voice/components/VoiceCallView.tsx
+++ b/fluxer_app/src/features/voice/components/VoiceCallView.tsx
@@ -19,6 +19,7 @@ import {BottomSheet} from '@app/features/ui/bottom_sheet/BottomSheet';
import * as ToastCommands from '@app/features/ui/commands/ToastCommands';
import FocusRing from '@app/features/ui/focus_ring/FocusRing';
import {usePopout} from '@app/features/ui/hooks/usePopout';
+import {ArrowLeftIcon} from '@app/features/ui/icons/DirectionalIcons';
import {PortalHostContext} from '@app/features/ui/overlay/PortalHostContext';
import {Popout as PopoverPopout} from '@app/features/ui/popover/PopoverPopout';
import ContextMenu, {isContextMenuNodeTarget} from '@app/features/ui/state/ContextMenu';
@@ -43,6 +44,7 @@ import {
useVoiceCallAppFullscreen,
useVoiceCallFullscreenPortalHost,
} from '@app/features/voice/components/useVoiceCallAppFullscreen';
+import {useVoiceCallCornerLift} from '@app/features/voice/components/useVoiceCallCornerLift';
import {useVoiceCallTracksAndLayout} from '@app/features/voice/components/useVoiceCallTracksAndLayout';
import {useVoiceEngineConnectionState} from '@app/features/voice/components/useVoiceEngineConnectionState';
import {VoiceCallCornerControls} from '@app/features/voice/components/VoiceCallCornerControls';
@@ -78,15 +80,7 @@ import {
import {ME} from '@fluxer/constants/src/AppConstants';
import {msg, plural} from '@lingui/core/macro';
import {useLingui} from '@lingui/react/macro';
-import {
- ArrowLeftIcon,
- ChartBarIcon,
- CornersInIcon,
- CornersOutIcon,
- ListIcon,
- PhoneIcon,
- StarIcon,
-} from '@phosphor-icons/react';
+import {ChartBarIcon, CornersInIcon, CornersOutIcon, ListIcon, PhoneIcon, StarIcon} from '@phosphor-icons/react';
import {clsx} from 'clsx';
import {observer} from 'mobx-react-lite';
import type React from 'react';
@@ -179,6 +173,7 @@ const VoiceCallViewInner = observer(
exitFullscreen: exitVoiceCallAppFullscreen,
toggleFullscreen: toggleVoiceCallAppFullscreen,
} = useVoiceCallAppFullscreen({containerRef});
+ const cornerLift = useVoiceCallCornerLift(containerRef);
const [isPointerHudActive, setIsPointerHudActive] = useState(false);
const connectionState = useVoiceEngineConnectionState();
const normalizedConnectionState = asVoiceEngineConnectionState(connectionState);
@@ -452,6 +447,7 @@ const VoiceCallViewInner = observer(
isChromePinned && styles.contextMenuActive,
keyboardModeEnabled && styles.keyboardModeActive,
)}
+ style={{'--voice-call-corner-lift': `${cornerLift}px`} as React.CSSProperties}
onPointerEnter={handleVoiceRootPointerActivity}
onPointerMove={handleVoiceRootPointerActivity}
onPointerDown={handleVoiceRootPointerActivity}
@@ -652,7 +648,7 @@ const VoiceCallViewInner = observer(
<VoiceCallCornerControls
wrapClassName={clsx(styles.fullscreenButtonWrap, styles.voiceChrome)}
buttonClassName={styles.voiceHeaderIconButton}
- showPopout={!inPopout && isVoicePopoutSupported()}
+ showPopout={!inPopout && !isMobile && isVoicePopoutSupported()}
onPopOut={handlePopOutCall}
showFullscreen={!inPopout && supportsVoiceCallAppFullscreen}
isFullscreen={isVoiceCallAppFullscreen}
diff --git a/fluxer_app/src/features/voice/components/VoiceControlBar.tsx b/fluxer_app/src/features/voice/components/VoiceControlBar.tsx
index 1fa58958e..35cb015a5 100644
--- a/fluxer_app/src/features/voice/components/VoiceControlBar.tsx
+++ b/fluxer_app/src/features/voice/components/VoiceControlBar.tsx
@@ -641,7 +641,11 @@ const VoiceControlBarInner = observer(function VoiceControlBarInner() {
const cameraSettingsLabel = i18n._(VOICE_CAMERA_SETTINGS_DESCRIPTOR);
const screenShareSettingsLabel = i18n._(VOICE_SCREEN_SHARE_SETTINGS_DESCRIPTOR);
return (
- <div className={styles.container} data-flx="voice.voice-control-bar.voice-control-bar-inner.container">
+ <div
+ className={styles.container}
+ data-voice-call-control-bar
+ data-flx="voice.voice-control-bar.voice-control-bar-inner.container"
+ >
<div
className={styles.buttonContainer}
data-flx="voice.voice-control-bar.voice-control-bar-inner.button-container"
diff --git a/fluxer_app/src/features/voice/components/compact_voice_call_view/CompactCallHeightToggleButton.tsx b/fluxer_app/src/features/voice/components/compact_voice_call_view/CompactCallHeightToggleButton.tsx
index 02de16e0d..38732c76c 100644
--- a/fluxer_app/src/features/voice/components/compact_voice_call_view/CompactCallHeightToggleButton.tsx
+++ b/fluxer_app/src/features/voice/components/compact_voice_call_view/CompactCallHeightToggleButton.tsx
@@ -55,6 +55,7 @@ export const CompactCallHeightToggleButton: React.FC<{
return (
<div
className={clsx(styles.heightToggleButtonWrap, voiceCallStyles.voiceChrome)}
+ data-voice-call-corner
data-flx="voice.compact-voice-call-view.compact-call-height-toggle-button.height-toggle-button-wrap"
>
<div
diff --git a/fluxer_app/src/features/voice/components/compact_voice_call_view/CompactVoiceCallViewInner.tsx b/fluxer_app/src/features/voice/components/compact_voice_call_view/CompactVoiceCallViewInner.tsx
index 743448dcb..6fde3d316 100644
--- a/fluxer_app/src/features/voice/components/compact_voice_call_view/CompactVoiceCallViewInner.tsx
+++ b/fluxer_app/src/features/voice/components/compact_voice_call_view/CompactVoiceCallViewInner.tsx
@@ -32,6 +32,7 @@ import {
} from '@app/features/voice/components/popout/PoppedOutSurfaceStateMachine';
import {usePoppedOutTransition} from '@app/features/voice/components/popout/usePoppedOutTransition';
import {useVoiceCallAppFullscreen} from '@app/features/voice/components/useVoiceCallAppFullscreen';
+import {useVoiceCallCornerLift} from '@app/features/voice/components/useVoiceCallCornerLift';
import {useVoiceCallTracksAndLayout} from '@app/features/voice/components/useVoiceCallTracksAndLayout';
import {useVoiceEngineConnectionState} from '@app/features/voice/components/useVoiceEngineConnectionState';
import {VoiceCallCornerControls} from '@app/features/voice/components/VoiceCallCornerControls';
@@ -97,6 +98,7 @@ export const CompactVoiceCallViewInner: React.FC<CompactVoiceCallViewProps> = ob
exitFullscreen: exitVoiceCallAppFullscreen,
toggleFullscreen: toggleVoiceCallAppFullscreen,
} = useVoiceCallAppFullscreen({containerRef});
+ const cornerLift = useVoiceCallCornerLift(containerRef);
const [expandedUserIds, setExpandedUserIds] = useState<Set<string>>(() => new Set());
const handleExpandUser = useCallback((userId: string) => {
setExpandedUserIds((previous) => {
@@ -340,10 +342,11 @@ export const CompactVoiceCallViewInner: React.FC<CompactVoiceCallViewProps> = ob
const measuredWidth = compactCallMetrics?.width ?? 0;
const measuredHeight = compactCallMetrics?.height ?? 0;
const measuredContentHeight = compactCallMetrics?.contentHeight ?? 0;
- const measuredControlBarHeight = compactCallMetrics?.controlBarHeight ?? 0;
+ const measuredControlBarHeight = (compactCallMetrics?.controlBarHeight ?? 0) + cornerLift;
const compactCallHeight = isResizable && compactHeight != null ? compactHeight : measuredHeight;
const nextStyle: CompactVoiceCallContainerStyle = {
'--compact-call-participant-count': `${participantCount}`,
+ '--voice-call-corner-lift': `${cornerLift}px`,
};
if (measuredWidth > 0) {
nextStyle['--compact-call-width'] = `${Math.round(measuredWidth)}px`;
@@ -380,6 +383,7 @@ export const CompactVoiceCallViewInner: React.FC<CompactVoiceCallViewProps> = ob
compactCallMetrics?.width,
compactHeight,
compactHeightMin,
+ cornerLift,
hasControlBar,
isResizable,
maxHeight,
@@ -500,7 +504,8 @@ export const CompactVoiceCallViewInner: React.FC<CompactVoiceCallViewProps> = ob
data-audio-only={shouldShowAvatarFallback ? 'true' : undefined}
data-flx="voice.compact-voice-call-view.compact-voice-call-view-inner.content-area"
>
- {shouldRenderCallLayout ? layoutNode : shouldShowAvatarFallback ? avatarFallbackNode : null}
+ {shouldRenderCallLayout ? layoutNode : null}
+ {!shouldRenderCallLayout && shouldShowAvatarFallback ? avatarFallbackNode : null}
</div>
{controlBarNode}
<CompactCallHeightToggleButton
@@ -510,7 +515,7 @@ export const CompactVoiceCallViewInner: React.FC<CompactVoiceCallViewProps> = ob
/>
<VoiceCallCornerControls
wrapClassName={clsx(styles.fullscreenButtonWrap, voiceCallStyles.voiceChrome)}
- showPopout={isVoicePopoutSupported()}
+ showPopout={!isMobile && isVoicePopoutSupported()}
onPopOut={handlePopOutCall}
showFullscreen={supportsVoiceCallAppFullscreen}
isFullscreen={isVoiceCallAppFullscreen}
diff --git a/fluxer_app/src/features/voice/components/compact_voice_call_view/shared.ts b/fluxer_app/src/features/voice/components/compact_voice_call_view/shared.ts
index e2e08cdda..9eca03f72 100644
--- a/fluxer_app/src/features/voice/components/compact_voice_call_view/shared.ts
+++ b/fluxer_app/src/features/voice/components/compact_voice_call_view/shared.ts
@@ -68,6 +68,7 @@ export interface CompactVoiceCallContainerStyle extends React.CSSProperties {
'--compact-call-audio-avatar-padding-bottom'?: string;
'--compact-call-edge-gradient-extension'?: string;
'--compact-call-participant-count'?: string;
+ '--voice-call-corner-lift'?: string;
}
export const COMPACT_HEIGHT_DRAG_THRESHOLD_SQ = 9;
diff --git a/fluxer_app/src/features/voice/components/useVoiceCallCornerLift.ts b/fluxer_app/src/features/voice/components/useVoiceCallCornerLift.ts
new file mode 100644
index 000000000..c2c088fe7
--- /dev/null
+++ b/fluxer_app/src/features/voice/components/useVoiceCallCornerLift.ts
@@ -0,0 +1,72 @@
+// SPDX-License-Identifier: AGPL-3.0-or-later
+
+import {appZoomLayoutPx} from '@app/features/ui/utils/AppZoomUtils';
+import type React from 'react';
+import {useLayoutEffect, useState} from 'react';
+
+const CORNER_GAP_PX = 4;
+const CORNER_STACK_GAP_PX = 8;
+
+interface HorizontalRect {
+ left: number;
+ right: number;
+ width: number;
+ height: number;
+}
+
+function getVoiceCallCornerLift(bar: HorizontalRect | null, corners: ReadonlyArray<HorizontalRect>): number {
+ if (!bar || bar.width === 0) return 0;
+ const crowded = corners.some(
+ (corner) => corner.width > 0 && corner.left < bar.right + CORNER_GAP_PX && bar.left - CORNER_GAP_PX < corner.right,
+ );
+ return crowded ? Math.ceil(appZoomLayoutPx(bar.height + CORNER_STACK_GAP_PX)) : 0;
+}
+
+export function useVoiceCallCornerLift(rootRef: React.RefObject<HTMLElement | null>): number {
+ const [lift, setLift] = useState(0);
+ useLayoutEffect(() => {
+ const root = rootRef.current;
+ if (!root || typeof ResizeObserver === 'undefined') return;
+ const ownedBy = (element: Element) => element.closest('[data-voice-call-root]') === root;
+ const observed = new Set<Element>();
+ let frame: number | null = null;
+ const measure = () => {
+ frame = null;
+ const bar = Array.from(root.querySelectorAll('[data-voice-call-control-bar]')).find(ownedBy) ?? null;
+ const corners = Array.from(root.querySelectorAll('[data-voice-call-corner]')).filter(ownedBy);
+ const targets = new Set<Element>(bar ? [bar, ...corners] : corners);
+ for (const element of observed) {
+ if (!targets.has(element)) {
+ resizeObserver.unobserve(element);
+ observed.delete(element);
+ }
+ }
+ for (const element of targets) {
+ if (!observed.has(element)) {
+ resizeObserver.observe(element);
+ observed.add(element);
+ }
+ }
+ setLift(
+ getVoiceCallCornerLift(
+ bar?.getBoundingClientRect() ?? null,
+ corners.map((corner) => corner.getBoundingClientRect()),
+ ),
+ );
+ };
+ const schedule = () => {
+ if (frame == null) frame = requestAnimationFrame(measure);
+ };
+ const resizeObserver = new ResizeObserver(schedule);
+ const mutationObserver = new MutationObserver(schedule);
+ resizeObserver.observe(root);
+ mutationObserver.observe(root, {childList: true, subtree: true});
+ measure();
+ return () => {
+ if (frame != null) cancelAnimationFrame(frame);
+ resizeObserver.disconnect();
+ mutationObserver.disconnect();
+ };
+ }, [rootRef]);
+ return lift;
+}