PluginProbe
Extendify / 1.6.1
Extendify v1.6.1
3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 0.7.0 All 126 releases
extendify / src / Chat / components / ChatDialog.js

ChatDialog.js in Extendify 1.6.1, at src/Chat/components/ChatDialog.js

33 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { useState } from '@wordpress/element'
2 import { Answer } from '@chat/components/dialog/Answer'
3 import { Header } from '@chat/components/dialog/Header'
4 import { Question } from '@chat/components/dialog/Question'
5 import { Support } from '@chat/components/dialog/Support'
6 import { useQuestion } from '@chat/hooks/useQuestion'
7
8 export const ChatDialog = () => {
9 // Store the answer in state that the current answer doesn't clear while the new one is loading.
10 const [question, setQuestion] = useState('')
11 const { data: answer, loading, error } = useQuestion(question ?? null)
12 const reset = () => setQuestion('')
13
14 return (
15 <div className="fixed z-high overflow-hidden w-80 bottom-24 right-6 border border-solid border-gray-300 text-base bg-white rounded-lg shadow-2xl">
16 <div className="px-6 py-4 bg-design-main text-design-text">
17 <Header question={question} reset={reset} />
18 {!answer && !question && <Question setQuestion={setQuestion} />}
19 </div>
20 {!answer && !question && <Support />}
21 {question && (
22 <Answer
23 question={question}
24 answerId={answer?.id}
25 reset={reset}
26 questionLoading={loading}
27 questionError={error}
28 />
29 )}
30 </div>
31 )
32 }
33