diff --git a/exoneration-covid/règles/exonération-covid.yaml b/exoneration-covid/règles/exonération-covid.yaml index d0710eff4..6a8f4f46c 100644 --- a/exoneration-covid/règles/exonération-covid.yaml +++ b/exoneration-covid/règles/exonération-covid.yaml @@ -3,8 +3,7 @@ secteur: une possibilité: choix obligatoire: oui possibilités: [S1, S1bis, S2] - metadata: - component: ToggleRadioBlock + type: radio block secteur . S1: valeur: secteur = 'S1' diff --git a/site/source/components/conversation/RuleInput.tsx b/site/source/components/conversation/RuleInput.tsx index 8fd3785f5..baa0f12cc 100644 --- a/site/source/components/conversation/RuleInput.tsx +++ b/site/source/components/conversation/RuleInput.tsx @@ -65,22 +65,11 @@ export const binaryQuestion = [ { value: 'non', label: 'Non' }, ] as const -interface RuleWithMetadata extends Rule { - metadata: T -} - -const isMetadata = >( - rule: Rule -): rule is T => 'metadata' in rule - // This function takes the unknown rule and finds which React component should // be displayed to get a user input through successive if statements // That's not great, but we won't invest more time until we have more diverse // input components and a better type system. -export default function RuleInput< - Names extends string = DottedName, - Metadata extends { component?: string } = { component?: string } ->({ +export default function RuleInput({ dottedName, onChange, showSuggestions = true, @@ -116,10 +105,7 @@ export default function RuleInput< /> ) } - if ( - isMetadata>(rule.rawNode) && - rule.rawNode.metadata.component === 'ToggleRadioBlock' - ) { + if (rule.rawNode.type === 'radio block') { return (