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.

eligiblePayoutsCount

Steven Tey8e3b36204694
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-tasks.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-tasks.tsx
index d36a0c51d8..506760478b 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-tasks.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/overview-tasks.tsx
@@ -14,9 +14,13 @@ export function OverviewTasks() {
number | undefined
>({ status: "pending", ignoreParams: true });
- const { payoutsCount, loading: payoutsCountLoading } = usePayoutsCount<
- number | undefined
- >({ status: "pending" });
+ const {
+ payoutsCount: eligiblePayoutsCount,
+ loading: eligiblePayoutsLoading,
+ } = usePayoutsCount<number | undefined>({
+ eligibility: "eligible",
+ status: "pending",
+ });
const tasks = useMemo(
() => [
@@ -30,9 +34,9 @@ export function OverviewTasks() {
{
icon: MoneyBills2,
label: "Confirm pending payouts",
- count: payoutsCount,
- href: `/${slug}/program/payouts?status=pending`,
- loading: payoutsCountLoading,
+ count: eligiblePayoutsCount,
+ href: `/${slug}/program/payouts?status=pending&sortBy=amount`,
+ loading: eligiblePayoutsLoading,
},
{
icon: ShieldKeyhole,
@@ -46,8 +50,8 @@ export function OverviewTasks() {
slug,
partnersCount,
partnersCountLoading,
- payoutsCount,
- payoutsCountLoading,
+ eligiblePayoutsCount,
+ eligiblePayoutsLoading,
],
);
@@ -77,7 +81,7 @@ export function OverviewTasks() {
className={cn(
"flex h-8 items-center rounded-lg bg-black/5 px-4 text-neutral-400",
task.loading && "w-10 animate-pulse",
- task.count && "bg-blue-100 text-blue-600",
+ task.count && task.count > 0 && "bg-blue-100 text-blue-600",
)}
>
{task.count ?? (task.loading ? "" : "-")}
diff --git a/apps/web/lib/actions/partners/confirm-payouts.ts b/apps/web/lib/actions/partners/confirm-payouts.ts
index 871e1cedc8..087b89989e 100644
--- a/apps/web/lib/actions/partners/confirm-payouts.ts
+++ b/apps/web/lib/actions/partners/confirm-payouts.ts
@@ -15,7 +15,6 @@ const confirmPayoutsSchema = z.object({
const allowedPaymentMethods = ["us_bank_account", "card", "link"];
-// Confirm payouts
export const confirmPayoutsAction = authActionClient
.schema(confirmPayoutsSchema)
.action(async ({ parsedInput, ctx }) => {
diff --git a/apps/web/lib/swr/use-payouts-count.ts b/apps/web/lib/swr/use-payouts-count.ts
index 3a13472a90..1856428310 100644
--- a/apps/web/lib/swr/use-payouts-count.ts
+++ b/apps/web/lib/swr/use-payouts-count.ts
@@ -30,6 +30,6 @@ export default function usePayoutsCount<T>(
return {
payoutsCount: payoutsCount as T,
error,
- loading: !payoutsCount && !error,
+ loading: payoutsCount === undefined && !error,
};
}