Skip to content

Commit

Permalink
Draw upload: error handling and userinformation (#1300)
Browse files Browse the repository at this point in the history
* feat: adds error handling and information
  • Loading branch information
FritzHoing authored Nov 23, 2023
1 parent ada5669 commit 75a5ce8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/components/ToolMenu/Draw/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, {
ChangeEvent
ChangeEvent, useState
} from 'react';

import {
Expand All @@ -18,6 +18,7 @@ import {
FontAwesomeIcon
} from '@fortawesome/react-fontawesome';

import { message } from 'antd';
import {
Feature
} from 'ol';
Expand Down Expand Up @@ -119,6 +120,9 @@ export const Draw: React.FC<DrawProps> = ({
)
) {
onGeoJSONUpload(uploadedFiles[0]);
message.success(t('Draw.uploadSuccess'));
} else {
message.error(t('Draw.uploadError'));
}
};

Expand Down
4 changes: 4 additions & 0 deletions src/i18n/translations.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ export default {
text: 'Anmerkung',
modify: 'Bearbeitung',
upload: 'Hochladen',
uploadSuccess: 'Die Datei wurde erfolgreich importiert',
uploadError: 'Der Import ist fehlgeschlagen. Bitte beachten Sie, dass nur .geojson-Dateien unterstützt werden.',
delete: 'Löschen',
export: 'Exportieren'
},
Expand Down Expand Up @@ -290,6 +292,8 @@ export default {
text: 'Annotation',
modify: 'Edit',
upload: 'Upload',
uploadSuccess: 'The file was uploaded successfully',
uploadError: 'The import failed, please note that only .geojson files are supported',
delete: 'Delete',
export: 'Export'
},
Expand Down

0 comments on commit 75a5ce8

Please sign in to comment.