Skip to content

Commit efcdce8

Browse files
Improve instructions when user uploads a part of a shapefile
1 parent a6b4f23 commit efcdce8

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

packages/client/src/admin/uploads/ProjectBackgroundJobContext.tsx

+19-12
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export default function DataUploadDropzone({
204204
message = t(`"${file.name}" is a projection file.`);
205205
isPartOfShapefile = true;
206206
} else if (file.name.endsWith(".shp")) {
207-
message = t(`"${file.name}" is a bare shapefile.`);
207+
message = t(`"${file.name}" should be a zipfile.`);
208208
isPartOfShapefile = true;
209209
} else if (file.name.endsWith(".xml")) {
210210
message = t(`"${file.name}" is an XML file.`);
@@ -218,7 +218,7 @@ export default function DataUploadDropzone({
218218
if (message) {
219219
const description = isPartOfShapefile
220220
? t(
221-
`Parts of shapefiles cannot be uploaded directly. To upload a shapefile, create a .zip file with all related files (.shp, .prj, .shx, etc) and upload that zipfile.`
221+
`Parts of shapefiles cannot be uploaded directly. To upload a shapefile, create a zipfile (.zip) with all related sidecar files (.shp, .prj, .shx, etc). At a minimum, your upload will need to contain the geometry file (.shp) and the projection file (.prj).`
222222
)
223223
: isUnsupportedRaster
224224
? t(
@@ -230,6 +230,7 @@ export default function DataUploadDropzone({
230230
return {
231231
message,
232232
description,
233+
isPartOfShapefile,
233234
};
234235
} else {
235236
return true;
@@ -249,16 +250,22 @@ export default function DataUploadDropzone({
249250
for (const file of acceptedFiles) {
250251
const supported = isUploadForSupported(file);
251252
if (supported !== true) {
252-
const { message, description } = supported;
253-
const response = await confirm(message, {
254-
description,
255-
secondaryButtonText: "Upload anyway",
256-
primaryButtonText: "Cancel",
257-
});
258-
if (!response) {
259-
filteredFiles.push(file);
260-
// Something weird happens when opening these confirm dialogs over and over again
261-
await sleep(100);
253+
const { message, description, isPartOfShapefile } = supported;
254+
if (isPartOfShapefile) {
255+
alert(message, {
256+
description,
257+
});
258+
} else {
259+
const response = await confirm(message, {
260+
description,
261+
secondaryButtonText: "Upload anyway",
262+
primaryButtonText: "Cancel",
263+
});
264+
if (!response) {
265+
filteredFiles.push(file);
266+
// Something weird happens when opening these confirm dialogs over and over again
267+
await sleep(100);
268+
}
262269
}
263270
} else {
264271
filteredFiles.push(file);

0 commit comments

Comments
 (0)