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.

fixed ts errors

Steven Tey74a7bea0ff50
diff --git a/app/ui/blog/mdx.tsx b/app/ui/blog/mdx.tsx
index 39bbca2014..1f40fb7162 100644
--- a/app/ui/blog/mdx.tsx
+++ b/app/ui/blog/mdx.tsx
@@ -5,6 +5,7 @@ import { useMDXComponent } from "next-contentlayer/hooks";
import Tweet from "#/ui/tweet";
import GithubRepo, { GithubRepoProps } from "@/components/shared/github-repo";
import BlurImage from "#/ui/blur-image";
+import { Tweet as TweetProps } from "react-tweet/api";
const CustomLink = (props: any) => {
const href = props.href;
@@ -59,8 +60,8 @@ export function MDX({ code, images, tweets, repos }: MDXProps) {
const MDXTweet = ({ id }: { id: string }) => {
if (!tweets) return null;
- const tweet = tweets.find((tweet: any) => tweet.id === id);
- return <Tweet metadata={tweet} />;
+ const tweet = tweets.find((tweet: TweetProps) => tweet.id_str === id);
+ return <Tweet data={tweet} />;
};
const MDXRepo = ({ url }: { url: string }) => {
diff --git a/app/ui/home/testimonials-mobile.tsx b/app/ui/home/testimonials-mobile.tsx
index 82a1570bc7..07db35a533 100644
--- a/app/ui/home/testimonials-mobile.tsx
+++ b/app/ui/home/testimonials-mobile.tsx
@@ -1,17 +1,22 @@
"use client";
-import { Tweet } from "react-tweet";
+import Tweet from "#/ui/tweet";
import { useRef, useState } from "react";
+import { Tweet as TweetProps } from "react-tweet/api";
-export default function TestimonialsMobile({ tweets }: { tweets: any[] }) {
+export default function TestimonialsMobile({
+ tweetsData,
+}: {
+ tweetsData: TweetProps[];
+}) {
const ref = useRef<HTMLDivElement>(null);
const [expanded, setExpanded] = useState(false);
return (
<div className="flex flex-col justify-center space-y-4 pt-8 sm:hidden">
<div ref={ref} className="space-y-6">
- {tweets.slice(0, expanded ? undefined : 4).map((tweet, idx) => (
- <Tweet key={idx} id={tweet} />
+ {tweetsData.slice(0, expanded ? undefined : 4).map((tweet, idx) => (
+ <Tweet key={idx} data={tweet} />
))}
</div>
{!expanded && (
diff --git a/app/ui/home/testimonials.tsx b/app/ui/home/testimonials.tsx
index 8e40d1d90d..57869f5f8e 100644
--- a/app/ui/home/testimonials.tsx
+++ b/app/ui/home/testimonials.tsx
@@ -4,7 +4,7 @@ import { nFormatter } from "#/lib/utils";
import MaxWidthWrapper from "@/components/shared/max-width-wrapper";
import TestimonialsMobile from "./testimonials-mobile";
import Tweet from "#/ui/tweet";
-import { getTweet } from "react-tweet/api";
+import { getTweet, Tweet as TweetProps } from "react-tweet/api";
const tweets = [
"1631671657617059842",
@@ -35,7 +35,9 @@ export default async function Testimonials() {
},
)();
- const tweetsData = await Promise.all(tweets.map((id) => getTweet(id)));
+ const tweetsData = (
+ await Promise.all(tweets.map((id) => getTweet(id)))
+ ).filter((t) => t) as TweetProps[];
return (
<MaxWidthWrapper className="pt-20">
@@ -50,7 +52,7 @@ export default async function Testimonials() {
Don't take it from us - here's what our users have to say about Dub.
</p>
</div>
- <TestimonialsMobile tweets={tweets} />
+ <TestimonialsMobile tweetsData={tweetsData} />
<div className="hidden space-y-6 py-8 sm:block sm:columns-2 sm:gap-6 xl:columns-3">
{tweetsData.filter(Boolean).map((tweet, idx) => (
<Tweet