Right panel store refactor (#7313)

Co-authored-by: J. Ryan Stinnett <jryans@gmail.com>
This commit is contained in:
Timo 2022-01-05 16:14:44 +01:00 committed by GitHub
parent 8e881336ab
commit 325e2ba99b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
42 changed files with 765 additions and 811 deletions

View file

@ -15,31 +15,26 @@ limitations under the License.
*/
import { MatrixEvent } from "matrix-js-sdk/src/models/event";
import { RightPanelPhases } from "../../stores/RightPanelStorePhases";
import { Action } from "../actions";
import dis from '../dispatcher';
import { SetRightPanelPhasePayload } from "../payloads/SetRightPanelPhasePayload";
import RightPanelStore from "../../stores/right-panel/RightPanelStore";
import { RightPanelPhases } from "../../stores/right-panel/RightPanelStorePhases";
export const dispatchShowThreadEvent = (
rootEvent: MatrixEvent,
initialEvent?: MatrixEvent,
highlighted?: boolean,
) => {
dis.dispatch({
action: Action.SetRightPanelPhase,
// TODO RightPanelStore (will be addressed in a follow up PR): this should really be a push!
RightPanelStore.instance.setCard({
phase: RightPanelPhases.ThreadView,
refireParams: {
event: rootEvent,
state: {
threadHeadEvent: rootEvent,
initialEvent,
highlighted,
isInitialEventHighlighted: highlighted,
},
});
};
export const dispatchShowThreadsPanelEvent = () => {
dis.dispatch<SetRightPanelPhasePayload>({
action: Action.SetRightPanelPhase,
phase: RightPanelPhases.ThreadPanel,
});
RightPanelStore.instance.setCard({ phase: RightPanelPhases.ThreadPanel });
};