handle public chat group update

pull/679/head
Ryan Tharp 6 years ago
parent 24f7c33ab6
commit b152d186d5

@ -13,6 +13,7 @@ interface Props {
titleText: string; titleText: string;
groupName: string; groupName: string;
okText: string; okText: string;
isPublic: boolean;
cancelText: string; cancelText: string;
// friends not in the group // friends not in the group
friendList: Array<any>; friendList: Array<any>;
@ -88,16 +89,25 @@ export class UpdateGroupDialog extends React.Component<Props, State> {
public render() { public render() {
const checkMarkedCount = this.getMemberCount(this.state.friendList); const checkMarkedCount = this.getMemberCount(this.state.friendList);
const titleText = `${this.props.titleText} (Members: ${checkMarkedCount})`; let titleText = `${this.props.titleText} (Members: ${checkMarkedCount})`;
const okText = this.props.okText; const okText = this.props.okText;
const cancelText = this.props.cancelText; const cancelText = this.props.cancelText;
const noFriendsClasses = let noFriendsClasses =
this.state.friendList.length === 0 this.state.friendList.length === 0
? 'no-friends' ? 'no-friends'
: classNames('no-friends', 'hidden'); : classNames('no-friends', 'hidden');
// alternatively, we can go back to const and use more trinary operators
// but this looks cleaner/more organized to me
if (this.props.isPublic) {
// remove member count from title
titleText = `${this.props.titleText}`;
// hide the no-friend message
noFriendsClasses = classNames('no-friends', 'hidden');
}
const errorMsg = this.state.errorMessage; const errorMsg = this.state.errorMessage;
const errorMessageClasses = classNames( const errorMessageClasses = classNames(
'error-message', 'error-message',

Loading…
Cancel
Save