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.

Add preview sidebar

Tim Wilsonaa47523f3334
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/links/[...link]/page-client.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/links/[...link]/page-client.tsx
index 98b8bb4c54..02d169d26e 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/links/[...link]/page-client.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/links/[...link]/page-client.tsx
@@ -17,8 +17,11 @@ import {
DraftControls,
DraftControlsHandle,
} from "@/ui/modals/link-builder/draft-controls";
+import { LinkPreview } from "@/ui/modals/link-builder/link-preview";
import { OptionsList } from "@/ui/modals/link-builder/options-list";
+import { QRCodePreview } from "@/ui/modals/link-builder/qr-code-preview";
import { TagSelect } from "@/ui/modals/link-builder/tag-select";
+import { useMetatags } from "@/ui/modals/link-builder/use-metatags";
import { cn } from "@dub/utils";
import { useCallback, useRef } from "react";
import { useFormContext } from "react-hook-form";
@@ -61,6 +64,8 @@ function LinkBuilder({ link }: { link: ExpandedLinkProps }) {
onSuccess: onSubmitSuccess,
});
+ useMetatags();
+
return (
<div className="flex min-h-[calc(100vh-8px)] flex-col rounded-t-[inherit] bg-white">
<div className="py-2 pl-4 pr-5">
@@ -99,9 +104,13 @@ function LinkBuilder({ link }: { link: ExpandedLinkProps }) {
</div>
</div>
</div>
- <div className="bg-neutral-50">
- WIP
- <div className="h-96 w-4 border border-red-500" />
+ <div className="divide-y divide-neutral-200 bg-neutral-50">
+ <div className="px-4 py-6">
+ <QRCodePreview />
+ </div>
+ <div className="px-4 py-6">
+ <LinkPreview />
+ </div>
</div>
</form>
</div>
diff --git a/apps/web/ui/modals/link-builder/link-preview.tsx b/apps/web/ui/modals/link-builder/link-preview.tsx
index aa88fadcad..46f86ab819 100644
--- a/apps/web/ui/modals/link-builder/link-preview.tsx
+++ b/apps/web/ui/modals/link-builder/link-preview.tsx
@@ -310,7 +310,7 @@ function DefaultOGPreview({ title, description, children }: OGPreviewProps) {
{children}
</div>
<ReactTextareaAutosize
- className="mt-4 line-clamp-2 w-full resize-none border-none p-0 text-xs font-medium text-neutral-700 outline-none focus:ring-0"
+ className="mt-4 line-clamp-2 w-full resize-none border-none bg-transparent p-0 text-xs font-medium text-neutral-700 outline-none focus:ring-0"
value={title || "Add a title..."}
maxRows={2}
onChange={(e) => {
@@ -321,7 +321,7 @@ function DefaultOGPreview({ title, description, children }: OGPreviewProps) {
}}
/>
<ReactTextareaAutosize
- className="mt-1.5 line-clamp-2 w-full resize-none border-none p-0 text-xs text-neutral-700/80 outline-none focus:ring-0"
+ className="mt-1.5 line-clamp-2 w-full resize-none border-none bg-transparent p-0 text-xs text-neutral-700/80 outline-none focus:ring-0"
value={description || "Add a description..."}
maxRows={2}
onChange={(e) => {
diff --git a/apps/web/ui/modals/link-builder/use-metatags.ts b/apps/web/ui/modals/link-builder/use-metatags.ts
index 5ae504726d..a86f2e6a5b 100644
--- a/apps/web/ui/modals/link-builder/use-metatags.ts
+++ b/apps/web/ui/modals/link-builder/use-metatags.ts
@@ -5,7 +5,7 @@ import { useFormContext, useWatch } from "react-hook-form";
import { useDebounce } from "use-debounce";
import { LinkFormData } from ".";
-export function useMetatags({ enabled }: { enabled: boolean }) {
+export function useMetatags({ enabled = true }: { enabled?: boolean } = {}) {
const { control, setValue } = useFormContext<LinkFormData>();
const [url, password, proxy, title, description, image] = useWatch({
control,