import { ActionIcon, Button, Card, FileInput, Group, Image, Modal, ScrollArea, SimpleGrid, Text, } from '@mantine/core'; import { useCommonHooks } from 'hooks'; import { useFileUploadAPI, useMutationAPI } from 'hooks/useAPI'; import { useState } from 'react'; import { FiTrash } from 'react-icons/fi'; import { modalClasses, scrollAreaClasses } from 'styles'; function BackgroundModal({ backgroundModalOpened, handleBackgroundModalClose, backgroundList, }: { backgroundModalOpened: boolean; handleBackgroundModalClose: () => void; backgroundList: string[]; }) { const [background, setBackground] = useState(null); const [err, setErr] = useState(false); const { isMobile } = useCommonHooks(); const { mutateAsync: uploadAsync } = useFileUploadAPI(); const { mutateAsync } = useMutationAPI(); const fd = new FormData(); const handleFileUpload = (e: any) => { setErr(false); setBackground(e); }; return ( { handleBackgroundModalClose(); setBackground(null); }} fullScreen={isMobile} centered > Manage Backgrounds {backgroundList .filter((background) => background !== 'None') .map((background) => ( {background} { mutateAsync({ method: 'DELETE', endpoint: 'api/backgrounds', body: { background }, }); }} > ))} {background ? ( ) : ( )} ); } export default BackgroundModal;