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 paste URL image feature (fixes #165)

Steven Tey84ab4a011e50
diff --git a/app/dub.sh/metatags/page.tsx b/app/dub.sh/metatags/page.tsx
index db1910cefd..e2518eebe0 100644
--- a/app/dub.sh/metatags/page.tsx
+++ b/app/dub.sh/metatags/page.tsx
@@ -38,9 +38,7 @@ export default function Metatags() {
and open-source.
</h2>
- <Suspense>
- <MetatagsContent />
- </Suspense>
+ <MetatagsContent />
<a
href="https://dub.sh/metatags-code"
diff --git a/app/ui/modals/add-edit-link-modal/og-section.tsx b/app/ui/modals/add-edit-link-modal/og-section.tsx
index ec5a1ce52e..3770f27e4e 100644
--- a/app/ui/modals/add-edit-link-modal/og-section.tsx
+++ b/app/ui/modals/add-edit-link-modal/og-section.tsx
@@ -97,7 +97,23 @@ export default function OGSection({
<div>
<div className="flex items-center justify-between">
<p className="block text-sm font-medium text-gray-700">Image</p>
- {fileError && <p className="text-sm text-red-500">{fileError}</p>}
+ {fileError ? (
+ <p className="text-sm text-red-500">{fileError}</p>
+ ) : (
+ <button
+ className="text-sm text-gray-500"
+ type="button"
+ onClick={() => {
+ const image = window.prompt(
+ "Paste a URL to an image (max 5MB)",
+ "https://",
+ );
+ setData((prev) => ({ ...prev, image }));
+ }}
+ >
+ Paste a URL instead
+ </button>
+ )}
</div>
<label
htmlFor={`image-${randomIdx}`}
@@ -174,7 +190,7 @@ export default function OGSection({
Drag and drop or click to upload.
</p>
<p className="mt-2 text-center text-sm text-gray-500">
- Recommended: 1200 x 627 pixels
+ Recommended: 1200 x 630 pixels (max 5MB)
</p>
<span className="sr-only">OG image upload</span>
</div>
diff --git a/components/app/modals/add-edit-link-modal/og-section.tsx b/components/app/modals/add-edit-link-modal/og-section.tsx
index 81127b03ce..2474322295 100644
--- a/components/app/modals/add-edit-link-modal/og-section.tsx
+++ b/components/app/modals/add-edit-link-modal/og-section.tsx
@@ -95,7 +95,23 @@ export default function OGSection({
<div>
<div className="flex items-center justify-between">
<p className="block text-sm font-medium text-gray-700">Image</p>
- {fileError && <p className="text-sm text-red-500">{fileError}</p>}
+ {fileError ? (
+ <p className="text-sm text-red-500">{fileError}</p>
+ ) : (
+ <button
+ className="text-sm text-gray-500"
+ type="button"
+ onClick={() => {
+ const image = window.prompt(
+ "Paste a URL to an image (max 5MB)",
+ "https://",
+ );
+ setData((prev) => ({ ...prev, image }));
+ }}
+ >
+ Paste a URL instead
+ </button>
+ )}
</div>
<label
htmlFor="image"
@@ -172,7 +188,7 @@ export default function OGSection({
Drag and drop or click to upload.
</p>
<p className="mt-2 text-center text-sm text-gray-500">
- Recommended: 1200 x 627 pixels
+ Recommended: 1200 x 630 pixels (max 5MB)
</p>
<span className="sr-only">OG image upload</span>
</div>