Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: link to original image file #206

Merged
merged 4 commits into from
Dec 8, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 28 additions & 1 deletion src/components/CaptureDetailDialog.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { verificationStates } from '../common/variables';
import { CaptureDetailContext } from '../context/CaptureDetailContext';
import CopyNotification from './common/CopyNotification';
import { CopyButton } from './common/CopyButton';
import { Link } from '@material-ui/core';

const useStyles = makeStyles((theme) => ({
chipRoot: {
Expand Down Expand Up @@ -66,6 +67,14 @@ const useStyles = makeStyles((theme) => ({
box: {
padding: theme.spacing(4),
},
imageLink: {
position: 'absolute',
bottom: 0,
margin: '0 auto',
left: '50%',
transform: 'translate(-50%, -50%)',
color: '#fff',
},
}));

function CaptureDetailDialog(props) {
Expand Down Expand Up @@ -172,12 +181,30 @@ function CaptureDetailDialog(props) {
},
{ label: 'Created', value: dateCreated.toLocaleString() },
{ label: 'Note', value: renderCapture.note },
{
label: 'Original Image URL',
value: renderCapture.imageUrl,
copy: true,
link: true,
image: true,
},
].map((item) => (
<Grid item key={item.label}>
<Typography variant="subtitle1">{item.label}</Typography>
<Typography variant="body1">
{item.link ? (
<LinkToWebmap value={item.value} type="user" />
// a link is either a GrowerID (item.image == false) or OriginalImage (item.image == true)
item.image ? (
<Link
href={renderCapture.imageUrl}
underline="always"
target="_blank"
>
Open in new tab
</Link>
) : (
<LinkToWebmap value={item.value} type="user" />
)
) : (
item.value || '---'
)}
Expand Down