diff --git a/src/components/PlanterDetail.js b/src/components/PlanterDetail.js
index bbe664924..ef583ef92 100644
--- a/src/components/PlanterDetail.js
+++ b/src/components/PlanterDetail.js
@@ -18,6 +18,7 @@ import { hasPermission, POLICIES } from '../models/auth';
import { AppContext } from './Context';
import EditPlanter from './EditPlanter';
import OptimizedImage from './OptimizedImage';
+import LinkToWebmap from './common/LinkToWebmap';
const useStyle = makeStyles((theme) => ({
root: {
@@ -158,7 +159,9 @@ const PlanterDetail = (props) => {
{planter.firstName} {planter.lastName}
- ID:{planter.id}
+
+ ID:
+
diff --git a/src/components/Planters.js b/src/components/Planters.js
index 7bd130283..10bb14a91 100644
--- a/src/components/Planters.js
+++ b/src/components/Planters.js
@@ -22,6 +22,7 @@ import Person from '@material-ui/icons/Person';
import Navbar from './Navbar';
import PlanterDetail from './PlanterDetail';
import OptimizedImage from './OptimizedImage';
+import LinkToWebmap from './common/LinkToWebmap';
const log = require('loglevel').getLogger('../components/Planters');
@@ -323,7 +324,9 @@ function Planter(props) {
{planter.firstName} {planter.lastName}
- ID: {planter.id}
+
+ ID:
+
{planter.organization && (
Organization: {planter.organization}
)}
diff --git a/src/components/TreeDetailDialog.js b/src/components/TreeDetailDialog.js
index 06b726cc2..1951f89e7 100644
--- a/src/components/TreeDetailDialog.js
+++ b/src/components/TreeDetailDialog.js
@@ -18,6 +18,7 @@ import Snackbar from '@material-ui/core/Snackbar';
import FileCopy from '@material-ui/icons/FileCopy';
import CloseIcon from '@material-ui/icons/Close';
import OptimizedImage from './OptimizedImage';
+import LinkToWebmap from './common/LinkToWebmap';
const useStyles = makeStyles((theme) => ({
chipRoot: {
@@ -110,13 +111,18 @@ function TreeDetailDialog(props) {
- {`Tree ${tree.id}`}
+ Tree
{[
- { label: 'Planter ID', value: tree.planterId, copy: true },
+ {
+ label: 'Planter ID',
+ value: tree.planterId,
+ copy: true,
+ link: true,
+ },
{
label: 'Planter Identifier',
value: tree.planterIdentifier,
@@ -138,7 +144,11 @@ function TreeDetailDialog(props) {
{item.label}
- {item.value || '---'}
+ {item.link ? (
+
+ ) : (
+ item.value || '---'
+ )}
{item.value && item.copy && (
)}
diff --git a/src/components/TreeTable.js b/src/components/TreeTable.js
index 218a5dd03..81051f1d7 100644
--- a/src/components/TreeTable.js
+++ b/src/components/TreeTable.js
@@ -18,6 +18,7 @@ import {
import { getDateTimeStringLocale } from '../common/locale';
import Filter, { FILTER_WIDTH } from './Filter';
import TreeDetails from './TreeDetails.js';
+import LinkToWebmap from './common/LinkToWebmap';
// change 88 to unit spacing,
const styles = (theme) => ({
@@ -229,7 +230,7 @@ class TreeTable extends Component {
>
{columns.map(({ attr, renderer }) => (
- {renderer ? renderer(tree[attr]) : tree[attr]}
+ {formatCell(tree, attr, renderer)}
))}
@@ -254,6 +255,16 @@ class TreeTable extends Component {
}
}
+const formatCell = (tree, attr, renderer) => {
+ if (attr === 'id' || attr === 'planterId') {
+ return (
+
+ );
+ } else {
+ return renderer ? renderer(tree[attr]) : tree[attr];
+ }
+};
+
const mapState = (state) => {
const keys = Object.keys(state.trees.data);
return {
diff --git a/src/components/common/LinkToWebmap.js b/src/components/common/LinkToWebmap.js
new file mode 100644
index 000000000..f7ca6299c
--- /dev/null
+++ b/src/components/common/LinkToWebmap.js
@@ -0,0 +1,26 @@
+import React from 'react';
+import Link from '@material-ui/core/Link';
+import OpenInNewIcon from '@material-ui/icons/OpenInNew';
+import { makeStyles } from '@material-ui/core/styles';
+
+const useStyles = makeStyles((theme) => ({
+ openInNewIcon: {
+ margin: theme.spacing(-0.5, 0.5),
+ },
+}));
+
+export default function LinkToWebmap(props) {
+ const { value, type } = props;
+ const classes = useStyles();
+
+ return (
+
+ {value}
+
+
+ );
+}