PluginProbe
Extendify / 1.9.3
Extendify v1.9.3
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 / ChatSettings.js

ChatSettings.js in Extendify 1.9.3, at src/Chat/ChatSettings.js

29 lines 934 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { Spinner, ToggleControl } from '@wordpress/components'
2 import { useState } from '@wordpress/element'
3 import { __ } from '@wordpress/i18n'
4 import { updateOptions } from '@chat/api/Data'
5
6 export const ChatSettings = ({ showChat, setShowChat }) => {
7 const [loading, setLoading] = useState(false)
8
9 const toggleChat = () => {
10 setLoading(true)
11 updateOptions({ showChat: !showChat }).then(() => {
12 setShowChat(!showChat)
13 setLoading(false)
14 })
15 }
16
17 return (
18 <div className="flex items-center mt-4">
19 <ToggleControl
20 label={__('Enable the AI Chatbot', 'extendify')}
21 checked={showChat}
22 onChange={toggleChat}
23 className="m-0 focus:ring-2 focus:ring-design-main focus:border-design-main"
24 />
25 {loading && <Spinner className="mt-0 text-design-main" />}
26 </div>
27 )
28 }
29