Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(generateBasemap): update tile source option value #2050

Merged
merged 2 commits into from
Jan 1, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading