import React from "react"; import { Text, Flex, Avatar, ActionIcon, Tooltip, CopyButton, SimpleGrid } from "@mantine/core"; // @ts-ignore import SvgAvatarDevChat from '@/views/avatar_devchat.svg'; // @ts-ignore import SvgAvatarUser from '@/views/avatar_spaceman.png'; import { IconCheck, IconCopy, Icon360, IconEdit } from "@tabler/icons-react"; import { useAppDispatch } from '@/views/hooks'; import { setContexts, setValue, } from './inputSlice'; const MessageHeader = (props: any) => { const { type, message, contexts, showEdit = false } = props; const dispatch = useAppDispatch(); const [done, setDone] = React.useState(false); return ( { type === 'bot' ? : } {type === 'bot' ? 'DevChat' : 'User'} {type === 'user' ? { dispatch(setValue(message)); dispatch(setContexts(contexts)); setDone(true); setTimeout(() => { setDone(false); }, 2000); }}> {done ? : } {showEdit && { }}> } : {({ copied, copy }) => ( {copied ? : } )} } ); }; export default MessageHeader;