From a4959f43d2882cf42bdd06385657e0f11db7c55a Mon Sep 17 00:00:00 2001 From: Swapnil Raj Date: Sat, 18 Jul 2020 17:56:53 +0530 Subject: [PATCH] Convert GroupHeaderButtons to TS Fix typo in SetRightPanelPhasePayload --- .../{GroupHeaderButtons.js => GroupHeaderButtons.tsx} | 11 +++++++---- src/dispatcher/payloads/SetRightPanelPhasePayload.ts | 2 +- 2 files changed, 8 insertions(+), 5 deletions(-) rename src/components/views/right_panel/{GroupHeaderButtons.js => GroupHeaderButtons.tsx} (93%) diff --git a/src/components/views/right_panel/GroupHeaderButtons.js b/src/components/views/right_panel/GroupHeaderButtons.tsx similarity index 93% rename from src/components/views/right_panel/GroupHeaderButtons.js rename to src/components/views/right_panel/GroupHeaderButtons.tsx index fb589b1a0f..7bd6d90038 100644 --- a/src/components/views/right_panel/GroupHeaderButtons.js +++ b/src/components/views/right_panel/GroupHeaderButtons.tsx @@ -25,6 +25,7 @@ import HeaderButtons, {HeaderKind} from './HeaderButtons'; import {RightPanelPhases} from "../../../stores/RightPanelStorePhases"; import {Action} from "../../../dispatcher/actions"; import {ActionPayload} from "../../../dispatcher/payloads"; +import {ViewUserPayload} from "../../../dispatcher/payloads/ViewUserPayload"; const GROUP_PHASES = [ RightPanelPhases.GroupMemberInfo, @@ -35,8 +36,10 @@ const ROOM_PHASES = [ RightPanelPhases.GroupRoomInfo, ]; +interface IProps {} + export default class GroupHeaderButtons extends HeaderButtons { - constructor(props) { + constructor(props: IProps) { super(props, HeaderKind.Group); this._onMembersClicked = this._onMembersClicked.bind(this); this._onRoomsClicked = this._onRoomsClicked.bind(this); @@ -46,8 +49,8 @@ export default class GroupHeaderButtons extends HeaderButtons { super.onAction(payload); if (payload.action === Action.ViewUser) { - if (payload.member) { - this.setPhase(RightPanelPhases.RoomMemberInfo, {member: payload.member}); + if ((payload as ViewUserPayload).member) { + this.setPhase(RightPanelPhases.RoomMemberInfo, {members: payload.member}); } else { this.setPhase(RightPanelPhases.GroupMemberList); } @@ -63,7 +66,7 @@ export default class GroupHeaderButtons extends HeaderButtons { } else if (payload.action === "view_group_member_list") { this.setPhase(RightPanelPhases.GroupMemberList); } else if (payload.action === "view_group_user") { - this.setPhase(RightPanelPhases.GroupMemberInfo, {member: payload.member}); + this.setPhase(RightPanelPhases.GroupMemberInfo, {members: payload.member}); } } diff --git a/src/dispatcher/payloads/SetRightPanelPhasePayload.ts b/src/dispatcher/payloads/SetRightPanelPhasePayload.ts index 94e38b7ce6..4b360d294a 100644 --- a/src/dispatcher/payloads/SetRightPanelPhasePayload.ts +++ b/src/dispatcher/payloads/SetRightPanelPhasePayload.ts @@ -31,7 +31,7 @@ export interface SetRightPanelPhaseRefireParams { // No appropriate types exist yet for the fields members?: any; verificationRequest?: typeof VerificationRequest; - groudId?: string; + groupId?: string; groupRoomId?: string; // XXX: 'view_3pid_invite' action's payload event?: any;