Source identity
| Field | Recorded value |
|---|---|
| Source type | GitHub source |
| Original record | Janady13/llms-txt-hub / apps/web/lib/member-utils.ts |
| Date | Not specified in source |
| Repository | Janady13/llms-txt-hub |
| Revision | e0f4bf978d4df168369c7601d9c5f5ea89e84377 |
| Branch | main |
| Path or archive member | apps/web/lib/member-utils.ts |
| Original SHA-256 | efd3ae834c7a5589ba21038106593cb84daa2ce9e55eb7aa7a3c82608fdc7b3d |
| Git blob SHA | 531d3b4b4304ab3cffa69ee82a55ad3ac399c173 |
| Reading-copy SHA-256 | efd3ae834c7a5589ba21038106593cb84daa2ce9e55eb7aa7a3c82608fdc7b3d |
Recovered source transcript
Download complete source text ↓50 lines · 1.2 KB
import { getUserContributions } from './github-contributions'
export interface MemberBadge {
type: 'contributor' | 'community'
label: string
variant: 'default' | 'secondary' | 'outline'
}
/**
* Determines the appropriate badge for a member based on their contributions
* @param username - GitHub username to check contributions for
* @returns Promise resolving to MemberBadge configuration
*/
export async function getMemberBadge(username?: string | null): Promise<MemberBadge> {
if (!username) {
return {
type: 'community',
label: 'Community',
variant: 'outline'
}
}
try {
const contributions = await getUserContributions(username)
if (contributions.total > 0) {
return {
type: 'contributor',
label: 'Contributor',
variant: 'default'
}
}
return {
type: 'community',
label: 'Community',
variant: 'outline'
}
} catch {
// If we can't fetch contributions, default to community member
return {
type: 'community',
label: 'Community',
variant: 'outline'
}
}
}
// getMemberBadgeSync has been moved to member-client-utils.ts for client-side use