import { h } from 'preact'; import PropTypes from 'prop-types'; // eslint-disable-next-line import/no-unresolved import ConfigImage from 'images/overflow-horizontal.svg'; import ChannelButton from './components/channelButton'; import { channelSorter } from './util'; const Channels = ({ activeChannelId, chatChannels, unopenedChannelIds, handleSwitchChannel, expanded, filterQuery = '', channelsLoaded, currentUserId, triggerActiveContent, }) => { const sortedChatChannels = channelSorter( chatChannels, currentUserId, filterQuery, ); const discoverableChannels = sortedChatChannels.discoverableChannels.map( (channel) => { return ( ); }, ); const channels = sortedChatChannels.activeChannels.map((channel) => { const isActive = parseInt(activeChannelId, 10) === channel.chat_channel_id; const isUnopened = !isActive && unopenedChannelIds.includes(channel.chat_channel_id); const newMessagesIndicator = isUnopened ? 'new' : 'old'; const otherClassname = isActive ? 'chatchanneltab--active' : 'chatchanneltab--inactive'; return ( ); }); let topNotice = ''; if ( expanded && filterQuery.length === 0 && channelsLoaded && (channels.length === 0 || channels[0].messages_count === 0) ) { topNotice = (
👋 {' '} Welcome to Connect! You may message anyone you mutually follow.
); } let channelsListFooter = ''; if (channels.length === 30) { channelsListFooter = (
...
); } let configFooter = ''; if (expanded) { // TODO: The
below should be converted into a real menu or