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
16 changes: 6 additions & 10 deletions website/app/(content)/platform/ecosystem/CommunityGrid.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import type { ReactNode } from "react";

import { TOOLS } from "@/src/components/header/navData";
import { RevealOnScroll } from "@/src/components/RevealOnScroll";
import { SectionHeading } from "@/src/components/SectionHeading";
import { GITHUB_REPO_URL, TOOLS } from "@/src/components/header/navData";
import { Card } from "@/src/design-system/Card";
import { GITHUB_REPO_URL } from "@/src/helpers/github";
import { BlogIcon } from "@/src/icons/Blog";
import { GitHubIcon } from "@/src/icons/GitHub";
import { SlackIcon } from "@/src/icons/Slack";
Expand Down Expand Up @@ -58,10 +59,9 @@ const COMMUNITY_CARDS: readonly CommunityCardSpec[] = [

interface CommunityCardProps {
readonly card: CommunityCardSpec;
readonly starCount: number | null;
}

function CommunityCard({ card, starCount }: CommunityCardProps) {
function CommunityCard({ card }: CommunityCardProps) {
const content = (
<>
<div className="border-cc-card-border bg-cc-surface text-cc-ink-dim flex h-10 w-10 items-center justify-center rounded-full border">
Expand All @@ -73,7 +73,7 @@ function CommunityCard({ card, starCount }: CommunityCardProps) {
<p className="text-cc-ink-dim mt-2 pb-6 text-sm">{card.body}</p>
<div className="mt-auto flex h-7 items-center">
{card.withStars ? (
<StarPill count={starCount} />
<StarPill />
) : (
<span className="text-cc-ink-dim group-hover:text-cc-heading text-sm font-medium transition-colors">
{card.action} <span aria-hidden="true">→</span>
Expand All @@ -100,11 +100,7 @@ function CommunityCard({ card, starCount }: CommunityCardProps) {
);
}

interface CommunityGridProps {
readonly starCount: number | null;
}

export function CommunityGrid({ starCount }: CommunityGridProps) {
export function CommunityGrid() {
return (
<section className="py-14 sm:py-20">
<RevealOnScroll>
Expand All @@ -114,7 +110,7 @@ export function CommunityGrid({ starCount }: CommunityGridProps) {
/>
<div className="mt-10 grid grid-cols-1 gap-5 sm:grid-cols-2 lg:grid-cols-4">
{COMMUNITY_CARDS.map((card) => (
<CommunityCard key={card.title} card={card} starCount={starCount} />
<CommunityCard key={card.title} card={card} />
))}
</div>
</RevealOnScroll>
Expand Down
36 changes: 16 additions & 20 deletions website/app/(content)/platform/ecosystem/Hero.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,23 @@ import Link from "next/link";
import type { CSSProperties, ReactNode } from "react";

import { ButtonRow } from "@/src/components/ButtonRow";
import {
GITHUB_REPO_URL,
GITHUB_STARGAZERS_URL,
TOOLS,
} from "@/src/components/header/navData";
import { TOOLS } from "@/src/components/header/navData";
import { OutlineButton, SolidButton } from "@/src/design-system/Button";
import { GITHUB_REPO_URL, GITHUB_STARGAZERS_URL } from "@/src/helpers/github";
import type { GitHubContributor } from "@/src/helpers/githubContributors";
import { BlogIcon } from "@/src/icons/Blog";
import { GitHubIcon } from "@/src/icons/GitHub";
import { SlackIcon } from "@/src/icons/Slack";

import { CARD_FOCUS_CLASSES } from "./cardFocus";
import { PILL_CLASSES, StarPillContent } from "./StarPill";
import {
CONNECTORS,
ORBIT_RINGS,
connectorPath,
polarPoint,
} from "./orbitGeometry";
import { PILL_CLASSES } from "./pillClasses";
import { StarPillContent } from "./StarPill";

const RING_STROKE = "rgba(245,240,234,0.17)";

Expand All @@ -43,30 +41,30 @@ interface OrbitNodeSpec {
readonly key: string;
readonly angle: number;
readonly radius: number;
readonly render: (starCount: number | null) => ReactNode;
readonly content: ReactNode;
}

const ORBIT_NODES: readonly OrbitNodeSpec[] = [
{
key: "stars",
angle: 197,
radius: 680,
render: (starCount) => (
content: (
<a
href={GITHUB_STARGAZERS_URL}
target="_blank"
rel="noopener noreferrer"
className={`${PILL_CLASSES} ${ORBIT_LINK_CLASSES}`}
>
<StarPillContent count={starCount} />
<StarPillContent />
</a>
),
},
{
key: "license",
angle: 343,
radius: 680,
render: () => (
content: (
<a
href={`${GITHUB_REPO_URL}/blob/main/LICENSE`}
target="_blank"
Expand All @@ -81,7 +79,7 @@ const ORBIT_NODES: readonly OrbitNodeSpec[] = [
key: "github",
angle: 155,
radius: 680,
render: () => (
content: (
<SocialChip href={GITHUB_REPO_URL} label="ChilliCream on GitHub">
<GitHubIcon className="h-5 w-5 fill-current" />
</SocialChip>
Expand All @@ -91,7 +89,7 @@ const ORBIT_NODES: readonly OrbitNodeSpec[] = [
key: "slack",
angle: 25,
radius: 680,
render: () => (
content: (
<SocialChip href={TOOLS.slack} label="Join the ChilliCream Slack">
<SlackIcon className="h-5 w-5 fill-current" />
</SocialChip>
Expand All @@ -101,7 +99,7 @@ const ORBIT_NODES: readonly OrbitNodeSpec[] = [
key: "blog",
angle: 38,
radius: 560,
render: () => (
content: (
<SocialChip href="/blog" label="ChilliCream blog">
<BlogIcon className="h-5 w-5 fill-current" />
</SocialChip>
Expand Down Expand Up @@ -203,11 +201,10 @@ function SocialChip({ href, label, children }: SocialChipProps) {
}

interface MobileHeroLinksProps {
readonly starCount: number | null;
readonly contributors: ReadonlyArray<GitHubContributor> | null;
}

function MobileHeroLinks({ starCount, contributors }: MobileHeroLinksProps) {
function MobileHeroLinks({ contributors }: MobileHeroLinksProps) {
const linkClassName = `border-cc-card-border bg-cc-surface text-cc-ink-dim flex min-h-11 items-center justify-center gap-2 rounded-lg border px-3 font-mono text-[0.65rem] no-underline ${CARD_FOCUS_CLASSES}`;
return (
<nav
Expand All @@ -222,7 +219,7 @@ function MobileHeroLinks({ starCount, contributors }: MobileHeroLinksProps) {
rel="noopener noreferrer"
className={linkClassName}
>
<StarPillContent count={starCount} />
<StarPillContent />
</a>
</li>
<li>
Expand Down Expand Up @@ -288,11 +285,10 @@ function MobileHeroLinks({ starCount, contributors }: MobileHeroLinksProps) {
}

interface HeroProps {
readonly starCount: number | null;
readonly contributors: ReadonlyArray<GitHubContributor> | null;
}

export function Hero({ starCount, contributors }: HeroProps) {
export function Hero({ contributors }: HeroProps) {
return (
<section className="relative flex min-h-[640px] flex-col items-center justify-center py-24 [--u:0.62] sm:min-h-[720px] sm:[--u:0.78] lg:min-h-[820px] lg:[--u:1]">
<style href="ecosystem-hero-entrance" precedence="medium">
Expand Down Expand Up @@ -355,7 +351,7 @@ export function Hero({ starCount, contributors }: HeroProps) {
radius={node.radius}
delay={i * 40}
>
{node.render(starCount)}
{node.content}
</OrbitNode>
))}
{contributors?.slice(0, AVATAR_SLOTS.length).map((contributor, i) => {
Expand Down Expand Up @@ -414,7 +410,7 @@ export function Hero({ starCount, contributors }: HeroProps) {
Read the docs
</OutlineButton>
</ButtonRow>
<MobileHeroLinks starCount={starCount} contributors={contributors} />
<MobileHeroLinks contributors={contributors} />
<p className="font-heading text-h4 text-cc-heading mx-auto mt-20 max-w-2xl font-semibold sm:mt-24">
Open source you can inspect. Standards you can follow. People you can
reach.
Expand Down
2 changes: 1 addition & 1 deletion website/app/(content)/platform/ecosystem/ProofBand.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RevealOnScroll } from "@/src/components/RevealOnScroll";
import { SectionHeading } from "@/src/components/SectionHeading";
import { GITHUB_REPO_URL } from "@/src/components/header/navData";
import { Card } from "@/src/design-system/Card";
import { GITHUB_REPO_URL } from "@/src/helpers/github";
import { GitHubIcon } from "@/src/icons/GitHub";

import { CARD_FOCUS_CLASSES } from "./cardFocus";
Expand Down
22 changes: 9 additions & 13 deletions website/app/(content)/platform/ecosystem/StarPill.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
"use client";

import { useGitHubStarCount } from "@/src/helpers/useGitHubStarCount";
import { GitHubIcon } from "@/src/icons/GitHub";

export const PILL_CLASSES =
"border-cc-card-border bg-cc-surface text-cc-ink-dim flex h-7 items-center gap-1.5 rounded-full border px-3 pt-[2px] font-mono text-[0.6rem] tracking-[0.14em] whitespace-nowrap uppercase";
import { PILL_CLASSES } from "./pillClasses";

interface StarPillContentProps {
readonly count: number | null;
}
export function StarPillContent() {
const count = useGitHubStarCount();

export function StarPillContent({ count }: StarPillContentProps) {
return (
<>
<GitHubIcon aria-hidden="true" className="h-3 w-3 fill-current" />
{count === null ? (
<span>GITHUB</span>
<span>Stars</span>
) : (
<span className="text-cc-heading">
<span className="sr-only">GitHub stars: </span>
Expand All @@ -23,14 +23,10 @@ export function StarPillContent({ count }: StarPillContentProps) {
);
}

interface StarPillProps {
readonly count: number | null;
}

export function StarPill({ count }: StarPillProps) {
export function StarPill() {
return (
<div className={PILL_CLASSES}>
<StarPillContent count={count} />
<StarPillContent />
</div>
);
}
10 changes: 3 additions & 7 deletions website/app/(content)/platform/ecosystem/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { RevealOnScroll } from "@/src/components/RevealOnScroll";
import { TOOLS } from "@/src/components/header/navData";
import commitActivity from "@/src/data/githubCommitActivity.json";
import { getGitHubContributors } from "@/src/helpers/githubContributors";
import { getGitHubStarCount } from "@/src/helpers/githubStars";
import { pageMetadata } from "@/src/helpers/pageMetadata";
import { schemaId, schemaRef } from "@/src/helpers/structuredData";

Expand Down Expand Up @@ -39,10 +38,7 @@ export const metadata = pageMetadata(PAGE);
const HIDDEN_CONTRIBUTOR_LOGINS = new Set(["artola"]);

export default async function EcosystemPage() {
const [starCount, contributors] = await Promise.all([
getGitHubStarCount(),
getGitHubContributors(),
]);
const contributors = await getGitHubContributors();
const heroContributors =
contributors?.filter(
(contributor) => !HIDDEN_CONTRIBUTOR_LOGINS.has(contributor.login),
Expand All @@ -66,10 +62,10 @@ export default async function EcosystemPage() {
schemaRef(schemaId("/products/mocha", "software")),
]}
/>
<Hero starCount={starCount} contributors={heroContributors} />
<Hero contributors={heroContributors} />
<ProofBand commitActivity={commitActivity.weeks} />
<StandardsBand />
<CommunityGrid starCount={starCount} />
<CommunityGrid />
<RevealOnScroll>
<FromOurBlog limit={3} className="py-10 sm:py-14" />
</RevealOnScroll>
Expand Down
2 changes: 2 additions & 0 deletions website/app/(content)/platform/ecosystem/pillClasses.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export const PILL_CLASSES =
"border-cc-card-border bg-cc-surface text-cc-ink-dim flex h-7 items-center gap-1.5 rounded-full border px-3 pt-[2px] font-mono text-[0.6rem] tracking-[0.14em] whitespace-nowrap uppercase";
5 changes: 5 additions & 0 deletions website/src/components/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { SlackIcon } from "@/src/icons/Slack";
import { XIcon } from "@/src/icons/X";
import { YouTubeIcon } from "@/src/icons/YouTube";

import { GitHubStarButton } from "./GitHubStarButton";

const tools = {
blog: "/blog",
github: "https://github.com/ChilliCream/graphql-platform",
Expand Down Expand Up @@ -51,6 +53,9 @@ export default function Footer() {
<br />
United States
</address>
<div className="flex">
<GitHubStarButton />
</div>
</div>
<div className="grid flex-4 grid-cols-2 gap-8 md:grid-cols-4">
<LinkColumn title="Platform">
Expand Down
36 changes: 36 additions & 0 deletions website/src/components/GitHubStarButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"use client";

import { GitHubIcon } from "@/src/icons/GitHub";

import { GITHUB_REPO_URL, GITHUB_STARGAZERS_URL } from "@/src/helpers/github";
import { useGitHubStarCount } from "@/src/helpers/useGitHubStarCount";

export function GitHubStarButton() {
const count = useGitHubStarCount();

return (
<span className="border-cc-card-border bg-cc-hover text-cc-heading inline-flex items-stretch overflow-hidden rounded-md border text-xs font-medium">
<a
href={GITHUB_REPO_URL}
target="_blank"
rel="noopener noreferrer"
className="hover:bg-cc-ink-faint inline-flex items-center gap-1.5 px-2 py-1 no-underline transition-colors"
aria-label="Star ChilliCream on GitHub"
>
<GitHubIcon className="text-cc-heading h-3.5 w-3.5 fill-current" />
Star
</a>
{!!count && (
<a
href={GITHUB_STARGAZERS_URL}
target="_blank"
rel="noopener noreferrer"
className="border-cc-card-border text-cc-heading hover:bg-cc-ink-faint inline-flex items-center border-l px-2 py-1 tabular-nums no-underline transition-colors"
aria-label={`${count.toLocaleString("en-US")} stargazers on GitHub`}
>
{count.toLocaleString("en-US")}
</a>
)}
</span>
);
}
10 changes: 4 additions & 6 deletions website/src/components/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
import Link from "next/link";
import { SolidButton } from "@/src/design-system/Button";
import { Picture } from "@/src/design-system/Picture";
import Link from "next/link";

import { getLatestBlogPost } from "@/src/helpers/blogPosts";
import { getGitHubStarCount } from "@/src/helpers/githubStars";
import { ChilliCreamText } from "@/src/icons/ChilliCreamText";
import { ChilliCreamWinking } from "@/src/icons/ChilliCreamWinking";

import { HeaderShell } from "./HeaderShell";
import { GitHubStarButton } from "./header/GitHubStarButton";
import { GitHubStarButton } from "./GitHubStarButton";
import { HeaderNav } from "./header/HeaderNav";
import { CONTACT_HREF, MOBILE_ITEMS, TOOLS } from "./header/navData";
import { HeaderShell } from "./HeaderShell";
import { MobileNav } from "./MobileNav";
import { Search } from "./Search";

export default async function Header() {
const latestBlog = getLatestBlogPost();
const starCount = await getGitHubStarCount();
// The optimized <Picture> is built here (server-only: it reads the image
// manifest from disk) and handed to the client nav as a ready-made node.
const blogImage = latestBlog?.featuredImage ? (
Expand Down Expand Up @@ -45,7 +43,7 @@ export default async function Header() {
<HeaderNav latestBlog={latestBlog} blogImage={blogImage} />

<div className="hidden flex-none items-center gap-5 min-[1060px]:flex">
<GitHubStarButton initialCount={starCount} />
<GitHubStarButton />
<Link
href={CONTACT_HREF}
prefetch={false}
Expand Down
Loading
Loading