Download spectrum/src/components/message/threadAttachment/attachment.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.79 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/src/components/message/threadAttachment/attachment.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/src/components/message/threadAttachment/attachment.js
-
curl -L -o attachment.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/src/components/message/threadAttachment/attachment.js
1.79 kB
| // @flow | |
| import React from 'react'; | |
| import { Link } from 'react-router-dom'; | |
| import type { Props } from './'; | |
| import compose from 'recompose/compose'; | |
| import { Loading } from 'src/components/loading'; | |
| import { Container, LinkWrapper, AvatarWrapper, Column } from './style'; | |
| import Activity from 'src/components/inboxThread/activity'; | |
| import { ThreadTitle } from 'src/components/inboxThread/style'; | |
| import { UserAvatar } from 'src/components/avatar'; | |
| import { withCurrentUser } from 'src/components/withCurrentUser'; | |
| import getThreadLink from 'src/helpers/get-thread-link'; | |
| class Attachment extends React.Component<Props> { | |
| render() { | |
| const { data, currentUser, id } = this.props; | |
| const { thread, loading, error } = data; | |
| if (loading) | |
| return ( | |
| <div className="attachment-container"> | |
| <Container style={{ padding: '16px 12px' }}> | |
| <Loading /> | |
| </Container> | |
| </div> | |
| ); | |
| if (error || !thread) | |
| return ( | |
| <Link to={`/thread/${id}`}>https://spectrum.chat/thread/{id}</Link> | |
| ); | |
| return ( | |
| <div className="attachment-container"> | |
| <Container data-cy="thread-attachment"> | |
| <LinkWrapper | |
| onClick={e => e.stopPropagation()} | |
| to={{ pathname: getThreadLink(thread), state: { modal: true } }} | |
| /> | |
| <AvatarWrapper> | |
| <UserAvatar user={thread.author.user} size={32} /> | |
| </AvatarWrapper> | |
| <Column> | |
| <ThreadTitle>{thread.content.title}</ThreadTitle> | |
| <Activity | |
| currentUser={currentUser} | |
| thread={thread} | |
| active={false} | |
| /> | |
| </Column> | |
| </Container> | |
| </div> | |
| ); | |
| } | |
| } | |
| export default compose(withCurrentUser)(Attachment); | |