File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22
33import Avatar from '@node-core/ui-components/Common/AvatarGroup/Avatar' ;
44import type { FC } from 'react' ;
5- import { use } from 'react' ;
65
76import type { Supporters } from '#site/types' ;
87
9- type SupportersProps = {
10- supporters : Promise < Array < Supporters > > ;
8+ type SupportersListProps = {
9+ supporters : Array < Supporters > ;
1110} ;
1211
1312// TODO: Sort supporters by all time contribution amount and link to their Open Collective page
14- const SupportersList : FC < SupportersProps > = ( { supporters } ) => {
15- const supportersList = use ( supporters ) ;
16-
17- return (
18- < div className = "flex max-w-full flex-wrap items-center justify-center gap-1" >
19- { supportersList . map ( ( { name, image } , i ) => (
20- < Avatar nickname = { name } image = { image } key = { `${ name } -${ i } ` } />
21- ) ) }
22- </ div >
23- ) ;
24- } ;
13+ const SupportersList : FC < SupportersListProps > = ( { supporters } ) => (
14+ < div className = "flex max-w-full flex-wrap items-center justify-center gap-1" >
15+ { supporters . map ( ( { name, image } , i ) => (
16+ < Avatar nickname = { name } image = { image } key = { `${ name } -${ i } ` } />
17+ ) ) }
18+ </ div >
19+ ) ;
2520
2621export default SupportersList ;
Original file line number Diff line number Diff line change 1+ 'use server' ;
12import type { FC , PropsWithChildren } from 'react' ;
23
3- import { fetchOpenCollectiveData } from '#site/next-data/generators/supportersData.mjs' ;
4- import type { Supporters } from '#site/types' ;
5-
64import SupportersList from './Common/Supporters' ;
75
6+ import provideSupporters from '#site/next-data/providers/supportersData' ;
7+
88const WithSupporters : FC < PropsWithChildren > = ( ) => {
9- const supporters = fetchOpenCollectiveData ( ) as Promise < Array < Supporters > > ;
9+ const supporters = provideSupporters ( ) ;
1010
1111 return (
1212 < div className = "flex max-w-full flex-wrap items-center gap-1" >
Original file line number Diff line number Diff line change 1+ /**
2+ * Fetches supporters data from Open Collective API, filters active backers,
3+ * and maps it to the Supporters type.
4+ *
5+ * @returns {Promise<Array<import('#site/types/supporters')>> } Array of supporters
6+ */
17async function fetchOpenCollectiveData ( ) {
28 const endpoint = 'https://opencollective.com/nodejs/members/all.json' ;
39
Original file line number Diff line number Diff line change 1+ import { cache } from 'react' ;
2+
3+ import { fetchOpenCollectiveData } from '#site/next-data/generators/supportersData.mjs' ;
4+
5+ const openCollectiveSupporters = await fetchOpenCollectiveData ( ) ;
6+
7+ const provideSupporters = cache ( ( ) => openCollectiveSupporters ) ;
8+
9+ export default provideSupporters ;
You can’t perform that action at this time.
0 commit comments