Skip to content

Commit 69b78ab

Browse files
committed
refactor(web): streamline CRS suggestion rendering in DatasetDownloadModal
1 parent d221169 commit 69b78ab

File tree

1 file changed

+7
-23
lines changed

1 file changed

+7
-23
lines changed

apps/web/components/modals/DatasetDownload.tsx

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import {
66
DialogActions,
77
DialogContent,
88
DialogTitle,
9-
Divider,
10-
ListSubheader,
119
MenuItem,
1210
Select,
1311
Stack,
@@ -134,11 +132,12 @@ const DatasetDownloadModal: React.FC<DownloadDatasetDialogProps> = ({
134132
}
135133
};
136134

137-
// Group CRS suggestions for rendering
138-
const globalCrs = crsSuggestions.filter((s) => s.group === "global");
139-
const utmCrs = crsSuggestions.filter((s) => s.group === "utm");
140-
const regionalCrs = crsSuggestions.filter((s) => s.group === "regional");
141-
const hasRecommended = utmCrs.length > 0 || regionalCrs.length > 0;
135+
// Order: global first, then UTM, then regional
136+
const orderedCrs = [
137+
...crsSuggestions.filter((s) => s.group === "global"),
138+
...crsSuggestions.filter((s) => s.group === "utm"),
139+
...crsSuggestions.filter((s) => s.group === "regional"),
140+
];
142141

143142
return (
144143
<Dialog open={open} onClose={onClose} fullWidth maxWidth="xs">
@@ -187,22 +186,7 @@ const DatasetDownloadModal: React.FC<DownloadDatasetDialogProps> = ({
187186
id="download-crs-select"
188187
value={dataCrs}
189188
onChange={(e) => setDataCrs(e.target.value as string)}>
190-
<ListSubheader>{t("crs_global")}</ListSubheader>
191-
{globalCrs.map((crs) => (
192-
<MenuItem key={crs.code} value={crs.code}>
193-
{crs.label}
194-
</MenuItem>
195-
))}
196-
{hasRecommended && <Divider />}
197-
{hasRecommended && (
198-
<ListSubheader>{t("crs_recommended")}</ListSubheader>
199-
)}
200-
{utmCrs.map((crs) => (
201-
<MenuItem key={crs.code} value={crs.code}>
202-
{crs.label}
203-
</MenuItem>
204-
))}
205-
{regionalCrs.map((crs) => (
189+
{orderedCrs.map((crs) => (
206190
<MenuItem key={crs.code} value={crs.code}>
207191
{crs.label}
208192
</MenuItem>

0 commit comments

Comments
 (0)