Skip to content

Commit e517aca

Browse files
committed
check if we are in suko and show finnish instruction in that case
1 parent d1f1754 commit e517aca

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

web/src/components/content/AssignmentContent.tsx

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,13 @@ import {
1111
} from '../../types'
1212
import { useKoodisto } from '../../hooks/useKoodisto'
1313
import { ContentActionRow, ContentContent, ContentInstruction } from './ContentCommon'
14-
import { useState } from 'react'
14+
import { useContext, useState } from 'react'
1515
import { useSetFavoriteFolders } from '../../hooks/useSetFavoriteFolders'
1616
import { SetFavoriteFoldersModal } from '../modal/favoriteModal/SetFavoriteFoldersModal'
1717
import { useFetch } from '../../hooks/useFetch'
1818
import { FavoriteToggleModalFormType } from '../modal/favoriteModal/favoriteToggleModalFormSchema'
1919
import { useLudosTranslation } from '../../hooks/useLudosTranslation'
20+
import { LudosContext } from '../../contexts/LudosContext'
2021

2122
type AssignmentContentProps = {
2223
assignment: AssignmentOut
@@ -25,6 +26,7 @@ type AssignmentContentProps = {
2526
}
2627

2728
export const AssignmentContent = ({ assignment, teachingLanguage, isPresentation }: AssignmentContentProps) => {
29+
const { features } = useContext(LudosContext)
2830
const { t } = useLudosTranslation()
2931
const { getKoodisLabel, getKoodiLabel, getOppimaaraLabel } = useKoodisto()
3032
const [isFavoriteModalOpen, setIsFavoriteModalOpen] = useState(false)
@@ -43,6 +45,15 @@ export const AssignmentContent = ({ assignment, teachingLanguage, isPresentation
4345
setIsFavoriteModalOpen(false)
4446
}
4547

48+
const showFinnishInstruction =
49+
features.additionalSvContentForKertominen &&
50+
isSukoAssignment(assignment) &&
51+
assignment.assignmentTypeKoodiArvo === '002'
52+
console.log(showFinnishInstruction)
53+
const instructionContent = teachingLanguage === Language.FI ? assignment.instructionFi : assignment.instructionSv
54+
55+
const instructionToShow = showFinnishInstruction ? assignment.instructionFi : instructionContent
56+
4657
return (
4758
<>
4859
{!isPresentation && (
@@ -115,10 +126,7 @@ export const AssignmentContent = ({ assignment, teachingLanguage, isPresentation
115126
</div>
116127
)}
117128

118-
<ContentInstruction
119-
teachingLanguage={teachingLanguage}
120-
content={teachingLanguage === Language.FI ? assignment.instructionFi : assignment.instructionSv}
121-
/>
129+
<ContentInstruction teachingLanguage={teachingLanguage} content={instructionToShow} />
122130

123131
<div className="mb-4 border-b border-gray-separator" />
124132

0 commit comments

Comments
 (0)