@@ -10,7 +10,7 @@ import {
1010 TabsList ,
1111 TabsTrigger ,
1212} from '@/src/shared/components/Tabs' ;
13- import catalogsData from '@/src/stacBrowser/components/catalogs.json ' ;
13+ import useStacIndex from '@/src/stacBrowser/hooks/useStacIndex ' ;
1414import useStacSearch from '@/src/stacBrowser/hooks/useStacSearch' ;
1515import StacPanelFilters from './StacPanelFilters' ;
1616import StacPanelResults from './StacPanelResults' ;
@@ -21,6 +21,8 @@ interface IStacViewProps {
2121const StacPanel = ( { model } : IStacViewProps ) => {
2222 const inputRef = React . useRef < HTMLInputElement | null > ( null ) ;
2323
24+ const { catalogs } = useStacIndex ( model ) ;
25+
2426 const {
2527 filterState,
2628 filterSetters,
@@ -45,7 +47,7 @@ const StacPanel = ({ model }: IStacViewProps) => {
4547 }
4648
4749 const handleOpenDialog = async ( ) => {
48- const widget = new URLInputWidget ( ) ;
50+ const widget = new URLInputWidget ( catalogs ) ;
4951 inputRef . current = widget . getInput ( ) ;
5052
5153 const dialog = new Dialog < boolean > ( {
@@ -108,9 +110,8 @@ export default StacPanel;
108110class URLInputWidget extends Widget {
109111 private input : HTMLInputElement ;
110112 private catalogInput : HTMLInputElement ;
111- private dropdown : HTMLSelectElement ;
112113
113- constructor ( ) {
114+ constructor ( catalogs : any [ ] = [ ] ) {
114115 const node = document . createElement ( 'div' ) ;
115116 node . style . padding = '10px' ;
116117
@@ -124,12 +125,7 @@ class URLInputWidget extends Widget {
124125 const input = document . createElement ( 'input' ) ;
125126 input . type = 'url' ;
126127 input . placeholder = 'https://example.com' ;
127- input . style . width = '100%' ;
128- input . style . padding = '8px' ;
129- input . style . boxSizing = 'border-box' ;
130- input . style . border = '1px solid #ccc' ;
131- input . style . borderRadius = '4px' ;
132- input . style . marginBottom = '20px' ;
128+ input . className = 'jgis-stac-url-input' ;
133129
134130 // Second section: Select from catalog dropdown
135131 const catalogLabel = document . createElement ( 'label' ) ;
@@ -151,7 +147,7 @@ class URLInputWidget extends Widget {
151147 defaultOption . textContent = 'Select a catalog...' ;
152148 dropdown . appendChild ( defaultOption ) ;
153149
154- catalogsData . forEach ( ( catalog : any ) => {
150+ catalogs . forEach ( ( catalog : any ) => {
155151 const option = document . createElement ( 'option' ) ;
156152 option . value = catalog . url ;
157153 option . textContent = catalog . title ;
@@ -162,20 +158,13 @@ class URLInputWidget extends Widget {
162158 catalogInputLabel . textContent = 'Selected Catalog URL:' ;
163159 catalogInputLabel . style . display = 'block' ;
164160 catalogInputLabel . style . marginBottom = '8px' ;
165- catalogInputLabel . style . fontWeight = 'normal' ;
166- catalogInputLabel . style . fontSize = '0.9em' ;
167- catalogInputLabel . style . color = '#666' ;
161+ catalogInputLabel . className = 'jgis-stac-catalog-input-label' ;
168162
169163 const catalogInput = document . createElement ( 'input' ) ;
170164 catalogInput . type = 'url' ;
171165 catalogInput . placeholder = 'Selected catalog URL will appear here' ;
172- catalogInput . style . width = '100%' ;
173- catalogInput . style . padding = '8px' ;
174- catalogInput . style . boxSizing = 'border-box' ;
175- catalogInput . style . border = '1px solid #ccc' ;
176- catalogInput . style . borderRadius = '4px' ;
166+ catalogInput . className = 'jgis-stac-catalog-input' ;
177167 catalogInput . readOnly = true ;
178- catalogInput . style . backgroundColor = '#f5f5f5' ;
179168
180169 dropdown . addEventListener ( 'change' , e => {
181170 const selectedUrl = ( e . target as HTMLSelectElement ) . value ;
@@ -192,7 +181,6 @@ class URLInputWidget extends Widget {
192181 super ( { node } ) ;
193182 this . input = input ;
194183 this . catalogInput = catalogInput ;
195- this . dropdown = dropdown ;
196184 }
197185
198186 getInput ( ) : HTMLInputElement {
0 commit comments