|
| 1 | +import { cn } from "@hypr/utils"; |
| 2 | +import { Icon } from "@iconify-icon/react"; |
| 3 | + |
| 4 | +const ORG_REPO = "fastrepl/hyprnote"; |
| 5 | + |
| 6 | +// Curated list of profiles to display |
| 7 | +const CURATED_PROFILES = [ |
| 8 | + // TODO: Add your curated list of avatar URLs here |
| 9 | + "https://avatars.githubusercontent.com/u/61503739?v=4", |
| 10 | + "https://avatars.githubusercontent.com/u/105270342?v=4", |
| 11 | + "https://avatars.githubusercontent.com/u/30039641?v=4", |
| 12 | + "https://avatars.githubusercontent.com/u/63365510?v=4", |
| 13 | + "https://avatars.githubusercontent.com/u/97124713?v=4", |
| 14 | + "https://avatars.githubusercontent.com/u/59800?v=4", |
| 15 | + "https://avatars.githubusercontent.com/u/51254761?v=4", |
| 16 | + "https://avatars.githubusercontent.com/u/76832007?v=4", |
| 17 | + "https://avatars.githubusercontent.com/u/86834898?v=4", |
| 18 | + "https://avatars.githubusercontent.com/u/48201223?v=4", |
| 19 | + "https://avatars.githubusercontent.com/u/26774729?v=4", |
| 20 | + "https://avatars.githubusercontent.com/u/23347263?v=4", |
| 21 | +]; |
| 22 | + |
| 23 | +function ProfileGrid({ profiles, cols }: { profiles: string[]; cols: 2 | 3 }) { |
| 24 | + const count = cols === 2 ? 4 : 6; |
| 25 | + return ( |
| 26 | + <div className={`grid grid-cols-${cols} gap-3`}> |
| 27 | + {profiles.slice(0, count).map((avatar, idx) => ( |
| 28 | + <div |
| 29 | + key={`profile-${idx}`} |
| 30 | + className="size-10 rounded-sm overflow-hidden border-2 border-neutral-200 bg-neutral-100" |
| 31 | + > |
| 32 | + <img |
| 33 | + src={avatar} |
| 34 | + alt="Contributor" |
| 35 | + className="w-full h-full object-cover" |
| 36 | + /> |
| 37 | + </div> |
| 38 | + ))} |
| 39 | + </div> |
| 40 | + ); |
| 41 | +} |
| 42 | + |
| 43 | +function StatBadge({ |
| 44 | + type, |
| 45 | + count, |
| 46 | +}: { |
| 47 | + type: "stars" | "forks"; |
| 48 | + count: number; |
| 49 | +}) { |
| 50 | + const renderCount = (n: number) => n > 1000 ? `${(n / 1000).toFixed(1)}k` : n; |
| 51 | + |
| 52 | + return ( |
| 53 | + <div className="flex flex-col gap-2 h-24 items-center justify-center border border-neutral-200 rounded-sm px-4 bg-neutral-100"> |
| 54 | + <p className="font-semibold text-stone-600 font-serif"> |
| 55 | + {type === "stars" ? "Stars" : "Forks"} |
| 56 | + </p> |
| 57 | + <p className="text-sm font-medium text-stone-600 text-center"> |
| 58 | + {renderCount(count)} |
| 59 | + </p> |
| 60 | + </div> |
| 61 | + ); |
| 62 | +} |
| 63 | + |
| 64 | +export function GitHubOpenSource() { |
| 65 | + const STARS_COUNT = 6419; |
| 66 | + const FORKS_COUNT = 396; |
| 67 | + |
| 68 | + return ( |
| 69 | + <section className="border-t border-neutral-100"> |
| 70 | + <div className="py-16 px-6"> |
| 71 | + <div className="grid grid-cols-1 lg:grid-cols-3 gap-8 lg:gap-12 items-center max-w-6xl mx-auto"> |
| 72 | + {/* Column 1: 2x2 grid + Stars badge + 3x2 grid */} |
| 73 | + <div className="flex items-center gap-4 justify-center"> |
| 74 | + <ProfileGrid profiles={CURATED_PROFILES.slice(0, 4)} cols={2} /> |
| 75 | + <StatBadge type="stars" count={STARS_COUNT} /> |
| 76 | + <ProfileGrid profiles={CURATED_PROFILES.slice(4, 10)} cols={3} /> |
| 77 | + </div> |
| 78 | + |
| 79 | + {/* Column 2: Text content */} |
| 80 | + <div className="text-center space-y-4"> |
| 81 | + <h2 className="text-3xl font-serif text-stone-600">Open source</h2> |
| 82 | + <p className="text-lg text-neutral-600"> |
| 83 | + Hyprnote was built to be transparent from day one. |
| 84 | + </p> |
| 85 | + <a |
| 86 | + href={`https://github.com/${ORG_REPO}`} |
| 87 | + target="_blank" |
| 88 | + rel="noopener noreferrer" |
| 89 | + className={cn([ |
| 90 | + "inline-flex items-center gap-2 px-6 py-3 mt-4", |
| 91 | + "bg-neutral-800 hover:bg-neutral-700 text-white rounded-sm", |
| 92 | + "transition-all hover:scale-[102%] active:scale-[98%]", |
| 93 | + ])} |
| 94 | + > |
| 95 | + <Icon icon="mdi:github" className="text-xl" /> |
| 96 | + <span>View on GitHub</span> |
| 97 | + </a> |
| 98 | + </div> |
| 99 | + |
| 100 | + {/* Column 3: 2x2 grid + Forks badge + 3x2 grid */} |
| 101 | + <div className="flex items-center gap-4 justify-center"> |
| 102 | + <ProfileGrid profiles={CURATED_PROFILES.slice(4, 10)} cols={3} /> |
| 103 | + <StatBadge type="forks" count={FORKS_COUNT} /> |
| 104 | + <ProfileGrid profiles={CURATED_PROFILES.slice(0, 4)} cols={2} /> |
| 105 | + </div> |
| 106 | + </div> |
| 107 | + </div> |
| 108 | + </section> |
| 109 | + ); |
| 110 | +} |
0 commit comments