mirror of
https://github.com/oxen-io/session-desktop.git
synced 2023-12-14 02:12:57 +01:00
show draggable call container when opening settings from call convo
This commit is contained in:
parent
8d83d99b26
commit
332d58027f
3 changed files with 9 additions and 47 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue