Skip to content

Commit

Permalink
Update links to x.com (#174)
Browse files Browse the repository at this point in the history
  • Loading branch information
n1ckoates authored Jul 18, 2024
1 parent 7eeac39 commit 3367f07
Show file tree
Hide file tree
Showing 5 changed files with 9,846 additions and 7,699 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
"prettier": "^2.8.4",
"turbo": "^1.8.3"
},
"packageManager": "pnpm@8.14.3"
"packageManager": "pnpm@9.5.0"
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import s from './tweet-actions.module.css'

export const TweetActionsCopy = ({ tweet }: { tweet: EnrichedTweet }) => {
const [copied, setCopied] = useState(false)
const [copyAllText, setCopyAltText] = useState(false)
const handleCopy = () => {
navigator.clipboard.writeText(tweet.url)
setCopied(true)
Expand All @@ -16,7 +15,6 @@ export const TweetActionsCopy = ({ tweet }: { tweet: EnrichedTweet }) => {
if (copied) {
const timeout = setTimeout(() => {
setCopied(false)
setCopyAltText(true)
}, 6000)

return () => clearTimeout(timeout)
Expand Down Expand Up @@ -45,9 +43,7 @@ export const TweetActionsCopy = ({ tweet }: { tweet: EnrichedTweet }) => {
</svg>
)}
</div>
<span className={s.copyText}>
{copied ? 'Copied!' : copyAllText ? 'Copy link to Tweet' : 'Copy link'}
</span>
<span className={s.copyText}>{copied ? 'Copied!' : 'Copy link'}</span>
</button>
)
}
2 changes: 1 addition & 1 deletion packages/react-tweet/src/twitter-theme/tweet-info.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const TweetInfo = ({ tweet }: { tweet: EnrichedTweet }) => (
<TweetInfoCreatedAt tweet={tweet} />
<a
className={s.infoLink}
href="https://help.twitter.com/en/twitter-for-websites-ads-info-and-privacy"
href="https://help.x.com/en/x-for-websites-ads-info-and-privacy"
target="_blank"
rel="noopener noreferrer"
aria-label="Twitter for Websites, Ads Information and Privacy"
Expand Down
16 changes: 8 additions & 8 deletions packages/react-tweet/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,32 @@ export type TweetCoreProps = {
}

const getTweetUrl = (tweet: TweetBase) =>
`https://twitter.com/${tweet.user.screen_name}/status/${tweet.id_str}`
`https://x.com/${tweet.user.screen_name}/status/${tweet.id_str}`

const getUserUrl = (usernameOrTweet: string | TweetBase) =>
`https://twitter.com/${
`https://x.com/${
typeof usernameOrTweet === 'string'
? usernameOrTweet
: usernameOrTweet.user.screen_name
}`

const getLikeUrl = (tweet: TweetBase) =>
`https://twitter.com/intent/like?tweet_id=${tweet.id_str}`
`https://x.com/intent/like?tweet_id=${tweet.id_str}`

const getReplyUrl = (tweet: TweetBase) =>
`https://twitter.com/intent/tweet?in_reply_to=${tweet.id_str}`
`https://x.com/intent/tweet?in_reply_to=${tweet.id_str}`

const getFollowUrl = (tweet: TweetBase) =>
`https://twitter.com/intent/follow?screen_name=${tweet.user.screen_name}`
`https://x.com/intent/follow?screen_name=${tweet.user.screen_name}`

const getHashtagUrl = (hashtag: HashtagEntity) =>
`https://twitter.com/hashtag/${hashtag.text}`
`https://x.com/hashtag/${hashtag.text}`

const getSymbolUrl = (symbol: SymbolEntity) =>
`https://twitter.com/search?q=%24${symbol.text}`
`https://x.com/search?q=%24${symbol.text}`

const getInReplyToUrl = (tweet: Tweet) =>
`https://twitter.com/${tweet.in_reply_to_screen_name}/status/${tweet.in_reply_to_status_id_str}`
`https://x.com/${tweet.in_reply_to_screen_name}/status/${tweet.in_reply_to_status_id_str}`

export const getMediaUrl = (
media: MediaDetails,
Expand Down
Loading

0 comments on commit 3367f07

Please sign in to comment.