// @flow import React from 'react'; import { FormField } from 'component/common/form'; type Props = { tiny?: boolean, label?: string, injected?: ?Array, channelIds?: Array, // Specific channel IDs to show. Must be a subset of own channels. // --- Redux --- myChannelClaims: ?Array, fetchingChannels: boolean, activeChannelClaimId: ?string, setActiveChannel: (claimId: ?string, override?: boolean) => void, }; function SelectChannel(props: Props) { const { fetchingChannels, channelIds, myChannelClaims = [], label, injected = [], tiny, activeChannelClaimId, setActiveChannel, } = props; function handleChannelChange(event: SyntheticInputEvent<*>) { const channelClaimId = event.target.value; setActiveChannel(channelClaimId); } let mine = myChannelClaims; if (myChannelClaims && channelIds) { mine = myChannelClaims.filter((x) => channelIds.includes(x.claim_id)); } return ( <> {fetchingChannels ? ( ) : ( <> {mine && mine.map(({ name, claim_id: claimId }) => ( ))} {injected && injected.map((item) => ( ))} )} ); } export default SelectChannel;