Remove useless i18n strings and restore the fetching info alert

This commit is contained in:
Lucas Verney 2018-11-08 23:36:10 +01:00
parent 14e28694e0
commit dcfa5c5897
5 changed files with 34 additions and 19 deletions

View File

@ -57,7 +57,7 @@
</div>
</v-toolbar>
<v-content>
<Alert :error="$t('reportDialog.unableToSendDescription')" :onDismiss="dismissError" v-if="hasReportError"></Alert>
<Alert type="error" :text="$t('reportDialog.unableToSend')" :onDismiss="dismissError" v-if="hasReportError"></Alert>
<ShareMapViewModal v-model="isShareMapViewModalShown"></ShareMapViewModal>
<ReportIssueModal v-model="isReportIssueModalShown"></ReportIssueModal>
<SearchModal v-model="isSearchModalShown"></SearchModal>

View File

@ -1,8 +1,9 @@
<template>
<div class="alert-wrapper">
<v-alert class="alert" type="error" v-model="showAlert" :dismissible="true" transition="slide-y-transition">
{{ error }}
<v-alert class="alert" :type="type" v-model="showAlert" :dismissible="true" transition="slide-y-transition">
{{ text }}
<v-progress-linear
v-if="autoDismiss"
class="progress"
v-model="progressValue"
background-opacity="0"
@ -31,18 +32,26 @@ export default {
}
},
},
mounted() {
this.interval = setInterval(() => {
this.progressValue -= 4;
if (this.progressValue < 0) {
this.showAlert = false;
this.clearTimer();
}
}, 100);
updated() {
this.clearTimer();
if (this.autoDismiss) {
this.interval = setInterval(() => {
this.progressValue -= 4;
if (this.progressValue < 0) {
this.showAlert = false;
this.clearTimer();
}
}, 100);
}
},
props: {
error: String,
autoDismiss: {
type: Boolean,
default: true,
},
text: String,
onDismiss: Function,
type: String,
},
watch: {
showAlert(newAlert) {
@ -58,7 +67,7 @@ export default {
.alert-wrapper {
position: absolute;
top: 0;
z-index: 9999;
z-index: 1001;
width: 100%;
}

View File

@ -1,6 +1,6 @@
<template>
<div>
<Alert :error="$t('reportDialog.unableToSendDescription')" :onDismiss="dismissError" v-if="hasError"></Alert>
<Alert type="error" :text="$t('reportDialog.unableToSend')" :onDismiss="dismissError" v-if="hasError"></Alert>
<v-bottom-sheet v-model="isActive" id="reportCardSheet">
<v-card>
<v-container fluid>

View File

@ -60,7 +60,6 @@
"discard": "Discard",
"ok": "OK",
"or": "or",
"retry": "Retry",
"spaceBeforeDoublePunctuations": "&#8203;"
},
"notification": {
@ -89,8 +88,7 @@
"Reported": "Reported {fromNow}."
},
"reportDialog": {
"unableToSendDescription": "There was a network issue preventing from sending the latest report.",
"unableToSendTitle": "Unable to send latest report"
"unableToSend": "There was a network issue preventing from sending the latest report."
},
"reportIssueModal": {
"description": "Description",

View File

@ -2,7 +2,9 @@
<v-container fluid fill-height class="no-padding">
<v-layout row wrap fill-height>
<ReportCard></ReportCard>
<Alert :error="error" v-if="error" :onDismiss="clearError"></Alert>
<Alert type="error" :text="error" v-if="error" :onDismiss="clearError"></Alert>
<Alert :autoDismiss="false" type="info" :text="$t('geolocation.fetching')" v-if="hasPromptedGeolocation && !hasGeolocationTracking && !hasGeolocationError"></Alert>
<!-- TODO: Show an alert when fetching geolocation -->
<v-flex xs12 fill-height v-if="mapCenter">
<Map
:accuracy="currentLocation.hdop"
@ -170,6 +172,8 @@ export default {
},
data() {
return {
hasGeolocationError: false,
hasPromptedGeolocation: false,
isReportDialogVisible: false,
noSleep: null,
notification: null,
@ -226,13 +230,17 @@ export default {
watchID = navigator.geolocation.watchPosition(
setPosition,
handlePositionError,
(error) => {
this.hasGeolocationError = true;
handlePositionError(error);
},
{
enableHighAccuracy: true,
maximumAge: 30000,
},
);
}
this.hasPromptedGeolocation = true;
this.$store.dispatch('setLocationWatcherId', { id: watchID });
},
onMapCenterManualUpdate(center) {