diff --git a/src/components/CaptureDetailDialog.js b/src/components/CaptureDetailDialog.js index 266442341..a4b300223 100644 --- a/src/components/CaptureDetailDialog.js +++ b/src/components/CaptureDetailDialog.js @@ -1,4 +1,4 @@ -import React, { Fragment, useRef, useState, useEffect } from 'react'; +import React, { Fragment, useCallback, useState, useEffect } from 'react'; import compose from 'recompose/compose'; import { connect } from 'react-redux'; @@ -6,14 +6,14 @@ import { connect } from 'react-redux'; import { makeStyles } from '@material-ui/core/styles'; import Typography from '@material-ui/core/Typography'; import Dialog from '@material-ui/core/Dialog'; -import DialogActions from '@material-ui/core/DialogActions'; -import DialogContent from '@material-ui/core/DialogContent'; import Grid from '@material-ui/core/Grid'; import Divider from '@material-ui/core/Divider'; import Chip from '@material-ui/core/Chip'; -import Button from '@material-ui/core/Button'; import IconButton from '@material-ui/core/IconButton'; import Snackbar from '@material-ui/core/Snackbar'; +import Drawer from '@material-ui/core/Drawer'; +import Box from '@material-ui/core/Box'; +import Close from '@material-ui/icons/Close'; import FileCopy from '@material-ui/icons/FileCopy'; import CloseIcon from '@material-ui/icons/Close'; @@ -57,20 +57,46 @@ const useStyles = makeStyles((theme) => ({ fontSize: '0.8em', color: 'rgba(0,0,0,0.5)', }, + root: { + width: 340, + }, + drawer: { + width: 0, + // remove backdrop + '& .MuiBackdrop-root': { + display: 'none', + }, + }, + dialog: { + backgroundColor: 'rgba(0, 0, 0, 0.75)', + }, + box: { + padding: theme.spacing(4), + }, })); function CaptureDetailDialog(props) { - const { open, TransitionComponent, capture } = props; + const { open, capture } = props; const [snackbarOpen, setSnackbarOpen] = useState(false); const [snackbarLabel, setSnackbarLabel] = useState(''); const [renderCapture, setRenderCapture] = useState(capture); + const [screenWidth, setScreenWidth] = useState(window.innerWidth); + const [screenHeight, setScreenHeight] = useState(window.innerHeight); + const resizeWindow = useCallback(() => { + setScreenWidth(window.innerWidth); + setScreenHeight(window.innerHeight); + }, []); const classes = useStyles(); - const textAreaRef = useRef(null); useEffect(() => { props.captureDetailDispatch.getCaptureDetail(props.capture.id); - }, [props.captureDetailDispatch, props.capture]); + + window.addEventListener('resize', resizeWindow); + return () => { + window.removeEventListener('resize', resizeWindow); + }; + }, [props.captureDetailDispatch, props.capture, resizeWindow]); /* * Render the most complete capture detail we have @@ -132,15 +158,26 @@ function CaptureDetailDialog(props) { } return ( - + - - Capture - - + + + + + Capture + + + + + + + + + + - + Capture Data {[ { @@ -180,7 +217,7 @@ function CaptureDetailDialog(props) { ))} - + Verification Status @@ -202,7 +239,7 @@ function CaptureDetailDialog(props) { )} - + Tags Species {species && species.name ? ( @@ -227,7 +264,7 @@ function CaptureDetailDialog(props) { )} - + Capture Token {getTokenStatus(capture.tokenId)} @@ -261,40 +298,42 @@ function CaptureDetailDialog(props) { } return ( - - - - - + + + + + + + - - - - - - - - - -