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> </div>
</v-toolbar> </v-toolbar>
<v-content> <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> <ShareMapViewModal v-model="isShareMapViewModalShown"></ShareMapViewModal>
<ReportIssueModal v-model="isReportIssueModalShown"></ReportIssueModal> <ReportIssueModal v-model="isReportIssueModalShown"></ReportIssueModal>
<SearchModal v-model="isSearchModalShown"></SearchModal> <SearchModal v-model="isSearchModalShown"></SearchModal>

View File

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

View File

@ -1,6 +1,6 @@
<template> <template>
<div> <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-bottom-sheet v-model="isActive" id="reportCardSheet">
<v-card> <v-card>
<v-container fluid> <v-container fluid>

View File

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

View File

@ -2,7 +2,9 @@
<v-container fluid fill-height class="no-padding"> <v-container fluid fill-height class="no-padding">
<v-layout row wrap fill-height> <v-layout row wrap fill-height>
<ReportCard></ReportCard> <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"> <v-flex xs12 fill-height v-if="mapCenter">
<Map <Map
:accuracy="currentLocation.hdop" :accuracy="currentLocation.hdop"
@ -170,6 +172,8 @@ export default {
}, },
data() { data() {
return { return {
hasGeolocationError: false,
hasPromptedGeolocation: false,
isReportDialogVisible: false, isReportDialogVisible: false,
noSleep: null, noSleep: null,
notification: null, notification: null,
@ -226,13 +230,17 @@ export default {
watchID = navigator.geolocation.watchPosition( watchID = navigator.geolocation.watchPosition(
setPosition, setPosition,
handlePositionError, (error) => {
this.hasGeolocationError = true;
handlePositionError(error);
},
{ {
enableHighAccuracy: true, enableHighAccuracy: true,
maximumAge: 30000, maximumAge: 30000,
}, },
); );
} }
this.hasPromptedGeolocation = true;
this.$store.dispatch('setLocationWatcherId', { id: watchID }); this.$store.dispatch('setLocationWatcherId', { id: watchID });
}, },
onMapCenterManualUpdate(center) { onMapCenterManualUpdate(center) {