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.

made only ZoomImage a client component, fixed LinksImported email

Steven Tey019f70c0daa5
diff --git a/app/api/cron/import/short/utils.ts b/app/api/cron/import/short/utils.ts
index ba40d9e1f9..fbf2ba7ba4 100644
--- a/app/api/cron/import/short/utils.ts
+++ b/app/api/cron/import/short/utils.ts
@@ -127,7 +127,13 @@ export const importLinksFromShort = async ({
key: true,
createdAt: true,
},
+ where: {
+ domain,
+ },
take: 5,
+ orderBy: {
+ createdAt: "desc",
+ },
},
},
});
diff --git a/app/ui/content/mdx.tsx b/app/ui/content/mdx.tsx
index 9a4c4f3875..d914a6677e 100644
--- a/app/ui/content/mdx.tsx
+++ b/app/ui/content/mdx.tsx
@@ -1,19 +1,15 @@
-"use client";
-
import Link from "next/link";
import { useMDXComponent } from "next-contentlayer/hooks";
import GithubRepo, { GithubRepoProps } from "@/components/shared/github-repo";
-import BlurImage from "#/ui/blur-image";
import MDXTweet from "#/ui/tweet";
import { Tweet as TweetProps } from "react-tweet/api";
-import useMediaQuery from "#/lib/hooks/use-media-query";
import { cn } from "#/lib/utils";
-import Zoom from "react-medium-image-zoom";
import "react-medium-image-zoom/dist/styles.css";
import { HELP_CATEGORIES, getPopularArticles } from "#/lib/constants/content";
import ArticleLink from "./article-link";
import CategoryCard from "./category-card";
import { ListChecks } from "lucide-react";
+import ZoomImage from "./zoom-image";
const CustomLink = (props: any) => {
const href = props.href;
@@ -109,7 +105,6 @@ interface MDXProps {
export function MDX({ code, images, tweets, repos, className }: MDXProps) {
const Component = useMDXComponent(code);
- const { isDesktop } = useMediaQuery();
const MDXImage = (props: any) => {
if (!images) return null;
@@ -117,24 +112,7 @@ export function MDX({ code, images, tweets, repos, className }: MDXProps) {
(image) => image.src === props.src,
)?.blurDataURL;
- return (
- <figure className="not-prose flex flex-col items-center justify-center space-y-3">
- <Zoom zoomMargin={isDesktop ? 45 : undefined}>
- <BlurImage
- {...props}
- className="rounded-lg border border-gray-200"
- placeholder="blur"
- blurDataURL={
- blurDataURL ||
- "data:image/webp;base64,AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
- }
- />
- </Zoom>
- <figcaption className="text-center text-sm italic text-gray-500">
- {props.alt}
- </figcaption>
- </figure>
- );
+ return <ZoomImage {...props} blurDataURL={blurDataURL} />;
};
const Tweet = ({ id }: { id: string }) => {
diff --git a/app/ui/content/zoom-image.tsx b/app/ui/content/zoom-image.tsx
new file mode 100644
index 0000000000..a41cd3c600
--- /dev/null
+++ b/app/ui/content/zoom-image.tsx
@@ -0,0 +1,31 @@
+"use client";
+
+import { ImageProps } from "next/image";
+import BlurImage from "#/ui/blur-image";
+import useMediaQuery from "#/lib/hooks/use-media-query";
+import Zoom from "react-medium-image-zoom";
+import "react-medium-image-zoom/dist/styles.css";
+
+export default function ZoomImage(
+ props: ImageProps & { blurDataURL?: string },
+) {
+ const { isDesktop } = useMediaQuery();
+ return (
+ <figure className="not-prose flex flex-col items-center justify-center space-y-3">
+ <Zoom zoomMargin={isDesktop ? 45 : undefined}>
+ <BlurImage
+ {...props}
+ className="rounded-lg border border-gray-200"
+ placeholder="blur"
+ blurDataURL={
+ props.blurDataURL ||
+ "data:image/webp;base64,AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA="
+ }
+ />
+ </Zoom>
+ <figcaption className="text-center text-sm italic text-gray-500">
+ {props.alt}
+ </figcaption>
+ </figure>
+ );
+}