Skip to content

Commit cdb3857

Browse files
committed
fix: types, disabled sponsors
1 parent ad7304a commit cdb3857

File tree

2 files changed

+18
-23
lines changed

2 files changed

+18
-23
lines changed

apps/docs/app/(home)/sponsors/sponsors-data.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,11 @@ export const sponsors: Sponsor[] = [
2929
},
3030
];
3131

32-
// Calculate sponsor statistics
32+
const activeSponsors = sponsors.filter((s) => !s.disabled);
33+
3334
export const sponsorStats = {
34-
totalSponsors: sponsors.length,
35-
featuredSponsors: sponsors.filter(
35+
totalSponsors: activeSponsors.length,
36+
featuredSponsors: activeSponsors.filter(
3637
(s) => s.tier === 'platinum' || s.tier === 'gold'
3738
).length,
3839
};

apps/docs/app/(home)/sponsors/sponsors-grid.tsx

Lines changed: 14 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -99,26 +99,20 @@ export default function SponsorsGrid({ sponsors }: SponsorsGridProps) {
9999
);
100100
}
101101

102-
const sponsorsByTier = sponsors.reduce(
103-
(acc, sponsor) => {
104-
if (!acc[sponsor.tier]) {
105-
if (sponsor.disabled) {
106-
return acc;
102+
const sponsorsByTier = sponsors
103+
.filter((sponsor) => !sponsor.disabled)
104+
.reduce(
105+
(acc, sponsor) => {
106+
if (!acc[sponsor.tier]) {
107+
acc[sponsor.tier] = [];
107108
}
108-
acc[sponsor.tier] = [];
109-
}
110-
acc[sponsor.tier].push(sponsor);
111-
return acc;
112-
},
113-
{} as Record<string, Sponsor[]>
114-
);
109+
acc[sponsor.tier].push(sponsor);
110+
return acc;
111+
},
112+
{} as Record<string, Sponsor[]>
113+
);
115114

116-
const tierOrder: Array<keyof typeof sponsorsByTier> = [
117-
'platinum',
118-
'gold',
119-
'silver',
120-
'bronze',
121-
];
115+
const tierOrder = ['platinum', 'gold', 'silver', 'bronze'] as const;
122116

123117
return (
124118
<div>
@@ -141,14 +135,14 @@ export default function SponsorsGrid({ sponsors }: SponsorsGridProps) {
141135
return null;
142136
}
143137

144-
const tierLabels = {
138+
const tierLabels: Record<typeof tier, string> = {
145139
platinum: 'Platinum Sponsors',
146140
gold: 'Gold Sponsors',
147141
silver: 'Silver Sponsors',
148142
bronze: 'Bronze Sponsors',
149143
};
150144

151-
const gridCols = {
145+
const gridCols: Record<typeof tier, string> = {
152146
platinum: 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-2',
153147
gold: 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-3',
154148
silver: 'grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4',

0 commit comments

Comments
 (0)