Skip to content

Commit d79af98

Browse files
committed
feat(ui): add description and identity claims to governance cards
- Merge twitterUsername into socialAccounts array (per ghostdevv feedback) - Simplify getSocialLinks — single unified array, no special-casing Closes #1564
1 parent bf0f030 commit d79af98

File tree

2 files changed

+20
-32
lines changed

2 files changed

+20
-32
lines changed

app/pages/about.vue

Lines changed: 6 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -51,28 +51,12 @@ function getSocialIcon(provider: string): string {
5151
return socialIcons[provider] ?? 'i-lucide:link'
5252
}
5353
54-
function getSocialLinks(person: { twitterUsername: string | null; socialAccounts: SocialAccount[] }): { provider: string; url: string; icon: string }[] {
55-
const links: { provider: string; url: string; icon: string }[] = []
56-
57-
if (person.twitterUsername) {
58-
links.push({
59-
provider: 'TWITTER',
60-
url: `https://x.com/${person.twitterUsername}`,
61-
icon: socialIcons.TWITTER!,
62-
})
63-
}
64-
65-
for (const account of person.socialAccounts) {
66-
// Skip twitter if already added via twitterUsername
67-
if (account.provider === 'TWITTER') continue
68-
links.push({
69-
provider: account.provider,
70-
url: account.url,
71-
icon: getSocialIcon(account.provider),
72-
})
73-
}
74-
75-
return links
54+
function getSocialLinks(person: { socialAccounts: SocialAccount[] }): { provider: string; url: string; icon: string }[] {
55+
return person.socialAccounts.map(account => ({
56+
provider: account.provider,
57+
url: account.url,
58+
icon: getSocialIcon(account.provider),
59+
}))
7660
}
7761
7862
const roleLabels = computed(

server/api/contributors.get.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,10 @@ export interface GitHubContributor {
1414
role: Role
1515
sponsors_url: string | null
1616
bio: string | null
17-
twitterUsername: string | null
1817
socialAccounts: SocialAccount[]
1918
}
2019

21-
type GitHubAPIContributor = Omit<GitHubContributor, 'role' | 'sponsors_url' | 'bio' | 'twitterUsername' | 'socialAccounts'>
20+
type GitHubAPIContributor = Omit<GitHubContributor, 'role' | 'sponsors_url' | 'bio' | 'socialAccounts'>
2221

2322
// Fallback when no GitHub token is available (e.g. preview environments).
2423
// Only stewards are shown as maintainers; everyone else is a contributor.
@@ -71,7 +70,6 @@ async function fetchTeamMembers(token: string): Promise<TeamMembers | null> {
7170
interface GovernanceProfile {
7271
hasSponsorsListing: boolean
7372
bio: string | null
74-
twitterUsername: string | null
7573
socialAccounts: SocialAccount[]
7674
}
7775

@@ -94,6 +92,7 @@ async function fetchGovernanceProfiles(
9492
socialAccounts(first: 10) { nodes { provider url } }
9593
}`,
9694
)
95+
// twitterUsername is fetched to normalise it into socialAccounts below
9796
const query = `{ ${fragments.join('\n')} }`
9897

9998
try {
@@ -126,14 +125,20 @@ async function fetchGovernanceProfiles(
126125
if (json.data) {
127126
for (const user of Object.values(json.data)) {
128127
if (user) {
128+
const socialAccounts: SocialAccount[] = user.socialAccounts.nodes.map(n => ({
129+
provider: n.provider,
130+
url: n.url,
131+
}))
132+
// Normalise twitterUsername into socialAccounts so callers have a
133+
// single unified array. GitHub returns it separately because it
134+
// predates the socialAccounts field.
135+
if (user.twitterUsername && !socialAccounts.some(a => a.provider === 'TWITTER')) {
136+
socialAccounts.unshift({ provider: 'TWITTER', url: `https://x.com/${user.twitterUsername}` })
137+
}
129138
profiles.set(user.login, {
130139
hasSponsorsListing: user.hasSponsorsListing,
131140
bio: user.bio,
132-
twitterUsername: user.twitterUsername,
133-
socialAccounts: user.socialAccounts.nodes.map(n => ({
134-
provider: n.provider,
135-
url: n.url,
136-
})),
141+
socialAccounts,
137142
})
138143
}
139144
}
@@ -221,9 +226,8 @@ export default defineCachedEventHandler(
221226
? `https://github.com/sponsors/${c.login}`
222227
: null
223228
const bio = profile?.bio ?? null
224-
const twitterUsername = profile?.twitterUsername ?? null
225229
const socialAccounts = profile?.socialAccounts ?? []
226-
Object.assign(c, { role, order, sponsors_url, bio, twitterUsername, socialAccounts })
230+
Object.assign(c, { role, order, sponsors_url, bio, socialAccounts })
227231
return c as GitHubContributor & { order: number }
228232
})
229233
.sort((a, b) => a.order - b.order || b.contributions - a.contributions)

0 commit comments

Comments
 (0)