Skip to content

Commit 0752bbd

Browse files
authored
Merge pull request #142 from GeoGuess/fix/fileIcon
fix: fileIcon Manifest.json
2 parents 9dd2936 + 6156a08 commit 0752bbd

2 files changed

Lines changed: 68 additions & 32 deletions

File tree

public/manifest.json

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,25 @@
7979
"accept": {
8080
"application/vnd.geo+json": [".geojson",".json"],
8181
"application/json": [".geojson"]
82-
}
82+
},
83+
"icons": [
84+
{
85+
"src": "./img/fileIcons/geojson.png",
86+
"sizes": "144x144"
87+
}
88+
]
8389
},
8490
{
8591
"action": "/history",
8692
"accept": {
8793
"application/json": [".geosave"]
88-
}
94+
},
95+
"icons": [
96+
{
97+
"src": "./img/fileIcons/geosave.png",
98+
"sizes": "144x144"
99+
}
100+
]
89101
}
90102
],
91103
"start_url": "/?utm_source=pwa",

src/components/home/DialogCustomMap.vue

Lines changed: 54 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -15,35 +15,45 @@
1515
<v-card-text>
1616
<v-row no-gutters class="dialog-customs__row">
1717
<v-col md="5" sm="12" class="mr-6">
18-
<v-alert
19-
type="error"
20-
v-if="isValidGeoJson === false"
21-
transition="out-in"
22-
>
23-
{{ $t('DialogCustomMap.invalid') }}
24-
</v-alert>
18+
<v-skeleton-loader
19+
v-if="loading"
20+
class="mx-auto"
21+
height="500"
22+
type="image"
23+
></v-skeleton-loader>
24+
<div v-else>
25+
<v-alert
26+
type="error"
27+
v-if="isValidGeoJson === false"
28+
transition="out-in"
29+
>
30+
{{ $t('DialogCustomMap.invalid') }}
31+
</v-alert>
2532

26-
<GmapMap
27-
:center="{ lat: 10, lng: 10 }"
28-
:zoom="1"
29-
ref="mapRef"
30-
map-type-id="roadmap"
31-
style="width: 100%; height: 500px"
32-
:options="{
33-
gestureHandling: 'greedy',
34-
}"
35-
>
36-
</GmapMap>
37-
<v-row>
38-
<v-btn
39-
class="mt-6 mr-auto ml-auto"
40-
@click="saveGeoJson"
41-
color="secondary"
33+
<GmapMap
34+
:center="{ lat: 10, lng: 10 }"
35+
:zoom="1"
36+
ref="mapRef"
37+
map-type-id="roadmap"
38+
style="width: 100%; height: 500px"
39+
:options="{
40+
gestureHandling: 'greedy',
41+
}"
4242
>
43-
<v-icon left dark> mdi-cloud-download </v-icon>
44-
{{ $t('DialogCustomMap.download') }}
45-
</v-btn>
46-
</v-row>
43+
</GmapMap>
44+
<v-row>
45+
<v-btn
46+
class="mt-6 mr-auto ml-auto"
47+
@click="saveGeoJson"
48+
color="secondary"
49+
>
50+
<v-icon left dark>
51+
mdi-cloud-download
52+
</v-icon>
53+
{{ $t('DialogCustomMap.download') }}
54+
</v-btn>
55+
</v-row>
56+
</div>
4757
</v-col>
4858

4959
<v-col>
@@ -90,6 +100,7 @@
90100
rows="21"
91101
filled
92102
clearable
103+
:loading="loading"
93104
>
94105
</v-textarea>
95106
</v-col>
@@ -115,17 +126,22 @@ export default {
115126
props: ['visibility'],
116127
data() {
117128
return {
118-
placeholderGeoJson: geoJsonExample,
119129
rulesUrl: [(value) => validURL(value)],
120130
rulesTextArea: [(value) => this.checkIfStringGeoJsonValid(value)],
121131
type: 'text',
122132
file: null,
123133
url: '',
124134
initMap: false,
125135
editMap: false,
136+
loading: false,
126137
};
127138
},
128-
computed: { ...mapGetters(['geoJsonString', 'isValidGeoJson', 'geoJson']) },
139+
computed: {
140+
...mapGetters(['geoJsonString', 'isValidGeoJson', 'geoJson']),
141+
placeholderGeoJson() {
142+
return this.loading ? '' : geoJsonExample;
143+
},
144+
},
129145
methods: {
130146
...mapActions(['loadGeoJsonFromUrl', 'setGeoJson', 'setGeoJsonString']),
131147
checkIfStringGeoJsonValid(string) {
@@ -165,7 +181,15 @@ export default {
165181
return;
166182
}
167183
launchParams.files[0].getFile().then((f) => {
168-
this.file = f;
184+
this.loading = true;
185+
this.$emit('change-visibility');
186+
f.text()
187+
.then((content) => {
188+
return this.setGeoJsonString(content);
189+
})
190+
.then(() => {
191+
this.loading = false;
192+
});
169193
});
170194
});
171195
}

0 commit comments

Comments
 (0)