Download spectrum/src/components/hoverProfile/channelProfile.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 2.7 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/src/components/hoverProfile/channelProfile.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/src/components/hoverProfile/channelProfile.js
-
curl -L -o channelProfile.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/src/components/hoverProfile/channelProfile.js
2.7 kB
| // @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<Object>, | |
| currentUser: ?Object, | |
| ref: (?HTMLElement) => void, | |
| style: CSSStyleDeclaration, | |
| }; | |
| class HoverProfile extends Component<ProfileProps> { | |
| 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 ( | |
| <HoverWrapper popperStyle={style} ref={ref}> | |
| <ProfileCard> | |
| <ChannelCommunityRow to={`/${channel.community.slug}`}> | |
| <AvatarImage | |
| size={24} | |
| src={channel.community.profilePhoto} | |
| type={'community'} | |
| alt={channel.community.name} | |
| /> | |
| <ChannelCommunityLabel> | |
| {channel.community.name} | |
| </ChannelCommunityLabel> | |
| </ChannelCommunityRow> | |
| <Content> | |
| <Link to={`/${channel.community.slug}/${channel.slug}`}> | |
| <Title>{channel.name}</Title> | |
| </Link> | |
| {channel.description && ( | |
| <Description> | |
| {renderTextWithLinks(channel.description)} | |
| </Description> | |
| )} | |
| </Content> | |
| <Actions> | |
| {(isGlobalModerator || isGlobalOwner) && ( | |
| <Link to={`/${channel.community.slug}/${channel.slug}/settings`}> | |
| <OutlineButton icon={'settings'}>Settings</OutlineButton> | |
| </Link> | |
| )} | |
| </Actions> | |
| </ProfileCard> | |
| </HoverWrapper> | |
| ); | |
| } | |
| } | |
| export default compose( | |
| withCurrentUser, | |
| withRouter, | |
| connect() | |
| )(HoverProfile); | |