From a7b243a894f9b1b09cc9478104b920ec47a94380 Mon Sep 17 00:00:00 2001 From: Anton Tananaev Date: Wed, 8 Sep 2021 20:59:18 -0700 Subject: Add calendar file upload --- modern/src/settings/CalendarPage.js | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'modern/src/settings') diff --git a/modern/src/settings/CalendarPage.js b/modern/src/settings/CalendarPage.js index de714c36..60d4ef76 100644 --- a/modern/src/settings/CalendarPage.js +++ b/modern/src/settings/CalendarPage.js @@ -4,6 +4,7 @@ import { Accordion, AccordionSummary, AccordionDetails, makeStyles, Typography, } from '@material-ui/core'; import ExpandMoreIcon from '@material-ui/icons/ExpandMore'; +import { DropzoneArea } from 'material-ui-dropzone'; import EditItemView from '../EditItemView'; import EditAttributesView from '../attributes/EditAttributesView'; import { useTranslation } from '../LocalizationProvider'; @@ -20,6 +21,19 @@ const CalendarPage = () => { const [item, setItem] = useState(); + const handleFiles = (files) => { + if (files.length > 0) { + const reader = new FileReader(); + reader.onload = (event) => { + const { result } = event.target; + setItem({ ...item, data: result.substr(result.indexOf(',') + 1) }); + }; + reader.readAsDataURL(files[0]); + } else { + setItem({ ...item, data: null }); + } + }; + return ( {item @@ -39,6 +53,10 @@ const CalendarPage = () => { label={t('sharedName')} variant="filled" /> + -- cgit v1.2.3