2
0

🚸 (js) Display last input if send message errored

This commit is contained in:
Baptiste Arnaud
2023-04-03 18:14:32 +02:00
parent a5d3f83c7f
commit 9f8398b9ae
7 changed files with 38 additions and 18 deletions

View File

@ -37,6 +37,7 @@ type Props = {
inputIndex: number
context: BotContext
isInputPrefillEnabled: boolean
hasError: boolean
onSubmit: (answer: string) => void
onSkip: () => void
}
@ -56,16 +57,14 @@ export const InputChatBlock = (props: Props) => {
return (
<Switch>
<Match when={answer()} keyed>
{(answer) => (
<GuestBubble
message={answer}
showAvatar={props.guestAvatar?.isEnabled ?? false}
avatarSrc={props.guestAvatar?.url && props.guestAvatar.url}
/>
)}
<Match when={answer() && !props.hasError}>
<GuestBubble
message={answer() as string}
showAvatar={props.guestAvatar?.isEnabled ?? false}
avatarSrc={props.guestAvatar?.url && props.guestAvatar.url}
/>
</Match>
<Match when={isNotDefined(answer())}>
<Match when={isNotDefined(answer()) || props.hasError}>
<div
class="flex justify-end animate-fade-in"
data-blockid={props.block.id}