import { h, Component, createRef } from 'preact';
import PropTypes from 'prop-types';
class ChannelButton extends Component {
buttonRef = createRef();
componentDidMount() {
const { isActiveChannel = false } = this.props;
if (isActiveChannel) {
this.buttonRef.current.click();
}
}
renderChannelImage = () => {
const { channel, newMessagesIndicator, discoverableChannel } = this.props;
return (
);
};
render() {
const {
channel,
handleSwitchChannel,
otherClassname,
newMessagesIndicator,
isUnopened,
discoverableChannel,
triggerActiveContent,
} = this.props;
return (
);
}
}
ChannelButton.propTypes = {
channel: PropTypes.shape({
channel_name: PropTypes.string,
channel_color: PropTypes.string,
channel_type: PropTypes.string,
channel_modified_slug: PropTypes.string,
id: PropTypes.number,
chat_channel_id: PropTypes.number,
status: PropTypes.string,
channel_image: PropTypes.string,
}).isRequired,
discoverableChannel: PropTypes.bool,
handleSwitchChannel: PropTypes.func,
triggerActiveContent: PropTypes.func,
newMessagesIndicator: PropTypes.string,
otherClassname: PropTypes.string,
isUnopened: PropTypes.string,
};
ChannelButton.defaultProps = {
otherClassname: '',
isUnopened: '',
newMessagesIndicator: '',
discoverableChannel: false,
handleSwitchChannel: null,
triggerActiveContent: null,
};
export default ChannelButton;