Skip to content

Commit

Permalink
fix(web): also activate learner events in exercise collections
Browse files Browse the repository at this point in the history
  • Loading branch information
elbotho committed Dec 13, 2024
1 parent 80c434a commit dff6ba5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions apps/web/src/components/taxonomy/topic.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { editorLearnerEvent } from '@editor/plugin/helpers/editor-learner-event'
import { editorRenderers } from '@editor/plugin/helpers/editor-renderer'
import { EditorPluginType } from '@editor/types/editor-plugin-type'
import { EditorRowsDocument } from '@editor/types/editor-plugins'
Expand Down Expand Up @@ -27,6 +28,7 @@ import {
import { TaxonomyTermType } from '@/fetcher/graphql-types/operations'
import { createRenderers } from '@/serlo-editor-integration/create-renderers'
import { EditorRenderer } from '@/serlo-editor-integration/editor-renderer'
import { useSerloHandleLearnerEvent } from '@/serlo-editor-integration/use-handle-learner-event'

export interface TopicProps {
data: TaxonomyData
Expand All @@ -42,6 +44,10 @@ const DonationsBanner = dynamic<DonationsBannerProps>(() =>
export function Topic({ data, breadcrumbs }: TopicProps) {
const { strings } = useInstanceData()

const handleLearnerEvent = useSerloHandleLearnerEvent()
editorLearnerEvent.init(handleLearnerEvent)
editorRenderers.init(createRenderers())

const isExerciseFolder = data.taxonomyType === TaxonomyTermType.ExerciseFolder
const isTopic = data.taxonomyType === TaxonomyTermType.Topic

Expand All @@ -54,8 +60,6 @@ export function Topic({ data, breadcrumbs }: TopicProps) {

const hasExercises = data.exercisesContent.length > 0

editorRenderers.init(createRenderers())

return (
<>
{data.trashed && renderTrashedNotice()}
Expand Down

0 comments on commit dff6ba5

Please sign in to comment.