Fix right panel data flow (#7811)
This commit is contained in:
parent
78524bddce
commit
0dc1355441
14 changed files with 254 additions and 74 deletions
|
@ -123,7 +123,7 @@ const EncryptionPanel: React.FC<IProps> = (props: IProps) => {
|
|||
state: { member, verificationRequest: verificationRequest_ },
|
||||
});
|
||||
}
|
||||
if (!RightPanelStore.instance.isOpenForRoom) RightPanelStore.instance.togglePanel();
|
||||
if (!RightPanelStore.instance.isOpen) RightPanelStore.instance.togglePanel();
|
||||
}, [member]);
|
||||
|
||||
const requested =
|
||||
|
|
|
@ -72,16 +72,16 @@ export default abstract class HeaderButtons<P = {}> extends React.Component<IPro
|
|||
|
||||
public setPhase(phase: RightPanelPhases, cardState?: Partial<IRightPanelCardState>) {
|
||||
const rps = RightPanelStore.instance;
|
||||
if (rps.currentCard.phase == phase && !cardState && rps.isOpenForRoom) {
|
||||
if (rps.currentCard.phase == phase && !cardState && rps.isOpen) {
|
||||
rps.togglePanel();
|
||||
} else {
|
||||
RightPanelStore.instance.setCard({ phase, state: cardState });
|
||||
if (!rps.isOpenForRoom) rps.togglePanel();
|
||||
if (!rps.isOpen) rps.togglePanel();
|
||||
}
|
||||
}
|
||||
|
||||
public isPhase(phases: string | string[]): boolean {
|
||||
if (!RightPanelStore.instance.isOpenForRoom) return false;
|
||||
if (!RightPanelStore.instance.isOpen) return false;
|
||||
if (Array.isArray(phases)) {
|
||||
return phases.includes(this.state.phase);
|
||||
} else {
|
||||
|
|
|
@ -40,19 +40,19 @@ const WidgetCard: React.FC<IProps> = ({ room, widgetId, onClose }) => {
|
|||
|
||||
const apps = useWidgets(room);
|
||||
const app = apps.find(a => a.id === widgetId);
|
||||
const isPinned = app && WidgetLayoutStore.instance.isInContainer(room, app, Container.Top);
|
||||
const isRight = app && WidgetLayoutStore.instance.isInContainer(room, app, Container.Right);
|
||||
|
||||
const [menuDisplayed, handle, openMenu, closeMenu] = useContextMenu();
|
||||
|
||||
useEffect(() => {
|
||||
if (!app || isPinned) {
|
||||
if (!app || !isRight) {
|
||||
// stop showing this card
|
||||
RightPanelStore.instance.popCard();
|
||||
}
|
||||
}, [app, isPinned]);
|
||||
}, [app, isRight]);
|
||||
|
||||
// Don't render anything as we are about to transition
|
||||
if (!app || isPinned) return null;
|
||||
if (!app || !isRight) return null;
|
||||
|
||||
let contextMenu;
|
||||
if (menuDisplayed) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue