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 bounty card hover (only show if href)

Steven Teyf4c9e5051c03
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/[bountyId]/page-client.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/[bountyId]/page-client.tsx
deleted file mode 100644
index 87b8487f32..0000000000
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/[bountyId]/page-client.tsx
+++ /dev/null
@@ -1,142 +0,0 @@
-"use client";
-
-import usePartnerBounty from "@/lib/swr/use-partner-bounty";
-import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";
-import { BountyDescription } from "@/ui/partners/bounties/bounty-description";
-import {
- PerformanceBountyProgress,
- SubmissionBountyProgress,
-} from "@/ui/partners/bounties/bounty-performance";
-import { BountyRewardCriteria } from "@/ui/partners/bounties/bounty-reward-criteria";
-import { BountySubmissionRequirements } from "@/ui/partners/bounties/bounty-submission-requirements";
-import { ChevronRight, Trophy } from "@dub/ui";
-import { cn, truncate } from "@dub/utils";
-import Link from "next/link";
-import { redirect, useParams } from "next/navigation";
-import {
- BountyRewardsTable,
- PartnerBountyCard,
- PartnerBountyCardSkeleton,
-} from "../bounty-card";
-import { BountySubmissionsTable } from "./bounty-submissions-table";
-
-export function PartnerBountyPageClient() {
- const { programSlug } = useParams<{ programSlug: string }>();
- const { bounty, isLoading } = usePartnerBounty();
-
- if (!bounty && !isLoading) {
- redirect(`/programs/${programSlug}/bounties`);
- }
-
- return (
- <PageWidthWrapper className="flex flex-col gap-6 pb-10">
- <div className="@3xl/page:grid-cols-[minmax(440px,1fr)_minmax(0,360px)] grid grid-cols-1 gap-6">
- <div className="@3xl/page:contents flex flex-col gap-6">
- {isLoading ? (
- <PartnerBountyCardSkeleton />
- ) : bounty ? (
- <div className="@3xl/page:col-start-2 @3xl/page:row-start-1 @3xl/page:w-[360px] @3xl/page:shrink-0 flex w-full flex-col gap-4">
- <PartnerBountyCard
- bounty={bounty}
- showFullTitle
- hideFooter
- showRewards
- />
-
- <BountyRewardsTable
- bounty={bounty}
- programSlug={programSlug}
- className="@3xl/page:hidden"
- />
- </div>
- ) : null}
- </div>
-
- <div className="@3xl/page:col-start-1 @3xl/page:row-start-1 flex flex-col gap-6">
- {isLoading ? (
- <BountyDetailsProgressSkeleton />
- ) : bounty ? (
- <>
- <div className="flex flex-col gap-3">
- <h2 className="text-content-emphasis text-lg font-semibold leading-7 tracking-[-0.36px]">
- Progress
- </h2>
- <div className="border-border-subtle flex w-full flex-col gap-4 rounded-xl border bg-white px-5 pb-4 pt-6">
- {bounty.type === "performance" ? (
- <PerformanceBountyProgress
- bounty={bounty}
- labelClassName="text-base"
- />
- ) : (
- <SubmissionBountyProgress
- bounty={bounty}
- labelClassName="text-base"
- />
- )}
- </div>
- </div>
-
- {bounty.type === "performance" ? null : (
- // (
- // <BountyPerformanceSection bounty={bounty} />
- // )
- <BountySubmissionsTable bounty={bounty} />
- )}
-
- <div className="flex max-w-[700px] flex-col gap-6 text-sm">
- <BountySubmissionRequirements bounty={bounty} />
- <BountyRewardCriteria bounty={bounty} />
- <BountyDescription bounty={bounty} />
- </div>
- </>
- ) : null}
- </div>
- </div>
- </PageWidthWrapper>
- );
-}
-
-function BountyDetailsProgressSkeleton() {
- return (
- <div className="flex flex-col gap-3">
- <div className="h-7 w-20 animate-pulse rounded-md bg-neutral-200" />
- <div className="border-border-subtle flex flex-col gap-4 rounded-xl border bg-white px-5 pb-4 pt-6">
- <div className="h-1 w-full animate-pulse rounded-full bg-neutral-200" />
- <div className="flex gap-1">
- <div className="h-6 w-8 animate-pulse rounded bg-neutral-200" />
- <div className="h-6 w-6 animate-pulse rounded bg-neutral-200" />
- <div className="h-6 w-24 animate-pulse rounded bg-neutral-200" />
- </div>
- </div>
- </div>
- );
-}
-
-export function PartnerBountyPageHeader() {
- const { programSlug } = useParams<{ programSlug: string }>();
- const { bounty } = usePartnerBounty();
-
- return (
- <div className="flex items-center gap-1.5">
- <Link
- href={`/programs/${programSlug}/bounties`}
- aria-label="Back to bounties"
- title="Back to bounties"
- className={cn(
- "bg-bg-subtle flex size-8 shrink-0 items-center justify-center rounded-lg",
- "hover:bg-bg-emphasis transition-[transform,background-color] duration-150 active:scale-95",
- )}
- >
- <Trophy className="size-4" />
- </Link>
- <ChevronRight className="text-content-muted size-2.5 shrink-0 [&_*]:stroke-2" />
- <div className="min-w-0 truncate">
- {bounty ? (
- truncate(bounty.name, 70)
- ) : (
- <div className="h-6 w-48 animate-pulse rounded-md bg-neutral-200" />
- )}
- </div>
- </div>
- );
-}
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/[bountyId]/page.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/[bountyId]/page.tsx
index 8cf6cab23a..d9e4c5ee47 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/[bountyId]/page.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/[bountyId]/page.tsx
@@ -1,13 +1,145 @@
+"use client";
+
+import usePartnerBounty from "@/lib/swr/use-partner-bounty";
import { PageContent } from "@/ui/layout/page-content";
+import { PageWidthWrapper } from "@/ui/layout/page-width-wrapper";
+import { BountyDescription } from "@/ui/partners/bounties/bounty-description";
+import {
+ PerformanceBountyProgress,
+ SubmissionBountyProgress,
+} from "@/ui/partners/bounties/bounty-performance";
+import { BountyRewardCriteria } from "@/ui/partners/bounties/bounty-reward-criteria";
+import { BountySubmissionRequirements } from "@/ui/partners/bounties/bounty-submission-requirements";
+import { ChevronRight, Trophy } from "@dub/ui";
+import { cn, truncate } from "@dub/utils";
+import Link from "next/link";
+import { redirect, useParams } from "next/navigation";
import {
- PartnerBountyPageClient,
- PartnerBountyPageHeader,
-} from "./page-client";
+ BountyRewardsTable,
+ PartnerBountyCard,
+ PartnerBountyCardSkeleton,
+} from "../bounty-card";
+import { BountySubmissionsTable } from "./bounty-submissions-table";
export default function PartnerBountyPage() {
+ const { programSlug } = useParams<{ programSlug: string }>();
+ const { bounty, isLoading } = usePartnerBounty();
+
+ if (!bounty && !isLoading) {
+ redirect(`/programs/${programSlug}/bounties`);
+ }
+
return (
<PageContent title={<PartnerBountyPageHeader />}>
- <PartnerBountyPageClient />
+ <PageWidthWrapper className="flex flex-col gap-6 pb-10">
+ <div className="@3xl/page:grid-cols-[minmax(440px,1fr)_minmax(0,360px)] grid grid-cols-1 gap-6">
+ <div className="@3xl/page:contents flex flex-col gap-6">
+ {isLoading ? (
+ <PartnerBountyCardSkeleton />
+ ) : bounty ? (
+ <div className="@3xl/page:col-start-2 @3xl/page:row-start-1 @3xl/page:w-[360px] @3xl/page:shrink-0 flex w-full flex-col gap-4">
+ <PartnerBountyCard
+ bounty={bounty}
+ showFullTitle
+ hideFooter
+ showRewards
+ />
+
+ <BountyRewardsTable
+ bounty={bounty}
+ programSlug={programSlug}
+ className="@3xl/page:hidden"
+ />
+ </div>
+ ) : null}
+ </div>
+
+ <div className="@3xl/page:col-start-1 @3xl/page:row-start-1 flex flex-col gap-6">
+ {isLoading ? (
+ <BountyDetailsProgressSkeleton />
+ ) : bounty ? (
+ <>
+ <div className="flex flex-col gap-3">
+ <h2 className="text-content-emphasis text-lg font-semibold leading-7 tracking-[-0.36px]">
+ Progress
+ </h2>
+ <div className="border-border-subtle flex w-full flex-col gap-4 rounded-xl border bg-white px-5 pb-4 pt-6">
+ {bounty.type === "performance" ? (
+ <PerformanceBountyProgress
+ bounty={bounty}
+ labelClassName="text-base"
+ />
+ ) : (
+ <SubmissionBountyProgress
+ bounty={bounty}
+ labelClassName="text-base"
+ />
+ )}
+ </div>
+ </div>
+
+ {bounty.type === "performance" ? null : (
+ // (
+ // <BountyPerformanceSection bounty={bounty} />
+ // )
+ <BountySubmissionsTable bounty={bounty} />
+ )}
+
+ <div className="flex max-w-[700px] flex-col gap-6 text-sm">
+ <BountySubmissionRequirements bounty={bounty} />
+ <BountyRewardCriteria bounty={bounty} />
+ <BountyDescription bounty={bounty} />
+ </div>
+ </>
+ ) : null}
+ </div>
+ </div>
+ </PageWidthWrapper>
</PageContent>
);
}
+
+function BountyDetailsProgressSkeleton() {
+ return (
+ <div className="flex flex-col gap-3">
+ <div className="h-7 w-20 animate-pulse rounded-md bg-neutral-200" />
+ <div className="border-border-subtle flex flex-col gap-4 rounded-xl border bg-white px-5 pb-4 pt-6">
+ <div className="h-1 w-full animate-pulse rounded-full bg-neutral-200" />
+ <div className="flex gap-1">
+ <div className="h-6 w-8 animate-pulse rounded bg-neutral-200" />
+ <div className="h-6 w-6 animate-pulse rounded bg-neutral-200" />
+ <div className="h-6 w-24 animate-pulse rounded bg-neutral-200" />
+ </div>
+ </div>
+ </div>
+ );
+}
+
+function PartnerBountyPageHeader() {
+ const { programSlug } = useParams<{ programSlug: string }>();
+ const { bounty } = usePartnerBounty();
+
+ return (
+ <div className="flex items-center gap-1.5">
+ <Link
+ href={`/programs/${programSlug}/bounties`}
+ aria-label="Back to bounties"
+ title="Back to bounties"
+ className={cn(
+ "bg-bg-subtle flex size-8 shrink-0 items-center justify-center rounded-lg",
+ "hover:bg-bg-emphasis transition-[transform,background-color] duration-150 active:scale-95",
+ )}
+ >
+ <Trophy className="size-4" />
+ </Link>
+ <ChevronRight className="text-content-muted size-2.5 shrink-0 [&_*]:stroke-2" />
+ <div className="min-w-0 truncate">
+ {bounty ? (
+ truncate(bounty.name, 70)
+ ) : (
+ <div className="h-6 w-48 animate-pulse rounded-md bg-neutral-200" />
+ )}
+ </div>
+ </div>
+ );
+}
diff --git a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/bounty-card.tsx b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/bounty-card.tsx
index 17ddba859c..47a7b9df88 100644
--- a/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/bounty-card.tsx
+++ b/apps/web/app/(ee)/partners.dub.co/(dashboard)/programs/[programSlug]/(enrolled)/bounties/bounty-card.tsx
@@ -39,7 +39,11 @@ export function PartnerBountyCard({
<As
href={href ?? "#"}
onClick={onClick}
- className="border-border-subtle hover:border-border-default bg-bg-default group relative flex w-full cursor-pointer flex-col overflow-hidden rounded-xl border text-left transition-all hover:shadow-lg"
+ className={cn(
+ "border-border-subtle bg-bg-default group relative flex w-full cursor-pointer flex-col overflow-hidden rounded-xl border text-left",
+ (href || onClick) &&
+ "hover:border-border-default transition-all hover:shadow-lg",
+ )}
>
<div className="p-3 pb-0">
<div className="bg-bg-subtle relative flex h-[124px] items-center justify-center rounded-lg">