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.

improve loading state

Steven Teyae47a6a4e6fa
diff --git a/apps/web/app/app.dub.co/embed/inline/activity.tsx b/apps/web/app/app.dub.co/embed/inline/activity.tsx
index 44d8beaedf..19849dd619 100644
--- a/apps/web/app/app.dub.co/embed/inline/activity.tsx
+++ b/apps/web/app/app.dub.co/embed/inline/activity.tsx
@@ -1,17 +1,9 @@
import { InfoTooltip, MiniAreaChart } from "@dub/ui";
import { nFormatter } from "@dub/utils";
import { fetcher } from "@dub/utils/src/functions";
-import { subDays } from "date-fns";
import { AnalyticsTimeseries } from "dub/models/components";
import useSWR from "swr";
-const TMP_CHART_DATA = [...Array(30)]
- .map((_, i) => ({
- date: subDays(new Date(), i),
- value: Math.floor(Math.random() * 100 * (30 - i)),
- }))
- .reverse();
-
export function EmbedActivity({
clicks,
leads,
@@ -65,7 +57,7 @@ export function EmbedActivity({
analytics?.map((a) => ({
date: new Date(a.start),
value: a[label.toLowerCase()],
- })) ?? TMP_CHART_DATA
+ })) ?? []
}
/>
</div>
diff --git a/apps/web/app/app.dub.co/embed/inline/hero-background.tsx b/apps/web/app/app.dub.co/embed/inline/hero-background.tsx
index 3128ef99af..6dd53cd59d 100644
--- a/apps/web/app/app.dub.co/embed/inline/hero-background.tsx
+++ b/apps/web/app/app.dub.co/embed/inline/hero-background.tsx
@@ -19,12 +19,14 @@ export function HeroBackground({
<div className="absolute inset-0 -z-[1] bg-current opacity-10" />
<div className="absolute right-4 top-4 block size-6 min-[300px]:size-10 md:hidden">
- <BlurImage
- src={logo || ""}
- alt="Program Logo"
- fill
- className="absolute object-cover object-center"
- />
+ {logo && (
+ <BlurImage
+ src={logo}
+ alt="Program Logo"
+ fill
+ className="absolute object-cover object-center"
+ />
+ )}
</div>
<svg
diff --git a/apps/web/app/app.dub.co/embed/inline/loading.tsx b/apps/web/app/app.dub.co/embed/inline/loading.tsx
new file mode 100644
index 0000000000..8f104c89d6
--- /dev/null
+++ b/apps/web/app/app.dub.co/embed/inline/loading.tsx
@@ -0,0 +1,51 @@
+import { Button, Copy, MoneyBill2, Wordmark } from "@dub/ui";
+import { HeroBackground } from "./hero-background";
+
+export default function EmbedInlineLoading() {
+ const tabs = ["Quickstart", "Sales", "Leaderboard", "FAQ"];
+ return (
+ <div className="flex min-h-screen flex-col">
+ <div className="p-5">
+ <div className="relative flex flex-col overflow-hidden rounded-lg border border-neutral-300 p-4 md:p-6">
+ <HeroBackground />
+ <span className="flex items-center gap-2 text-sm text-neutral-500">
+ <MoneyBill2 className="size-4" />
+ Refer and earn
+ </span>
+ <div className="relative mt-16 flex flex-col gap-2">
+ <div className="h-6 w-60 rounded-md bg-neutral-50" />
+ <div className="h-6 w-40 rounded-md bg-neutral-50" />
+ </div>
+ <span className="mb-1.5 mt-6 block text-sm text-neutral-800">
+ Referral link
+ </span>
+ <div className="xs:flex-row relative flex flex-col items-center gap-2">
+ <div className="xs:w-60 h-10 w-full rounded-md border border-neutral-300 bg-neutral-50" />
+ <Button
+ icon={<Copy className="size-4" />}
+ text="Copy link"
+ className="xs:w-fit"
+ disabled
+ />
+ </div>
+ <a
+ href="https://dub.partners"
+ target="_blank"
+ className="mt-4 flex items-center justify-center gap-1.5 text-neutral-500 transition-colors duration-75 hover:text-neutral-700 md:absolute md:bottom-3 md:right-3 md:mt-0 md:translate-x-0"
+ >
+ <p className="text-xs font-medium">Powered by</p>
+ <Wordmark className="h-3.5 text-neutral-900" />
+ </a>
+ </div>
+ <div className="mt-4 grid gap-2 sm:h-32 sm:grid-cols-3">
+ <div className="h-full w-full rounded-lg border border-neutral-200 bg-neutral-50 sm:col-span-2" />
+ <div className="h-full w-full rounded-lg border border-neutral-200 bg-neutral-50" />
+ </div>
+ <div className="mt-4">
+ <div className="h-10 w-full rounded-lg border border-neutral-200 bg-neutral-50" />
+ <div className="my-4 h-80 w-full rounded-lg border border-neutral-100 p-2" />
+ </div>
+ </div>
+ </div>
+ );
+}