import React, { useState } from 'react'; import { FaBars, FaPaperPlane } from 'react-icons/fa'; import type { IHTTPConnection, Protobuf, Types, } from '@meshtastic/meshtasticjs'; import type { LanguageEnum, languageTemplate } from './App'; import ChatMessage from './components/ChatMessage'; import Sidebar from './components/Sidebar'; interface MainProps { Messages: { message: Types.TextPacket; ack: boolean }[]; Connection: IHTTPConnection; MyNodeInfo: Protobuf.MyNodeInfo; Nodes: Types.NodeInfoPacket[]; Channels: Protobuf.Channel[]; IsReady: boolean; Preferences: Protobuf.RadioConfig_UserPreferences; Language: LanguageEnum; SetLanguage: Function; Translations: languageTemplate; } const Main = (props: MainProps) => { const [currentMessage, setCurrentMessage] = useState(''); const [mobileNavOpen, setMobileNavOpen] = useState(true); const sendMessage = () => { if (props.IsReady) { props.Connection.sendText(currentMessage, undefined, true); setCurrentMessage(''); } }; return (