From 039987aacdf4b4e789389348b9dce97206f53e82 Mon Sep 17 00:00:00 2001 From: Troplo Date: Thu, 4 Feb 2021 21:52:30 +1100 Subject: [PATCH] Provide feedback --- src/components/Footer.vue | 105 +++++++++++++++++++++++++++++++++++++- src/locales/en.json | 8 +++ src/views/Avatar.vue | 5 +- 3 files changed, 115 insertions(+), 3 deletions(-) diff --git a/src/components/Footer.vue b/src/components/Footer.vue index 9cd0ea2..e487e14 100644 --- a/src/components/Footer.vue +++ b/src/components/Footer.vue @@ -1,5 +1,57 @@ @@ -28,9 +81,41 @@ import AjaxErrorHandler from '../../assets/js/errorHandler' export default { name: 'locale-changer', data () { - return { langs: ['en', 'debug', 'wind'], currentLang: this.$i18n.locale, langModal: false} + return { + feedbackModal: false, + langs: ['en', 'debug', 'wind'], + currentLang: this.$i18n.locale, + langModal: false, + feedback: { + route: this.$route.path, + stars: 0, + text: '', + email: this.$store.state.user.email, + loading: false + } + } }, methods: { + doFeedback() { + this.feedback.loading = true + this.axios + .post(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'feedback', { + text: this.feedback.text, + stars: this.feedback.stars, + email: this.feedback.email, + route: this.feedback.route + }) + .then(() => { + this.axios.get(process.env.VUE_APP_APIENDPOINT + process.env.VUE_APP_APIVERSION + '/' + 'userinfo') + this.feedbackModal = false + this.$buefy.snackbar.open({message:this.$t('errors.feedbackThanks'), type: 'is-info'}) + this.feedback.loading = false + }) + .catch(e => { + AjaxErrorHandler(this.$store)(e) + this.feedback.loading = false + }) + }, en () { this.$i18n.locale = "en" this.setLang() @@ -74,8 +159,24 @@ export default { } else { this.$i18n.locale = "en" } + this.$nextTick(() => { + this.feedback = { + route: this.$route.path, + stars: 0, + text: '', + email: this.$store.state.user.email + } + }) }, watch: { + $route() { + this.feedback = { + route: this.$route.path, + stars: 0, + text: '', + email: this.$store.state.user.email + } + }, currentLang() { this.setLang() console.log('change') diff --git a/src/locales/en.json b/src/locales/en.json index d12210e..5a8c7f0 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -296,6 +296,14 @@ "pending": "Requests from you", "accepted": "Accepted requests" }, + "feedback": { + "title": "Route Feedback", + "email": "Email we can get back to you with:", + "route": "Route you are providing feedback for:", + "rating": "Rating", + "text": "How can we improve?", + "submit": "Submit" + }, "currency": "Koins", "close": "Close", "tos": "Terms of Service", diff --git a/src/views/Avatar.vue b/src/views/Avatar.vue index 0cbe50d..fbe652d 100644 --- a/src/views/Avatar.vue +++ b/src/views/Avatar.vue @@ -30,6 +30,9 @@ Apply +
+ +
@@ -39,7 +42,7 @@