-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1964 from dubinc/analytics-link-comments
Add link comments to Analytics tab
- Loading branch information
Showing
10 changed files
with
83 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
"use client"; | ||
|
||
import { Markdown } from "@/ui/shared/markdown"; | ||
import { Page2 } from "@dub/ui/icons"; | ||
import * as HoverCard from "@radix-ui/react-hover-card"; | ||
|
||
export function CommentsBadge({ comments }: { comments: string }) { | ||
return ( | ||
<div className="hidden sm:block"> | ||
<HoverCard.Root openDelay={100}> | ||
<HoverCard.Portal> | ||
<HoverCard.Content | ||
side="bottom" | ||
sideOffset={8} | ||
className="animate-slide-up-fade z-[99] items-center overflow-hidden rounded-xl border border-gray-200 bg-white shadow-sm" | ||
> | ||
<div className="divide-y-gray-200 divide-y text-sm"> | ||
<div className="flex items-center gap-2 px-4 py-3"> | ||
<Page2 className="size-3.5" /> | ||
<span className="text-gray-500">Link comments</span> | ||
</div> | ||
<Markdown className="max-w-[300px] whitespace-normal break-words px-5 py-3"> | ||
{comments} | ||
</Markdown> | ||
</div> | ||
</HoverCard.Content> | ||
</HoverCard.Portal> | ||
<HoverCard.Trigger asChild> | ||
<div className="rounded-full p-1.5 hover:bg-gray-100"> | ||
<Page2 className="size-3.5" /> | ||
</div> | ||
</HoverCard.Trigger> | ||
</HoverCard.Root> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"use client"; | ||
|
||
import { cn } from "@dub/utils"; | ||
import ReactMarkdown from "react-markdown"; | ||
import remarkGfm from "remark-gfm"; | ||
|
||
export function Markdown({ | ||
children, | ||
className, | ||
components, | ||
}: { | ||
children: string; | ||
className?: string; | ||
components?: any; | ||
}) { | ||
return ( | ||
<ReactMarkdown | ||
className={cn( | ||
"prose prose-sm prose-gray max-w-none p-6 transition-all", | ||
"prose-headings:leading-tight", | ||
"prose-a:font-medium prose-a:text-neutral-500 prose-a:underline-offset-4 hover:prose-a:text-black", | ||
className, | ||
)} | ||
components={{ | ||
a: ({ node, ...props }) => ( | ||
<a {...props} target="_blank" rel="noopener noreferrer" /> | ||
), | ||
...components, | ||
}} | ||
remarkPlugins={[remarkGfm] as any} | ||
> | ||
{children} | ||
</ReactMarkdown> | ||
); | ||
} |