-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: update tweet view * feat: update video view * refactor: changed conditional ? : to && * fix: prettier fix and added && --------- Co-authored-by: Расул <[email protected]> Co-authored-by: Github Actions <[email protected]>
- Loading branch information
1 parent
9be146f
commit 584c74e
Showing
35 changed files
with
312 additions
and
8,296 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,37 +1,87 @@ | ||
import { useState } from 'react' | ||
import { ClipLoader } from 'react-spinners' | ||
import { Tweet } from 'react-twitter-widgets' | ||
import styled from 'styled-components' | ||
import { Flex } from '~/components/common/Flex' | ||
import { Text } from '~/components/common/Text' | ||
import { useSelectedNode } from '~/stores/useDataStore' | ||
import { colors } from '~/utils/colors' | ||
|
||
export const TwitData = () => { | ||
const selectedNode = useSelectedNode() | ||
const [loading, setLoading] = useState(true) | ||
|
||
const twitId: string = selectedNode?.tweet_id || '' | ||
|
||
return ( | ||
<Flex direction="column" px={24} py={16}> | ||
<Flex align="center" direction="row" justify="flex-start" p={10}> | ||
<Text color="primaryText1">{selectedNode?.label}</Text> | ||
</Flex> | ||
{loading && ( | ||
<Flex align="center" direction="row" justify="center" p={10}> | ||
<ClipLoader color={colors.white} /> | ||
selectedNode && ( | ||
<Flex direction="column" px={24} py={16}> | ||
<Flex align="center" direction="row" justify="flex-start" p={10}> | ||
<Text color="primaryText1">{selectedNode?.label}</Text> | ||
</Flex> | ||
)} | ||
{twitId && ( | ||
<Tweet | ||
onLoad={() => setLoading(false)} | ||
options={{ theme: 'dark' }} | ||
renderError={() => <Error />} | ||
tweetId={twitId} | ||
/> | ||
)} | ||
</Flex> | ||
{twitId && ( | ||
<TweetContainer> | ||
<Flex direction="row"> | ||
<ProfilePicture> | ||
<img alt="Profile" src={selectedNode.image_url || 'twitter_placeholder.png'} /> | ||
</ProfilePicture> | ||
|
||
<AuthorInfo> | ||
<AuthorName>{selectedNode.name}</AuthorName> | ||
<TwitterHandle>{selectedNode.twitter_handle || '@unknown_handle'}</TwitterHandle> | ||
</AuthorInfo> | ||
</Flex> | ||
<TweetText>{selectedNode.text}</TweetText> | ||
</TweetContainer> | ||
)} | ||
</Flex> | ||
) | ||
) | ||
} | ||
|
||
const Error = () => <Flex>Error occurred</Flex> | ||
const TweetContainer = styled.div` | ||
padding: 10px; | ||
border-radius: 6px; | ||
display: flex; | ||
flex-direction: column; | ||
background: ${colors.BG1}; | ||
` | ||
|
||
const ProfilePicture = styled.div` | ||
width: 50px; | ||
height: 50px; | ||
border-radius: 6px; | ||
overflow: hidden; | ||
margin-right: 10px; | ||
flex: 1 1 50px; | ||
max-width: 50px; | ||
margin-bottom: 16px; | ||
img { | ||
width: 100%; | ||
height: 100%; | ||
} | ||
` | ||
|
||
const AuthorInfo = styled.div` | ||
display: flex; | ||
align-items: flex-start; | ||
justify-content: flex-start; | ||
margin-bottom: 5px; | ||
flex-direction: column; | ||
` | ||
|
||
const AuthorName = styled.span` | ||
font-family: Barlow; | ||
font-weight: 700; | ||
color: ${colors.white}; | ||
` | ||
|
||
const TwitterHandle = styled.span` | ||
color: ${colors.PRIMARY_BLUE}; | ||
` | ||
|
||
const TweetText = styled.p` | ||
font-family: Barlow; | ||
font-size: 16px; | ||
font-style: normal; | ||
font-weight: 500; | ||
line-height: 21px; | ||
color: ${colors.white}; | ||
` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.