File tree Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Expand file tree Collapse file tree 2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import { StacAsset } from "stac-ts";
44import StacFields from "@radiantearth/stac-fields" ;
55import { PropertyGroup } from "../../types" ;
66import PropertyList from "./PropertyList" ;
7+ import Roles from "./Roles" ;
78
89type AssetProps = {
910 assetKey : string ;
@@ -29,7 +30,7 @@ function Asset({ asset, assetKey }: AssetProps) {
2930 < Box borderBottom = "1px dashed" borderColor = "gray.300" pb = "4" >
3031 < Text as = "h3" mb = "1" > { title || assetKey } </ Text >
3132 { description && < Text my = "0" > { description } </ Text > }
32- < Text my = "0" fontSize = "sm" > { formattedProperties . type . formatted } | { formattedProperties . roles . formatted } </ Text >
33+ < Text my = "0" fontSize = "sm" > { formattedProperties . type . formatted } | < Roles roles = { formattedProperties . roles } /> </ Text >
3334 < Box mt = "2" mb = "4" >
3435 { alternate ? (
3536 Object . entries ( alternate )
Original file line number Diff line number Diff line change 1+ type RolesProps = {
2+ roles : {
3+ spec : {
4+ label : "Purpose" ,
5+ mapping : {
6+ data : "Data"
7+ graphic : "Illustration"
8+ metadata : "Metadata"
9+ overview : "Overview"
10+ thumbnail : "Preview"
11+ visual : "Visualization"
12+ [ key : string ] : string
13+ }
14+ } ,
15+ value : string [ ] ;
16+ }
17+ } ;
18+
19+ function Roles ( { roles } : RolesProps ) {
20+ const { value, spec } = roles ;
21+ const { mapping } = spec ;
22+ return (
23+ < >
24+ { value . map ( ( val ) => mapping [ val ] || val ) . join ( ", " ) }
25+ </ >
26+ ) ;
27+ }
28+
29+ export default Roles ;
You can’t perform that action at this time.
0 commit comments