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.

small fixes

Kiran K2253f73b1b1e
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/invite-partner-sheet.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/invite-partner-sheet.tsx
index 3572e76c8c..43ab50e8a9 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/invite-partner-sheet.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/invite-partner-sheet.tsx
@@ -24,7 +24,7 @@ import { cn } from "@dub/utils/src";
import { motion } from "framer-motion";
import { ChevronDown } from "lucide-react";
import { useAction } from "next-safe-action/hooks";
-import { Dispatch, memo, SetStateAction, useMemo, useState } from "react";
+import { Dispatch, memo, SetStateAction, useState } from "react";
import { useForm } from "react-hook-form";
import { toast } from "sonner";
import { z } from "zod";
@@ -53,13 +53,6 @@ function InvitePartnerSheetContent({ setIsOpen }: InvitePartnerSheetProps) {
const [name, email, linkId] = watch(["name", "email", "linkId"]);
- // sort rewards by event
- // const sortedRewards = useMemo(() => {
- // return rewards?.sort((a, b) => {
- // return a.event.localeCompare(b.event);
- // });
- // }, [rewards]);
-
const { executeAsync, isPending } = useAction(invitePartnerAction, {
onSuccess: async () => {
toast.success("Invitation sent to partner!");
diff --git a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/use-partner-filters.tsx b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/use-partner-filters.tsx
index 4879cc28ff..6b4bbe4e57 100644
--- a/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/use-partner-filters.tsx
+++ b/apps/web/app/app.dub.co/(dashboard)/[slug]/(ee)/program/partners/use-partner-filters.tsx
@@ -88,48 +88,64 @@ export function usePartnerFilters(extraSearchParams: Record<string, string>) {
right: nFormatter(_count, { full: true }),
})) ?? [],
},
- {
- key: "saleRewardId",
- icon: InvoiceDollar,
- label: "Sale reward",
- options:
- saleRewardsCount?.map((reward) => {
- return {
- value: reward.id,
- label: reward.name || formatRewardDescription({ reward }),
- icon: <InvoiceDollar className="size-4 bg-transparent" />,
- right: nFormatter(reward.partnersCount, { full: true }),
- };
- }) ?? [],
- },
- {
- key: "leadRewardId",
- icon: UserPlus,
- label: "Lead reward",
- options:
- leadRewardsCount?.map((reward) => {
- return {
- value: reward.id,
- label: reward.name || formatRewardDescription({ reward }),
- icon: <UserPlus className="size-4 bg-transparent" />,
- right: nFormatter(reward.partnersCount, { full: true }),
- };
- }) ?? [],
- },
- {
- key: "clickRewardId",
- icon: CursorRays,
- label: "Click reward",
- options:
- clickRewardsCount?.map((reward) => {
- return {
- value: reward.id,
- label: reward.name || formatRewardDescription({ reward }),
- icon: <CursorRays className="size-4 bg-transparent" />,
- right: nFormatter(reward.partnersCount, { full: true }),
- };
- }) ?? [],
- },
+
+ ...(saleRewardsCount && saleRewardsCount.length > 0
+ ? [
+ {
+ key: "saleRewardId",
+ icon: InvoiceDollar,
+ label: "Sale reward",
+ options:
+ saleRewardsCount?.map((reward) => {
+ return {
+ value: reward.id,
+ label: reward.name || formatRewardDescription({ reward }),
+ icon: <InvoiceDollar className="size-4 bg-transparent" />,
+ right: nFormatter(reward.partnersCount, { full: true }),
+ };
+ }) ?? [],
+ },
+ ]
+ : []),
+
+ ...(leadRewardsCount && leadRewardsCount.length > 0
+ ? [
+ {
+ key: "leadRewardId",
+ icon: UserPlus,
+ label: "Lead reward",
+ options:
+ leadRewardsCount?.map((reward) => {
+ return {
+ value: reward.id,
+ label: reward.name || formatRewardDescription({ reward }),
+ icon: <UserPlus className="size-4 bg-transparent" />,
+ right: nFormatter(reward.partnersCount, { full: true }),
+ };
+ }) ?? [],
+ },
+ ]
+ : []),
+
+ ...(clickRewardsCount && clickRewardsCount.length > 0
+ ? [
+ {
+ key: "clickRewardId",
+ icon: CursorRays,
+ label: "Click reward",
+ options:
+ clickRewardsCount?.map((reward) => {
+ return {
+ value: reward.id,
+ label: reward.name || formatRewardDescription({ reward }),
+ icon: <CursorRays className="size-4 bg-transparent" />,
+ right: nFormatter(reward.partnersCount, { full: true }),
+ };
+ }) ?? [],
+ },
+ ]
+ : []),
+
{
key: "status",
icon: CircleDotted,