This commit is contained in:
Half-Shot
2024-12-09 16:44:28 +00:00
parent de19565c4f
commit ed35049eb3
4 changed files with 15 additions and 9 deletions

View File

@@ -24,14 +24,14 @@ import {
import { useTranslation } from "react-i18next";
import { logger } from "matrix-js-sdk/src/logger";
import classNames from "classnames";
import { useObservableState } from "observable-hooks";
import { map } from "rxjs";
import { useReactions } from "../useReactions";
import styles from "./ReactionToggleButton.module.css";
import { ReactionOption, ReactionSet, ReactionsRowSize } from "../reactions";
import { Modal } from "../Modal";
import { CallViewModel } from "../state/CallViewModel";
import { useObservableState } from "observable-hooks";
import { map } from "rxjs";
interface InnerButtonProps extends ComponentPropsWithoutRef<"button"> {
raised: boolean;

View File

@@ -6,9 +6,10 @@ Please see LICENSE in the repository root for full details.
*/
import { ReactNode } from "react";
import { useObservableState } from "observable-hooks";
import styles from "./ReactionsOverlay.module.css";
import { CallViewModel } from "../state/CallViewModel";
import { useObservableState } from "observable-hooks";
export function ReactionsOverlay({ vm }: { vm: CallViewModel }): ReactNode {
const reactionsIcons = useObservableState(vm.visibleReactions);

View File

@@ -1117,12 +1117,17 @@ export class CallViewModel extends ViewModel {
this.scope.state(),
);
public readonly handsRaised = new Subject<Record<string, Date>>();
public readonly reactions = new Subject<Record<string, ReactionOption>>();
private readonly handsRaisedSubject = new Subject<Record<string, Date>>();
private readonly reactionsSubject = new Subject<
Record<string, ReactionOption>
>();
public updateReactions(data: ReturnType<typeof useReactions>) {
this.handsRaised.next(data.raisedHands);
this.reactions.next(data.reactions);
public readonly handRaised = this.handsRaisedSubject.asObservable();
public readonly reactions = this.reactionsSubject.asObservable();
public updateReactions(data: ReturnType<typeof useReactions>): void {
this.handsRaisedSubject.next(data.raisedHands);
this.reactionsSubject.next(data.reactions);
}
/**

View File

@@ -108,7 +108,7 @@ export const ReactionsProvider = ({
memberships.find(
(m) => m.sender === myUserId && m.deviceId === myDeviceId,
)?.eventId,
[memberships, myUserId],
[memberships, myUserId, myDeviceId],
);
const myMembershipIdentifier = useMemo(() => {
const membership = memberships.find((m) => m.sender === myUserId);