Download spectrum/src/views/community/components/postsFeeds.js from Devendra174/react-code-dataset: direct link, hf CLI and curl.
- Browser
- Download file 1.69 kB
-
https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/src/views/community/components/postsFeeds.js
- Command line
-
hf download hf://datasets/Devendra174/react-code-dataset/spectrum/src/views/community/components/postsFeeds.js
-
curl -L -o postsFeeds.js https://huggingface.co/datasets/Devendra174/react-code-dataset/resolve/main/spectrum/src/views/community/components/postsFeeds.js
1.69 kB
| // @flow | |
| import React, { useState } from 'react'; | |
| import compose from 'recompose/compose'; | |
| import type { GetCommunityType } from 'shared/graphql/queries/community/getCommunity'; | |
| import type { UserInfoType } from 'shared/graphql/fragments/user/userInfo'; | |
| import getCommunityThreads from 'shared/graphql/queries/community/getCommunityThreadConnection'; | |
| import ThreadFeed from 'src/components/threadFeed'; | |
| import Select from 'src/components/select'; | |
| import { withCurrentUser } from 'src/components/withCurrentUser'; | |
| import { PostsFeedsSelectorContainer } from '../style'; | |
| const CommunityThreadFeed = compose(getCommunityThreads)(ThreadFeed); | |
| type Props = { | |
| community: GetCommunityType, | |
| currentUser: ?UserInfoType, | |
| }; | |
| export const PostsFeeds = withCurrentUser((props: Props) => { | |
| const { community, currentUser } = props; | |
| const defaultFeed = !currentUser ? 'trending' : 'latest'; | |
| const [activeFeed, setActiveFeed] = useState(defaultFeed); | |
| return ( | |
| <React.Fragment> | |
| <PostsFeedsSelectorContainer> | |
| <Select | |
| value={activeFeed} | |
| onChange={e => setActiveFeed(e.target.value)} | |
| > | |
| <option key="latest" value="latest"> | |
| Latest | |
| </option> | |
| <option key="trending" value="trending"> | |
| Popular | |
| </option> | |
| </Select> | |
| </PostsFeedsSelectorContainer> | |
| <CommunityThreadFeed | |
| viewContext="communityProfile" | |
| slug={community.slug} | |
| id={community.id} | |
| setThreadsStatus={false} | |
| isNewAndOwned={false} | |
| community={community} | |
| pinnedThreadId={community.pinnedThreadId} | |
| sort={activeFeed} | |
| /> | |
| </React.Fragment> | |
| ); | |
| }); | |