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.

fix ts errors

Steven Tey90fa79b09361
diff --git a/apps/web/app/api/admin/ban/route.ts b/apps/web/app/api/admin/ban/route.ts
index 7f422d9bdb..fb222ee1f4 100644
--- a/apps/web/app/api/admin/ban/route.ts
+++ b/apps/web/app/api/admin/ban/route.ts
@@ -31,6 +31,7 @@ export const POST = withAdmin(async ({ req }) => {
slug: true,
logo: true,
stripeId: true,
+ referralLinkId: true,
},
},
},
@@ -44,14 +45,7 @@ export const POST = withAdmin(async ({ req }) => {
waitUntil(
Promise.allSettled([
- ...user.projects.map(({ project }) =>
- deleteWorkspaceAdmin({
- id: project.id,
- slug: project.slug,
- stripeId: project.stripeId || null,
- logo: project.logo || null,
- }),
- ),
+ ...user.projects.map(({ project }) => deleteWorkspaceAdmin(project)),
// delete user
prisma.user.delete({
where: {
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/page.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/page.tsx
index abdb7e51fb..313e0c3db5 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/page.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/page.tsx
@@ -130,7 +130,7 @@ const placeholderEvents = {
country: "US",
}) as z.infer<typeof clickEventEnrichedSchema>,
),
- leads: [...Array(4)].map(
+ leads: [...Array(8)].map(
(_, idx) =>
({
timestamp: subDays(new Date(), idx).toISOString(),
@@ -142,7 +142,7 @@ const placeholderEvents = {
country: "US",
}) as z.infer<typeof leadEventEnrichedSchema>,
),
- sales: [...Array(3)].map(
+ sales: [...Array(8)].map(
(_, idx) =>
({
timestamp: subDays(new Date(), idx).toISOString(),
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/stats.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/stats.tsx
index d2b0730480..bf959ebc55 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/stats.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/settings/referrals/stats.tsx
@@ -6,7 +6,12 @@ import {
REFERRAL_CLICKS_QUOTA_BONUS_MAX,
REFERRAL_REVENUE_SHARE,
} from "@/lib/referrals/constants";
-import { Gauge, MiniAreaChart, StatCard, StatCardSkeleton } from "@dub/blocks";
+import {
+ Gauge,
+ MiniAreaChart,
+ StatsCard,
+ StatsCardSkeleton,
+} from "@dub/blocks";
import { CountingNumbers } from "@dub/ui";
import { User } from "@dub/ui/src/icons";
import {
@@ -20,7 +25,7 @@ export function Stats({ slug }: { slug: string }) {
<div className="grid grid-cols-1 gap-x-4 gap-y-4 md:grid-cols-2 lg:gap-x-6">
<Suspense
fallback={[...Array(2)].map(() => (
- <StatCardSkeleton />
+ <StatsCardSkeleton />
))}
>
<StatsInner slug={slug} />
@@ -35,12 +40,12 @@ async function StatsInner({ slug }: { slug: string }) {
if (!link) {
return (
<>
- <StatCard label="Affiliate Earnings" demo>
+ <StatsCard label="Affiliate Earnings" demo>
$60
- </StatCard>
- <StatCard label="Clicks Quota Earned" demo>
+ </StatsCard>
+ <StatsCard label="Clicks Quota Earned" demo>
500
- </StatCard>
+ </StatsCard>
</>
);
}
@@ -50,15 +55,15 @@ async function StatsInner({ slug }: { slug: string }) {
return (
<>
- <StatCard
+ <StatsCard
label="Affiliate Earnings"
graphic={<MiniAreaChart data={sales} />}
>
<CountingNumbers prefix="$" fullNumber>
{(totalSales / 100) * REFERRAL_REVENUE_SHARE}
</CountingNumbers>
- </StatCard>
- <StatCard
+ </StatsCard>
+ <StatsCard
label="Clicks Quota Earned"
graphic={
<Gauge
@@ -73,14 +78,14 @@ async function StatsInner({ slug }: { slug: string }) {
}
>
<CountingNumbers fullNumber>{clicksQuotaBonus}</CountingNumbers>
- </StatCard>
+ </StatsCard>
</>
);
} catch (e) {
console.error("Failed to load referral stats", e);
}
- return [...Array(2)].map(() => <StatCardSkeleton error />);
+ return [...Array(2)].map(() => <StatsCardSkeleton error />);
}
async function loadData(linkId: string) {
diff --git a/packages/blocks/src/index.ts b/packages/blocks/src/index.ts
index c5ec9f45e1..3a63f7417a 100644
--- a/packages/blocks/src/index.ts
+++ b/packages/blocks/src/index.ts
@@ -6,4 +6,4 @@ export * from "./event-list";
export * from "./gauge";
export * from "./mini-area-chart";
export * from "./pagination-controls";
-export * from "./stat-card";
+export * from "./stats-card";
diff --git a/packages/blocks/src/stat-card.tsx b/packages/blocks/src/stats-card.tsx
similarity index 93%
rename from packages/blocks/src/stat-card.tsx
rename to packages/blocks/src/stats-card.tsx
index 2b81103204..b84bb94360 100644
--- a/packages/blocks/src/stat-card.tsx
+++ b/packages/blocks/src/stats-card.tsx
@@ -4,7 +4,7 @@ import { PropsWithChildren, ReactNode } from "react";
const wrapperClassName =
"flex justify-between gap-4 rounded-xl border border-gray-200 bg-white px-5 py-4 text-left";
-export function StatCard({
+export function StatsCard({
label,
demo,
graphic,
@@ -38,7 +38,7 @@ export function StatCard({
);
}
-export function StatCardSkeleton({ error }: { error?: boolean }) {
+export function StatsCardSkeleton({ error }: { error?: boolean }) {
return (
<div className={wrapperClassName}>
{error ? (