Skip to content

Commit

Permalink
fix cd
Browse files Browse the repository at this point in the history
  • Loading branch information
prokopsimek committed Jan 16, 2025
1 parent bff1fc3 commit 245ae31
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 12 deletions.
3 changes: 1 addition & 2 deletions src/app/topics/[id]/DifficultyPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import Link from 'next/link';
import Navigation from '../../components/Navigation';
import { difficulties, topics } from '../../constants/topics';
import type { TopicId } from '../../constants/topics';
import { difficulties } from '../../constants/topics';

const difficultyColors = {
beginner: 'bg-electric-violet', // Pink for Surface Level
Expand Down
1 change: 0 additions & 1 deletion src/app/topics/[id]/difficulty/page.tsx

This file was deleted.

9 changes: 5 additions & 4 deletions src/app/topics/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@ export function generateStaticParams() {
}));
}

export default function Difficulty(props: { params: { id: string } }) {
const topic = topics[props.params.id as TopicId];

return <DifficultyPage id={props.params.id} title={topic.title} description={topic.description} />;
export default async function Difficulty({ params }: { params: Promise<{ id: string }> }) {
const { id } = await params;
const topic = topics[id as TopicId];

return <DifficultyPage id={id} title={topic.title} description={topic.description} />;
}
10 changes: 5 additions & 5 deletions src/app/topics/[id]/questions/[difficulty]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ export function generateStaticParams() {
);
}

export default function Questions(props: { params: { id: string; difficulty: string } }) {
const topic = topics[props.params.id as TopicId];
const difficulty = props.params.difficulty as Difficulty;
export default async function Questions({ params }: { params: Promise<{ id: string; difficulty: string }> }) {
const { id, difficulty } = await params;
const topic = topics[id as TopicId];

if (!topic || !difficultyNames[difficulty]) {
if (!topic || !difficultyNames[difficulty as Difficulty]) {
return null;
}

return <QuestionsPage id={props.params.id} difficulty={difficulty} questions={topic.questions[difficulty]} />;
return <QuestionsPage id={id} difficulty={difficulty as Difficulty} questions={topic.questions[difficulty as Difficulty]} />;
}

0 comments on commit 245ae31

Please sign in to comment.