Skip to content

Commit

Permalink
fix(generateBasemap): update tile source option value (#2050)
Browse files Browse the repository at this point in the history
* fix(generateBasemap): update tile source option value

* fix(environment): update OSMAnd value
  • Loading branch information
NSUWAL123 authored Jan 1, 2025
1 parent 4e20c3c commit 5cfc983
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
14 changes: 7 additions & 7 deletions src/frontend/src/components/GenerateBasemap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ const GenerateBasemap = ({ projectInfo }: { projectInfo: Partial<projectInfoType

useEffect(() => {
if (projectInfo?.custom_tms_url) {
setSelectedTileSource('tms');
setSelectedTileSource('custom');
setTmsUrl(projectInfo?.custom_tms_url);
}
}, [projectInfo]);

const handleTileSourceChange = (e: React.ChangeEvent<HTMLInputElement>) => {
setSelectedTileSource(e.target.value);
// If 'tms' is selected, clear the TMS URL
if (e.target.value !== 'tms') {
// If 'custom' is selected, clear the TMS URL
if (e.target.value !== 'custom') {
setTmsUrl('');
}
};
Expand All @@ -70,7 +70,7 @@ const GenerateBasemap = ({ projectInfo }: { projectInfo: Partial<projectInfoType
if (!selectedOutputFormat) {
currentError.push('selectedOutputFormat');
}
if (!tmsUrl && selectedTileSource === 'tms') {
if (!tmsUrl && selectedTileSource === 'custom') {
currentError.push('tmsUrl');
}
setError(currentError);
Expand Down Expand Up @@ -150,7 +150,7 @@ const GenerateBasemap = ({ projectInfo }: { projectInfo: Partial<projectInfoType
<p className="fmtm-text-sm fmtm-text-red-500">Tile Source is Required.</p>
)}
</CoreModules.Grid>
{selectedTileSource === 'tms' && (
{selectedTileSource === 'custom' && (
<CoreModules.Grid item xs={12} sm={6} md={4}>
<CoreModules.FormControl fullWidth>
<CoreModules.TextField
Expand Down Expand Up @@ -219,8 +219,8 @@ const GenerateBasemap = ({ projectInfo }: { projectInfo: Partial<projectInfoType
<CoreModules.Grid
item
xs={12}
sm={selectedTileSource === 'tms' ? 6 : 12}
md={selectedTileSource === 'tms' ? 12 : 4}
sm={selectedTileSource === 'custom' ? 6 : 12}
md={selectedTileSource === 'custom' ? 12 : 4}
>
<div className="fmtm-w-full fmtm-flex fmtm-items-center fmtm-justify-center sm:fmtm-justify-end fmtm-mr-4 fmtm-gap-4 fmtm-h-full">
{/* Generate Button */}
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/environment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ export default {
{ id: 1, label: 'ESRI', value: 'esri' },
{ id: 2, label: 'Bing', value: 'bing' },
{ id: 3, label: 'Google', value: 'google' },
{ id: 5, label: 'Custom TMS', value: 'tms' },
{ id: 5, label: 'Custom TMS', value: 'custom' },
],
tileOutputFormats: [
{ id: 1, label: 'MBTiles', value: 'mbtiles' },
{ id: 2, label: 'OSMAnd', value: 'sqlite3' },
{ id: 2, label: 'OSMAnd', value: 'sqlitedb' },
{ id: 3, label: 'PMTiles', value: 'pmtiles' },
],
statusColors: {
Expand Down

0 comments on commit 5cfc983

Please sign in to comment.