Skip to content

Commit 2a58d27

Browse files
committed
fix(api): pass gradient_stops and gradient_dir through validation and params
1 parent e6b5723 commit 2a58d27

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

app/api/streak/route.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ export async function GET(request: Request) {
9191
versus,
9292
shading,
9393
gradient,
94+
gradient_stops,
95+
gradient_dir,
9496
opacity,
9597
tz: tzParam,
9698
disable_particles,
@@ -165,6 +167,8 @@ export async function GET(request: Request) {
165167
versus,
166168
shading,
167169
gradient,
170+
gradient_stops,
171+
gradient_dir,
168172
opacity,
169173
disable_particles,
170174
glow,

lib/svg/generator.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -646,6 +646,9 @@ export function generateSVG(
646646
computeTowers(calendar, params.scale, stats.todayDate, params.mode),
647647
sf
648648
);
649+
if (params.gradient) {
650+
generateCustomGradients(params);
651+
}
649652
const towers = renderTowers(
650653
towerData,
651654
params,

lib/validations.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ const baseStreakParamsSchema = z.object({
275275
return val === 'true';
276276
})
277277
.default(false),
278+
gradient_stops: z.string().optional(),
279+
gradient_dir: z.enum(['vertical', 'horizontal', 'diagonal']).catch('vertical').optional(),
278280
disable_particles: z
279281
.string()
280282
.optional()

0 commit comments

Comments
 (0)