2018-10-30 19:15:19 +03:00
|
|
|
/*
|
|
|
|
Copyright 2015, 2016 OpenMarket Ltd
|
|
|
|
Copyright 2017 Vector Creations Ltd
|
|
|
|
Copyright 2017 New Vector Ltd
|
|
|
|
Copyright 2018 New Vector Ltd
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import React from 'react';
|
|
|
|
import { _t } from '../../../languageHandler';
|
|
|
|
import dis from '../../../dispatcher';
|
|
|
|
import HeaderButton from './HeaderButton';
|
|
|
|
import HeaderButtons from './HeaderButtons';
|
|
|
|
import RightPanel from '../../structures/RightPanel';
|
|
|
|
|
|
|
|
export default class RoomHeaderButtons extends HeaderButtons {
|
|
|
|
constructor(props) {
|
|
|
|
super(props, RightPanel.Phase.RoomMemberList);
|
|
|
|
}
|
|
|
|
|
|
|
|
onAction(payload) {
|
|
|
|
super.onAction(payload);
|
|
|
|
if (payload.action === "view_user") {
|
|
|
|
dis.dispatch({
|
|
|
|
action: 'show_right_panel',
|
|
|
|
});
|
|
|
|
if (payload.member) {
|
|
|
|
this.setPhase(RightPanel.Phase.RoomMemberInfo, {member: payload.member});
|
|
|
|
} else {
|
|
|
|
this.setPhase(RightPanel.Phase.RoomMemberList);
|
|
|
|
}
|
|
|
|
} else if (payload.action === "view_room") {
|
|
|
|
this.setPhase(RightPanel.Phase.RoomMemberList);
|
2019-03-29 05:38:15 +03:00
|
|
|
} else if (payload.action === "view_3pid_invite") {
|
|
|
|
if (payload.event) {
|
|
|
|
this.setPhase(RightPanel.Phase.Room3pidMemberInfo, {event: payload.event});
|
|
|
|
} else {
|
|
|
|
this.setPhase(RightPanel.Phase.RoomMemberList);
|
|
|
|
}
|
2018-10-30 19:15:19 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
renderButtons() {
|
2018-12-18 17:36:54 +03:00
|
|
|
const membersPhases = [
|
2018-10-30 19:15:19 +03:00
|
|
|
RightPanel.Phase.RoomMemberList,
|
|
|
|
RightPanel.Phase.RoomMemberInfo,
|
2019-03-29 05:38:15 +03:00
|
|
|
RightPanel.Phase.Room3pidMemberInfo,
|
2018-12-18 17:36:54 +03:00
|
|
|
];
|
2018-10-30 19:15:19 +03:00
|
|
|
|
|
|
|
return [
|
2019-02-12 20:31:47 +03:00
|
|
|
<HeaderButton key="membersButton" name="membersButton"
|
|
|
|
title={_t('Members')}
|
2018-12-18 17:36:54 +03:00
|
|
|
isHighlighted={this.isPhase(membersPhases)}
|
2019-04-10 14:21:07 +03:00
|
|
|
onClick={() => this.togglePhase(RightPanel.Phase.RoomMemberList)}
|
2018-10-30 19:15:19 +03:00
|
|
|
analytics={['Right Panel', 'Member List Button', 'click']}
|
|
|
|
/>,
|
2019-02-12 20:31:47 +03:00
|
|
|
<HeaderButton key="filesButton" name="filesButton"
|
|
|
|
title={_t('Files')}
|
2018-12-18 17:36:54 +03:00
|
|
|
isHighlighted={this.isPhase(RightPanel.Phase.FilePanel)}
|
2019-04-10 14:21:07 +03:00
|
|
|
onClick={() => this.togglePhase(RightPanel.Phase.FilePanel)}
|
2018-10-30 19:15:19 +03:00
|
|
|
analytics={['Right Panel', 'File List Button', 'click']}
|
|
|
|
/>,
|
2019-02-12 20:31:47 +03:00
|
|
|
<HeaderButton key="notifsButton" name="notifsButton"
|
|
|
|
title={_t('Notifications')}
|
2018-12-18 17:36:54 +03:00
|
|
|
isHighlighted={this.isPhase(RightPanel.Phase.NotificationPanel)}
|
2019-04-10 14:21:07 +03:00
|
|
|
onClick={() => this.togglePhase(RightPanel.Phase.NotificationPanel)}
|
2018-10-30 19:15:19 +03:00
|
|
|
analytics={['Right Panel', 'Notification List Button', 'click']}
|
2018-10-31 14:20:10 +03:00
|
|
|
/>,
|
2018-10-30 19:15:19 +03:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|