import * as React from 'react';
import { useState } from 'react';
import { Avatar, Container, Divider, Flex, Grid, Stack } from '@mantine/core';
import { Input, Tooltip } from '@mantine/core';
import { List } from '@mantine/core';
import { ScrollArea } from '@mantine/core';
import { createStyles } from '@mantine/core';
import { ActionIcon } from '@mantine/core';
import { Menu, Button, Text } from '@mantine/core';
import { useViewportSize } from '@mantine/hooks';
import { IconEdit, IconRobot, IconSend, IconSquareRoundedPlus, IconUser } from '@tabler/icons-react';
import { IconSettings, IconSearch, IconPhoto, IconMessageCircle, IconTrash, IconArrowsLeftRight } from '@tabler/icons-react';
import { Prism } from '@mantine/prism';
const useStyles = createStyles((theme, _params, classNames) => ({
panel: {
height: '100%',
backgroundColor: theme.colors.gray[0],
},
plusMenu: {
top: 'unset !important',
left: '31px !important',
bottom: 60,
},
commandMenu: {
top: 'unset !important',
left: '31px !important',
bottom: 60,
},
commandText: {
fontSize: '1.0rem',
fontWeight: 'bolder',
},
commandDesc: {
fontSize: '0.8rem',
color: theme.colors.gray[6],
},
icon: {
pointerEvents: 'all',
},
}));
const chatPanel = () => {
const [opened, setOpened] = useState(false);
const [commandOpened, setCommandOpened] = useState(false);
const { classes } = useStyles();
const { height, width } = useViewportSize();
const demoCode = `import { Button } from '@mantine/core';
function Demo() {
return
}`;
const handlePlusBottonClick = (event: React.MouseEvent) => {
setOpened(!opened);
event.stopPropagation();
};
const handleContainerClick = (event: React.MouseEvent) => {
if (opened) { setOpened(false); }
};
const handleInputChange = (event: React.ChangeEvent) => {
const value = event.target.value
// if value start with '/' command show menu
if (value.startsWith('/')) {
setCommandOpened(true);
} else {
setCommandOpened(false);
}
}
return (
Write a hello world, and explain it.
{/* {demoCode} */}
Write a hello world, and explain it.
}
rightSection={
}
onChange={handleInputChange}
/>
);
};
export default chatPanel;