Convert GroupHeaderButtons to TS

Fix typo in SetRightPanelPhasePayload
This commit is contained in:
Swapnil Raj 2020-07-18 17:56:53 +05:30
parent 887d507772
commit a4959f43d2
2 changed files with 8 additions and 5 deletions

View file

@ -25,6 +25,7 @@ import HeaderButtons, {HeaderKind} from './HeaderButtons';
import {RightPanelPhases} from "../../../stores/RightPanelStorePhases"; import {RightPanelPhases} from "../../../stores/RightPanelStorePhases";
import {Action} from "../../../dispatcher/actions"; import {Action} from "../../../dispatcher/actions";
import {ActionPayload} from "../../../dispatcher/payloads"; import {ActionPayload} from "../../../dispatcher/payloads";
import {ViewUserPayload} from "../../../dispatcher/payloads/ViewUserPayload";
const GROUP_PHASES = [ const GROUP_PHASES = [
RightPanelPhases.GroupMemberInfo, RightPanelPhases.GroupMemberInfo,
@ -35,8 +36,10 @@ const ROOM_PHASES = [
RightPanelPhases.GroupRoomInfo, RightPanelPhases.GroupRoomInfo,
]; ];
interface IProps {}
export default class GroupHeaderButtons extends HeaderButtons { export default class GroupHeaderButtons extends HeaderButtons {
constructor(props) { constructor(props: IProps) {
super(props, HeaderKind.Group); super(props, HeaderKind.Group);
this._onMembersClicked = this._onMembersClicked.bind(this); this._onMembersClicked = this._onMembersClicked.bind(this);
this._onRoomsClicked = this._onRoomsClicked.bind(this); this._onRoomsClicked = this._onRoomsClicked.bind(this);
@ -46,8 +49,8 @@ export default class GroupHeaderButtons extends HeaderButtons {
super.onAction(payload); super.onAction(payload);
if (payload.action === Action.ViewUser) { if (payload.action === Action.ViewUser) {
if (payload.member) { if ((payload as ViewUserPayload).member) {
this.setPhase(RightPanelPhases.RoomMemberInfo, {member: payload.member}); this.setPhase(RightPanelPhases.RoomMemberInfo, {members: payload.member});
} else { } else {
this.setPhase(RightPanelPhases.GroupMemberList); this.setPhase(RightPanelPhases.GroupMemberList);
} }
@ -63,7 +66,7 @@ export default class GroupHeaderButtons extends HeaderButtons {
} else if (payload.action === "view_group_member_list") { } else if (payload.action === "view_group_member_list") {
this.setPhase(RightPanelPhases.GroupMemberList); this.setPhase(RightPanelPhases.GroupMemberList);
} else if (payload.action === "view_group_user") { } else if (payload.action === "view_group_user") {
this.setPhase(RightPanelPhases.GroupMemberInfo, {member: payload.member}); this.setPhase(RightPanelPhases.GroupMemberInfo, {members: payload.member});
} }
} }

View file

@ -31,7 +31,7 @@ export interface SetRightPanelPhaseRefireParams {
// No appropriate types exist yet for the fields // No appropriate types exist yet for the fields
members?: any; members?: any;
verificationRequest?: typeof VerificationRequest; verificationRequest?: typeof VerificationRequest;
groudId?: string; groupId?: string;
groupRoomId?: string; groupRoomId?: string;
// XXX: 'view_3pid_invite' action's payload // XXX: 'view_3pid_invite' action's payload
event?: any; event?: any;