import * as React from 'react'; import Box from '@mui/material/Box'; import Button from '@mui/material/Button'; import Typography from '@mui/material/Typography'; import Modal from '@mui/material/Modal'; import { Add } from '@mui/icons-material'; import { Grid, TextField, IconButton } from '@mui/material'; import { common } from "@yokowasis/firegun"; const style = { position: 'absolute' as 'absolute', top: '50%', left: '50%', transform: 'translate(-50%, -50%)', width: 400, bgcolor: 'background.paper', border: '2px solid #000', boxShadow: 24, p: 4, }; export default function GroupChat( props: { common : typeof common, newGroup : (name:string,desc:string,image:string) => void, } ) { const [open, setOpen] = React.useState(false); const [newGroupName, setNewGroupName] = React.useState(""); const [newGroupDescription, setNewGroupDescription] = React.useState(""); const [newImage, setNewImage] = React.useState(""); const handleOpen = () => setOpen(true); const handleClose = () => setOpen(false); const handleNewGroupName = (event: React.ChangeEvent) => { props.common.fileTobase64(event.target) .then((s:any)=>{ setNewImage(s.content); }) } const selectLogo = () => { if (document != null) { let b = document.getElementById("newGroupImage"); if (b != null) { b.click(); } } } const saveNewGroup = () => { props.newGroup(newGroupName,newGroupDescription,newImage); } return ( New Group { newImage ? new group : } {setNewGroupName(e.target.value)}} /> {setNewGroupDescription(e.target.value)}} /> ); }