diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 87468d39..d3455b2b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,6 @@ jobs: TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} TURBO_TEAM: ${{ vars.TURBO_TEAM }} CC_OS: ${{ matrix.os }} - SPONSOR_GITHUB_TOKEN: ${{ secrets.SPONSOR_GITHUB_TOKEN }} steps: - name: Check out code diff --git a/.github/workflows/preview-release.yml b/.github/workflows/preview-release.yml index c47bcec6..c2c8c0c6 100644 --- a/.github/workflows/preview-release.yml +++ b/.github/workflows/preview-release.yml @@ -21,7 +21,6 @@ jobs: env: TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} TURBO_TEAM: ${{ vars.TURBO_TEAM }} - SPONSOR_GITHUB_TOKEN: ${{ secrets.SPONSOR_GITHUB_TOKEN }} steps: - name: Check out code (push or pull_request) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 659aca3a..04154fb2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -41,4 +41,3 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - SPONSOR_GITHUB_TOKEN: ${{ secrets.SPONSOR_GITHUB_TOKEN }} diff --git a/website/app/(home)/sponsors/page.tsx b/website/app/(home)/sponsors/page.tsx index 9f43a25d..dc3c2cca 100644 --- a/website/app/(home)/sponsors/page.tsx +++ b/website/app/(home)/sponsors/page.tsx @@ -1,98 +1,45 @@ +import clsx from "clsx"; +import { allSponsors, Sponsor } from "content-collections"; import Image from "next/image"; -const queryOneTimeSponsors = `query sponsors($user: String!) { - user(login: $user) { - sponsorsActivities(first: 100, period: ALL) { - nodes { - sponsorsTier { - monthlyPriceInDollars - isOneTime - } - sponsor { - ... on Organization { - name - avatarUrl - url - } - ... on User { - name - avatarUrl - url - } - } - } - } - } -}`; - -type Sponsor = { - name: string; - avatarUrl: string; - url: string; - isOneTime: boolean; -}; - -async function fetchSponsors(): Promise { - const response = await fetch("https://api.github.com/graphql", { - method: "POST", - headers: { - Authorization: `Bearer ${process.env.SPONSOR_GITHUB_TOKEN}`, - "Content-Type": "application/json", - }, - body: JSON.stringify({ - query: queryOneTimeSponsors, - variables: { - user: "sdorra", - }, - }), - }); - - if (!response.ok || response.status !== 200) { - throw new Error(`Failed to fetch sponsors: ${response.status}`); - } - - const { data } = await response.json(); - - const sponsors = data.user.sponsorsActivities.nodes; - sponsors.sort( - (a: any, b: any) => - b.sponsorsTier.monthlyPriceInDollars - - a.sponsorsTier.monthlyPriceInDollars, - ); - - return sponsors.map((node: any) => ({ - name: node.sponsor.name, - avatarUrl: node.sponsor.avatarUrl, - url: node.sponsor.url, - isOneTime: node.sponsorsTier.isOneTime, - })); -} +const sortedSponsors = allSponsors.toSorted((a, b) => b.order - a.order); type SponsorListProps = { title: string; sponsors: Sponsor[]; + size: "small" | "large"; }; -function SponsorList({ title, sponsors }: SponsorListProps) { +function SponsorList({ title, sponsors, size }: SponsorListProps) { return ( <>

{title}

-
+
{sponsors.map((sponsor) => ( {sponsor.name} -

{sponsor.name}

+

+ {sponsor.name} +

))}
@@ -100,8 +47,7 @@ function SponsorList({ title, sponsors }: SponsorListProps) { ); } -export default async function SponsorPage() { - const sponsors = await fetchSponsors(); +export default function SponsorPage() { return (

Sponsors

@@ -110,12 +56,14 @@ export default async function SponsorPage() { Content Collections.

!sponsor.isOneTime)} + title="Current Sponsors" + sponsors={sortedSponsors.filter((sponsor) => sponsor.isActive)} + size="large" /> sponsor.isOneTime)} + title="Past Sponsors" + sponsors={sortedSponsors.filter((sponsor) => !sponsor.isActive)} + size="small" />

Become a Sponsor

diff --git a/website/content-collections.ts b/website/content-collections.ts index 2cfaeedc..9a8fa473 100644 --- a/website/content-collections.ts +++ b/website/content-collections.ts @@ -137,6 +137,20 @@ const metas = defineCollection({ parser: "json", }); +const sponsors = defineCollection({ + name: "sponsors", + directory: "./content/sponsors", + include: "**/*.yml", + parser: "yaml", + schema: (z) => ({ + name: z.string(), + avatarUrl: z.string().url(), + url: z.string().url(), + isActive: z.boolean(), + order: z.number(), + }), +}); + export default defineConfig({ - collections: [samples, docs, metas], + collections: [samples, docs, metas, sponsors], }); diff --git a/website/content/sponsors/cloudogu.yml b/website/content/sponsors/cloudogu.yml new file mode 100644 index 00000000..31f5eab6 --- /dev/null +++ b/website/content/sponsors/cloudogu.yml @@ -0,0 +1,5 @@ +name: Cloudogu +avatarUrl: https://avatars.githubusercontent.com/u/13451207?v=4 +url: https://cloudogu.com +isActive: true +order: 100 diff --git a/website/content/sponsors/dubinc.yml b/website/content/sponsors/dubinc.yml new file mode 100644 index 00000000..93c51a1a --- /dev/null +++ b/website/content/sponsors/dubinc.yml @@ -0,0 +1,5 @@ +name: Dub.co +avatarUrl: https://avatars.githubusercontent.com/u/153106492?v=4 +url: https://github.com/dubinc +isActive: false +order: 100 diff --git a/website/content/sponsors/malikpiara.yml b/website/content/sponsors/malikpiara.yml new file mode 100644 index 00000000..cf1d90d6 --- /dev/null +++ b/website/content/sponsors/malikpiara.yml @@ -0,0 +1,5 @@ +name: Malik Piara +avatarUrl: https://avatars.githubusercontent.com/u/6923650?v=4 +url: https://github.com/malikpiara +isActive: true +order: 10 diff --git a/website/content/sponsors/nebrelbug.yml b/website/content/sponsors/nebrelbug.yml new file mode 100644 index 00000000..4b0c584d --- /dev/null +++ b/website/content/sponsors/nebrelbug.yml @@ -0,0 +1,5 @@ +name: Ben Gubler +avatarUrl: https://avatars.githubusercontent.com/u/25597854?v=4 +url: https://github.com/nebrelbug +isActive: false +order: 20 diff --git a/website/content/sponsors/supastarter.yml b/website/content/sponsors/supastarter.yml new file mode 100644 index 00000000..33a93684 --- /dev/null +++ b/website/content/sponsors/supastarter.yml @@ -0,0 +1,5 @@ +name: supastarter +avatarUrl: https://avatars.githubusercontent.com/u/110960143?v=4 +url: https://supastarter.dev/ +isActive: true +order: 90 diff --git a/website/content/sponsors/youngle316.yml b/website/content/sponsors/youngle316.yml new file mode 100644 index 00000000..0f506a69 --- /dev/null +++ b/website/content/sponsors/youngle316.yml @@ -0,0 +1,5 @@ +name: YangLeLe +avatarUrl: https://avatars.githubusercontent.com/u/38031149?v=4 +url: https://github.com/youngle316 +isActive: false +order: 10 diff --git a/website/package.json b/website/package.json index a25342a0..9b01bd15 100644 --- a/website/package.json +++ b/website/package.json @@ -3,7 +3,7 @@ "version": "0.1.0", "private": true, "scripts": { - "dev": "next dev --turbo", + "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" diff --git a/website/turbo.json b/website/turbo.json index 83acbb41..147725ac 100644 --- a/website/turbo.json +++ b/website/turbo.json @@ -4,7 +4,6 @@ "tasks": { "build": { "inputs": ["$TURBO_DEFAULT$", "../docs/**"], - "env": ["SPONSOR_GITHUB_TOKEN"], "dependsOn": ["^build"], "outputs": [ "dist/**",