controlRenderBX.jsx 1.17 KB
Newer Older
Muhammadali's avatar
Muhammadali committed
1 2
/** @format */
import React, { useEffect, useState } from 'react';
Muhammadali's avatar
Muhammadali committed
3
import Root from '../root';
Muhammadali's avatar
Muhammadali committed
4
import {useColorConfig} from "../storage/globalColorConfig"
Muhammadali's avatar
Muhammadali committed
5

Muhammadali's avatar
Muhammadali committed
6
const ControlRenderBX = () => {
Muhammadali's avatar
Muhammadali committed
7
	const useColorConfigStore = useColorConfig((store)=> store)
Muhammadali's avatar
Muhammadali committed
8
	const [wsphonedata, setWsphonedata] = useState({});
Muhammadali's avatar
Muhammadali committed
9
	useEffect(() => {
Muhammadali's avatar
Muhammadali committed
10
		setWsphonedata(window.alovoice_wsphone);
Muhammadali's avatar
Muhammadali committed
11
		useColorConfigStore.getColors()
Muhammadali's avatar
Muhammadali committed
12 13 14 15 16 17 18 19 20 21 22 23
		if (!window.alovoice_wsphone) {
			setWsphonedata({
				iscloud: true,
				number: '2020',
				wsurl: 'cld.alovoice.uz:61040',
				server_id: 40,
				secret: '97bff7',
				lefttime: 231461,
				reasons: ['free', 'outcalls', 'home', 'totop'],
				reason: 'free',
				variant: 'bxmini',
				position: 'bottomRight',
Muhammadali's avatar
Muhammadali committed
24 25 26 27 28 29 30
				extnums: [
					{
						title: 'text-1',
						number: '994412860',
					},
					{
						title: 'test-2',
Muhammadali's avatar
Muhammadali committed
31
						number: '770412860',
Muhammadali's avatar
Muhammadali committed
32 33
					},
				],
Muhammadali's avatar
Muhammadali committed
34 35
			});
		}
Muhammadali's avatar
Muhammadali committed
36
		// getHistoryColor
Muhammadali's avatar
Muhammadali committed
37
	}, []);
Muhammadali's avatar
Muhammadali committed
38
	console.log('window_alovoice_wsphone: ', window.alovoice_wsphone);
Muhammadali's avatar
Muhammadali committed
39 40
	return (
		<div>
Muhammadali's avatar
Muhammadali committed
41
			{wsphonedata?.number && (
Muhammadali's avatar
Muhammadali committed
42
				<Root
Muhammadali's avatar
Muhammadali committed
43
					setWsphonedata={setWsphonedata}
Muhammadali's avatar
Muhammadali committed
44 45 46
					onSetDnd={window.alovoice_onsetdnd}
					wsphonedata={wsphonedata}
				/>
Muhammadali's avatar
Muhammadali committed
47
			)}
Muhammadali's avatar
Muhammadali committed
48 49
		</div>
	);
Muhammadali's avatar
Muhammadali committed
50 51 52
};

export default ControlRenderBX;