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.

added testimonials section

Steven Tey4029cf55485e
diff --git a/components/home/testimonials.tsx b/components/home/testimonials.tsx
index 21d1946a82..cd9e3dd0af 100644
--- a/components/home/testimonials.tsx
+++ b/components/home/testimonials.tsx
@@ -1,19 +1,36 @@
-import MaxWidthWrapper from "../shared/max-width-wrapper";
+import { nFormatter } from "@/lib/utils";
+import MaxWidthWrapper from "@/components/shared/max-width-wrapper";
+import Tweet from "@/components/shared/tweet";
-export default function Testimonials() {
+export default function Testimonials({
+ userCount,
+ tweets,
+}: {
+ userCount: number;
+ tweets: any[];
+}) {
return (
<MaxWidthWrapper className="py-20">
<div className="mx-auto max-w-md text-center sm:max-w-xl">
<h2 className="font-display text-4xl font-extrabold leading-tight text-black sm:text-5xl sm:leading-tight">
+ Loved by{" "}
<span className="bg-gradient-to-r from-red-600 to-amber-600 bg-clip-text text-transparent">
- Loved
- </span>{" "}
- by our users
+ {nFormatter(userCount)} users
+ </span>
</h2>
<p className="mt-5 text-gray-600 sm:text-lg">
Don't take it from us - here's what our users have to say about Dub.
</p>
</div>
+ <div className="columns-3 gap-6 space-y-6 py-8">
+ {tweets.map((tweet) => (
+ <Tweet
+ key={tweet.id}
+ id={tweet.id}
+ metadata={JSON.stringify(tweet)}
+ />
+ ))}
+ </div>
</MaxWidthWrapper>
);
}
diff --git a/components/shared/icons/heart.tsx b/components/shared/icons/heart.tsx
new file mode 100644
index 0000000000..06c4f9cfe9
--- /dev/null
+++ b/components/shared/icons/heart.tsx
@@ -0,0 +1,18 @@
+export default function Heart({ className }: { className: string }) {
+ return (
+ <svg
+ fill="none"
+ shapeRendering="geometricPrecision"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ viewBox="0 0 24 24"
+ width="14"
+ height="14"
+ className={className}
+ >
+ <path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z" />
+ </svg>
+ );
+}
diff --git a/components/shared/icons/index.tsx b/components/shared/icons/index.tsx
index 490f3fd100..45c8598b63 100644
--- a/components/shared/icons/index.tsx
+++ b/components/shared/icons/index.tsx
@@ -43,3 +43,6 @@ export { default as Logout } from "./logout";
export { default as Save } from "./save";
export { default as Users } from "./users";
export { default as Eye } from "./eye";
+export { default as Heart } from "./heart";
+export { default as Repeat } from "./repeat";
+export { default as Message } from "./message";
diff --git a/components/shared/icons/message.tsx b/components/shared/icons/message.tsx
new file mode 100644
index 0000000000..5e6876da39
--- /dev/null
+++ b/components/shared/icons/message.tsx
@@ -0,0 +1,18 @@
+export default function Message({ className }: { className: string }) {
+ return (
+ <svg
+ fill="none"
+ shapeRendering="geometricPrecision"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ viewBox="0 0 24 24"
+ width="14"
+ height="14"
+ className={className}
+ >
+ <path d="M21 11.5a8.38 8.38 0 01-.9 3.8 8.5 8.5 0 01-7.6 4.7 8.38 8.38 0 01-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 01-.9-3.8 8.5 8.5 0 014.7-7.6 8.38 8.38 0 013.8-.9h.5a8.48 8.48 0 018 8v.5z" />{" "}
+ </svg>
+ );
+}
diff --git a/components/shared/icons/repeat.tsx b/components/shared/icons/repeat.tsx
new file mode 100644
index 0000000000..edc61ef693
--- /dev/null
+++ b/components/shared/icons/repeat.tsx
@@ -0,0 +1,21 @@
+export default function Repeat({ className }: { className: string }) {
+ return (
+ <svg
+ fill="none"
+ shapeRendering="geometricPrecision"
+ stroke="currentColor"
+ strokeLinecap="round"
+ strokeLinejoin="round"
+ strokeWidth="1.5"
+ viewBox="0 0 24 24"
+ width="14"
+ height="14"
+ className={className}
+ >
+ <path d="M17 1l4 4-4 4" />
+ <path d="M3 11V9a4 4 0 014-4h14" />
+ <path d="M7 23l-4-4 4-4" />
+ <path d="M21 13v2a4 4 0 01-4 4H3" />{" "}
+ </svg>
+ );
+}
diff --git a/components/shared/tweet/index.tsx b/components/shared/tweet/index.tsx
new file mode 100644
index 0000000000..45303678f2
--- /dev/null
+++ b/components/shared/tweet/index.tsx
@@ -0,0 +1,334 @@
+import BlurImage from "@/components/shared/blur-image";
+import { nFormatter } from "@/lib/utils";
+import { Heart, Message, Repeat, Twitter } from "../icons";
+import styles from "./tweet.module.css";
+
+function getRemainingTime(ISOString: Date) {
+ const currentTime = new Date();
+ const endTime = new Date(ISOString);
+ const diff = endTime.getTime() - currentTime.getTime();
+ if (diff > 36e5 * 24) {
+ const days = Math.floor(diff / (36e5 * 24));
+ const hours = Math.floor((diff - days * 36e5 * 24) / 36e5);
+ return `${days} day${days > 1 ? "s" : ""} ${hours} hours`;
+ } else if (diff > 36e5) {
+ return `${Math.floor(diff / 36e5)} hours`;
+ } else if (diff > 60e3) {
+ return `${Math.floor(diff / 60e3)} minutes`;
+ } else {
+ return "Less than a minute";
+ }
+}
+
+export default function Tweet({
+ id,
+ metadata,
+ className,
+}: {
+ id: string;
+ metadata: any;
+ className?: string;
+}) {
+ const parsedMetadata = JSON.parse(metadata.replace(/\n/g, "\\n"));
+
+ // console.log(JSON.stringify(parsedMetadata, null, 4));
+
+ const text = parsedMetadata.text;
+ const author = parsedMetadata.author;
+ const media = parsedMetadata.media;
+ const video = parsedMetadata.video;
+ const polls = parsedMetadata.polls;
+ const url_meta = parsedMetadata.url_meta;
+ const created_at = parsedMetadata.created_at;
+ const public_metrics = parsedMetadata.public_metrics;
+ const referenced_tweets = parsedMetadata.referenced_tweets;
+
+ const authorUrl = `https://twitter.com/${author.username}`;
+ 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.username}/status/${id}`;
+ const createdAt = new Date(created_at);
+
+ const formattedText = text
+ .replace(/\B\@([\w\-]+)/gim, (match) => {
+ // format all @ mentions
+ return `<a style="color: rgb(29,161,242); font-weight:normal; text-decoration: none" href="https://twitter.com/${match.replace(
+ "@",
+ "",
+ )}" target="_blank">${match}</a>`;
+ })
+ .replace(/(#+[a-zA-Z0-9(_)]{1,})/g, (match) => {
+ // format all # hashtags
+ return `<a style="color: rgb(29,161,242); font-weight:normal; text-decoration: none" href="https://twitter.com/hashtag/${match.replace(
+ "#",
+ "",
+ )}" target="_blank">${match}</a>`;
+ });
+
+ const quoteTweet =
+ referenced_tweets && referenced_tweets.find((t) => t.type === "quoted");
+
+ const repliedTo =
+ referenced_tweets && referenced_tweets.find((t) => t.type === "replied_to");
+
+ return (
+ <div className={styles.card}>
+ {/* User info, verified badge, twitter logo, text, etc. */}
+ <div>
+ <div className="flex items-center justify-between">
+ <div className="flex items-center space-x-2">
+ <a href={authorUrl} target="_blank" rel="noreferrer">
+ <BlurImage
+ alt={author.username}
+ height={48}
+ width={48}
+ src={author.profile_image_url}
+ className="h-10 w-10 overflow-hidden rounded-full transition-all ease-in-out hover:scale-105 hover:shadow-md"
+ />
+ </a>
+ <div>
+ <a
+ href={authorUrl}
+ target="_blank"
+ rel="noreferrer"
+ className="flex items-center font-semibold text-gray-900"
+ >
+ {author.name}
+ {author.verified ? (
+ <svg
+ aria-label="Verified Account"
+ className="ml-1 inline h-4 w-4 text-blue-500"
+ viewBox="0 0 24 24"
+ >
+ <g fill="currentColor">
+ <path d="M22.5 12.5c0-1.58-.875-2.95-2.148-3.6.154-.435.238-.905.238-1.4 0-2.21-1.71-3.998-3.818-3.998-.47 0-.92.084-1.336.25C14.818 2.415 13.51 1.5 12 1.5s-2.816.917-3.437 2.25c-.415-.165-.866-.25-1.336-.25-2.11 0-3.818 1.79-3.818 4 0 .494.083.964.237 1.4-1.272.65-2.147 2.018-2.147 3.6 0 1.495.782 2.798 1.942 3.486-.02.17-.032.34-.032.514 0 2.21 1.708 4 3.818 4 .47 0 .92-.086 1.335-.25.62 1.334 1.926 2.25 3.437 2.25 1.512 0 2.818-.916 3.437-2.25.415.163.865.248 1.336.248 2.11 0 3.818-1.79 3.818-4 0-.174-.012-.344-.033-.513 1.158-.687 1.943-1.99 1.943-3.484zm-6.616-3.334l-4.334 6.5c-.145.217-.382.334-.625.334-.143 0-.288-.04-.416-.126l-.115-.094-2.415-2.415c-.293-.293-.293-.768 0-1.06s.768-.294 1.06 0l1.77 1.767 3.825-5.74c.23-.345.696-.436 1.04-.207.346.23.44.696.21 1.04z" />
+ </g>
+ </svg>
+ ) : null}
+ </a>
+ <div className="flex items-center space-x-1">
+ <a
+ href={authorUrl}
+ target="_blank"
+ rel="noreferrer"
+ className="text-sm text-gray-500 transition-all duration-75 hover:text-gray-900"
+ >
+ @{author.username}
+ </a>
+ <p>·</p>
+ <a
+ href={tweetUrl}
+ target="_blank"
+ rel="noreferrer"
+ className="text-sm text-gray-500 transition-all duration-75 hover:text-gray-900"
+ >
+ {createdAt.toLocaleDateString("en-US", {
+ month: "short",
+ day: "numeric",
+ })}
+ </a>
+ </div>
+ </div>
+ </div>
+ <a href={tweetUrl} target="_blank" rel="noreferrer">
+ <Twitter className="h-5 w-5 text-[#3BA9EE] transition-all ease-in-out hover:scale-105" />
+ </a>
+ </div>
+ {repliedTo && repliedTo.username && (
+ <div className="mt-5 text-base text-gray-500">
+ Replying to{" "}
+ <a
+ className="text-[#1da1f2] no-underline"
+ href={`https://twitter.com/${repliedTo.author.username}`}
+ target="_blank"
+ >
+ @{repliedTo.author.username}
+ </a>
+ </div>
+ )}
+ <div
+ className="mt-4 mb-2 truncate whitespace-pre-wrap text-[15px] text-gray-700"
+ dangerouslySetInnerHTML={{ __html: formattedText }}
+ />
+ </div>
+
+ {/* Images, Preview images, videos, polls, etc. */}
+ <div className="mt-3 -mb-2">
+ {media && media.length ? (
+ <div
+ className={
+ media.length === 1
+ ? ""
+ : "inline-grid grid-cols-2 gap-x-2 gap-y-2"
+ }
+ >
+ {media.map((m) => (
+ <a key={m.media_key} href={tweetUrl} target="_blank">
+ {m.type == "video" || m.type == "animated_gif" ? (
+ video ? (
+ <video
+ className="-mt-10 rounded-lg"
+ loop
+ width="2048px"
+ height="2048px"
+ autoPlay
+ muted
+ playsInline
+ >
+ <source src={video.url} type="video/mp4" />
+ Your browser does not support the video tag.
+ </video>
+ ) : (
+ <BlurImage
+ key={m.media_key}
+ alt={text}
+ width={2048}
+ height={m.height * (2048 / m.width)}
+ src={m.preview_image_url}
+ className="rounded-lg"
+ />
+ )
+ ) : (
+ <BlurImage
+ key={m.media_key}
+ alt={text}
+ width={2048}
+ height={m.height * (2048 / m.width)}
+ src={m.url}
+ className="rounded-lg"
+ />
+ )}
+ </a>
+ ))}
+ </div>
+ ) : null}
+ {url_meta?.images ? (
+ <a href={url_meta.unwound_url} target="_blank" rel="noreferrer">
+ <div className="overflow-hidden rounded-lg border border-gray-200 drop-shadow-sm">
+ <BlurImage
+ key={url_meta.unwound_url}
+ alt={url_meta.title}
+ width={2048}
+ height={1000}
+ src={url_meta.images[0].url}
+ className="h-40"
+ />
+ <div className="w-full bg-white p-3">
+ <p className="text-sm font-semibold line-clamp-1">
+ {url_meta.title}
+ </p>
+ <p className="text-sm text-gray-500 line-clamp-2">
+ {url_meta.description}
+ </p>
+ </div>
+ </div>
+ </a>
+ ) : null}
+ {polls && (
+ <div className="mt-5">
+ {polls.map((poll) => {
+ poll.total_votes = poll.options.reduce(
+ (sum, option) => sum + option.votes,
+ 0,
+ );
+ return poll.voting_status == "open" ? (
+ <div key={poll.end_datetime}>
+ {poll.options.map((option) => (
+ <a
+ key={option.label}
+ href={tweetUrl}
+ target="_blank"
+ className="no-underline"
+ >
+ <div className="my-2 rounded-3xl border border-[#1da1f2] text-center font-bold text-[#1da1f2] transition-all duration-150 ease-in-out hover:bg-[#1da1f2] hover:bg-opacity-10">
+ {option.label}
+ </div>
+ </a>
+ ))}
+ <div className="mt-4 text-base text-gray-500">
+ {poll.total_votes} votes ·{" "}
+ {getRemainingTime(poll.end_datetime)} left
+ </div>
+ </div>
+ ) : (
+ <div key={poll.end_datetime}>
+ {poll.options.map((option) => (
+ <div
+ key={option.label}
+ className={`
+ ${
+ option.position == 1 ? "font-bold" : ""
+ } relative my-2 flex cursor-pointer justify-between whitespace-nowrap px-3 text-black
+ `}
+ >
+ <p className="z-10 my-0">{option.label}</p>
+ <p className="z-10 my-0">{`${(
+ (option.votes / poll.total_votes) *
+ 100
+ )
+ .toFixed(1)
+ .replace(".0", "")}%`}</p>
+ <div
+ className={`
+ ${
+ option.position == 1
+ ? "bg-[#1da1f2] font-bold"
+ : "bg-gray-300"
+ }
+ absolute top-0 left-0 h-full w-full rounded-md
+ `}
+ style={{
+ width: `${Math.round(
+ (option.votes / poll.total_votes) * 100,
+ )}%`,
+ }}
+ />
+ </div>
+ ))}
+ <div className="mt-4 text-base text-gray-500">
+ {poll.total_votes} votes · Final results
+ </div>
+ </div>
+ );
+ })}
+ </div>
+ )}
+ {quoteTweet && quoteTweet.author && (
+ <Tweet id={quoteTweet.id} metadata={JSON.stringify(quoteTweet)} />
+ )}
+ </div>
+
+ <div className="flex justify-center space-x-6 text-sm text-gray-500">
+ <a
+ className="group flex items-center space-x-1 hover:text-red-600"
+ href={likeUrl}
+ target="_blank"
+ rel="noreferrer"
+ >
+ <Heart className="h-4 w-4 group-hover:fill-red-600" />
+ <p>{nFormatter(public_metrics.like_count)}</p>
+ </a>
+ <a
+ className="flex items-center space-x-1 hover:text-green-600"
+ href={retweetUrl}
+ target="_blank"
+ rel="noreferrer"
+ >
+ <Repeat className="h-4 w-4" />
+ <p>{nFormatter(public_metrics.retweet_count)}</p>
+ </a>
+
+ <a
+ className="group flex items-center space-x-1 hover:text-blue-600"
+ href={replyUrl}
+ target="_blank"
+ rel="noreferrer"
+ >
+ <Message className="h-4 w-4 group-hover:fill-blue-600" />
+ <p>{nFormatter(public_metrics.reply_count)}</p>
+ </a>
+ </div>
+ </div>
+ );
+}
diff --git a/components/shared/tweet/tweet.module.css b/components/shared/tweet/tweet.module.css
new file mode 100644
index 0000000000..32b745d8f2
--- /dev/null
+++ b/components/shared/tweet/tweet.module.css
@@ -0,0 +1,9 @@
+.card {
+ padding: 1.5rem;
+ padding-bottom: 1rem;
+ border-radius: 0.5rem;
+ border-width: 1px;
+ border-color: #d1d5db;
+ backdrop-filter: blur(8px);
+ /* shadow-[inset_10px_-50px_94px_0_rgb(199,199,199,0.2)] */
+}
diff --git a/lib/twitter/get-tweet.ts b/lib/twitter/get-tweet.ts
new file mode 100644
index 0000000000..06566c61b7
--- /dev/null
+++ b/lib/twitter/get-tweet.ts
@@ -0,0 +1,101 @@
+import querystring from "querystring";
+import { getTwitterMedia } from "./twitter-media";
+
+export const getTweet = async (id: string) => {
+ const queryParams = querystring.stringify({
+ expansions:
+ "author_id,attachments.media_keys,referenced_tweets.id,referenced_tweets.id.author_id,attachments.poll_ids",
+ "tweet.fields":
+ "attachments,author_id,public_metrics,created_at,id,in_reply_to_user_id,referenced_tweets,text,entities",
+ "user.fields": "id,name,profile_image_url,protected,url,username,verified",
+ "media.fields":
+ "duration_ms,height,media_key,preview_image_url,type,url,width,public_metrics",
+ "poll.fields": "duration_minutes,end_datetime,id,options,voting_status",
+ });
+
+ const response = await fetch(
+ `https://api.twitter.com/2/tweets/${id}?${queryParams}`,
+ {
+ headers: {
+ Authorization: `Bearer ${process.env.TWITTER_AUTH_TOKEN}`,
+ },
+ },
+ );
+
+ const tweet = await response.json();
+
+ //console.log(JSON.stringify(tweet, null, 4));
+
+ const getAuthorInfo = (author_id) => {
+ return tweet.includes.users.find((user) => user.id === author_id);
+ };
+
+ const getReferencedTweets = (mainTweet) => {
+ return (
+ mainTweet?.referenced_tweets?.map((referencedTweet) => {
+ const fullReferencedTweet = tweet.includes.tweets.find(
+ (tweet) => tweet.id === referencedTweet.id,
+ );
+
+ return {
+ type: referencedTweet.type,
+ author: getAuthorInfo(fullReferencedTweet.author_id),
+ ...fullReferencedTweet,
+ };
+ }) || []
+ );
+ };
+
+ // function to distinguish between external URLs and external t.co links and internal t.co links
+ // (e.g. images, videos, gifs, quote tweets) and remove/replace them accordingly
+ const getExternalUrls = (tweet) => {
+ const externalURLs = tweet.entities?.urls;
+ const mappings = {};
+ if (externalURLs) {
+ externalURLs.map((url) => {
+ mappings[`${url.url}`] =
+ !url.display_url.startsWith("pic.twitter.com") &&
+ !url.display_url.startsWith("twitter.com")
+ ? `<a style='color: rgb(29,161,242); font-weight:normal; text-decoration: none' href='${url.expanded_url.replace(
+ "@",
+ "",
+ )}' target='_blank'>${url.display_url.replace("@", "")}</a>`
+ : "";
+ });
+ }
+ var processedText = tweet.text;
+ Object.entries(mappings).map(([k, v], i) => {
+ processedText = processedText.replace(k, v);
+ });
+ return processedText;
+ };
+ tweet.data.text = getExternalUrls(tweet.data); // removing/replacing t.co links for main tweet
+ tweet?.includes?.tweets?.map((twt) => {
+ // removing/replacing t.co links for referenced tweets
+ twt.text = getExternalUrls(twt);
+ });
+
+ const media = tweet.data?.attachments?.media_keys?.map((key) =>
+ tweet.includes.media.find((media) => media.media_key === key),
+ );
+
+ const referenced_tweets = getReferencedTweets(tweet.data);
+
+ return {
+ ...tweet.data,
+ media: media || [],
+ video:
+ media && (media[0].type == "video" || media[0].type == "animated_gif")
+ ? await getTwitterMedia(id)
+ : null,
+ polls: tweet.includes.polls || [],
+ url_meta:
+ media ||
+ referenced_tweets.length > 0 ||
+ tweet.data?.entities?.urls == undefined
+ ? null
+ : tweet.data.entities?.urls[0],
+ referenced_tweets: referenced_tweets,
+ author: getAuthorInfo(tweet.data.author_id),
+ };
+};
diff --git a/lib/twitter/index.ts b/lib/twitter/index.ts
new file mode 100644
index 0000000000..fa401f5622
--- /dev/null
+++ b/lib/twitter/index.ts
@@ -0,0 +1,15 @@
+import { getTweet } from "./get-tweet";
+
+export default function getTweetsMetadata(ids: string[]) {
+ return Promise.all(ids.map((id) => getTweet(id)));
+}
+
+export const homepageTweets = [
+ "1574639172605816832",
+ "1573744854655533069",
+ "1581017931043196928",
+ "1580891783277395970",
+ "1582956754425421825",
+ "1574164441498894339",
+ // "1580479816071270401",
+];
diff --git a/lib/twitter/twitter-media.ts b/lib/twitter/twitter-media.ts
new file mode 100644
index 0000000000..76633e2e17
--- /dev/null
+++ b/lib/twitter/twitter-media.ts
@@ -0,0 +1,28 @@
+export const getTwitterMedia = async (id: string) => {
+ try {
+ const response = await fetch(
+ `https://api.twitter.com/1.1/statuses/show.json?id=${id}&tweet_mode=extended`,
+ {
+ headers: {
+ Authorization: `Bearer ${process.env.TWITTER_AUTH_TOKEN}`,
+ },
+ },
+ );
+ const data = await response.json();
+ const videoData = data.extended_entities.media[0].video_info;
+
+ // filter for only MP4 videos
+ const mp4VideosOnly = videoData?.variants?.filter(
+ (variant) => variant.content_type === "video/mp4",
+ );
+
+ // get the video with the best bitrate
+ const bestVideoBitrate = mp4VideosOnly.reduce(function (prev, current) {
+ return prev.bitrate > current.bitrate ? prev : current;
+ });
+
+ return bestVideoBitrate;
+ } catch (error) {
+ console.log(id, error);
+ }
+};
diff --git a/next.config.js b/next.config.js
index a4a70260b8..d9384e77a9 100644
--- a/next.config.js
+++ b/next.config.js
@@ -8,6 +8,7 @@ module.exports = {
"faisalman.github.io",
"avatars.dicebear.com",
"res.cloudinary.com",
+ "pbs.twimg.com",
],
},
async headers() {
diff --git a/pages/index.tsx b/pages/index.tsx
index a1a586d8a1..5bc794244b 100644
--- a/pages/index.tsx
+++ b/pages/index.tsx
@@ -1,5 +1,6 @@
import { useRouter } from "next/router";
import { useCallback, useEffect } from "react";
+import prisma from "@/lib/prisma";
import { useStatsModal } from "@/components/app/modals/stats-modal";
import Background from "@/components/home/background";
import Demo from "@/components/home/demo";
@@ -10,8 +11,18 @@ import Logos from "@/components/home/logos";
import Pricing from "@/components/home/pricing";
import HomeLayout from "@/components/layout/home";
import OSS from "@/components/home/oss";
+import Testimonials from "@/components/home/testimonials";
+import getTweetsMetadata, { homepageTweets } from "@/lib/twitter";
-export default function Home({ stars }: { stars: number }) {
+export default function Home({
+ userCount,
+ stars,
+ tweets,
+}: {
+ userCount: number;
+ stars: number;
+ tweets: any;
+}) {
const router = useRouter();
const { key: stats } = router.query;
const { setShowStatsModal, StatsModal } = useStatsModal();
@@ -44,6 +55,7 @@ export default function Home({ stars }: { stars: number }) {
<Logos />
<Globe />
<Features />
+ <Testimonials userCount={userCount} tweets={tweets} />
<Pricing />
<OSS stars={stars} />
</div>
@@ -53,6 +65,8 @@ export default function Home({ stars }: { stars: number }) {
}
export async function getStaticProps() {
+ const userCount = await prisma.user.count();
+
const { stargazers_count: stars } = await fetch(
"https://api.github.com/repos/steven-tey/dub",
{
@@ -66,9 +80,13 @@ export async function getStaticProps() {
},
).then((res) => res.json());
+ const tweets = await getTweetsMetadata(homepageTweets);
+
return {
props: {
+ userCount,
stars,
+ tweets,
},
revalidate: 10,
};
diff --git a/tailwind.config.js b/tailwind.config.js
index 83f8f4d169..63d925fcee 100644
--- a/tailwind.config.js
+++ b/tailwind.config.js
@@ -19,7 +19,7 @@ module.exports = {
"slide-down-fade": "slide-down-fade 0.4s cubic-bezier(0.16, 1, 0.3, 1)",
"slide-left-fade": "slide-left-fade 0.4s cubic-bezier(0.16, 1, 0.3, 1)",
// Custom wiggle animation
- wiggle: "wiggle 1.5s infinite",
+ wiggle: "wiggle 0.75s infinite",
},
keyframes: {
// Tooltip
@@ -45,11 +45,11 @@ module.exports = {
transform: "translateX(0%)",
transformOrigin: "50% 50%",
},
- "15%": { transform: "translateX(-6px) rotate(-6deg)" },
- "30%": { transform: "translateX(9px) rotate(6deg)" },
- "45%": { transform: "translateX(-9px) rotate(-3.6deg)" },
- "60%": { transform: "translateX(3px) rotate(2.4deg)" },
- "75%": { transform: "translateX(-2px) rotate(-1.2deg)" },
+ "15%": { transform: "translateX(-4px) rotate(-4deg)" },
+ "30%": { transform: "translateX(6px) rotate(4deg)" },
+ "45%": { transform: "translateX(-6px) rotate(-2.4deg)" },
+ "60%": { transform: "translateX(2px) rotate(1.6deg)" },
+ "75%": { transform: "translateX(-1px) rotate(-0.8deg)" },
},
},
},