Skip to content

armgit / mapcn

Public Imported from GitHub
0

Beautiful map components. 100% Free, Zero config, one command setup.

TypeScript

feat: add sponsorships and legal pages

Anmol421f2edcf521
diff --git a/README.md b/README.md
index 89cf99e..8aafb45 100644
--- a/README.md
+++ b/README.md
@@ -49,11 +49,22 @@ Then ask for a map, or ask where one would fit in your app. See [mapcn.dev/docs/
## Basemap Terms of Service
-This project uses [CARTO Basemaps](https://docs.carto.com/faqs/carto-basemaps) which are based on OpenStreetMap data.
+mapcn uses [CARTO Basemaps](https://docs.carto.com/faqs/carto-basemaps) powered by OpenStreetMap data for its default styles and examples.
-- **Commercial use**: Requires a CARTO Enterprise license. [Request a demo](https://carto.com/request-live-demo) for pricing details.
-- **Non-commercial use**: Free for CARTO grantees under their [basemap terms](https://carto.com/legal/bmap).
-- **Alternative**: You can switch to [OpenStreetMap](https://www.openstreetmap.org/) tiles or any other MapLibre-compatible tile provider (MapTiler, Stadia Maps, etc).
+CARTO offers free tiers for commercial and non-commercial usage, subject to monthly tile request limits and attribution requirements.
+
+- **Commercial use**: Free up to 1 million tile requests per month.
+- **Non-commercial use**: Free up to 5 million tile requests per month.
+- **Attribution**: CARTO and OpenStreetMap attribution must remain visible.
+- **API keys**: CARTO requires API keys for raster basemaps and may extend this requirement to vector basemaps.
+
+For production applications, review [CARTO's terms](https://carto.com/legal/basemap-terms/) and configure your own basemap provider or API key as needed.
+
+mapcn is built on MapLibre and supports alternative MapLibre-compatible basemap providers.
+
+## Sponsors
+
+mapcn is free and open source, kept going by its sponsors. Want your logo here? See [mapcn.dev/sponsors](https://mapcn.dev/sponsors).
## Contributing
diff --git a/src/app/(main)/(home)/page.tsx b/src/app/(main)/(home)/page.tsx
index 2b213f2..e4b23f0 100644
--- a/src/app/(main)/(home)/page.tsx
+++ b/src/app/(main)/(home)/page.tsx
@@ -5,6 +5,7 @@ import { ChevronRight } from "lucide-react";
import { HeroInstallCommand } from "./_components/hero-install-command";
import { MapWall } from "./_components/map-wall";
import { Footer } from "@/components/footer";
+import { SponsorStrip } from "@/components/sponsor-logos";
import {
PageHeader,
PageHeaderHeading,
@@ -13,8 +14,11 @@ import {
} from "@/components/page-header";
import { Badge } from "@/components/ui/badge";
import { Button } from "@/components/ui/button";
+import { hasFeaturedSponsors, pageviewsSinceLaunch } from "@/lib/sponsors";
export default function Page() {
+ const hasSponsors = hasFeaturedSponsors();
+
return (
<>
<div className="flex-1">
@@ -78,6 +82,39 @@ export default function Page() {
</a>
</p>
</section>
+
+ {hasSponsors ? (
+ <section className="container flex flex-col items-center gap-8 pt-20 pb-28 md:pt-24 md:pb-32">
+ <div className="flex flex-col items-center gap-1.5 text-center">
+ <h2 className="text-lg font-medium tracking-tight">Backed by</h2>
+ <p className="text-muted-foreground max-w-sm text-sm text-balance">
+ Thanks to the teams keeping mapcn free and open source.
+ </p>
+ </div>
+ <SponsorStrip />
+ <Link
+ href="/sponsors"
+ className="text-muted-foreground hover:text-foreground flex items-center gap-1 text-sm transition-colors"
+ >
+ Become a sponsor
+ <ChevronRight className="size-3.5" />
+ </Link>
+ </section>
+ ) : (
+ <section className="container flex flex-col items-center gap-2 py-16 text-center md:py-20">
+ <p className="text-muted-foreground text-sm text-balance">
+ mapcn is free and open source, kept going by sponsors. Reach the
+ developers behind its {pageviewsSinceLaunch} pageviews.
+ </p>
+ <Link
+ href="/sponsors"
+ className="text-foreground/80 hover:text-foreground flex items-center gap-1 text-sm font-medium transition-colors"
+ >
+ Become a sponsor
+ <ChevronRight className="size-3.5" />
+ </Link>
+ </section>
+ )}
</div>
<Footer className="mt-0!" />
diff --git a/src/app/(main)/docs/_components/docs.tsx b/src/app/(main)/docs/_components/docs.tsx
index bdb07a4..23c3c77 100644
--- a/src/app/(main)/docs/_components/docs.tsx
+++ b/src/app/(main)/docs/_components/docs.tsx
@@ -11,6 +11,7 @@ import {
} from "@/components/ui/table";
import { cn } from "@/lib/utils";
import { DocsToc } from "./docs-toc";
+import { DocsSponsors } from "@/components/sponsor-logos";
import { ChevronLeft, ChevronRight } from "lucide-react";
export function slugify(text: string): string {
@@ -131,11 +132,13 @@ export function DocsLayout({
)}
</div>
)}
+ <DocsSponsors className="mt-12 xl:hidden" />
</div>
<aside className="hidden w-42 shrink-0 xl:block">
- <nav className="sticky top-14 max-h-[calc(100svh-3.5rem)] overflow-y-auto pt-12 pb-10 [scrollbar-gutter:stable]">
+ <nav className="sticky top-14 -mx-3 max-h-[calc(100svh-3.5rem)] overflow-y-auto px-3 pt-12 pb-10 [scrollbar-gutter:stable]">
{tocItems.length > 0 && <DocsToc items={tocItems} />}
+ <DocsSponsors className={tocItems.length > 0 ? "mt-10" : undefined} />
</nav>
</aside>
</div>
diff --git a/src/app/(main)/sponsors/_components/placement-preview.tsx b/src/app/(main)/sponsors/_components/placement-preview.tsx
new file mode 100644
index 0000000..0e12a9d
--- /dev/null
+++ b/src/app/(main)/sponsors/_components/placement-preview.tsx
@@ -0,0 +1,111 @@
+import { cn } from "@/lib/utils";
+
+export function PlacementPreviews() {
+ return (
+ <div className="mx-auto grid w-full max-w-4xl grid-cols-1 gap-6 md:grid-cols-2">
+ {placements.map((placement) => (
+ <figure
+ key={placement.title}
+ className="bg-muted ring-foreground/5 dark:bg-muted/30 rounded-2xl p-2 ring-1"
+ >
+ <div
+ aria-hidden
+ className="bg-background ring-foreground/10 dark:ring-foreground/5 aspect-[2/1] overflow-hidden rounded-lg p-5 shadow-xs ring-1 md:p-6"
+ >
+ <placement.preview />
+ </div>
+ <figcaption className="px-2 pt-3.5 pb-2">
+ <div className="flex items-baseline justify-between gap-4">
+ <h3 className="text-base font-medium">{placement.title}</h3>
+ <span className="text-muted-foreground text-sm">
+ {placement.tiers}
+ </span>
+ </div>
+ <p className="text-muted-foreground mt-0.5 text-sm">
+ {placement.description}
+ </p>
+ </figcaption>
+ </figure>
+ ))}
+ </div>
+ );
+}
+
+function HomePreview() {
+ return (
+ <div className="flex h-full flex-col">
+ <div className="flex flex-col items-center gap-2">
+ <Bar className="h-2 w-2/5" />
+ <Bar className="w-1/4" />
+ </div>
+ <div className="mt-5 grid grid-cols-3 gap-2 mask-b-from-30%">
+ {Array.from({ length: 3 }, (_, i) => (
+ <div key={i} className="bg-muted aspect-[4/3] rounded-sm" />
+ ))}
+ </div>
+ <div className="mt-auto flex flex-col items-center gap-2.5">
+ <div className="flex gap-4">
+ <Slot className="h-2.5 w-12" />
+ <Slot className="h-2.5 w-12" />
+ </div>
+ <div className="flex gap-3">
+ {Array.from({ length: 4 }, (_, i) => (
+ <Slot key={i} className="h-2 w-8" />
+ ))}
+ </div>
+ </div>
+ </div>
+ );
+}
+
+function DocsPreview() {
+ return (
+ <div className="grid h-full grid-cols-[1fr_3fr_1fr] gap-5">
+ <div className="flex flex-col gap-2">
+ {Array.from({ length: 5 }, (_, i) => (
+ <Bar key={i} className={i % 2 === 0 ? "w-full" : "w-2/3"} />
+ ))}
+ </div>
+ <div className="flex flex-col gap-2">
+ <Bar className="h-2 w-1/2" />
+ <Bar className="w-5/6" />
+ <div className="bg-muted mt-2 h-2/5 rounded-sm" />
+ </div>
+ <div className="flex flex-col gap-2">
+ <Bar className="w-full" />
+ <Bar className="w-2/3" />
+ <Slot className="mt-4 h-2.5 w-3/4" />
+ <Slot className="h-2.5 w-3/4" />
+ <div className="mt-1 grid grid-cols-2 gap-2">
+ <Slot className="h-2" />
+ <Slot className="h-2" />
+ </div>
+ </div>
+ </div>
+ );
+}
+
+function Bar({ className }: { className?: string }) {
+ return <div className={cn("bg-muted h-1.5 rounded-full", className)} />;
+}
+
+function Slot({ className }: { className?: string }) {
+ return <div className={cn("bg-foreground/20 rounded-full", className)} />;
+}
+
+const placements = [
+ {
+ title: "Homepage",
+ tiers: "Platinum · Gold",
+ description:
+ "Right below the map showcase, seen by everyone exploring mapcn.",
+ preview: HomePreview,
+ },
+ {
+ title: "Every docs page",
+ tiers: "Platinum · Gold",
+ description:
+ "Beside every page developers read, right under the table of contents.",
+ preview: DocsPreview,
+ },
+];
diff --git a/src/app/(main)/sponsors/_components/sponsor-contact-button.tsx b/src/app/(main)/sponsors/_components/sponsor-contact-button.tsx
new file mode 100644
index 0000000..d44d583
--- /dev/null
+++ b/src/app/(main)/sponsors/_components/sponsor-contact-button.tsx
@@ -0,0 +1,39 @@
+"use client";
+
+import { Button } from "@/components/ui/button";
+import { trackEvent } from "@/lib/events";
+import { getSponsorAction, type SponsorTier } from "@/lib/sponsors";
+
+interface SponsorContactButtonProps extends Omit<
+ React.ComponentProps<typeof Button>,
+ "asChild" | "onClick"
+> {
+ tier?: SponsorTier;
+}
+
+export function SponsorContactButton({
+ tier,
+ children,
+ ...props
+}: SponsorContactButtonProps) {
+ const action = getSponsorAction(tier);
+
+ return (
+ <Button asChild {...props}>
+ <a
+ href={action.href}
+ onClick={() =>
+ trackEvent({
+ name:
+ action.kind === "checkout"
+ ? "click_sponsor_checkout"
+ : "click_sponsor_contact",
+ properties: { tier: tier?.id ?? "custom" },
+ })
+ }
+ >
+ {children}
+ </a>
+ </Button>
+ );
+}
diff --git a/src/app/(main)/sponsors/_components/sponsor-stats.tsx b/src/app/(main)/sponsors/_components/sponsor-stats.tsx
new file mode 100644
index 0000000..0f0a7ae
--- /dev/null
+++ b/src/app/(main)/sponsors/_components/sponsor-stats.tsx
@@ -0,0 +1,49 @@
+import { Suspense } from "react";
+
+import { getStarCount } from "@/components/github-button";
+import { Skeleton } from "@/components/ui/skeleton";
+import { siteStats } from "@/lib/sponsors";
+
+export function SponsorStats() {
+ return (
+ <div className="bg-muted ring-foreground/5 dark:bg-muted/30 mx-auto w-full max-w-4xl rounded-2xl p-2 ring-1">
+ <dl className="bg-background ring-foreground/10 dark:ring-foreground/5 grid grid-cols-2 rounded-lg text-left shadow-xs ring-1 sm:grid-cols-4 sm:divide-x max-sm:[&>*:nth-child(-n+2)]:border-b max-sm:[&>*:nth-child(even)]:border-l">
+ {siteStats.map((stat) => (
+ <Stat key={stat.label} label={stat.label}>
+ {stat.value}
+ </Stat>
+ ))}
+ <Stat label="GitHub stars">
+ <Suspense
+ fallback={
+ <Skeleton className="h-8 w-14 sm:h-10 sm:w-20 md:h-12 md:w-24" />
+ }
+ >
+ <Stars />
+ </Suspense>
+ </Stat>
+ </dl>
+ </div>
+ );
+}
+
+function Stat({
+ label,
+ children,
+}: {
+ label: string;
+ children: React.ReactNode;
+}) {
+ return (
+ <div className="flex flex-col-reverse justify-end gap-1.5 p-4 sm:p-6 md:gap-3 md:px-8 md:py-9">
+ <dt className="text-muted-foreground text-xs sm:text-sm">{label}</dt>
+ <dd className="text-2xl font-semibold tracking-tight tabular-nums sm:text-4xl md:text-5xl">
+ {children}
+ </dd>
+ </div>
+ );
+}
+
+async function Stars() {
+ return (await getStarCount())?.toUpperCase() ?? "—";
+}
diff --git a/src/app/(main)/sponsors/_components/sponsor-tiers.tsx b/src/app/(main)/sponsors/_components/sponsor-tiers.tsx
new file mode 100644
index 0000000..600cfea
--- /dev/null
+++ b/src/app/(main)/sponsors/_components/sponsor-tiers.tsx
@@ -0,0 +1,70 @@
+import { Check } from "lucide-react";
+
+import {
+ getOpenSlots,
+ getSponsorAction,
+ sponsorTiers,
+ type SponsorTier,
+} from "@/lib/sponsors";
+import { SponsorContactButton } from "./sponsor-contact-button";
+
+export function SponsorTiers() {
+ return (
+ <div className="grid grid-cols-1 gap-6 md:grid-cols-3">
+ {sponsorTiers.map((tier) => (
+ <TierCard key={tier.id} tier={tier} />
+ ))}
+ </div>
+ );
+}
+
+function TierCard({ tier }: { tier: SponsorTier }) {
+ const openSlots = getOpenSlots(tier);
+ const action = getSponsorAction(tier);
+ const label = {
+ checkout: `Sponsor as ${tier.name}`,
+ waitlist: "Join the waitlist",
+ contact: "Reserve a spot",
+ }[action.kind];
+
+ return (
+ <div className="bg-muted ring-foreground/5 dark:bg-muted/30 flex flex-col rounded-2xl p-2 ring-1">
+ <div className="bg-background ring-foreground/10 dark:ring-foreground/5 flex flex-1 flex-col rounded-lg p-6 shadow-xs ring-1 md:p-7">
+ <div className="flex items-baseline justify-between gap-4">
+ <h3 className="text-lg font-medium">{tier.name}</h3>
+ <span className="text-muted-foreground text-sm tabular-nums">
+ {openSlots === undefined
+ ? "Open"
+ : `${openSlots} of ${tier.slots} open`}
+ </span>
+ </div>
+ <p className="mt-4 flex items-baseline gap-1">
+ <span className="text-4xl font-semibold tracking-tight tabular-nums sm:text-5xl">
+ ${tier.price}
+ </span>
+ <span className="text-muted-foreground text-base">/month</span>
+ </p>
+ <ul className="mt-6 mb-7 space-y-2.5 text-[15px]">
+ {tier.perks.map((perk) => (
+ <li key={perk} className="flex gap-2.5">
+ <Check className="text-muted-foreground mt-1 size-4 shrink-0" />
+ <span>{perk}</span>
+ </li>
+ ))}
+ </ul>
+ <SponsorContactButton
+ tier={tier}
+ variant={
+ tier.id === "platinum" && action.kind !== "waitlist"
+ ? "default"
+ : "outline"
+ }
+ size="lg"
+ className="mt-auto w-full rounded-lg"
+ >
+ {label}
+ </SponsorContactButton>
+ </div>
+ </div>
+ );
+}
diff --git a/src/app/(main)/sponsors/_components/sponsor-wall.tsx b/src/app/(main)/sponsors/_components/sponsor-wall.tsx
new file mode 100644
index 0000000..445c2ec
--- /dev/null
+++ b/src/app/(main)/sponsors/_components/sponsor-wall.tsx
@@ -0,0 +1,78 @@
+import Link from "next/link";
+import { Plus } from "lucide-react";
+
+import { SponsorLink } from "@/components/sponsor-link";
+import { SponsorImage } from "@/components/sponsor-logos";
+import {
+ getOpenSlots,
+ getSponsorsByTier,
+ sponsorTiers,
+ type SponsorTier,
+ type SponsorTierId,
+} from "@/lib/sponsors";
+import { cn } from "@/lib/utils";
+
+export function SponsorWall() {
+ return (
+ <div className="mx-auto w-full max-w-3xl space-y-10 text-left">
+ {sponsorTiers.map((tier) => (
+ <TierRow key={tier.id} tier={tier} />
+ ))}
+ </div>
+ );
+}
+
+function TierRow({ tier }: { tier: SponsorTier }) {
+ const sponsors = getSponsorsByTier(tier.id);
+ const layout = tierLayouts[tier.id];
+ const openSlots = getOpenSlots(tier);
+ const emptySlots = openSlots ?? 1;
+
+ return (
+ <div className="space-y-3">
+ <div className="flex items-baseline justify-between gap-4 text-sm">
+ <h3 className="text-foreground font-medium">{tier.name}</h3>
+ <span className="text-muted-foreground">
+ {openSlots === undefined
+ ? "Open"
+ : `${openSlots} of ${tier.slots} open`}
+ </span>
+ </div>
+ <div className={cn("grid gap-2", layout.grid)}>
+ {sponsors.map((sponsor) => (
+ <SponsorLink
+ key={sponsor.name}
+ sponsor={sponsor}
+ placement="sponsors"
+ className={cn(
+ "bg-muted/50 ring-foreground/5 hover:bg-muted dark:bg-muted/30 dark:hover:bg-muted/50 flex items-center justify-center rounded-xl ring-1 transition-colors",
+ layout.tile,
+ )}
+ >
+ <SponsorImage sponsor={sponsor} className="h-1/2 w-2/3" />
+ </SponsorLink>
+ ))}
+ {Array.from({ length: emptySlots }, (_, i) => (
+ <Link
+ key={i}
+ href="#tiers"
+ aria-label={`Sponsor mapcn at ${tier.name}`}
+ className={cn(
+ "text-muted-foreground hover:text-foreground ring-foreground/10 hover:bg-muted/30 flex items-center justify-center gap-1.5 rounded-xl text-sm ring-1 transition-colors ring-inset",
+ layout.tile,
+ )}
+ >
+ <Plus className="size-3.5" />
+ {tier.id !== "silver" && <span>Your logo here</span>}
+ </Link>
+ ))}
+ </div>
+ </div>
+ );
+}
+
+const tierLayouts: Record<SponsorTierId, { grid: string; tile: string }> = {
+ platinum: { grid: "grid-cols-2", tile: "h-20 sm:h-28" },
+ gold: { grid: "grid-cols-2 sm:grid-cols-4", tile: "h-20" },
+ silver: { grid: "grid-cols-3 sm:grid-cols-6", tile: "h-14" },
+};
diff --git a/src/app/(main)/sponsors/page.tsx b/src/app/(main)/sponsors/page.tsx
new file mode 100644
index 0000000..427c14f
--- /dev/null
+++ b/src/app/(main)/sponsors/page.tsx
@@ -0,0 +1,218 @@
+import { Metadata } from "next";
+import Link from "next/link";
+
+import { CodeCopyButton } from "@/components/code-copy-button";
+import { Footer } from "@/components/footer";
+import {
+ PageActions,
+ PageHeader,
+ PageHeaderDescription,
+ PageHeaderHeading,
+} from "@/components/page-header";
+import {
+ Accordion,
+ AccordionContent,
+ AccordionItem,
+ AccordionTrigger,
+} from "@/components/ui/accordion";
+import { TextLink } from "@/components/text-link";
+import { Button } from "@/components/ui/button";
+import {
+ checkoutEnabled,
+ githubSponsorsUrl,
+ sponsorEmail,
+ sponsors,
+ xProfileUrl,
+} from "@/lib/sponsors";
+import { PlacementPreviews } from "./_components/placement-preview";
+import { SponsorContactButton } from "./_components/sponsor-contact-button";
+import { SponsorStats } from "./_components/sponsor-stats";
+import { SponsorTiers } from "./_components/sponsor-tiers";
+import { SponsorWall } from "./_components/sponsor-wall";
+
+export const metadata: Metadata = {
+ title: "Sponsor",
+ description:
+ "Sponsor mapcn and put your product in front of developers building maps with React.",
+};
+
+export default function Page() {
+ return (
+ <>
+ <div className="flex-1">
+ <PageHeader size="sm">
+ <PageHeaderHeading>Sponsor mapcn</PageHeaderHeading>
+ <PageHeaderDescription>
+ mapcn is free and open source. Sponsors keep it that way, and put
+ their product in front of developers adding maps to React apps.
+ </PageHeaderDescription>
+ <PageActions className="max-sm:flex-row max-sm:gap-3">
+ <Button asChild size="lg" className="rounded-lg">
+ <Link href="#tiers">See tiers</Link>
+ </Button>
+ <SponsorContactButton
+ variant="outline"
+ size="lg"
+ className="rounded-lg"
+ >
+ Email us
+ </SponsorContactButton>
+ </PageActions>
+ </PageHeader>
+
+ <div className="container pb-24">
+ <div className="mx-auto max-w-6xl space-y-24 md:space-y-36">
+ <SponsorStats />
+
+ {sponsors.length > 0 && (
+ <Section id="sponsors" label="Sponsors" title="Backed by">
+ <SponsorWall />
+ </Section>
+ )}
+
+ <Section
+ id="placements"
+ label="Placements"
+ title="Seen where developers build"
+ >
+ <PlacementPreviews />
+ </Section>
+
+ <Section id="tiers" label="Pricing" title="Pick a tier">
+ <SponsorTiers />
+ <p className="text-muted-foreground text-center text-sm text-balance">
+ {checkoutEnabled
+ ? "Billed monthly in USD through Dodo Payments."
+ : "Billed monthly in USD once your sponsorship is approved."}{" "}
+ Cancel anytime. See the{" "}
+ <TextLink href="/terms#sponsorships">terms</TextLink>.
+ Supporting as an individual?{" "}
+ <TextLink href={githubSponsorsUrl}>Sponsor on GitHub</TextLink>
+ </p>
+ </Section>
+
+ <Section id="faq" label="FAQ" title="Common questions">
+ <Accordion
+ type="single"
+ collapsible
+ className="mx-auto max-w-2xl border-y"
+ >
+ {faqs.map((faq) => (
+ <AccordionItem key={faq.question} value={faq.question}>
+ <AccordionTrigger className="py-5 text-base hover:no-underline">
+ {faq.question}
+ </AccordionTrigger>
+ <AccordionContent className="text-muted-foreground pb-5 text-[15px] leading-relaxed">
+ {faq.answer}
+ </AccordionContent>
+ </AccordionItem>
+ ))}
+ </Accordion>
+ </Section>
+
+ <section className="bg-muted ring-foreground/5 dark:bg-muted/30 flex flex-col items-center gap-8 rounded-2xl px-6 py-14 text-center ring-1 md:py-20">
+ <div className="space-y-3">
+ <h2 className="text-2xl font-semibold tracking-tight text-balance md:text-3xl">
+ Need something custom?
+ </h2>
+ <p className="text-muted-foreground mx-auto max-w-sm text-[15px] leading-relaxed text-pretty md:text-base">
+ A launch campaign, a different placement, or just a question
+ first. Happy to put something together.
+ </p>
+ </div>
+ <div className="flex flex-wrap items-center justify-center gap-3">
+ <div className="bg-background ring-foreground/10 flex h-10 items-center gap-1 rounded-lg pr-1 pl-4 shadow-xs ring-1">
+ <span className="text-foreground/80 text-sm">
+ {sponsorEmail}
+ </span>
+ <CodeCopyButton
+ text={sponsorEmail}
+ label="Copy email"
+ className="bg-transparent"
+ />
+ </div>
+ <Button
+ variant="outline"
+ size="lg"
+ className="rounded-lg"
+ asChild
+ >
+ <a
+ href={xProfileUrl}
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ DM on X
+ </a>
+ </Button>
+ </div>
+ </section>
+ </div>
+ </div>
+ </div>
+
+ <Footer />
+ </>
+ );
+}
+
+function Section({
+ id,
+ label,
+ title,
+ children,
+}: {
+ id: string;
+ label: string;
+ title: string;
+ children: React.ReactNode;
+}) {
+ return (
+ <section
+ id={id}
+ aria-labelledby={`${id}-heading`}
+ className="scroll-m-24 space-y-10 md:space-y-12"
+ >
+ <div className="flex flex-col items-center gap-3 text-center">
+ <p className="text-muted-foreground text-sm font-medium">{label}</p>
+ <h2
+ id={`${id}-heading`}
+ className="text-foreground text-3xl font-semibold tracking-tight text-balance md:text-4xl"
+ >
+ {title}
+ </h2>
+ </div>
+ {children}
+ </section>
+ );
+}
+
+const faqs = [
+ {
+ question: "How does booking work?",
+ answer: checkoutEnabled
+ ? "Pick a tier with an open slot and pay through Dodo Payments, which handles invoices and tax. You land back on mapcn with a short list of what to send."
+ : "Pick a tier with an open slot and reserve your spot by email. Once your sponsorship is approved, we send payment instructions and a short list of what to send.",
+ },
+ {
+ question: "What do I need to send?",
+ answer:
+ "An SVG logo (plus a dark-mode version if it needs one), the link it should point to, and, for Platinum, a one-line tagline. A monochrome logo works best. Colour is fine too: it shows in grey to match the site, and in full colour on hover.",
+ },
+ {
+ question: "When does my logo go live?",
+ answer:
+ "Within three business days of receiving all your assets and confirming payment.",
+ },
+ {
+ question: "Can I cancel?",
+ answer: checkoutEnabled
+ ? "Yes. Sponsorships are month to month. Cancel from the link in your Dodo Payments receipt and your logo comes down at the end of your current billing period."
+ : "Yes. Sponsorships are month to month. Email to cancel and your logo comes down at the end of your current billing period.",
+ },
+ {
+ question: "How do I measure results?",
+ answer:
+ "Every sponsor link carries ref=mapcn.dev and UTM tags, so visits from mapcn show up in your own analytics.",
+ },
+];
diff --git a/src/app/(main)/sponsors/thank-you/page.tsx b/src/app/(main)/sponsors/thank-you/page.tsx
new file mode 100644
index 0000000..293e547
--- /dev/null
+++ b/src/app/(main)/sponsors/thank-you/page.tsx
@@ -0,0 +1,202 @@
+import { Metadata } from "next";
+import Link from "next/link";
+
+import { Footer } from "@/components/footer";
+import {
+ PageActions,
+ PageHeader,
+ PageHeaderDescription,
+ PageHeaderHeading,
+} from "@/components/page-header";
+import { TextLink } from "@/components/text-link";
+import { Button } from "@/components/ui/button";
+import {
+ checkoutEnabled,
+ getSponsorTier,
+ sponsorAssetsMailto,
+ sponsorEmail,
+ xProfileUrl,
+ type SponsorTierId,
+} from "@/lib/sponsors";
+
+export const metadata: Metadata = {
+ title: "Thank you",
+ description: "Your mapcn sponsorship is confirmed.",
+ robots: { index: false, follow: false },
+};
+
+export default async function Page({
+ searchParams,
+}: {
+ searchParams: Promise<{ [key: string]: string | string[] | undefined }>;
+}) {
+ const params = await searchParams;
+ const tier = getSponsorTier(params.tier);
+
+ if (
+ params.status !== undefined &&
+ !paidStatuses.includes(`${params.status}`)
+ ) {
+ return <PaymentPending />;
+ }
+
+ const items = assetChecklist.filter(
+ (item) => !item.tiers || !tier || item.tiers.includes(tier.id),
+ );
+
+ return (
+ <>
+ <div className="flex-1">
+ <PageHeader size="sm">
+ <PageHeaderHeading>
+ {tier
+ ? `You're a ${tier.name} sponsor`
+ : "Thanks for sponsoring mapcn"}
+ </PageHeaderHeading>
+ <PageHeaderDescription>
+ Your sponsorship is confirmed. Thank you for helping keep mapcn free
+ and open source.
+ </PageHeaderDescription>
+ </PageHeader>
+
+ <div className="container pb-24">
+ <div className="mx-auto max-w-2xl space-y-10">
+ <section className="space-y-6">
+ <div className="space-y-1.5">
+ <h2 className="text-xl font-semibold tracking-tight">
+ What to send next
+ </h2>
+ <p className="text-muted-foreground text-[15px]">
+ Send these over and your logo goes live within three business
+ days.
+ </p>
+ </div>
+
+ <div className="bg-muted ring-foreground/5 dark:bg-muted/30 rounded-2xl p-2 ring-1">
+ <ol className="bg-background ring-foreground/10 dark:ring-foreground/5 divide-y rounded-lg shadow-xs ring-1">
+ {items.map((item, index) => (
+ <li
+ key={item.title}
+ className="flex items-baseline gap-4 px-5 py-4"
+ >
+ <span className="text-muted-foreground text-sm tabular-nums">
+ {String(index + 1).padStart(2, "0")}
+ </span>
+ <div className="space-y-1">
+ <p className="text-[15px] font-medium">{item.title}</p>
+ <p className="text-muted-foreground text-sm leading-relaxed">
+ {item.detail}
+ </p>
+ </div>
+ </li>
+ ))}
+ </ol>
+ </div>
+
+ <div className="flex flex-wrap items-center gap-3">
+ <Button asChild size="lg" className="rounded-lg">
+ <a href={sponsorAssetsMailto(tier)}>Email your assets</a>
+ </Button>
+ <Button
+ asChild
+ variant="outline"
+ size="lg"
+ className="rounded-lg"
+ >
+ <a
+ href={xProfileUrl}
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ DM on X
+ </a>
+ </Button>
+ </div>
+ </section>
+
+ <section className="text-muted-foreground space-y-3 border-t pt-8 text-sm leading-relaxed">
+ <p>
+ Your sponsorship renews monthly until you cancel.{" "}
+ {checkoutEnabled
+ ? "You can cancel or update your card from the link in your Dodo Payments receipt,"
+ : "Email to cancel or change your billing details,"}{" "}
+ and your sponsorship remains active until the end of your
+ current paid billing period.
+ </p>
+ <p>
+ Questions? Email{" "}
+ <TextLink href={`mailto:${sponsorEmail}`}>
+ {sponsorEmail}
+ </TextLink>{" "}
+ or head back to the{" "}
+ <TextLink href="/sponsors">sponsors page</TextLink>.
+ </p>
+ </section>
+ </div>
+ </div>
+ </div>
+
+ <Footer />
+ </>
+ );
+}
+
+function PaymentPending() {
+ return (
+ <>
+ <div className="flex-1">
+ <PageHeader size="sm">
+ <PageHeaderHeading>Payment not confirmed</PageHeaderHeading>
+ <PageHeaderDescription>
+ Your payment hasn&apos;t gone through. Try again from the tiers, or
+ email us if you were charged and we&apos;ll sort it out.
+ </PageHeaderDescription>
+ <PageActions className="max-sm:flex-row max-sm:gap-3">
+ <Button asChild size="lg" className="rounded-lg">
+ <Link href="/sponsors#tiers">Back to tiers</Link>
+ </Button>
+ <Button asChild variant="outline" size="lg" className="rounded-lg">
+ <a href={`mailto:${sponsorEmail}`}>Email us</a>
+ </Button>
+ </PageActions>
+ </PageHeader>
+ </div>
+
+ <Footer />
+ </>
+ );
+}
+
+const paidStatuses = ["active", "succeeded"];
+
+const assetChecklist: {
+ title: string;
+ detail: string;
+ tiers?: SponsorTierId[];
+}[] = [
+ {
+ title: "Your logo",
+ detail:
+ "An SVG, monochrome if you have one. Colour works too: it shows in grey to match the site, and in full colour on hover.",
+ },
+ {
+ title: "A dark mode version",
+ detail:
+ "Only if your logo needs one to stay readable on a dark background.",
+ },
+ {
+ title: "Your link",
+ detail:
+ "Where your logo should point. ref=mapcn.dev and UTM tags are added for you.",
+ },
+ {
+ title: "A one-line tagline",
+ detail: "Shown under your logo on the homepage and every docs page.",
+ tiers: ["platinum"],
+ },
+ {
+ title: "Your X handle",
+ detail: "For your one-time shoutout on X.",
+ tiers: ["platinum", "gold"],
+ },
+];
diff --git a/src/app/(main)/terms/page.tsx b/src/app/(main)/terms/page.tsx
new file mode 100644
index 0000000..d8a1740
--- /dev/null
+++ b/src/app/(main)/terms/page.tsx
@@ -0,0 +1,284 @@
+import { Metadata } from "next";
+import { Footer } from "@/components/footer";
+import {
+ PageHeader,
+ PageHeaderDescription,
+ PageHeaderHeading,
+} from "@/components/page-header";
+import { TextLink } from "@/components/text-link";
+import { githubRepoUrl } from "@/lib/site-navigation";
+import {
+ checkoutEnabled,
+ githubSponsorsUrl,
+ sponsorEmail,
+ xProfileUrl,
+} from "@/lib/sponsors";
+
+export const metadata: Metadata = {
+ title: "Terms",
+ description:
+ "Terms of service, privacy policy, and refund and cancellation policy for mapcn.",
+};
+
+export default function Page() {
+ return (
+ <>
+ <div className="flex-1">
+ <PageHeader size="sm">
+ <PageHeaderHeading>Terms</PageHeaderHeading>
+ <PageHeaderDescription>
+ The terms for using mapcn, how sponsorships work, what data the site
+ collects, and how refunds and cancellations are handled.
+ </PageHeaderDescription>
+ <nav
+ aria-label="Sections"
+ className="text-muted-foreground mt-6 flex flex-wrap justify-center gap-x-5 gap-y-2 text-sm"
+ >
+ {sections.map((section) => (
+ <a
+ key={section.id}
+ href={`#${section.id}`}
+ className="hover:text-foreground transition-colors"
+ >
+ {section.title}
+ </a>
+ ))}
+ </nav>
+ </PageHeader>
+
+ <div className="container pb-24">
+ <div className="mx-auto max-w-2xl space-y-16">
+ <Section id="terms" title="Terms of Service">
+ <p>
+ These terms cover your use of mapcn.dev and sponsorships. mapcn
+ is run by Anmoldeep Singh, an independent developer. By using
+ the site or sponsoring, you agree to them. Using the mapcn code
+ is covered only by its license, below.
+ </p>
+
+ <h3>Open-source license</h3>
+ <p>
+ mapcn is free and open source under the MIT License. The{" "}
+ <TextLink href={`${githubRepoUrl}/blob/main/LICENSE`}>
+ LICENSE file
+ </TextLink>{" "}
+ governs your use of the code, and these terms don&apos;t add any
+ restrictions to it. The code is provided as is, without warranty
+ of any kind. The license covers the code, not the mapcn name or
+ logo.
+ </p>
+
+ <h3>Basemaps</h3>
+ <p>
+ The default map styles use CARTO basemaps, built on
+ OpenStreetMap data. If you use them in your own app,
+ CARTO&apos;s{" "}
+ <TextLink href="https://carto.com/legal/basemap-terms/">
+ basemap terms
+ </TextLink>
+ , usage limits and attribution requirements apply to you. These
+ can change, so check CARTO&apos;s{" "}
+ <TextLink href="https://docs.carto.com/faqs/carto-basemaps">
+ current limits
+ </TextLink>{" "}
+ before relying on them in production.
+ </p>
+
+ <h3 id="sponsorships">Sponsorships</h3>
+ <p>
+ A sponsorship is a monthly placement of your logo and link on
+ mapcn.dev and in the README, depending on the tier. Tiers,
+ prices and what each includes are listed on the{" "}
+ <TextLink href="/sponsors">sponsors page</TextLink>.
+ </p>
+ <p>
+ {checkoutEnabled
+ ? "You pay at checkout through Dodo Payments. Sponsorships are billed monthly in USD and renew until cancelled."
+ : "Sponsorships are currently arranged by email. Once a sponsorship is approved, we send payment instructions. Sponsorships are billed monthly in USD and renew until cancelled, under the payment arrangement we agree with you."}
+ </p>
+ <p>
+ We aim to publish approved sponsor assets within three business
+ days after receiving all required materials (your logo, link
+ and, for Platinum, a tagline) and confirming payment. Your logo
+ stays up for as long as your sponsorship is active. Traffic
+ figures on the sponsors page describe past traffic and
+ aren&apos;t a guarantee of future views or clicks.
+ </p>
+ <p>
+ Individual sponsorships through{" "}
+ <TextLink href={githubSponsorsUrl}>GitHub Sponsors</TextLink>{" "}
+ are handled by GitHub under its own terms.
+ </p>
+
+ <h3>Sponsor approval</h3>
+ <p>
+ We review every sponsorship. We may decline a sponsorship, or
+ remove a live one, for example if the product is unrelated to
+ mapcn, misleading, or harmful. What you get back in each case is
+ set out in the{" "}
+ <TextLink href="#refunds">refund policy</TextLink>.
+ </p>
+
+ <h3>Sponsor content</h3>
+ <p>
+ You confirm you have the right to use the logo, name and tagline
+ you send, and you allow us to show them on mapcn.dev and in the
+ README while your sponsorship is active. Logos are shown in grey
+ to match the site, and in full colour on hover.
+ </p>
+
+ <h3>Changes</h3>
+ <p>
+ We may update these terms from time to time. Changes apply from
+ when they&apos;re published on this page.
+ </p>
+ </Section>
+
+ <Section id="privacy" title="Privacy Policy">
+ <p>
+ mapcn.dev has no accounts or sign-up. This section explains what
+ data the site collects and who handles it.
+ </p>
+
+ <h3>Analytics</h3>
+ <p>
+ We use{" "}
+ <TextLink href="https://vercel.com/docs/analytics/privacy-policy">
+ Vercel Web Analytics
+ </TextLink>{" "}
+ to count page views and a few actions, like copying an install
+ command or clicking a sponsor link. It doesn&apos;t set cookies,
+ and the events we send don&apos;t include personal information.
+ Sponsor links carry ref and UTM tags so sponsors can see a visit
+ came from mapcn. Nothing about you is added to them.
+ </p>
+
+ <h3>Hosting and third-party services</h3>
+ <p>
+ The site is hosted on Vercel, which processes standard request
+ data such as your IP address and browser details to serve pages.
+ Maps and examples load tiles, styles and images from third-party
+ services such as CARTO, which receive the same kind of request
+ data.
+ </p>
+
+ <h3>Preferences</h3>
+ <p>
+ Your light or dark theme choice is saved in your browser&apos;s
+ local storage, and the docs sidebar may save its open state in a
+ cookie. Neither is used for tracking.
+ </p>
+
+ <h3>Emails and sponsorships</h3>
+ <p>
+ If you email us or sponsor mapcn, we keep your messages and the
+ details you send, such as your name, company, logo, link and X
+ handle, to arrange and run your sponsorship. We don&apos;t sell
+ your personal data or use it for targeted advertising. The site
+ shows sponsor logos, but they&apos;re the same for every visitor
+ and don&apos;t use your data.
+ </p>
+ <p>
+ To ask what we hold about you, or to have it corrected or
+ deleted, email{" "}
+ <TextLink href={`mailto:${sponsorEmail}`}>
+ {sponsorEmail}
+ </TextLink>
+ .
+ </p>
+ </Section>
+
+ <Section id="refunds" title="Refund & Cancellation Policy">
+ <h3>Cancelling</h3>
+ <p>
+ Sponsorships are month to month, and you can cancel anytime{" "}
+ {checkoutEnabled
+ ? "from the link in your Dodo Payments receipt or by email"
+ : "by email"}
+ . Your sponsorship remains active until the end of your current
+ paid billing period, and you won&apos;t be charged again.
+ </p>
+
+ <h3>Refunds</h3>
+ <p>
+ Partial billing periods are not refunded for voluntary
+ cancellations. Exceptions apply to undelivered placements and
+ sponsorships terminated by mapcn without sponsor misconduct.
+ </p>
+ <p>
+ If mapcn is unable to deliver an agreed sponsorship placement, a
+ refund will be provided for the undelivered portion.
+ </p>
+ <p>
+ We reserve the right to remove sponsorships that materially
+ violate our terms. Such removals do not automatically qualify
+ for a refund. Refund requests may be reviewed individually.
+ </p>
+ <p>
+ If mapcn ends a sponsorship for reasons unrelated to a
+ sponsor&apos;s conduct, a prorated refund will be provided for
+ the unused portion of the paid period.
+ </p>
+ <p>
+ To request a refund, email us from the address you used to
+ sponsor. Joining the waitlist is free and doesn&apos;t commit
+ you to anything.
+ </p>
+ <p>
+ Refunds remain subject to applicable law and payment-provider
+ requirements.
+ </p>
+ </Section>
+
+ <Section id="contact" title="Contact">
+ <p>
+ For questions about these terms, your data, or a sponsorship,
+ email{" "}
+ <TextLink href={`mailto:${sponsorEmail}`}>
+ {sponsorEmail}
+ </TextLink>{" "}
+ or <TextLink href={xProfileUrl}>DM on X</TextLink>.
+ </p>
+ </Section>
+ </div>
+ </div>
+ </div>
+
+ <Footer />
+ </>
+ );
+}
+
+function Section({
+ id,
+ title,
+ children,
+}: {
+ id: string;
+ title: string;
+ children: React.ReactNode;
+}) {
+ return (
+ <section
+ id={id}
+ aria-labelledby={`${id}-heading`}
+ className="text-foreground/85 [&_h3]:text-foreground scroll-m-24 space-y-4 text-[15px] leading-relaxed [&_h3]:scroll-m-24 [&_h3]:pt-4 [&_h3]:text-base [&_h3]:font-medium"
+ >
+ <h2
+ id={`${id}-heading`}
+ className="text-foreground text-2xl font-semibold tracking-tight"
+ >
+ {title}
+ </h2>
+ {children}
+ </section>
+ );
+}
+
+const sections = [
+ { id: "terms", title: "Terms" },
+ { id: "sponsorships", title: "Sponsorships" },
+ { id: "privacy", title: "Privacy" },
+ { id: "refunds", title: "Refunds" },
+ { id: "contact", title: "Contact" },
+];
diff --git a/src/app/layout.tsx b/src/app/layout.tsx
index 1f8c74a..7439518 100644
--- a/src/app/layout.tsx
+++ b/src/app/layout.tsx
@@ -1,7 +1,7 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import { SiteAnalytics } from "@/components/site-analytics";
-import { siteBanner } from "@/lib/metadata";
+import { siteBanner, siteUrl } from "@/lib/metadata";
import "@/styles/globals.css";
@@ -18,7 +18,6 @@ const geistMono = Geist_Mono({
variable: "--font-mono",
});
-const siteUrl = process.env.NEXT_PUBLIC_SITE_URL || "http://localhost:3000";
const siteName = "mapcn";
const creator = "https://github.com/AnmolSaini16";
const siteDescription =
diff --git a/src/components/footer.tsx b/src/components/footer.tsx
index 763be9e..898993a 100644
--- a/src/components/footer.tsx
+++ b/src/components/footer.tsx
@@ -45,11 +45,7 @@ const footerLinks = {
href: "https://github.com/AnmolSaini16/mapcn",
external: true,
},
- {
- label: "Sponsor",
- href: "https://github.com/sponsors/AnmolSaini16",
- external: true,
- },
+ { label: "Sponsor", href: "/sponsors", external: false },
],
resources: [
{ label: "MapLibre GL", href: "https://maplibre.org/", external: true },
@@ -62,6 +58,12 @@ const footerLinks = {
],
};
+const legalLinks = [
+ { label: "Terms", href: "/terms" },
+ { label: "Privacy", href: "/terms#privacy" },
+ { label: "Refunds", href: "/terms#refunds" },
+];
+
export function Footer({ className }: { className?: string }) {
return (
<footer className={cn("bg-muted/30 mt-24 border-t md:mt-40", className)}>
@@ -142,10 +144,21 @@ export function Footer({ className }: { className?: string }) {
</div>
</div>
- <div className="mt-12 border-t pt-6">
+ <div className="mt-12 flex flex-col gap-3 border-t pt-6 sm:flex-row sm:items-center sm:justify-between">
<p className="text-muted-foreground text-xs">
© {new Date().getFullYear()} mapcn. All rights reserved.
</p>
+ <nav aria-label="Legal" className="flex items-center gap-4 text-xs">
+ {legalLinks.map((link) => (
+ <Link
+ key={link.href}
+ href={link.href}
+ className="text-muted-foreground hover:text-foreground transition-colors"
+ >
+ {link.label}
+ </Link>
+ ))}
+ </nav>
</div>
</div>
</footer>
diff --git a/src/components/github-button.tsx b/src/components/github-button.tsx
index c8b5c53..4e8c475 100644
--- a/src/components/github-button.tsx
+++ b/src/components/github-button.tsx
@@ -30,18 +30,25 @@ export function GitHubButton({ withCount = true }: { withCount?: boolean }) {
);
}
-export async function StarCount() {
- const response = await fetch(
- "https://api.github.com/repos/AnmolSaini16/mapcn",
- { next: { revalidate: 60 } },
- );
+export async function getStarCount() {
+ let count: number | undefined;
+ try {
+ const response = await fetch(
+ "https://api.github.com/repos/AnmolSaini16/mapcn",
+ { next: { revalidate: 60 } },
+ );
+ if (!response.ok) return null;
+ count = (await response.json()).stargazers_count;
+ } catch {
+ return null;
+ }
+ if (typeof count !== "number") return null;
- const data = await response.json();
+ return count >= 1000 ? `${(count / 1000).toFixed(1)}k` : `${count}`;
+}
- const formattedCount =
- data.stargazers_count >= 1000
- ? `${(data.stargazers_count / 1000).toFixed(1)}k`
- : data.stargazers_count;
+export async function StarCount() {
+ const formattedCount = await getStarCount();
return (
<>
diff --git a/src/components/sponsor-link.tsx b/src/components/sponsor-link.tsx
new file mode 100644
index 0000000..899ca28
--- /dev/null
+++ b/src/components/sponsor-link.tsx
@@ -0,0 +1,35 @@
+"use client";
+
+import { trackEvent } from "@/lib/events";
+import { sponsorHref, type Sponsor } from "@/lib/sponsors";
+import { cn } from "@/lib/utils";
+
+export function SponsorLink({
+ sponsor,
+ placement,
+ className,
+ children,
+}: {
+ sponsor: Sponsor;
+ placement: string;
+ className?: string;
+ children: React.ReactNode;
+}) {
+ return (
+ <a
+ href={sponsorHref(sponsor.href, placement)}
+ target="_blank"
+ rel="sponsored noopener"
+ aria-label={sponsor.name}
+ onClick={() =>
+ trackEvent({
+ name: "click_sponsor",
+ properties: { sponsor: sponsor.name, placement },
+ })
+ }
+ className={cn("group", className)}
+ >
+ {children}
+ </a>
+ );
+}
diff --git a/src/components/sponsor-logos.tsx b/src/components/sponsor-logos.tsx
new file mode 100644
index 0000000..566ded3
--- /dev/null
+++ b/src/components/sponsor-logos.tsx
@@ -0,0 +1,207 @@
+import Image from "next/image";
+import Link from "next/link";
+import { ArrowRight, ChevronRight } from "lucide-react";
+
+import { SponsorLink } from "@/components/sponsor-link";
+import {
+ getFeaturedSponsors,
+ hasFeaturedSponsors,
+ type Sponsor,
+} from "@/lib/sponsors";
+import { cn } from "@/lib/utils";
+
+export function SponsorStrip({ className }: { className?: string }) {
+ const { platinum, gold } = getFeaturedSponsors();
+
+ return (
+ <div
+ className={cn(
+ "bg-muted ring-foreground/5 dark:bg-muted/30 mx-auto w-full max-w-3xl rounded-2xl p-2 ring-1",
+ className,
+ )}
+ >
+ <div className="bg-border ring-foreground/10 dark:ring-foreground/5 flex flex-col gap-px overflow-hidden rounded-lg shadow-xs ring-1">
+ {platinum.length > 0 && (
+ <div
+ className={cn(
+ "grid gap-px",
+ platinum.length > 1 && "sm:grid-cols-2",
+ )}
+ >
+ {platinum.map((sponsor) => (
+ <SponsorLink
+ key={sponsor.name}
+ sponsor={sponsor}
+ placement="home"
+ className={cn(
+ stripCellClassName,
+ "flex-col gap-2.5 px-6 py-8 text-center md:py-10",
+ )}
+ >
+ <SponsorImage sponsor={sponsor} className="h-8 w-36" />
+ {sponsor.tagline && (
+ <span className="text-muted-foreground group-hover:text-foreground/80 text-sm transition-colors">
+ {sponsor.tagline}
+ </span>
+ )}
+ </SponsorLink>
+ ))}
+ </div>
+ )}
+ {gold.length > 0 && (
+ <div
+ className={cn(
+ "grid gap-px max-sm:[&>*:last-child:nth-child(odd)]:col-span-2",
+ gold.length > 1 ? "grid-cols-2" : "grid-cols-1",
+ goldColumns[Math.min(gold.length, 4)],
+ )}
+ >
+ {gold.map((sponsor) => (
+ <SponsorLink
+ key={sponsor.name}
+ sponsor={sponsor}
+ placement="home"
+ className={cn(stripCellClassName, "h-16 md:h-20")}
+ >
+ <SponsorImage sponsor={sponsor} className="h-6 w-24" />
+ </SponsorLink>
+ ))}
+ </div>
+ )}
+ </div>
+ </div>
+ );
+}
+
+export function DocsSponsors({ className }: { className?: string }) {
+ const { platinum, gold } = getFeaturedSponsors();
+
+ if (!hasFeaturedSponsors()) {
+ return (
+ <Link
+ href="/sponsors"
+ className={cn(
+ "group bg-muted/60 hover:bg-muted dark:bg-muted/30 dark:hover:bg-muted/50 -mx-3 block rounded-xl px-3 py-3 transition-colors",
+ className,
+ )}
+ >
+ <span className="flex items-center justify-between gap-2 text-sm font-medium">
+ Sponsor mapcn
+ <ArrowRight className="text-muted-foreground group-hover:text-foreground size-3.5 transition-[color,translate] group-hover:translate-x-0.5" />
+ </span>
+ <span className="text-muted-foreground mt-1 block text-xs leading-relaxed">
+ Reach developers building with mapcn.
+ </span>
+ </Link>
+ );
+ }
+
+ return (
+ <div className={cn("flex flex-col", className)}>
+ <p className="text-muted-foreground mb-3 text-xs font-medium">Sponsors</p>
+ <div className="-mx-3 flex flex-col gap-2">
+ {platinum.map((sponsor) => (
+ <SponsorLink
+ key={sponsor.name}
+ sponsor={sponsor}
+ placement="docs"
+ className={cn(
+ docsTileClassName,
+ "flex flex-col gap-2 rounded-xl p-3",
+ )}
+ >
+ <SponsorImage
+ sponsor={sponsor}
+ className="h-6 w-full"
+ imageClassName="object-left"
+ />
+ {sponsor.tagline && (
+ <span className="text-muted-foreground group-hover:text-foreground/80 text-xs leading-relaxed transition-colors">
+ {sponsor.tagline}
+ </span>
+ )}
+ </SponsorLink>
+ ))}
+ {gold.length > 0 && (
+ <div
+ className={cn(
+ "grid grid-cols-2 gap-x-4 gap-y-3 px-3",
+ platinum.length > 0 && "pt-2",
+ )}
+ >
+ {gold.map((sponsor) => (
+ <SponsorLink
+ key={sponsor.name}
+ sponsor={sponsor}
+ placement="docs"
+ className="flex items-center"
+ >
+ <SponsorImage
+ sponsor={sponsor}
+ className="h-5 w-full"
+ imageClassName="object-left"
+ />
+ </SponsorLink>
+ ))}
+ </div>
+ )}
+ </div>
+ <Link
+ href="/sponsors"
+ className="group text-muted-foreground/70 hover:text-foreground mt-4 flex items-center gap-1 text-xs transition-colors"
+ >
+ Become a sponsor
+ <ChevronRight className="size-3 transition-transform group-hover:translate-x-0.5" />
+ </Link>
+ </div>
+ );
+}
+
+export function SponsorImage({
+ sponsor,
+ className,
+ imageClassName,
+}: {
+ sponsor: Sponsor;
+ className?: string;
+ imageClassName?: string;
+}) {
+ const baseClassName = cn(
+ "object-contain opacity-70 grayscale transition-[opacity,filter] duration-200 group-hover:opacity-100 group-hover:grayscale-0 group-focus-visible:opacity-100 group-focus-visible:grayscale-0",
+ imageClassName,
+ );
+
+ return (
+ <span className={cn("relative block", className)}>
+ <Image
+ src={sponsor.logo}
+ alt=""
+ fill
+ sizes="208px"
+ className={cn(baseClassName, sponsor.logoDark && "dark:hidden")}
+ />
+ {sponsor.logoDark && (
+ <Image
+ src={sponsor.logoDark}
+ alt=""
+ fill
+ sizes="208px"
+ className={cn(baseClassName, "hidden dark:block")}
+ />
+ )}
+ </span>
+ );
+}
+
+const docsTileClassName =
+ "bg-muted/60 hover:bg-muted dark:bg-muted/30 dark:hover:bg-muted/50 transition-colors";
+
+const stripCellClassName =
+ "bg-background hover:bg-[color-mix(in_oklab,var(--muted)_35%,var(--background))] flex items-center justify-center transition-colors duration-200";
+
+const goldColumns: Record<number, string> = {
+ 1: "sm:grid-cols-1",
+ 2: "sm:grid-cols-2",
+ 3: "sm:grid-cols-3",
+ 4: "sm:grid-cols-4",
+};
diff --git a/src/components/text-link.tsx b/src/components/text-link.tsx
new file mode 100644
index 0000000..e4d4cd8
--- /dev/null
+++ b/src/components/text-link.tsx
@@ -0,0 +1,22 @@
+import Link from "next/link";
+
+export function TextLink({
+ href,
+ children,
+}: {
+ href: string;
+ children: React.ReactNode;
+}) {
+ const external = href.startsWith("http");
+
+ return (
+ <Link
+ href={href}
+ target={external ? "_blank" : undefined}
+ rel={external ? "noopener noreferrer" : undefined}
+ className="text-foreground decoration-foreground/25 hover:decoration-foreground/60 underline underline-offset-4 transition-colors"
+ >
+ {children}
+ </Link>
+ );
+}
diff --git a/src/components/ui/accordion.tsx b/src/components/ui/accordion.tsx
new file mode 100644
index 0000000..480911c
--- /dev/null
+++ b/src/components/ui/accordion.tsx
@@ -0,0 +1,65 @@
+"use client"
+
+import * as React from "react"
+import { cn } from "@/lib/utils"
+import { PlusIcon } from "lucide-react"
+import { Accordion as AccordionPrimitive } from "radix-ui"
+
+function Accordion({
+ ...props
+}: React.ComponentProps<typeof AccordionPrimitive.Root>) {
+ return <AccordionPrimitive.Root data-slot="accordion" {...props} />
+}
+
+function AccordionItem({
+ className,
+ ...props
+}: React.ComponentProps<typeof AccordionPrimitive.Item>) {
+ return (
+ <AccordionPrimitive.Item
+ data-slot="accordion-item"
+ className={cn("border-b last:border-b-0", className)}
+ {...props}
+ />
+ )
+}
+
+function AccordionTrigger({
+ className,
+ children,
+ ...props
+}: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
+ return (
+ <AccordionPrimitive.Header className="flex">
+ <AccordionPrimitive.Trigger
+ data-slot="accordion-trigger"
+ className={cn(
+ "flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none hover:underline focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 [&[data-state=open]>svg]:rotate-45",
+ className
+ )}
+ {...props}
+ >
+ {children}
+ <PlusIcon className="pointer-events-none size-4 shrink-0 translate-y-0.5 text-muted-foreground transition-transform duration-200" />
+ </AccordionPrimitive.Trigger>
+ </AccordionPrimitive.Header>
+ )
+}
+
+function AccordionContent({
+ className,
+ children,
+ ...props
+}: React.ComponentProps<typeof AccordionPrimitive.Content>) {
+ return (
+ <AccordionPrimitive.Content
+ data-slot="accordion-content"
+ className="overflow-hidden text-sm data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down"
+ {...props}
+ >
+ <div className={cn("pt-0 pb-4", className)}>{children}</div>
+ </AccordionPrimitive.Content>
+ )
+}
+
+export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
diff --git a/src/lib/events.ts b/src/lib/events.ts
index 9efa822..9c2fa18 100644
--- a/src/lib/events.ts
+++ b/src/lib/events.ts
@@ -4,7 +4,10 @@ type EventName =
| "copy_install_command"
| "copy_block_cli"
| "copy_block_code"
- | "copy_agent_prompt";
+ | "copy_agent_prompt"
+ | "click_sponsor"
+ | "click_sponsor_contact"
+ | "click_sponsor_checkout";
type AllowedPropertyValues = string | number | boolean | null;
diff --git a/src/lib/metadata.ts b/src/lib/metadata.ts
index 5f5e580..a960c11 100644
--- a/src/lib/metadata.ts
+++ b/src/lib/metadata.ts
@@ -1,3 +1,6 @@
+export const siteUrl =
+ process.env.NEXT_PUBLIC_SITE_URL || "http://localhost:3000";
+
export const siteBanner = {
url: "/banner.png",
width: 1200,
diff --git a/src/lib/site-navigation.ts b/src/lib/site-navigation.ts
index c06eb0f..2f9c60a 100644
--- a/src/lib/site-navigation.ts
+++ b/src/lib/site-navigation.ts
@@ -50,6 +50,7 @@ const navItems: SiteNavigationItem[] = [
{ title: "Docs", href: "/docs", icon: CornerDownRight },
{ title: "Components", href: "/docs/basic-map", icon: CornerDownRight },
{ title: "Blocks", href: "/blocks", icon: CornerDownRight },
+ { title: "Sponsors", href: "/sponsors", icon: CornerDownRight },
];
export const siteNavigation: SiteNavigationGroup[] = [
diff --git a/src/lib/sponsors.ts b/src/lib/sponsors.ts
new file mode 100644
index 0000000..501fb15
--- /dev/null
+++ b/src/lib/sponsors.ts
@@ -0,0 +1,162 @@
+import { siteUrl } from "@/lib/metadata";
+
+export const sponsorEmail = "[email protected]";
+export const githubSponsorsUrl = "https://github.com/sponsors/AnmolSaini16";
+export const xProfileUrl = "https://x.com/anmold_s";
+export const dodoCheckoutBase = "https://checkout.dodopayments.com";
+
+export type SponsorTierId = "platinum" | "gold" | "silver";
+
+export interface SponsorTier {
+ id: SponsorTierId;
+ name: string;
+ price: number;
+ /** Max concurrent sponsors. Omit for unlimited. */
+ slots?: number;
+ perks: string[];
+ /** Dodo Payments product ID. Falls back to email when unset. */
+ productId?: string;
+}
+
+export interface Sponsor {
+ name: string;
+ tier: SponsorTierId;
+ href: string;
+ /** Monochrome SVG in `public/sponsors/`. */
+ logo: string;
+ /** Optional dark-mode variant of `logo`. */
+ logoDark?: string;
+ tagline?: string;
+}
+
+export interface SiteStat {
+ label: string;
+ value: string;
+}
+
+export const sponsorTiers: SponsorTier[] = [
+ {
+ id: "platinum",
+ name: "Platinum",
+ price: 500,
+ slots: 2,
+ productId: "",
+ perks: [
+ "Largest logo on the homepage, below the showcase",
+ "Top logo with tagline on every docs page",
+ "Largest logo on the sponsors page and README",
+ "One-time shoutout on X",
+ ],
+ },
+ {
+ id: "gold",
+ name: "Gold",
+ price: 250,
+ slots: 4,
+ productId: "",
+ perks: [
+ "Logo on the homepage, below the showcase",
+ "Logo on every docs page",
+ "Logo on the sponsors page and README",
+ "One-time shoutout on X",
+ ],
+ },
+ {
+ id: "silver",
+ name: "Silver",
+ price: 100,
+ productId: "",
+ perks: ["Logo on the sponsors page", "Logo in the README"],
+ },
+];
+
+export const sponsors: Sponsor[] = [];
+
+export const checkoutEnabled = sponsorTiers.some((tier) => tier.productId);
+
+/** Rounded down so they stay true without monthly updates. */
+export const pageviewsSinceLaunch = "1M+";
+
+export const siteStats: SiteStat[] = [
+ { label: "Pageviews since launch", value: pageviewsSinceLaunch },
+ { label: "Visitors since launch", value: "225K+" },
+ { label: "Monthly pageviews", value: "45K+" },
+];
+
+export function getSponsorsByTier(tier: SponsorTierId) {
+ return sponsors.filter((sponsor) => sponsor.tier === tier);
+}
+
+export function getFeaturedSponsors() {
+ return {
+ platinum: getSponsorsByTier("platinum"),
+ gold: getSponsorsByTier("gold"),
+ };
+}
+
+export function hasFeaturedSponsors() {
+ const { platinum, gold } = getFeaturedSponsors();
+ return platinum.length + gold.length > 0;
+}
+
+export function getOpenSlots(tier: SponsorTier) {
+ if (tier.slots === undefined) return undefined;
+ return Math.max(tier.slots - getSponsorsByTier(tier.id).length, 0);
+}
+
+export function sponsorHref(href: string, placement: string) {
+ try {
+ const url = new URL(href);
+ url.searchParams.set("ref", "mapcn.dev");
+ url.searchParams.set("utm_source", "mapcn.dev");
+ url.searchParams.set("utm_medium", placement);
+ return url.toString();
+ } catch {
+ return href;
+ }
+}
+
+export function getSponsorTier(id: unknown) {
+ if (typeof id !== "string") return undefined;
+ const tierId = id.split("?")[0];
+ return sponsorTiers.find((tier) => tier.id === tierId);
+}
+
+export function getSponsorAction(tier?: SponsorTier) {
+ const checkoutUrl = tier && sponsorCheckoutUrl(tier);
+ if (checkoutUrl) return { kind: "checkout", href: checkoutUrl } as const;
+ if (tier && getOpenSlots(tier) === 0) {
+ return { kind: "waitlist", href: sponsorMailto(tier, "waitlist") } as const;
+ }
+ return { kind: "contact", href: sponsorMailto(tier) } as const;
+}
+
+export function sponsorCheckoutUrl(tier: SponsorTier) {
+ if (!tier.productId || getOpenSlots(tier) === 0) return undefined;
+
+ const redirect = `${siteUrl}/sponsors/thank-you?tier=${tier.id}`;
+ return `${dodoCheckoutBase}/buy/${tier.productId}?quantity=1&redirect_url=${encodeURIComponent(redirect)}`;
+}
+
+export function sponsorMailto(tier?: SponsorTier, intent?: "waitlist") {
+ const subject = tier
+ ? `mapcn sponsorship - ${tier.name}${intent ? " waitlist" : ""}`
+ : "mapcn sponsorship";
+ const body = [
+ "Hi Anmol,",
+ "",
+ intent && tier
+ ? `I'd like to join the waitlist for the ${tier.name} tier.`
+ : `I'd like to sponsor mapcn${tier ? ` at the ${tier.name} tier` : ""}.`,
+ "",
+ "Company:",
+ "Website:",
+ ].join("\n");
+
+ return `mailto:${sponsorEmail}?subject=${encodeURIComponent(subject)}&body=${encodeURIComponent(body)}`;
+}
+
+export function sponsorAssetsMailto(tier?: SponsorTier) {
+ const subject = `mapcn ${tier ? `${tier.name} ` : ""}sponsorship assets`;
+ return `mailto:${sponsorEmail}?subject=${encodeURIComponent(subject)}`;
+}
diff --git a/src/styles/globals.css b/src/styles/globals.css
index 30ea0dc..23ad9a8 100644
--- a/src/styles/globals.css
+++ b/src/styles/globals.css
@@ -160,7 +160,7 @@
}
.container {
- @apply mx-auto max-w-[1440px] px-6;
+ @apply mx-auto max-w-[1500px] px-6;
}
.container-wide {