File tree Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Expand file tree Collapse file tree 2 files changed +28
-4
lines changed Original file line number Diff line number Diff line change @@ -39,31 +39,46 @@ export default function Value({
39
39
40
40
{ children }
41
41
42
- { selfHref && < SelfHrefButtons href = { selfHref } > </ SelfHrefButtons > }
42
+ { selfHref && (
43
+ < SelfHrefButtons
44
+ href = { selfHref }
45
+ isItem = { value . type === "Feature" }
46
+ > </ SelfHrefButtons >
47
+ ) }
43
48
</ Stack >
44
49
</ Section >
45
50
) ;
46
51
}
47
52
48
- function SelfHrefButtons ( { href : selfHref } : { href : string } ) {
53
+ function SelfHrefButtons ( { href, isItem } : { href : string ; isItem : boolean } ) {
49
54
return (
50
55
< ButtonGroup size = { "xs" } variant = { "outline" } py = { 4 } >
51
56
< Button asChild >
52
- < a href = { selfHref } target = "_blank" >
57
+ < a href = { href } target = "_blank" >
53
58
< LuExternalLink > </ LuExternalLink > Source
54
59
</ a >
55
60
</ Button >
56
61
< Button asChild >
57
62
< a
58
63
href = {
59
64
"https://radiantearth.github.io/stac-browser/#/external/" +
60
- selfHref . replace ( / ^ ( h t t p s ? : \/ \/ ) / , "" )
65
+ href . replace ( / ^ ( h t t p s ? : \/ \/ ) / , "" )
61
66
}
62
67
target = "_blank"
63
68
>
64
69
< LuExternalLink > </ LuExternalLink > STAC Browser
65
70
</ a >
66
71
</ Button >
72
+ { isItem && (
73
+ < Button asChild >
74
+ < a
75
+ href = { "https://titiler.xyz/stac/viewer?url=" + href }
76
+ target = "_blank"
77
+ >
78
+ < LuExternalLink > </ LuExternalLink > TiTiler
79
+ </ a >
80
+ </ Button >
81
+ ) }
67
82
</ ButtonGroup >
68
83
) ;
69
84
}
Original file line number Diff line number Diff line change @@ -33,4 +33,13 @@ describe("loading", () => {
33
33
. element ( app . getByRole ( "heading" , { name : "Planet" } ) )
34
34
. toBeVisible ( ) ;
35
35
} ) ;
36
+
37
+ test ( "Item has TiTiler link" , async ( ) => {
38
+ const app = renderApp (
39
+ "?href=https://raw.githubusercontent.com/radiantearth/stac-spec/refs/heads/master/examples/simple-item.json" ,
40
+ ) ;
41
+ await expect
42
+ . element ( app . getByRole ( "link" , { name : "TiTiler" } ) )
43
+ . toBeVisible ( ) ;
44
+ } ) ;
36
45
} ) ;
You can’t perform that action at this time.
0 commit comments