Skip to content

Connect, collaborate, and grow with a community of TypeScript developers

patch challenge view

bautistaaa105a4de536f3
diff --git a/apps/aot/src/app/events/[year]/[day]/page.tsx b/apps/aot/src/app/events/[year]/[day]/page.tsx
index 56065458..397fe67c 100644
--- a/apps/aot/src/app/events/[year]/[day]/page.tsx
+++ b/apps/aot/src/app/events/[year]/[day]/page.tsx
@@ -1,9 +1,11 @@
import { type Session } from '@repo/auth/server';
import { api } from '~/trpc/server';
import { getAotSlug } from '~/utils/getAotSlug';
-import { isAfterJanuaryFirst } from '~/utils/time-utils';
+import { isAfterJanuaryFirst, isChallengeUnlocked } from '~/utils/time-utils';
import { Comments } from './_components/comments';
import { Description } from './_components/description';
+import { getAllFlags } from '~/utils/feature-flag';
+import { notFound } from 'next/navigation';
interface ChallengesProps {
params: {
@@ -13,6 +15,10 @@ interface ChallengesProps {
}
export default async function Challenges({ params: { year, day } }: ChallengesProps) {
+ const { unlockAotChallenges } = await getAllFlags();
+ if (!isChallengeUnlocked(Number(year), Number(day)) && !unlockAotChallenges) {
+ return notFound();
+ }
const challenge = await api.event.getEventChallengeBySlug({ slug: getAotSlug({ year, day }) });
return (