react-tweet
Advanced tools
Comparing version 3.2.1 to 3.2.2
@@ -5,3 +5,3 @@ export interface TweetUser { | ||
profile_image_url_https: string; | ||
profile_image_shape: 'Circle' | 'Square' | 'Hexagon'; | ||
profile_image_shape: 'Circle' | 'Square'; | ||
screen_name: string; | ||
@@ -8,0 +8,0 @@ verified: boolean; |
@@ -5,2 +5,4 @@ import { jsx as _jsx } from "react/jsx-runtime"; | ||
className: s.root, | ||
lang: tweet.lang, | ||
dir: "auto", | ||
children: tweet.entities.map((item, i)=>/*#__PURE__*/ _jsx("span", { | ||
@@ -7,0 +9,0 @@ dangerouslySetInnerHTML: { |
@@ -7,3 +7,2 @@ 'use client'; | ||
const [copied, setCopied] = useState(false); | ||
const [copyAllText, setCopyAltText] = useState(false); | ||
const handleCopy = ()=>{ | ||
@@ -17,3 +16,2 @@ navigator.clipboard.writeText(tweet.url); | ||
setCopied(false); | ||
setCopyAltText(true); | ||
}, 6000); | ||
@@ -55,3 +53,3 @@ return ()=>clearTimeout(timeout); | ||
className: s.copyText, | ||
children: copied ? 'Copied!' : copyAllText ? 'Copy link to Tweet' : 'Copy link' | ||
children: copied ? 'Copied!' : 'Copy link' | ||
}) | ||
@@ -58,0 +56,0 @@ ] |
@@ -6,2 +6,4 @@ import { jsx as _jsx } from "react/jsx-runtime"; | ||
className: s.root, | ||
lang: tweet.lang, | ||
dir: "auto", | ||
children: tweet.entities.map((item, i)=>{ | ||
@@ -8,0 +10,0 @@ switch(item.type){ |
@@ -5,2 +5,2 @@ /// <reference types="react" /> | ||
tweet: EnrichedTweet; | ||
}) => import("react").JSX.Element; | ||
}) => import("react").JSX.Element | null; |
@@ -12,3 +12,3 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; | ||
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", | ||
@@ -15,0 +15,0 @@ rel: "noopener noreferrer", |
@@ -20,3 +20,3 @@ 'use client'; | ||
controls: !playButton, | ||
muted: true, | ||
playsInline: true, | ||
preload: "none", | ||
@@ -54,5 +54,11 @@ tabIndex: playButton ? -1 : 0, | ||
setPlayButton(false); | ||
setIsPlaying(true); | ||
video.play(); | ||
video.focus(); | ||
video.load(); | ||
video.play().then(()=>{ | ||
setIsPlaying(true); | ||
video.focus(); | ||
}).catch((error)=>{ | ||
console.error('Error playing video:', error); | ||
setPlayButton(true); | ||
setIsPlaying(false); | ||
}); | ||
}, | ||
@@ -59,0 +65,0 @@ children: /*#__PURE__*/ _jsx("svg", { |
@@ -1,9 +0,9 @@ | ||
const getTweetUrl = (tweet)=>`https://twitter.com/${tweet.user.screen_name}/status/${tweet.id_str}`; | ||
const getUserUrl = (usernameOrTweet)=>`https://twitter.com/${typeof usernameOrTweet === 'string' ? usernameOrTweet : usernameOrTweet.user.screen_name}`; | ||
const getLikeUrl = (tweet)=>`https://twitter.com/intent/like?tweet_id=${tweet.id_str}`; | ||
const getReplyUrl = (tweet)=>`https://twitter.com/intent/tweet?in_reply_to=${tweet.id_str}`; | ||
const getFollowUrl = (tweet)=>`https://twitter.com/intent/follow?screen_name=${tweet.user.screen_name}`; | ||
const getHashtagUrl = (hashtag)=>`https://twitter.com/hashtag/${hashtag.text}`; | ||
const getSymbolUrl = (symbol)=>`https://twitter.com/search?q=%24${symbol.text}`; | ||
const getInReplyToUrl = (tweet)=>`https://twitter.com/${tweet.in_reply_to_screen_name}/status/${tweet.in_reply_to_status_id_str}`; | ||
const getTweetUrl = (tweet)=>`https://x.com/${tweet.user.screen_name}/status/${tweet.id_str}`; | ||
const getUserUrl = (usernameOrTweet)=>`https://x.com/${typeof usernameOrTweet === 'string' ? usernameOrTweet : usernameOrTweet.user.screen_name}`; | ||
const getLikeUrl = (tweet)=>`https://x.com/intent/like?tweet_id=${tweet.id_str}`; | ||
const getReplyUrl = (tweet)=>`https://x.com/intent/tweet?in_reply_to=${tweet.id_str}`; | ||
const getFollowUrl = (tweet)=>`https://x.com/intent/follow?screen_name=${tweet.user.screen_name}`; | ||
const getHashtagUrl = (hashtag)=>`https://x.com/hashtag/${hashtag.text}`; | ||
const getSymbolUrl = (symbol)=>`https://x.com/search?q=%24${symbol.text}`; | ||
const getInReplyToUrl = (tweet)=>`https://x.com/${tweet.in_reply_to_screen_name}/status/${tweet.in_reply_to_status_id_str}`; | ||
export const getMediaUrl = (media, size)=>{ | ||
@@ -10,0 +10,0 @@ const url = new URL(media.media_url_https); |
{ | ||
"name": "react-tweet", | ||
"version": "3.2.1", | ||
"version": "3.2.2", | ||
"repository": "https://github.com/vercel-labs/react-tweet.git", | ||
@@ -40,4 +40,4 @@ "author": "Luis Alvarez (https://twitter.com/luis_fades)", | ||
"peerDependencies": { | ||
"react": ">= 18.0.0", | ||
"react-dom": ">= 18.0.0" | ||
"react": "^18.0.0 || ^19.0.0", | ||
"react-dom": "^18.0.0 || ^19.0.0" | ||
}, | ||
@@ -44,0 +44,0 @@ "dependencies": { |
98584
147
2785