show draggable call container when opening settings from call convo

This commit is contained in:
Audric Ackermann 2022-04-06 13:41:04 +10:00
parent 8d83d99b26
commit 332d58027f
No known key found for this signature in database
GPG key ID: 999F434D76324AD4
3 changed files with 9 additions and 47 deletions

View file

@ -9,6 +9,8 @@ import { openConversationWithMessages } from '../../state/ducks/conversations';
import { Avatar, AvatarSize } from '../avatar/Avatar';
import { useVideoCallEventsListener } from '../../hooks/useVideoEventListener';
import { VideoLoadingSpinner } from './InConversationCallContainer';
import { getSection } from '../../state/selectors/section';
import { SectionType } from '../../state/ducks/section';
export const DraggableCallWindow = styled.div`
position: absolute;
@ -57,6 +59,7 @@ export const DraggableCallContainer = () => {
const ongoingCallProps = useSelector(getHasOngoingCallWith);
const selectedConversationKey = useSelector(getSelectedConversationKey);
const hasOngoingCall = useSelector(getHasOngoingCall);
const selectedSection = useSelector(getSection);
// the draggable container has a width of 12vw, so we just set it's X to a bit more than this
const [positionX, setPositionX] = useState(window.innerWidth - (window.innerWidth * 1) / 6);
@ -99,7 +102,12 @@ export const DraggableCallContainer = () => {
}
};
if (!hasOngoingCall || !ongoingCallProps || ongoingCallPubkey === selectedConversationKey) {
if (
!hasOngoingCall ||
!ongoingCallProps ||
(ongoingCallPubkey === selectedConversationKey &&
selectedSection.focusedSection !== SectionType.Settings)
) {
return null;
}

View file

@ -1,45 +0,0 @@
// Code from https://github.com/andywer/typed-emitter
type Arguments<T> = [T] extends [(...args: infer U) => any] ? U : [T] extends [void] ? [] : [T];
/**
* Type-safe event emitter.
*
* Use it like this:
*
* interface MyEvents {
* error: (error: Error) => void
* message: (from: string, content: string) => void
* }
*
* const myEmitter = new EventEmitter() as TypedEmitter<MyEvents>
*
* myEmitter.on("message", (from, content) => {
* // ...
* })
*
* myEmitter.emit("error", "x") // <- Will catch this type error
*
* or
*
* class MyEmitter extends EventEmitter implements TypedEventEmitter<MyEvents>
*/
export interface TypedEventEmitter<Events> {
addListener<E extends keyof Events>(event: E, listener: Events[E]): this;
on<E extends keyof Events>(event: E, listener: Events[E]): this;
once<E extends keyof Events>(event: E, listener: Events[E]): this;
prependListener<E extends keyof Events>(event: E, listener: Events[E]): this;
prependOnceListener<E extends keyof Events>(event: E, listener: Events[E]): this;
off<E extends keyof Events>(event: E, listener: Events[E]): this;
removeAllListeners<E extends keyof Events>(event?: E): this;
removeListener<E extends keyof Events>(event: E, listener: Events[E]): this;
emit<E extends keyof Events>(event: E, ...args: Arguments<Events[E]>): boolean;
eventNames(): Array<keyof Events | string | symbol>;
listeners<E extends keyof Events>(event: E): Array<Function>;
listenerCount<E extends keyof Events>(event: E): number;
getMaxListeners(): number;
setMaxListeners(maxListeners: number): this;
}

View file

@ -10,7 +10,6 @@ import * as AttachmentDownloads from './AttachmentsDownload';
import * as CallManager from './calling/CallManager';
export * from './Attachments';
export * from './TypedEmitter';
export * from './JobQueue';
export {