Skip to content

Commit 2abab21

Browse files
committed
Add download modal integration with backend
1 parent 108463f commit 2abab21

File tree

6 files changed

+779
-11
lines changed

6 files changed

+779
-11
lines changed

.env.example

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Backend API URL
2+
# For local development: http://localhost:8000
3+
# For production: https://your-lambda-url.amazonaws.com
4+
VITE_BACKEND_URL=http://localhost:8000

src/App.jsx

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { useState, useCallback, useRef } from 'react';
77
import Map from './components/MapLeaflet';
88
import SearchBar from './components/SearchBar';
99
import ImageList from './components/ImageList';
10+
import DownloadModal from './components/DownloadModal';
1011
import { searchSatelliteData, formatStacItem } from './utils/stacApi';
1112
import './App.css';
1213

@@ -22,6 +23,7 @@ function App() {
2223
const [elevationRange, setElevationRange] = useState({ min: -10, max: 150 });
2324
const [thermalRange, setThermalRange] = useState({ min: 28000, max: 55000 });
2425
const [selectedTileInfo, setSelectedTileInfo] = useState(null);
26+
const [downloadItem, setDownloadItem] = useState(null);
2527

2628
const handleSearch = async (searchParams) => {
2729
let searchBbox = currentBbox;
@@ -118,6 +120,13 @@ function App() {
118120
setSelectedTileInfo(tileData);
119121
};
120122

123+
/**
124+
* Handle opening download modal for a tile
125+
*/
126+
const handleDownload = (item) => {
127+
setDownloadItem(item);
128+
};
129+
121130
return (
122131
<div className="app">
123132
{/* Header */}
@@ -150,7 +159,10 @@ function App() {
150159
selectedImages={selectedImages}
151160
isLoading={isLoading} currentCollection={currentCollection}
152161
selectedBands={selectedBands}
153-
onBandChange={handleBandChange} onShowInfo={handleShowInfo} />
162+
onBandChange={handleBandChange}
163+
onShowInfo={handleShowInfo}
164+
onDownload={handleDownload}
165+
/>
154166
</aside>
155167

156168
{/* Map Area */}
@@ -162,10 +174,20 @@ function App() {
162174
onZoomToImage={handleZoomToImage} currentCollection={currentCollection}
163175
selectedBands={selectedBands} elevationRange={elevationRange} thermalRange={thermalRange}
164176
selectedTileInfo={selectedTileInfo}
165-
onCloseTileInfo={() => setSelectedTileInfo(null)} />
177+
onCloseTileInfo={() => setSelectedTileInfo(null)}
178+
/>
166179
</main>
167180
</div>
168181

182+
{/* Download Modal */}
183+
{downloadItem && (
184+
<DownloadModal
185+
item={downloadItem}
186+
collection={currentCollection}
187+
onClose={() => setDownloadItem(null)}
188+
/>
189+
)}
190+
169191
{/* Error Display */}
170192
{error && (
171193
<div className="app-error">
@@ -184,7 +206,9 @@ function App() {
184206
</a> |
185207
Developed by: <a href="https://github.com/Kongstad" target="_blank" rel="noopener noreferrer">
186208
Peter Kongstad
187-
</a>
209+
</a> |
210+
Hosted on: <a href="https://pages.github.com/" target="_blank" rel="noopener noreferrer">GitHub Pages</a> |
211+
Processing by: <a href="https://aws.amazon.com/lambda/" target="_blank" rel="noopener noreferrer">AWS Lambda</a>
188212
</p>
189213
</footer>
190214
</div>

0 commit comments

Comments
 (0)