Skip to content

Commit

Permalink
removed duplicate wrong answer message and updated snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
Maija Y committed Nov 13, 2023
1 parent 87e5a36 commit 8c87231
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 41 deletions.
Original file line number Diff line number Diff line change
@@ -1,51 +1,23 @@
import { css, cx } from "@emotion/css"
import React, { useId } from "react"
import { useTranslation } from "react-i18next"

import { UserItemAnswerClosedEndedQuestion } from "../../../../../types/quizTypes/answer"
import { PublicSpecQuizItemClosedEndedQuestion } from "../../../../../types/quizTypes/publicSpec"
import TextField from "../../../../shared-module/components/InputFields/TextField"
import withErrorBoundary from "../../../../shared-module/utils/withErrorBoundary"
import { quizTheme } from "../../../../styles/QuizStyles"
import MarkdownText from "../../../MarkdownText"
import CloseEndedQuestionWrapper from "../../../Shared/CloseEndedQuestionWrapper"

import { QuizItemSubmissionComponentProps } from "."

// eslint-disable-next-line i18next/no-literal-string
const correctAnswer = css`
display: flex;
align-items: center;
margin-top: 1rem;
margin-bottom: 1rem;
padding: 1rem;
background-color: ${quizTheme.successItemBackgroundColor};
color: ${quizTheme.successItemForegroundColor};
border-radius: 5px;
`

// eslint-disable-next-line i18next/no-literal-string
const incorrectAnswer = css`
display: flex;
align-items: center;
margin-top: 1rem;
margin-bottom: 1rem;
padding: 1rem;
background-color: ${quizTheme.errorItemBackgroundColor};
color: ${quizTheme.errorItemForegroundColor};
border-radius: 5px;
`

const ClosedEndedQuestionFeedback: React.FC<
QuizItemSubmissionComponentProps<
PublicSpecQuizItemClosedEndedQuestion,
UserItemAnswerClosedEndedQuestion
>
> = ({ public_quiz_item, quiz_direction, quiz_item_answer_feedback, user_quiz_item_answer }) => {
> = ({ public_quiz_item, quiz_direction, user_quiz_item_answer }) => {
const { t } = useTranslation()
const correct = quiz_item_answer_feedback?.correctnessCoefficient == 1
const fieldId = useId()
const item_feedback = quiz_item_answer_feedback?.quiz_item_feedback
return (
<CloseEndedQuestionWrapper wideScreenDirection={quiz_direction}>
<div>{public_quiz_item.title && <MarkdownText text={public_quiz_item.title} />}</div>
Expand All @@ -59,18 +31,6 @@ const ClosedEndedQuestionFeedback: React.FC<
value={user_quiz_item_answer.textData ?? ""}
/>
</div>
<div
className={css`
display: flex;
justify-content: center;
`}
>
{item_feedback && item_feedback.trim() !== "" && (
<div className={cx(correct ? correctAnswer : incorrectAnswer)}>
<p>{item_feedback}</p>
</div>
)}
</div>
</CloseEndedQuestionWrapper>
)
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 8c87231

Please sign in to comment.