Small cleanup of downloadPanel-file

This commit is contained in:
Pieter Vander Vennet 2022-03-17 23:19:20 +01:00
parent 225f14ec06
commit e6997f9b9d

View file

@ -28,13 +28,13 @@ export class DownloadPanel extends Toggle {
const t = Translations.t.general.download const t = Translations.t.general.download
const name = State.state.layoutToUse.id; const name = State.state.layoutToUse.id;
const includeMetaToggle = new CheckBoxes([t.includeMetaData.Clone()]) const includeMetaToggle = new CheckBoxes([t.includeMetaData])
const metaisIncluded = includeMetaToggle.GetValue().map(selected => selected.length > 0) const metaisIncluded = includeMetaToggle.GetValue().map(selected => selected.length > 0)
const buttonGeoJson = new SubtleButton(Svg.floppy_ui(), const buttonGeoJson = new SubtleButton(Svg.floppy_ui(),
new Combine([t.downloadGeojson.Clone().SetClass("font-bold"), new Combine([t.downloadGeojson.SetClass("font-bold"),
t.downloadGeoJsonHelper.Clone()]).SetClass("flex flex-col")) t.downloadGeoJsonHelper]).SetClass("flex flex-col"))
.OnClickWithLoading(t.exporting,async () => { .OnClickWithLoading(t.exporting,async () => {
const geojson = DownloadPanel.getCleanGeoJson(state, metaisIncluded.data) const geojson = DownloadPanel.getCleanGeoJson(state, metaisIncluded.data)
Utils.offerContentsAsDownloadableFile(JSON.stringify(geojson, null, " "), Utils.offerContentsAsDownloadableFile(JSON.stringify(geojson, null, " "),
@ -45,8 +45,8 @@ export class DownloadPanel extends Toggle {
const buttonCSV = new SubtleButton(Svg.floppy_ui(), new Combine( const buttonCSV = new SubtleButton(Svg.floppy_ui(), new Combine(
[t.downloadCSV.Clone().SetClass("font-bold"), [t.downloadCSV.SetClass("font-bold"),
t.downloadCSVHelper.Clone()]).SetClass("flex flex-col")) t.downloadCSVHelper]).SetClass("flex flex-col"))
.OnClickWithLoading(t.exporting, async () => { .OnClickWithLoading(t.exporting, async () => {
const geojson = DownloadPanel.getCleanGeoJson(state, metaisIncluded.data) const geojson = DownloadPanel.getCleanGeoJson(state, metaisIncluded.data)
const csv = GeoOperations.toCSV(geojson.features) const csv = GeoOperations.toCSV(geojson.features)
@ -62,12 +62,12 @@ export class DownloadPanel extends Toggle {
buttonGeoJson, buttonGeoJson,
buttonCSV, buttonCSV,
includeMetaToggle, includeMetaToggle,
t.licenseInfo.Clone().SetClass("link-underline")]) t.licenseInfo.SetClass("link-underline")])
.SetClass("w-full flex flex-col border-4 border-gray-300 rounded-3xl p-4") .SetClass("w-full flex flex-col border-4 border-gray-300 rounded-3xl p-4")
super( super(
downloadButtons, downloadButtons,
t.noDataLoaded.Clone(), t.noDataLoaded,
state.featurePipeline.somethingLoaded) state.featurePipeline.somethingLoaded)
} }
@ -110,7 +110,7 @@ export class DownloadPanel extends Toggle {
const cleaned = { const cleaned = {
type: feature.type, type: feature.type,
geometry: feature.geometry, geometry: {...feature.geometry},
properties: {...feature.properties} properties: {...feature.properties}
} }