History based navigation with new right panel store (#7398)

Co-authored-by: J. Ryan Stinnett <jryans@gmail.com>
This commit is contained in:
Timo 2022-01-05 17:25:41 +01:00 committed by GitHub
parent 6f89267a31
commit 4ab3470184
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 248 additions and 252 deletions

View file

@ -51,10 +51,11 @@ export default class MKeyVerificationRequest extends React.Component<IProps> {
private openRequest = () => {
const { verificationRequest } = this.props.mxEvent;
const member = MatrixClientPeg.get().getUser(verificationRequest.otherUserId);
RightPanelStore.instance.setCard({
phase: RightPanelPhases.EncryptionPanel,
state: { verificationRequest, member },
});
RightPanelStore.instance.setCards([
{ phase: RightPanelPhases.RoomSummary },
{ phase: RightPanelPhases.RoomMemberInfo, state: { member } },
{ phase: RightPanelPhases.EncryptionPanel, state: { verificationRequest, member } },
]);
};
private onRequestChanged = () => {

View file

@ -39,8 +39,9 @@ import DownloadActionButton from "./DownloadActionButton";
import SettingsStore from '../../../settings/SettingsStore';
import { RoomPermalinkCreator } from '../../../utils/permalinks/Permalinks';
import ReplyChain from '../elements/ReplyChain';
import { dispatchShowThreadEvent } from '../../../dispatcher/dispatch-actions/threads';
import { showThread } from '../../../dispatcher/dispatch-actions/threads';
import ReactionPicker from "../emojipicker/ReactionPicker";
import { CardContext } from '../right_panel/BaseCard';
interface IOptionsButtonProps {
mxEvent: MatrixEvent;
@ -219,8 +220,8 @@ export default class MessageActionBar extends React.PureComponent<IMessageAction
});
};
private onThreadClick = (): void => {
dispatchShowThreadEvent(this.props.mxEvent);
private onThreadClick = (isCard: boolean): void => {
showThread({ rootEvent: this.props.mxEvent, push: isCard });
dis.dispatch({
action: Action.FocusSendMessageComposer,
context: TimelineRenderingType.Thread,
@ -303,6 +304,17 @@ export default class MessageActionBar extends React.PureComponent<IMessageAction
key="cancel"
/>;
const threadTooltipButton = <CardContext.Consumer>
{ context =>
<RovingAccessibleTooltipButton
className="mx_MessageActionBar_maskButton mx_MessageActionBar_threadButton"
title={_t("Reply in thread")}
onClick={this.onThreadClick.bind(null, context.isCard)}
key="thread"
/>
}
</CardContext.Consumer>;
// We show a different toolbar for failed events, so detect that first.
const mxEvent = this.props.mxEvent;
const editStatus = mxEvent.replacingEvent() && mxEvent.replacingEvent().status;
@ -335,12 +347,7 @@ export default class MessageActionBar extends React.PureComponent<IMessageAction
key="reply"
/>
{ (this.showReplyInThreadAction) && (
<RovingAccessibleTooltipButton
className="mx_MessageActionBar_maskButton mx_MessageActionBar_threadButton"
title={_t("Reply in thread")}
onClick={this.onThreadClick}
key="thread"
/>
threadTooltipButton
) }
</>);
}
@ -368,12 +375,7 @@ export default class MessageActionBar extends React.PureComponent<IMessageAction
this.props.mxEvent.getThread() &&
!isContentActionable(this.props.mxEvent)
) {
toolbarOpts.unshift(<RovingAccessibleTooltipButton
className="mx_MessageActionBar_maskButton mx_MessageActionBar_threadButton"
title={_t("Reply in thread")}
onClick={this.onThreadClick}
key="thread"
/>);
toolbarOpts.unshift(threadTooltipButton);
}
if (allowCancel) {