Skip to content

Commit 15a22f5

Browse files
committed
Use Radiant Earth as default stac browser
Fix #23
1 parent 3811fa0 commit 15a22f5

File tree

5 files changed

+49
-21
lines changed

5 files changed

+49
-21
lines changed

packages/client/.env

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
APP_TITLE=STAC Manager
2-
APP_DESCRIPTION=Plugin baed stac editor
2+
APP_DESCRIPTION=Plugin based STAC editor
3+
REACT_APP_STAC_BROWSER=
4+
REACT_APP_STAC_API=

packages/client/README.md

+15-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,18 @@
44
The STAC-Manager is a tool designed for managing the values of a STAC (SpatioTemporal Asset Catalog) collection and its items. This interface provides a user-friendly way to modify and update the properties of collections and items within a STAC catalog.
55

66
## Installation and Usage
7-
See root README.md for instructions on how to install and use the project.
7+
See root README.md for instructions on how to install and run the project.
8+
9+
## Client specific instructions
10+
11+
Some client options are controlled by environment variables. These are:
12+
```
13+
APP_TITLE
14+
APP_DESCRIPTION
15+
REACT_APP_STAC_BROWSER
16+
REACT_APP_STAC_API
17+
```
18+
19+
You must provide a value for the `REACT_APP_STAC_API` environment variable. This should be the URL of the STAC API you wish to interact with.
20+
21+
If the `REACT_APP_STAC_BROWSER` environment variable is not set, [Radiant Earth's STAC Browser](https://radiantearth.github.io/stac-browser/) will be used by default, which will connect to the STAC API specified in `REACT_APP_STAC_API`.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import React from 'react';
2+
import { MenuItem, MenuItemProps } from '@chakra-ui/react';
3+
import { CollecticonGlobe } from '@devseed-ui/collecticons-chakra';
4+
import SmartLink from './SmartLink';
5+
6+
const baseStacBrowserUrl =
7+
process.env.REACT_APP_STAC_BROWSER ||
8+
'https://radiantearth.github.io/stac-browser/#/external';
9+
10+
export function StacBrowserMenuItem(
11+
props: MenuItemProps & { resourcePath: string }
12+
) {
13+
const { resourcePath, ...rest } = props;
14+
return (
15+
<MenuItem
16+
icon={<CollecticonGlobe />}
17+
as={SmartLink}
18+
_hover={{ textDecoration: 'none' }}
19+
to={`${baseStacBrowserUrl}${resourcePath}`}
20+
{...rest}
21+
>
22+
View in STAC Browser
23+
</MenuItem>
24+
);
25+
}

packages/client/src/pages/CollectionDetail/index.tsx

+2-9
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ import { MdAccessTime, MdBalance, MdEdit } from 'react-icons/md';
1919
import { useCollection, useStacSearch } from '@developmentseed/stac-react';
2020
import {
2121
CollecticonEllipsisVertical,
22-
CollecticonGlobe,
2322
CollecticonPencil,
2423
CollecticonTrashBin
2524
} from '@devseed-ui/collecticons-chakra';
@@ -31,6 +30,7 @@ import ItemResults from '../../components/ItemResults';
3130
import CollectionMap from './CollectionMap';
3231
import SmartLink from '$components/SmartLink';
3332
import { InnerPageHeader } from '$components/InnerPageHeader';
33+
import { StacBrowserMenuItem } from '$components/StacBrowserMenuItem';
3434

3535
const dateFormat: Intl.DateTimeFormatOptions = {
3636
year: 'numeric',
@@ -115,14 +115,7 @@ function CollectionDetail() {
115115
size='sm'
116116
/>
117117
<MenuList>
118-
<MenuItem
119-
icon={<CollecticonGlobe />}
120-
as={SmartLink}
121-
_hover={{ textDecoration: 'none' }}
122-
to={`${process.env.REACT_APP_STAC_BROWSER}/collections/${id}`}
123-
>
124-
View in STAC Browser
125-
</MenuItem>
118+
<StacBrowserMenuItem resourcePath={`/collections/${id}`} />
126119
<MenuItem
127120
icon={<CollecticonTrashBin />}
128121
color='danger.500'

packages/client/src/pages/ItemDetail/index.tsx

+4-10
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ import { StacAsset } from 'stac-ts';
1616
import { useItem } from '@developmentseed/stac-react';
1717
import {
1818
CollecticonEllipsisVertical,
19-
CollecticonGlobe,
2019
CollecticonTrashBin
2120
} from '@devseed-ui/collecticons-chakra';
2221
import getBbox from '@turf/bbox';
@@ -28,7 +27,7 @@ import { PropertyGroup } from '../../types';
2827
import { BackgroundTiles } from '../../components/Map';
2928
import AssetList from './AssetList';
3029
import { InnerPageHeader } from '$components/InnerPageHeader';
31-
import SmartLink from '$components/SmartLink';
30+
import { StacBrowserMenuItem } from '$components/StacBrowserMenuItem';
3231

3332
const resultsOutline = {
3433
'line-color': '#C53030',
@@ -114,14 +113,9 @@ function ItemDetail() {
114113
size='sm'
115114
/>
116115
<MenuList>
117-
<MenuItem
118-
icon={<CollecticonGlobe />}
119-
as={SmartLink}
120-
_hover={{ textDecoration: 'none' }}
121-
to={`${process.env.REACT_APP_STAC_BROWSER}/collections/${properties.collection}/items/${properties.id}/edit`}
122-
>
123-
View in STAC Browser
124-
</MenuItem>
116+
<StacBrowserMenuItem
117+
resourcePath={`/collections/${properties.collection}/items/${properties.id}`}
118+
/>
125119
<MenuItem
126120
icon={<CollecticonTrashBin />}
127121
color='danger.500'

0 commit comments

Comments
 (0)