Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ function BountySubmissionDetailsSheetContent({
</div>

<div className="sticky bottom-0 z-10 border-t border-neutral-200 bg-white">
<div className="flex items-center justify-between gap-2 border-t border-neutral-200 p-5">
<div className="flex items-center justify-between gap-2 p-5">
{submission.status === "approved" ? (
<a
href={`/${workspaceSlug}/program/commissions?partnerId=${submission.partner.id}&type=custom`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import usePartner from "@/lib/swr/use-partner";
import useWorkspace from "@/lib/swr/use-workspace";
import { EnrolledPartnerProps } from "@/lib/types";
import { useAddPartnerLinkModal } from "@/ui/partners/add-partner-link-modal";
import { Button, LoadingSpinner, Table, useTable } from "@dub/ui";
import { Button, CopyButton, LoadingSpinner, Table, useTable } from "@dub/ui";
import { cn, currencyFormatter, getPrettyUrl, nFormatter } from "@dub/utils";
import Link from "next/link";
import { useParams } from "next/navigation";
Expand Down Expand Up @@ -43,13 +43,16 @@ const PartnerLinks = ({ partner }: { partner: EnrolledPartnerProps }) => {
id: "shortLink",
header: "Link",
cell: ({ row }) => (
<Link
href={`/${slug}/links/${row.original.domain}/${row.original.key}`}
target="_blank"
className="cursor-alias font-medium text-black decoration-dotted hover:underline"
>
{getPrettyUrl(row.original.shortLink)}
</Link>
<div className="flex items-center gap-3">
<Link
href={`/${slug}/links/${row.original.domain}/${row.original.key}`}
target="_blank"
className="cursor-alias font-medium text-black decoration-dotted hover:underline"
>
{getPrettyUrl(row.original.shortLink)}
</Link>
<CopyButton value={row.original.shortLink} className="p-0.5" />
</div>
),
},
{
Expand Down Expand Up @@ -81,7 +84,7 @@ const PartnerLinks = ({ partner }: { partner: EnrolledPartnerProps }) => {
),
},
{
header: "Sales",
header: "Conversions",
size: 1,
minSize: 1,
cell: ({ row }) => (
Expand All @@ -90,7 +93,7 @@ const PartnerLinks = ({ partner }: { partner: EnrolledPartnerProps }) => {
target="_blank"
className="block w-full cursor-alias decoration-dotted hover:underline"
>
{nFormatter(row.original.sales)}
{nFormatter(row.original.conversions)}
</Link>
),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,10 @@ export function PartnersTable() {
error,
isLoading,
} = useSWR<EnrolledPartnerProps[]>(
`/api/partners${getQueryString(
{
workspaceId,
includeExpandedFields: true,
},
{ exclude: ["partnerId"] },
)}`,
`/api/partners${getQueryString({
workspaceId,
includeExpandedFields: true,
})}`,
fetcher,
{
keepPreviousData: true,
Expand Down Expand Up @@ -394,8 +391,8 @@ export function PartnersTable() {
onRemove={onRemove}
/>
<SearchBoxPersisted
placeholder="Search by name, email, or link"
inputClassName="md:w-72"
placeholder="Search by ID, name, email, or link"
inputClassName="md:w-[19rem]"
/>
</div>
<AnimatedSizeContainer height>
Expand Down
4 changes: 2 additions & 2 deletions apps/web/lib/actions/partners/ban-partner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const banPartnerAction = authActionClient

const supportEmail = program.supportEmail || "[email protected]";

// Delete links from cache
// Expire links from cache
const links = await prisma.link.findMany({
where,
select: {
Expand All @@ -105,7 +105,7 @@ export const banPartnerAction = authActionClient
},
});

await linkCache.deleteMany(links);
await linkCache.expireMany(links);

await Promise.allSettled([
sendEmail({
Expand Down
2 changes: 1 addition & 1 deletion apps/web/lib/actions/partners/bulk-ban-partners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export const bulkBanPartnersAction = authActionClient
);

// Expire links from cache
await linkCache.deleteMany(
await linkCache.expireMany(
programEnrollments.flatMap(({ links }) => links),
);

Expand Down
4 changes: 2 additions & 2 deletions apps/web/lib/actions/partners/revoke-program-invite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ export const revokeProgramInviteAction = authActionClient

waitUntil(
Promise.all([
// Delete the links from Redis
linkCache.deleteMany(partnerLinks),
// Expire the links from Redis
linkCache.expireMany(partnerLinks),

// Record the links deletion in Tinybird
recordLinkTB(
Expand Down
4 changes: 2 additions & 2 deletions apps/web/lib/actions/partners/unban-partner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ export const unbanPartnerAction = authActionClient
});

await Promise.allSettled([
// Delete links from cache
linkCache.deleteMany(links),
// Expire links from cache
linkCache.expireMany(links),

recordAuditLog({
workspaceId: workspace.id,
Expand Down
1 change: 1 addition & 0 deletions apps/web/lib/api/partners/get-partner-for-program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export async function getPartnerForProgram({
'url', l.url,
'clicks', CAST(l.clicks AS SIGNED),
'leads', CAST(l.leads AS SIGNED),
'conversions', CAST(l.conversions AS SIGNED),
'sales', CAST(l.sales AS SIGNED),
'saleAmount', CAST(l.saleAmount AS SIGNED)
),
Expand Down
3 changes: 2 additions & 1 deletion apps/web/lib/api/partners/get-partners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ export async function getPartners(filters: PartnerFilters) {
${
search
? Prisma.sql`AND (
LOWER(p.name) LIKE LOWER(${`%${search}%`})
LOWER(p.id) LIKE LOWER(${`%${search}%`})
OR LOWER(p.name) LIKE LOWER(${`%${search}%`})
OR LOWER(p.email) LIKE LOWER(${`%${search}%`})
OR EXISTS (
SELECT 1 FROM Link searchLink
Expand Down
2 changes: 1 addition & 1 deletion apps/web/lib/zod/schemas/partners.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ export const getPartnersQuerySchema = z
.string()
.optional()
.describe(
"A search query to filter partners by name, email, or tenantId.",
"A search query to filter partners by ID, name, email, or link.",
)
.openapi({ example: "john" }),
includeExpandedFields: booleanQuerySchema
Expand Down
1 change: 1 addition & 0 deletions apps/web/lib/zod/schemas/programs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ export const ProgramPartnerLinkSchema = LinkSchema.pick({
url: true,
clicks: true,
leads: true,
conversions: true,
sales: true,
saleAmount: true,
});
Expand Down