Skip to content

Commit d44357b

Browse files
authored
Merge pull request #10 from callumflack/post-export
Display restart modal after exporting
2 parents db6edf6 + 37ab865 commit d44357b

File tree

7 files changed

+15867
-12
lines changed

7 files changed

+15867
-12
lines changed

package-lock.json

Lines changed: 15793 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/App.vue

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,12 @@ export default {
3838
.fade-in-left .fade-in-left-leave-active {
3939
/* transition: all 10s ease !important; */
4040
}
41+
42+
.vue-slick-popover__overlay {
43+
/* Stop overlay creating horizontal scroll from "width: 100vw" */
44+
height: auto;
45+
width: auto;
46+
bottom: 0;
47+
right: 0;
48+
}
4149
</style>

src/assets/css/element/element-button.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ textarea.Input {
196196
.ButtonComplex .Button--outline,
197197
.Button--outline,
198198
.Button--invisible {
199-
--button-color: theme(colors.text);
199+
--button-color: var(--button-invert-color);
200200
--button-bg-color: transparent;
201201
--button-bg-color-hover: transparent;
202202
}

src/components/ButtonExport.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ export default {
107107
108108
focused.focus();
109109
this.$refs.popover.close();
110+
111+
this.$emit('onExport');
110112
},
111113
exportGmail() {
112114
return this.exportReply(GmailFormatter);

src/main.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import './assets/css/tailwind.css';
1010

1111
Vue.config.productionTip = false;
1212

13+
Vue.use(PortalVue);
1314
Vue.use(VuePageTransition);
1415

1516
Vue.use(PortalVue);

src/store.js

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@ import Vuex from 'vuex';
33

44
Vue.use(Vuex);
55

6+
const defaultState = {
7+
timestamp: null,
8+
editorState: null,
9+
selections: [],
10+
// Keyed by selection ids
11+
orders: {},
12+
replies: {},
13+
repliesIntro: '',
14+
repliesOutro: '',
15+
};
16+
617
export default new Vuex.Store({
7-
state: {
8-
timestamp: null,
9-
editorState: null,
10-
selections: [],
11-
// Keyed by selection ids
12-
orders: {},
13-
replies: {},
14-
repliesIntro: '',
15-
repliesOutro: '',
16-
},
18+
state: Object.assign({}, defaultState),
1719
mutations: {
1820
setEditorState(state, editorState) {
1921
state.editorState = editorState;
@@ -63,6 +65,11 @@ export default new Vuex.Store({
6365
setRepliesOutro(state, text) {
6466
state.repliesOutro = text;
6567
},
68+
// eslint-disable-next-line no-unused-vars
69+
resetState(state) {
70+
// eslint-disable-next-line no-param-reassign
71+
state = Object.assign(state, defaultState);
72+
},
6673
},
6774
actions: {
6875
},

src/views/Reply.vue

Lines changed: 45 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,22 +69,40 @@
6969
@input="handleOutroInput"
7070
>{{ $store.state.repliesOutro }}</textarea>
7171

72-
<ButtonExport :groupedSelections="groupedSelections" />
72+
<ButtonExport @onExport="handleExport" :groupedSelections="groupedSelections" />
7373
</div>
74+
<portal to="modals">
75+
<Modal :show="isResetModalOpen" @close="isResetModalOpen = false" ref="resetModal">
76+
<div class="max-w-xl">
77+
<p class="s-p">Successfully copied to your clipboard!</p>
78+
<div class="flex">
79+
<button class="mr-2 w-1/2 Button" @click="resetState">Start again</button>
80+
<button class="ml-2 w-1/2 Button Button--outline" @click="dismiss">Keep Editing</button>
81+
</div>
82+
</div>
83+
</Modal>
84+
</portal>
7485
</div>
7586
</template>
7687

7788
<script>
7889
import draggable from 'vuedraggable';
7990
import ButtonExport from '@/components/ButtonExport.vue';
8091
import Tooltip from '@/components/Tooltip.vue';
92+
import Modal from '@/components/Modal.vue';
8193
8294
export default {
8395
name: 'reply',
8496
components: {
8597
draggable,
8698
ButtonExport,
8799
Tooltip,
100+
Modal,
101+
},
102+
data() {
103+
return {
104+
isResetModalOpen: false,
105+
};
88106
},
89107
computed: {
90108
groupedSelections: {
@@ -97,6 +115,18 @@ export default {
97115
},
98116
},
99117
methods: {
118+
dismiss() {
119+
this.$refs.resetModal.dismiss();
120+
},
121+
async resetState() {
122+
await this.$store.commit('resetState');
123+
this.$refs.resetModal.dismiss();
124+
window.scrollTo({ top: 0, behavior: 'smooth' });
125+
this.$router.push('/');
126+
},
127+
handleExport() {
128+
this.isResetModalOpen = true;
129+
},
100130
handleDragEnd() {},
101131
goBackIfSelectionsEmpty() {
102132
if (!this.$store.state.selections.length) {
@@ -236,6 +266,20 @@ export default {
236266
transform: translate(-50%, 100%);
237267
} */
238268
269+
/*
270+
Modal
271+
*/
272+
.Modal-backdrop {
273+
background: rgba(255, 255, 255, 0.7);
274+
}
275+
276+
>>> .Modal {
277+
box-shadow: 0 0 6px 4px #eaeaea;
278+
}
279+
280+
>>> .Modal .Button {
281+
white-space: nowrap;
282+
239283
/*
240284
Draggable
241285
*/

0 commit comments

Comments
 (0)