* Fix multiple chat loading bug * Open profile links in chat via new tab * Add unmount handling for chat * Add overscroll property to chat * Add channel_name to ChatChannel model * Create route and page for chatroom WIP * Expose ChatChannel id to live page * Implement multichannel support WIP * Implement chatroom page WIP * Add css for chatroom * Update chat's moderation * Refactor chat's message type * Swap the use of :message_markdown & :message_html * Add channel permissions WIP * Fix failing specs * Adjust json reponses * Add empty message prevention * Update participant error message * Change Workshop channel to General
34 lines
897 B
JavaScript
34 lines
897 B
JavaScript
import { h } from 'preact';
|
|
import PropTypes from 'prop-types';
|
|
|
|
const Channels = ({ activeChannelId, chatChannels, handleSwitchChannel }) => {
|
|
const channels = chatChannels.map(channel => {
|
|
const otherClassname =
|
|
parseInt(activeChannelId, 10) === channel.id
|
|
? 'chatchanneltab--active'
|
|
: 'chatchanneltab--inactive';
|
|
return (
|
|
<button
|
|
className={`chatchanneltab ${otherClassname}`}
|
|
onClick={handleSwitchChannel}
|
|
data-channel-id={channel.id}
|
|
>
|
|
{channel.channel_name}
|
|
</button>
|
|
);
|
|
});
|
|
|
|
return (
|
|
<div className="chatchannels">
|
|
<div className="chatchannels__channelslist">{channels}</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
Channels.propTypes = {
|
|
activeChannelId: PropTypes.number.isRequired,
|
|
chatChannels: PropTypes.array.isRequired,
|
|
handleSwitchChannel: PropTypes.func.isRequired,
|
|
};
|
|
|
|
export default Channels;
|