diff --git a/app/pages/about.vue b/app/pages/about.vue index be344b577..bf9f5c16c 100644 --- a/app/pages/about.vue +++ b/app/pages/about.vue @@ -138,7 +138,48 @@ const { data: contributors, status: contributorsStatus } = useLazyFetch('/api/co
-

+

Team

+

+ {{ $t('about.contributors.description') }} +

+ + +
+

Governance

+

+ TODO: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor + incididunt ut labore et dolore magna aliqua. +

+ +
+ + +
+
@{{ person.login }}
+
{{ person.role }}
+
+
+ TODO: add other maintainers +
+
+ +

{{ $t( 'about.contributors.title', @@ -146,9 +187,10 @@ const { data: contributors, status: contributorsStatus } = useLazyFetch('/api/co contributors?.length ?? 0, ) }} -

+

- {{ $t('about.contributors.description') }} + TODO: Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor + incididunt ut labore et dolore magna aliqua.

diff --git a/server/api/contributors.get.ts b/server/api/contributors.get.ts index bf9d0fcc2..819ffa4a3 100644 --- a/server/api/contributors.get.ts +++ b/server/api/contributors.get.ts @@ -4,6 +4,22 @@ export interface GitHubContributor { avatar_url: string html_url: string contributions: number + role: Role +} + +// TODO: stub - need to fetch list of role members from somewhere to avoid hardcoding ( +type Role = 'stewards' | 'core' | 'maintainers' | 'contributor' +const roleMembers: Record, Set> = { + stewards: new Set(['danielroe', 'patak-dev']), + core: new Set([]), + maintainers: new Set([]), +} + +function getRoleInfo(login: string): { role: Role; order: number } { + if (roleMembers.stewards.has(login)) return { role: 'stewards', order: 0 } + if (roleMembers.core.has(login)) return { role: 'core', order: 1 } + if (roleMembers.maintainers.has(login)) return { role: 'maintainers', order: 2 } + return { role: 'contributor', order: 3 } } export default defineCachedEventHandler( @@ -46,8 +62,19 @@ export default defineCachedEventHandler( page++ } - // Filter out bots - return allContributors.filter(c => !c.login.includes('[bot]')) + return ( + allContributors + // Filter out bots + .filter(c => !c.login.includes('[bot]')) + // Assign role + .map(c => { + const { role, order } = getRoleInfo(c.login) + return Object.assign(c, { role, order }) + }) + // Sort by role (steward > core > maintainer > contributor) + .sort((a, b) => a.order - b.order) + .map(({ order: _, ...rest }) => rest) + ) }, { maxAge: 3600, // Cache for 1 hour