diff --git a/src/app/(withAuth)/courses/[courseId]/programs/[programId]/page.tsx b/src/app/(withAuth)/courses/[courseId]/programs/[programId]/page.tsx index 38e4c347..71ad4a96 100644 --- a/src/app/(withAuth)/courses/[courseId]/programs/[programId]/page.tsx +++ b/src/app/(withAuth)/courses/[courseId]/programs/[programId]/page.tsx @@ -23,7 +23,7 @@ const ProblemPage: NextPage<{ params: { courseId: string; programId: string } }> const checkPointLines = [2, 6, 8, 12]; const [selectedLanguageId, setSelectedLanguageId] = useState(''); - const [problemProgram, setProblemProgram] = useState(); + const [problemProgram, setProblemProgram] = useState({ displayProgram: '', excuteProgram: '' }); const [step, setStep] = useState('normal'); const [beforeCheckPointLine, setBeforeCheckPointLine] = useState(0); const [currentCheckPointLine, setCurrentCheckPointLine] = useState(checkPointLines[0]); @@ -43,8 +43,6 @@ const ProblemPage: NextPage<{ params: { courseId: string; programId: string } }> }; const ProblemComponent: React.FC = () => { - // problemProgramがundefinedの時の処理。どうしたらいいですか。 - if (!problemProgram) return <>; switch (step) { case 'normal': { return ( diff --git a/src/problems/problemData.ts b/src/problems/problemData.ts index 085bc88e..08d551df 100644 --- a/src/problems/problemData.ts +++ b/src/problems/problemData.ts @@ -92,25 +92,17 @@ public class Straight { curve: { js: ` const character = new Character(); -for (let i = 0; i < <3-10>; i++) { - character.moveForward(); -} +for (let i = 0; i < <3-10>; i++) { character.moveForward(); } character.turnLeft(); -for (let i = 0; i < <3-5>; i++) { - character.moveForward(); -} +for (let i = 0; i < <3-5>; i++) { character.moveForward(); } `.trim(), java: ` public class Curve { public static void main(String[] args) { var character = new Character(); - for (int i = 0; i < <3-10>; i++) { - character.moveForward(); - } + for (int i = 0; i < <3-10>; i++) { character.moveForward(); } character.turnLeft(); - for (int i = 0; i < <3-5>; i++) { - character.moveForward(); - } + for (int i = 0; i < <3-5>; i++) { character.moveForward(); } } } `.trim(),