diff --git a/site/src/components/CopyButton.astro b/site/src/components/CopyButton.astro index 5a2e54e..dc4b1fa 100644 --- a/site/src/components/CopyButton.astro +++ b/site/src/components/CopyButton.astro @@ -1,31 +1,53 @@ --- +import { GITHUB_URL } from '../data/site'; + interface Props { targetId: string; label?: string; variant?: 'icon' | 'text'; class?: string; + withAttribution?: boolean; + nudge?: boolean; } -const { targetId, label = 'Copy', variant = 'icon', class: extraClass = '' } = Astro.props; +const { targetId, label = 'Copy', variant = 'icon', class: extraClass = '', withAttribution = false, nudge = false } = Astro.props; const btnId = `copy-btn-${targetId}`; +const nudgeId = `star-nudge-${btnId}`; --- {variant === 'icon' ? ( - - - - - - - - Copy - Copied! - + + + + + + + + + Copy + Copied! + + {nudge && ( + + + + + Star + + )} + ) : ( )} - diff --git a/site/src/components/ExporterSection.astro b/site/src/components/ExporterSection.astro index 8a11c4c..fd72974 100644 --- a/site/src/components/ExporterSection.astro +++ b/site/src/components/ExporterSection.astro @@ -68,7 +68,7 @@ const exporterPrefix = showExporterNumber - + diff --git a/site/src/components/Header.astro b/site/src/components/Header.astro index 436b7cf..b9992f5 100644 --- a/site/src/components/Header.astro +++ b/site/src/components/Header.astro @@ -25,7 +25,7 @@ try { } } catch {} -const starsLabel = stars >= 1000 ? `${(stars / 1000).toFixed(1)}k` : String(stars); +const starsLabel = stars > 0 ? (stars >= 1000 ? `${(stars / 1000).toFixed(1)}k` : String(stars)) : '—'; --- diff --git a/site/src/components/RuleCard.astro b/site/src/components/RuleCard.astro index 9bb85ea..c89d2c0 100644 --- a/site/src/components/RuleCard.astro +++ b/site/src/components/RuleCard.astro @@ -37,7 +37,7 @@ const codeId = `code-${anchorId}`; - + diff --git a/site/src/components/StatsBar.astro b/site/src/components/StatsBar.astro index 9867d98..9339702 100644 --- a/site/src/components/StatsBar.astro +++ b/site/src/components/StatsBar.astro @@ -1,11 +1,14 @@ --- import { getTotalRuleCount, getTotalExporterCount, data } from '../data/rules'; -import { GITHUB_API_REPO_URL } from '../data/site'; +import { GITHUB_API_REPO_URL, GITHUB_URL } from '../data/site'; const totalRules = getTotalRuleCount(); const totalExporters = getTotalExporterCount(); const totalGroups = data.groups.length; +const STAR_MILESTONE = 10000; +const MILESTONE_LABEL = '10k'; + let stars = 0; try { const res = await fetch(GITHUB_API_REPO_URL, { @@ -17,7 +20,10 @@ try { } } catch {} -const starsLabel = stars >= 1000 ? `${(stars / 1000).toFixed(1)}k` : String(stars); +const starsLabel = stars > 0 ? (stars >= 1000 ? `${(stars / 1000).toFixed(1)}k` : String(stars)) : '—'; +const progressPct = stars > 0 ? Math.min(100, (stars / STAR_MILESTONE) * 100).toFixed(1) : '0'; +const starsFormatted = stars > 0 ? stars.toLocaleString('en') : ''; +const milestoneFormatted = STAR_MILESTONE.toLocaleString('en'); --- @@ -33,33 +39,70 @@ const starsLabel = stars >= 1000 ? `${(stars / 1000).toFixed(1)}k` : String(star {totalGroups} categories - + {starsLabel} - GitHub stars + engineers starred -