Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/llms-txt-hub / apps/web/components/stats/github-stars-card.tsx |
| Date | Not specified in source |
| Repository | Janady13/llms-txt-hub |
| Revision | e0f4bf978d4df168369c7601d9c5f5ea89e84377 |
| Branch | main |
| Path or archive member | apps/web/components/stats/github-stars-card.tsx |
| Original SHA-256 | 714310aa5c60c1d0af17524f124a12810a0fdeaf44a0e51b18d4490bd4ea83a3 |
| Git blob SHA | 8701a9cb291a541fba21d6ec9aa0fb868cbb7fff |
| Reading-copy SHA-256 | 714310aa5c60c1d0af17524f124a12810a0fdeaf44a0e51b18d4490bd4ea83a3 |
Recovered source transcript
Download complete source text ↓45 lines · 1.1 KB
'use client'
import { logger } from '@thedaviddias/logging'
import { Star } from 'lucide-react'
import { useEffect, useState } from 'react'
import { StatCard } from '@/components/stats/stat-card'
/**
* A client component that displays GitHub stars count in a stat card
*
* @returns React component displaying GitHub stars
*
* @example
* ```tsx
* <GitHubStarsCard />
* ```
*/
export function GitHubStarsCard() {
const [stars, setStars] = useState<number | null>(null)
useEffect(() => {
fetch('https://api.github.com/repos/thedaviddias/llms-txt-hub')
.then(res => {
if (!res.ok) {
throw new Error('Failed to fetch GitHub stars')
}
return res.json()
})
.then(data => setStars(data.stargazers_count))
.catch(error => {
logger.error('Error fetching GitHub stars:', { data: error, tags: { type: 'component' } })
setStars(0)
})
}, [])
return (
<StatCard
title="GitHub Stars"
value={stars ?? '...'}
icon={Star}
description="Show your support by starring us on GitHub!"
/>
)
}