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.

finalize changes

Steven Tey03ef66b28578
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/resources/page-client.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/resources/page-client.tsx
index 0b8dd205d2..e52801725b 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/resources/page-client.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/resources/page-client.tsx
@@ -6,7 +6,12 @@ import { ResourceCard } from "@/ui/partners/resources/resource-card";
import { ResourceSection } from "@/ui/partners/resources/resource-section";
import { AnimatedEmptyState } from "@/ui/shared/animated-empty-state";
import { FileContent, FileZip2, Link4, Palette2, Post } from "@dub/ui/icons";
-import { formatFileSize, getApexDomain, GOOGLE_FAVICON_URL } from "@dub/utils";
+import {
+ formatFileSize,
+ getApexDomain,
+ getPrettyUrl,
+ GOOGLE_FAVICON_URL,
+} from "@dub/utils";
const emptyStateIcons = [Post, Palette2, FileZip2, Link4];
@@ -97,8 +102,8 @@ export function ResourcesPageClient() {
</div>
}
title={link.name}
- description={link.url}
- copyText={link.url}
+ description={getPrettyUrl(link.url)}
+ visitUrl={link.url}
/>
))}
</ResourceSection>
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-brand-assets/index.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-brand-assets/index.tsx
index 1d7af7518e..cd271212ac 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-brand-assets/index.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/resources/program-brand-assets/index.tsx
@@ -10,6 +10,7 @@ import {
capitalize,
formatFileSize,
getApexDomain,
+ getPrettyUrl,
GOOGLE_FAVICON_URL,
} from "@dub/utils";
import { useAction } from "next-safe-action/hooks";
@@ -190,7 +191,7 @@ export function ProgramBrandAssets() {
</div>
}
title={link.name}
- description={link.url}
+ description={getPrettyUrl(link.url)}
visitUrl={link.url}
copyText={link.url}
onDelete={() => handleDelete("link", link.id)}
diff --git a/apps/web/ui/partners/resources/resource-card.tsx b/apps/web/ui/partners/resources/resource-card.tsx
index b1fb654237..56d35cf403 100644
--- a/apps/web/ui/partners/resources/resource-card.tsx
+++ b/apps/web/ui/partners/resources/resource-card.tsx
@@ -69,7 +69,7 @@ export function ResourceCard({
</div>
</div>
<div className="relative">
- {onDelete || (downloadUrl && copyText) || visitUrl ? (
+ {onDelete || (downloadUrl && copyText && visitUrl) ? (
<Popover
content={
<div className="grid w-full grid-cols-1 gap-px p-2 sm:w-48">
@@ -94,6 +94,21 @@ export function ResourceCard({
</a>
)}
+ {copyText && (
+ <Button
+ text={`Copy ${resourceType}`}
+ variant="outline"
+ onClick={() => {
+ copyToClipboard(copyText, {
+ onSuccess: () => toast.success("Copied to clipboard"),
+ });
+ setOpenPopover(false);
+ }}
+ icon={<Copy className="size-4" />}
+ className="h-9 justify-start px-2 font-medium"
+ />
+ )}
+
{visitUrl && (
<a
href={visitUrl}
@@ -106,24 +121,10 @@ export function ResourceCard({
onClick={() => setOpenPopover(false)}
>
<Link className="size-4" />
- Visit
+ Visit {resourceType}
</a>
)}
- {copyText && (
- <Button
- text="Copy"
- variant="outline"
- onClick={() => {
- copyToClipboard(copyText, {
- onSuccess: () => toast.success("Copied to clipboard"),
- });
- setOpenPopover(false);
- }}
- icon={<Copy className="size-4" />}
- className="h-9 justify-start px-2 font-medium"
- />
- )}
{onDelete && (
<Button
text={`Delete ${resourceType}`}
@@ -220,6 +221,17 @@ export function ResourceCard({
onClick={() => copyToClipboard(copyText)}
/>
)}
+ {visitUrl && (
+ <a href={visitUrl} target="_blank" rel="noopener noreferrer">
+ <Button
+ icon={<Link className="size-4" />}
+ text="Visit URL"
+ variant="secondary"
+ className="h-8 px-3"
+ onClick={() => setOpenPopover(false)}
+ />
+ </a>
+ )}
</>
)}
</div>