Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix testimonials

Steven Tey9393703ac7c7
diff --git a/app/dub.sh/metatags/launch.tsx b/app/dub.sh/metatags/launch.tsx
index 11479d6813..52b4bd8023 100644
--- a/app/dub.sh/metatags/launch.tsx
+++ b/app/dub.sh/metatags/launch.tsx
@@ -1,12 +1,12 @@
import Tweet from "#/ui/tweet";
-import { getTweet } from "#/lib/twitter/get-tweet";
+import { getTweet } from "react-tweet/api";
export default async function LaunchTweet() {
const tweet = await getTweet("1595465648938930180");
if (!tweet) return null;
return (
<div className="text-left">
- <Tweet key={tweet.id} metadata={JSON.stringify(tweet)} />
+ <Tweet data={tweet} />
</div>
);
}
diff --git a/app/ui/home/testimonials.tsx b/app/ui/home/testimonials.tsx
index 3c47f308c8..8e40d1d90d 100644
--- a/app/ui/home/testimonials.tsx
+++ b/app/ui/home/testimonials.tsx
@@ -7,10 +7,11 @@ import Tweet from "#/ui/tweet";
import { getTweet } from "react-tweet/api";
const tweets = [
- "1574639172605816832",
"1631671657617059842",
+ "1574639172605816832",
"1573744854655533069",
"1644155001034657792",
+ "1663567242616004610",
"1586745532386578433",
"1582956754425421825",
@@ -55,14 +56,11 @@ export default async function Testimonials() {
<Tweet
key={idx}
data={tweet || null}
- // className={
- // // this is a bit hacky but it allows us to have a 3-column mosaic layout on desktop
- // // it basically says "if the card is NOT in the middle column, push it down by 4rem
- // idx < Math.floor(tweets.length / 3) ||
- // idx >= Math.floor(tweets.length / 3) * 2
- // ? "relative lg:top-16"
- // : ""
- // }
+ className={
+ // this is a bit hacky but it allows us to have a 3-column mosaic layout on desktop
+ // it basically says "if the card is NOT in the middle column, push it down by 4rem
+ idx < 5 || idx >= 9 ? "relative lg:top-16" : ""
+ }
/>
))}
</div>
diff --git a/app/ui/tweet.tsx b/app/ui/tweet.tsx
index 5b49fc120b..3f5528ea9d 100644
--- a/app/ui/tweet.tsx
+++ b/app/ui/tweet.tsx
@@ -2,9 +2,10 @@
import BlurImage from "#/ui/blur-image";
import { nFormatter, truncate } from "#/lib/utils";
-import { Heart, Message, Repeat, Twitter } from "@/components/shared/icons";
+import { Heart, Message, Twitter } from "@/components/shared/icons";
import Tilt from "react-parallax-tilt";
import { Tweet } from "react-tweet/api";
+import clsx from "clsx";
export default function Tweet({
data,
@@ -35,7 +36,8 @@ export default function Tweet({
id_str: id,
text,
user: author,
- photos: media,
+ photos,
+ video,
favorite_count,
conversation_count,
created_at,
@@ -43,7 +45,6 @@ export default function Tweet({
const authorUrl = `https://twitter.com/${author.screen_name}`;
const likeUrl = `https://twitter.com/intent/like?tweet_id=${id}`;
- const retweetUrl = `https://twitter.com/intent/retweet?tweet_id=${id}`;
const replyUrl = `https://twitter.com/intent/tweet?in_reply_to=${id}`;
const tweetUrl = `https://twitter.com/${author.screen_name}/status/${id}`;
const createdAt = new Date(created_at);
@@ -154,15 +155,25 @@ export default function Tweet({
{/* Images, Preview images, videos, polls, etc. */}
<div className="my-3">
- {media && media.length ? (
+ {video && (
+ <video
+ className="rounded-lg border border-gray-200 drop-shadow-sm"
+ loop
+ autoPlay
+ muted
+ playsInline
+ >
+ <source src={video.variants[0].src} type="video/mp4" />
+ Your browser does not support the video tag.
+ </video>
+ )}
+ {photos && (
<div
- className={
- media.length === 1
- ? ""
- : "inline-grid grid-cols-2 gap-x-2 gap-y-2"
- }
+ className={clsx({
+ "inline-grid grid-cols-2 gap-x-2 gap-y-2": photos.length > 1,
+ })}
>
- {media.map((m) => (
+ {photos.map((m) => (
<a key={m.url} href={tweetUrl} target="_blank">
<BlurImage
key={m.url}
@@ -175,7 +186,7 @@ export default function Tweet({
</a>
))}
</div>
- ) : null}
+ )}
</div>
<div className="flex justify-center space-x-8 text-sm text-gray-500">
@@ -188,16 +199,6 @@ export default function Tweet({
<Heart className="h-4 w-4 group-hover:fill-red-600" />
<p>{nFormatter(favorite_count)}</p>
</a>
- <a
- className="flex items-center space-x-3 hover:text-green-600"
- href={retweetUrl}
- target="_blank"
- rel="noreferrer"
- >
- <Repeat className="h-4 w-4" />
- <p>{nFormatter(favorite_count)}</p>
- </a>
-
<a
className="group flex items-center space-x-3 hover:text-blue-600"
href={replyUrl}