Skip to content

Commit 3d02721

Browse files
authored
Allow users to provide feedback via Google Form after site is deployed (#88)
* Allow users to provide feedback via Google Form after site is deployed * WIP * Tests for deploy button * Check ZIP path * Fix Typescript errors
1 parent d44756d commit 3d02721

File tree

7 files changed

+90
-4
lines changed

7 files changed

+90
-4
lines changed

docker-compose-dev.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ version: '3.8'
33
services:
44
rainfall-db-dev:
55
image: mariadb:latest
6-
container_name: mariadb
6+
container_name: rainfall-mariadb
77
environment:
88
MYSQL_ROOT_PASSWORD: rainfall-dev-db
99
MYSQL_DATABASE: rainfall_dev

rainfall-frontend/cypress/e2e/edit_site.cy.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@ describe('Edit Site test', () => {
8383
cy.get('#new-release-button').should('be.disabled');
8484
});
8585

86+
it('starts with the deploy button disabled', () => {
87+
cy.get('#deploy-site-button').should('be.disabled');
88+
});
89+
8690
describe('when a release is added', () => {
8791
beforeEach(() => {
8892
cy.intercept('POST', 'api/v1/release', {
@@ -217,7 +221,7 @@ describe('Edit Site test', () => {
217221
cy.get('#preview-site-button').should('not.be.disabled');
218222
});
219223

220-
describe.only('when the preview button is clicked', () => {
224+
describe('when the preview button is clicked', () => {
221225
let calledPreview = false;
222226
beforeEach(() => {
223227
cy.intercept('POST', 'api/v1/preview/06547ed8-206f-7d3d-8000-20ab423e0bb9', (req) => {
@@ -247,6 +251,11 @@ describe('Edit Site test', () => {
247251
cy.wrap(calledPreview).should('eq', true);
248252
});
249253

254+
it('enables the deploy button', () => {
255+
cy.wait('@preview-site');
256+
cy.get('#deploy-site-button').should('not.be.disabled');
257+
});
258+
250259
it('shows a loading message', () => {
251260
cy.get('.preview-load').find('.loader').should('be.visible');
252261
cy.get('.preview-load').should('not.contain', 'Open preview in new window');
@@ -264,6 +273,14 @@ describe('Edit Site test', () => {
264273
.should('not.be.empty')
265274
.and('contain', '/preview');
266275
});
276+
277+
it('has the right URL for the deploy ZIP link', () => {
278+
cy.wait('@preview-site');
279+
cy.get('#deploy-zip-button')
280+
.should('have.attr', 'href')
281+
.should('not.be.empty')
282+
.and('contain', '/zip');
283+
});
267284
});
268285

269286
describe('and the delete button is successfully pressed for one of the files', () => {

rainfall-frontend/src/components/DeployButton.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,18 @@ export default {
1414
mounted() {
1515
initFlowbite();
1616
},
17+
methods: {
18+
gotoFeedbackPage() {
19+
this.$router.push('/feedback');
20+
},
21+
},
1722
};
1823
</script>
1924

2025
<template>
2126
<div class="mt-4 block text-center md:text-left md:flex md:items-center">
2227
<button
23-
id="dropdownDefaultButton"
28+
id="deploy-site-button"
2429
:disabled="!readyForDeploy"
2530
data-dropdown-toggle="dropdown"
2631
class="inline-flex items-center justify-center cursor-pointer w-10/12 md:w-48 p-4 md:py-2 text-xl md:text-base disabled:cursor-auto bg-blue-600 text-grey-200 disabled:bg-blue-400 disabled:text-white hover:bg-blue-800 disabled:hover:bg-blue-400 focus:ring-4 focus:outline-none focus:ring-blue-300 font-semibold text-gray-100 hover:text-white px-4 border border-blue-500 rounded hover:border-transparent disabled:hover:border-blue-500"
@@ -62,7 +67,9 @@ export default {
6267
</li>
6368
<li>
6469
<a
70+
id="deploy-zip-button"
6571
:href="downloadUrl"
72+
@click="gotoFeedbackPage()"
6673
class="block px-4 py-2 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white"
6774
>Download .ZIP</a
6875
>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<template>
2+
<div>
3+
<h1 class="text-gray-900 dark:text-white text-2xl md:text-2xl font-extrabold mb-2">
4+
Thank you for using Rainfall!
5+
</h1>
6+
<p class="mt-4 w-full md:w-3/4">
7+
This project has been coded, deployed and is run by a single person (<a
8+
class="text-blue-500 hover:underline"
9+
href="https://travisbriggs.com"
10+
>Travis Briggs</a
11+
>). I'm so glad you have taken the time to use it. If you have a few minutes, any feedback you
12+
could provide at the following form would really help me understand who is using the site and
13+
what they are using it for. It will help me make Rainfall better and more useful for everyone.
14+
Thanks!
15+
</p>
16+
<a
17+
href="https://docs.google.com/forms/d/e/1FAIpQLSca4myLs9S0kw1DTA5MOB2OGUDP27f6qaTBELT2oDXjAEyUHw/viewform?usp=header"
18+
target="_blank"
19+
class="block cursor-pointer mx-auto md:mx-0 text-center mt-4 w-10/12 md:w-48 p-4 md:py-2 text-xl md:text-base bg-blue-600 text-grey-200 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-semibold text-gray-100 hover:text-white px-4 border border-blue-500 rounded hover:border-transparent"
20+
>
21+
Provide feedback
22+
</a>
23+
</div>
24+
</template>

rainfall-frontend/src/router/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import NotFoundView from '../views/NotFoundView.vue';
77
import EditSiteView from '../views/EditSiteView.vue';
88
import EditReleaseView from '@/views/EditReleaseView.vue';
99
import DeployNetlifyView from '@/views/DeployNetlifyView.vue';
10+
import FeedbackView from '@/views/FeedbackView.vue';
1011

1112
const router = createRouter({
1213
history: createWebHistory(import.meta.env.BASE_URL),
@@ -39,6 +40,7 @@ const router = createRouter({
3940
{ path: '/mastodon', name: 'mastodonLogin', component: MastodonLoginView },
4041
{ path: '/deploy/:site_id/netlify', name: 'deployNetlify', component: DeployNetlifyView },
4142

43+
{ path: '/feedback', name: 'feedback', component: FeedbackView },
4244
// 404 page
4345
{ path: '/:pathMatch(.*)*', name: 'notfound', component: NotFoundView },
4446
],

rainfall-frontend/src/views/DeployNetlifyView.vue

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import { mapStores } from 'pinia';
33
import { useUserStore } from '@/stores/user';
44
import { getCsrf } from '@/helpers/cookie';
55
import { type Site } from '@/types/site';
6+
import Feedback from '@/components/Feedback.vue';
67
78
export default {
9+
components: { Feedback },
810
data(): {
911
site: null | Site;
1012
sitesError: string;
@@ -42,9 +44,15 @@ export default {
4244
hasNetlifyToken(): boolean {
4345
return !!this.userStore.user?.integration?.has_netlify_token;
4446
},
47+
doneDeploying(): boolean {
48+
return !!this.site && !!this.site.netlify_url && !this.deploying;
49+
},
4550
...mapStores(useUserStore),
4651
},
4752
methods: {
53+
gotoFeedbackPage() {
54+
this.$router.push('/feedback');
55+
},
4856
getCsrf() {
4957
return getCsrf();
5058
},
@@ -174,7 +182,7 @@ export default {
174182
<span class="sr-only">Deploying your site...</span>
175183
</div>
176184
<div
177-
v-if="site && site.netlify_url && !deploying"
185+
v-if="doneDeploying && site"
178186
id="netlify-deploy-result"
179187
class="ml-4 mt-1 md:mt-0 text-sm text-center md:text-left md:leading-[2.5rem]"
180188
>
@@ -185,5 +193,6 @@ export default {
185193
</div>
186194
</div>
187195
</div>
196+
<Feedback v-if="doneDeploying" class="mt-8" />
188197
</div>
189198
</template>
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<script lang="ts">
2+
import { mapStores } from 'pinia';
3+
import { useUserStore } from '@/stores/user';
4+
import Feedback from '@/components/Feedback.vue';
5+
6+
export default {
7+
components: { Feedback },
8+
async mounted() {
9+
await this.userStore.loadUser();
10+
const user = this.userStore.user;
11+
if (!user) {
12+
this.$router.replace('/');
13+
return;
14+
}
15+
if (!user.is_welcomed) {
16+
this.$router.replace('/welcome');
17+
}
18+
},
19+
computed: {
20+
...mapStores(useUserStore),
21+
},
22+
};
23+
</script>
24+
25+
<template>
26+
<Feedback></Feedback>
27+
</template>

0 commit comments

Comments
 (0)