botman / web-widget

MIT License
37 stars 68 forks source link

how to disable user input if conversiton has buttons? (Problem Solve) #56

Closed HamadHadi closed 3 years ago

HamadHadi commented 3 years ago

there any way to disable the user input if the conversation has buttons to make sure the user select one of buttons ?? any suggestion.

HamadHadi commented 3 years ago

i solve it by check the type of last data if return text

e.messages.map((a) => a.type)[n.state.messages.length - 1] === "text" ? Object(r.b)("input", { id: "userText", class: "textarea", style: "display:block", type: this.props.conf.type, placeholder: this.props.conf.placeholderText, ref: function(t) { n.input = t; }, onKeyPress: this.handleKeyPress, autofocus: !0, autocomplete: "off", disabled: false, }) : "",

if the return as action

e.messages.map((a) => a.type)[n.state.messages.length - 1] === "actions" ? Object(r.b)( "div", { class: "option_div", }, null, Object(r.b)( "div", { class: "option_text", }, "your message here" ) ) : "",