File tree Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Expand file tree Collapse file tree 2 files changed +26
-3
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,10 @@ const tiers = [
1717 " Startups" ,
1818 " Bronze" ,
1919 " Patron" ,
20+ " Sprint" ,
2021 " Financial Aid" ,
21- " Supporters" ,
22+ " Open Space" ,
23+ " Supporters" ,
2224 " Partners" ,
2325 " Media Partners"
2426] as const ;
@@ -27,10 +29,20 @@ const sponsors = await getCollection("sponsors");
2729
2830let hasSponsors = false ;
2931
32+ function getSponsorTiers(sponsor ) {
33+ if (typeof sponsor .data .tier === ' string' ) {
34+ return sponsor .data .tier .split (' ,' ).map (tier => tier .trim ());
35+ }
36+ return Array .isArray (sponsor .data .tier ) ? sponsor .data .tier : [sponsor .data .tier ];
37+ }
38+
3039const sponsorTiers = tiers
3140 .map ((tier ) => {
3241 const tierSponsors = sponsors .filter (
33- (sponsor ) => sponsor .data .tier === tier ,
42+ (sponsor ) => {
43+ const sponsorTiers = getSponsorTiers (sponsor );
44+ return sponsorTiers .includes (tier );
45+ }
3446 );
3547
3648 if (tierSponsors .length > 0 ) {
Original file line number Diff line number Diff line change @@ -23,19 +23,30 @@ const tiers = [
2323 " Silver" ,
2424 " Bronze" ,
2525 " Patron" ,
26+ " Sprint" ,
2627 " Financial Aid" ,
28+ " Open Space" ,
2729 " Supporters" ,
2830 " Partners" ,
2931] as const ;
3032
33+ function getSponsorTiers(sponsor ) {
34+ if (typeof sponsor .data .tier === ' string' ) {
35+ return sponsor .data .tier .split (' ,' ).map (tier => tier .trim ());
36+ }
37+ return Array .isArray (sponsor .data .tier ) ? sponsor .data .tier : [sponsor .data .tier ];
38+ }
39+
3140// Group sponsors by their tier
3241const grouped = sponsors .reduce ((acc , sponsor ) => {
33- const tier = sponsor .data .tier ;
42+ const sponsorTiers = getSponsorTiers (sponsor );
43+ sponsorTiers .forEach (tier => {
3444 const key = tier ?? ' unknown' ;
3545 if (! acc [key ]) {
3646 acc [key ] = [];
3747 }
3848 acc [key ].push (sponsor );
49+ });
3950 return acc ;
4051}, {} as Record <string , CollectionEntry <" sponsors" >[]>);
4152---
You can’t perform that action at this time.
0 commit comments