diff --git a/src/components/Challenge/EventViewer.tsx b/src/components/Challenge/EventViewer.tsx index 5846ba5f..15b0eec3 100644 --- a/src/components/Challenge/EventViewer.tsx +++ b/src/components/Challenge/EventViewer.tsx @@ -23,7 +23,7 @@ const Description = styled('div', { fontSize: '0.8em', }); -interface EventViewerProps extends StyleProps { +export interface EventViewerProps extends StyleProps { event: Event; eventState?: boolean; locale: LocalizedString.Language; diff --git a/src/components/Challenge/PredicateEditor.tsx b/src/components/Challenge/PredicateEditor.tsx index ffda9e7f..5c0afa47 100644 --- a/src/components/Challenge/PredicateEditor.tsx +++ b/src/components/Challenge/PredicateEditor.tsx @@ -8,8 +8,8 @@ import Predicate from '../../state/State/Challenge/Predicate'; import PredicateCompletion from '../../state/State/ChallengeCompletion/PredicateCompletion'; import { StyleProps } from '../../util/style'; import HTree, { HTreeNode } from './HTree'; -import EventViewer from './EventViewer'; -import Operator from './Operator'; +import EventViewer, { EventViewerProps } from './EventViewer'; +import Operator, { OperatorProps } from './Operator'; export interface PredicateEditorProps extends StyleProps { predicate: Predicate; @@ -48,42 +48,45 @@ const treeify = (exprs: Dict, rootId: string, events: Dict, locale: case Expr.Type.And: case Expr.Type.Or: case Expr.Type.Xor: { - return { + const node: Node = { type: Node.Type.NonTerminal, parent: { component: Operator, - // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment - props: { type: root.type } as any + props: { type: root.type, locale } }, children: Dict.generate(root.argIds, id => treeify(exprs, id, events, locale, exprStates)), childrenOrdering: root.argIds, state: exprStates ? exprStates[rootId] : undefined }; + + return node; } case Expr.Type.Once: case Expr.Type.Not: { - return { + const node: Node = { type: Node.Type.NonTerminal, parent: { component: Operator, - // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment - props: { type: root.type } as any + props: { type: root.type, locale } }, children: Dict.generate([root.argId], id => treeify(exprs, id, events, locale, exprStates)), childrenOrdering: [root.argId], state: exprStates ? exprStates[rootId] : undefined }; + + return node; } case Expr.Type.Event: { - return { + const node: Node = { type: Node.Type.Terminal, node: { component: EventViewer, - // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment - props: { event: events[root.eventId], locale } as any + props: { event: events[root.eventId], locale } }, state: exprStates ? exprStates[rootId] : undefined }; + + return node; } } };