// @flow import React, { Component } from 'react'; import compose from 'recompose/compose'; import { connect } from 'react-redux'; import { withRouter } from 'react-router'; import AvatarImage from 'src/components/avatar/image'; import { Link } from 'react-router-dom'; import { Button, OutlineButton } from 'src/components/button'; import renderTextWithLinks from 'src/helpers/render-text-with-markdown-links'; import type { GetChannelType } from 'shared/graphql/queries/channel/getChannel'; import type { Dispatch } from 'redux'; import { withCurrentUser } from 'src/components/withCurrentUser'; import { HoverWrapper, ProfileCard, ChannelCommunityRow, ChannelCommunityLabel, Content, Title, Description, Actions, } from './style'; type ProfileProps = { channel: GetChannelType, dispatch: Dispatch, currentUser: ?Object, ref: (?HTMLElement) => void, style: CSSStyleDeclaration, }; class HoverProfile extends Component { render() { const { channel, ref, style } = this.props; const { isOwner: isChannelOwner, isMember: isChannelMember, } = channel.channelPermissions; const { communityPermissions } = channel.community; const { isOwner: isCommunityOwner, isModerator: isCommunityModerator, } = communityPermissions; const isGlobalOwner = isChannelOwner || isCommunityOwner; const isGlobalModerator = isCommunityModerator; return ( {channel.community.name} {channel.name} {channel.description && ( {renderTextWithLinks(channel.description)} )} {(isGlobalModerator || isGlobalOwner) && ( Settings )} ); } } export default compose( withCurrentUser, withRouter, connect() )(HoverProfile);