diff --git a/public/crown.png b/public/crown.png deleted file mode 100644 index efa99119..00000000 Binary files a/public/crown.png and /dev/null differ diff --git a/src/app/(withAuth)/courses/[courseId]/Course.tsx b/src/app/(withAuth)/courses/[courseId]/Course.tsx index b8ce5076..4390f1b0 100644 --- a/src/app/(withAuth)/courses/[courseId]/Course.tsx +++ b/src/app/(withAuth)/courses/[courseId]/Course.tsx @@ -1,25 +1,24 @@ 'use client'; import type { UserAnswer } from '@prisma/client'; -import Image from 'next/image'; import NextLink from 'next/link'; import React, { useEffect } from 'react'; +import { MdCheckCircle, MdCheckCircleOutline, MdOutlineVerified, MdVerified } from 'react-icons/md'; import { useLocalStorage } from 'usehooks-ts'; import { - Accordion, - AccordionButton, - AccordionIcon, - AccordionItem, - AccordionPanel, Box, - Flex, + Card, + CardBody, + CardHeader, Heading, HStack, + Icon, Link, + Progress, Select, + SimpleGrid, Table, - TableContainer, Tag, Tbody, Td, @@ -40,7 +39,7 @@ import { import type { UserProblemSessionWithUserAnswers } from '../../../../utils/fetch'; import { selectedLanguageIdKey } from '../../../lib/sessionStorage'; -const SPECIFIED_COMPLETION_COUNT = 2; +const SPECIFIED_COMPLETION_COUNT = 1; const countFailedAnswers = (userProblemSession: UserProblemSessionWithUserAnswers | undefined): number => { if (!userProblemSession) return 0; @@ -98,114 +97,127 @@ export const Course: React.FC<{ ))} - - - {courseIdToProgramIdLists[courseId].map((programIds, iLesson) => { - const completedProblemCount = programIds.filter( - (programId) => - countUserCompletedProblems(userCompletedProblems, programId, selectedLanguageId) >= - SPECIFIED_COMPLETION_COUNT - ).length; - - return ( - - - - - 第{iLesson + 1}回 - - - Completed {completedProblemCount} / {programIds.length} - - {completedProblemCount >= programIds.length && ( - - 完了の王冠 - - )} - - - - - - - - - - - - - - - + + {courseIdToProgramIdLists[courseId].map((programIds, lessonIndex) => { + const completedProblemCount = programIds.filter( + (programId) => + countUserCompletedProblems(userCompletedProblems, programId, selectedLanguageId) >= + SPECIFIED_COMPLETION_COUNT + ).length; + + const isLessonCompleted = completedProblemCount >= programIds.length; + + return ( + + + + 第{lessonIndex + 1}回 + + + + + +
プログラム進捗 - 初回セッションの -
- 不正解回数 -
- 初回セッションの -
- 所要時間(秒) -
+ + + + + + + + + {programIds.map((programId) => { + const suspendedSession = userProblemSessions.find( + (session) => + session.courseId === courseId && + session.programId === programId && + session.languageId === selectedLanguageId && + !session.finishedAt && + !session.isCompleted + ); + const firstSession = userProblemSessions.find( + (session) => + session.courseId === courseId && + session.programId === programId && + session.languageId === selectedLanguageId + ); + const completedProblemCount = countUserCompletedProblems( + userCompletedProblems, + programId, + selectedLanguageId + ); + const isProgramCompleted = completedProblemCount >= SPECIFIED_COMPLETION_COUNT; + + return ( + + + + + - - - {programIds.map((programId) => { - const suspendedSession = userProblemSessions.find( - (session) => - session.courseId === courseId && - session.programId === programId && - session.languageId === selectedLanguageId && - !session.finishedAt && - !session.isCompleted - ); - const firstSession = userProblemSessions.find( - (session) => - session.courseId === courseId && - session.programId === programId && - session.languageId === selectedLanguageId - ); - const completedProblemCount = countUserCompletedProblems( - userCompletedProblems, - programId, - selectedLanguageId - ); - return ( - - - - - - - - ); - })} - -
+ + + 初回不正解 + + 初回所要時間 +
+ + + + {suspendedSession && ( + + 挑戦中 + + )} + + {programIdToName[programId]} + + + + {countFailedAnswers(firstSession)} + + 回 + + + {typeof firstSession?.timeSpent === 'number' + ? Math.floor(totalAnswerTimeSpent(firstSession) / 1000) + : 0} + + 秒 + +
- - {programIdToName[programId]} - - {suspendedSession && 挑戦中} - -

- {completedProblemCount} / {SPECIFIED_COMPLETION_COUNT} -

- {completedProblemCount >= SPECIFIED_COMPLETION_COUNT && ( - - 完了の王冠 - - )} -
-
{countFailedAnswers(firstSession)} - {typeof firstSession?.timeSpent === 'number' - ? Math.floor(totalAnswerTimeSpent(firstSession) / 1000) - : 0} -
-
-
-
- ); - })} -
-
+ ); + })} + + + + + ); + })} + ); }; diff --git a/src/infrastructures/useClient/chakra.ts b/src/infrastructures/useClient/chakra.ts index e30840e4..0b05b8c8 100644 --- a/src/infrastructures/useClient/chakra.ts +++ b/src/infrastructures/useClient/chakra.ts @@ -86,6 +86,7 @@ export { PopoverContent, PopoverTrigger, Portal, + Progress, Radio, RadioGroup, Select,