@@ -11,12 +11,13 @@ import {
11
11
} from '../../types'
12
12
import { useKoodisto } from '../../hooks/useKoodisto'
13
13
import { ContentActionRow , ContentContent , ContentInstruction } from './ContentCommon'
14
- import { useState } from 'react'
14
+ import { useContext , useState } from 'react'
15
15
import { useSetFavoriteFolders } from '../../hooks/useSetFavoriteFolders'
16
16
import { SetFavoriteFoldersModal } from '../modal/favoriteModal/SetFavoriteFoldersModal'
17
17
import { useFetch } from '../../hooks/useFetch'
18
18
import { FavoriteToggleModalFormType } from '../modal/favoriteModal/favoriteToggleModalFormSchema'
19
19
import { useLudosTranslation } from '../../hooks/useLudosTranslation'
20
+ import { LudosContext } from '../../contexts/LudosContext'
20
21
21
22
type AssignmentContentProps = {
22
23
assignment : AssignmentOut
@@ -25,6 +26,7 @@ type AssignmentContentProps = {
25
26
}
26
27
27
28
export const AssignmentContent = ( { assignment, teachingLanguage, isPresentation } : AssignmentContentProps ) => {
29
+ const { features } = useContext ( LudosContext )
28
30
const { t } = useLudosTranslation ( )
29
31
const { getKoodisLabel, getKoodiLabel, getOppimaaraLabel } = useKoodisto ( )
30
32
const [ isFavoriteModalOpen , setIsFavoriteModalOpen ] = useState ( false )
@@ -43,6 +45,15 @@ export const AssignmentContent = ({ assignment, teachingLanguage, isPresentation
43
45
setIsFavoriteModalOpen ( false )
44
46
}
45
47
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
+
46
57
return (
47
58
< >
48
59
{ ! isPresentation && (
@@ -115,10 +126,7 @@ export const AssignmentContent = ({ assignment, teachingLanguage, isPresentation
115
126
</ div >
116
127
) }
117
128
118
- < ContentInstruction
119
- teachingLanguage = { teachingLanguage }
120
- content = { teachingLanguage === Language . FI ? assignment . instructionFi : assignment . instructionSv }
121
- />
129
+ < ContentInstruction teachingLanguage = { teachingLanguage } content = { instructionToShow } />
122
130
123
131
< div className = "mb-4 border-b border-gray-separator" />
124
132
0 commit comments