Skip to content

Commit 3db6606

Browse files
Merge pull request #23 from oslabs-beta/bryan/stopDeleteOnTyping
Bryan/stop delete on typing
2 parents 85377f5 + c129fdb commit 3db6606

File tree

4 files changed

+25
-7
lines changed

4 files changed

+25
-7
lines changed

src/components/ComponentDisplay.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
<!--
2-
Description:
1+
<!--
2+
Description:
33
Handles display grid functionality
44
Functionality includes: resizing/dragging component boxes, display grid image, active component
55
-->
@@ -162,16 +162,21 @@ Description:
162162
label="Add your note here"
163163
filled
164164
dark
165+
autogrow
165166
max-height=15%
166167
autofocus true
167168
></q-input>
168169
<q-btn
169170
color="secondary"
170171
label="Submit Note"
171-
type="submit"
172172
:disable="noteText.length > 0 ? false : true"
173173
@click="submitNote"
174174
/>
175+
<q-btn
176+
color="secondary"
177+
label="Exit Notes"
178+
@click="this.openNoteModal"
179+
/>
175180
</q-form>
176181
</div>
177182
</div>
@@ -435,7 +440,7 @@ export default {
435440
},
436441
// renders modal with Update Children and Layer in it
437442
handleAddNotes(){
438-
if (this.wasDragged === false){
443+
if (this.wasDragged === false && this.activeComponent !== ''){
439444
this.openNoteModal();
440445
}
441446
},

src/store/actions.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import * as types from "./types";
44
const actions = {
55
// Actions that primarily affect componentDisplay.vue //////
66
[types.deleteActiveComponent]: ({ state, commit }) => {
7+
if (state.noteModalOpen === true){
8+
return;
9+
}
710
commit(types.DELETE_ACTIVE_COMPONENT);
811
const activeRouteArray = [...state.routes[state.activeRoute]];
912
const newActiveRouteArray = activeRouteArray.filter(
@@ -290,6 +293,7 @@ const actions = {
290293
// Loading ///////////////////////////////////////////////////////
291294

292295
[types.openProject]: ({ commit, state }, payload) => {
296+
commit(types.REMOVE_ALL_STATE_PROPS_ACTIONS)
293297
payload.userProps.forEach((prop)=>{commit(types.CREATE_PROP, prop)})
294298
payload.userActions.forEach((action)=>{commit(types.CREATE_ACTION, action)})
295299
payload.userState.forEach((state)=>{commit(types.CREATE_STATE, state)})

src/store/mutations.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
} from "../utils/search.util";
1515
import _ from "lodash";
1616

17+
1718
const cloneDeep = require("lodash.clonedeep");
1819

1920
const mutations = {
@@ -22,9 +23,18 @@ const mutations = {
2223
payload.store.replaceState(cloneDeep(payload.initialState));
2324
},
2425

26+
[types.REMOVE_ALL_STATE_PROPS_ACTIONS]: (state) =>{
27+
const emptyObj = {
28+
userProps: [],
29+
userState: [],
30+
userActions: [],
31+
}
32+
Object.assign(state, emptyObj)
33+
},
34+
2535
[types.TOGGLE_TUTORIAL]: (state) => {
2636
state.showTutorial = !state.showTutorial;
27-
},
37+
},
2838

2939
// *** ROUTES *** //////////////////////////////////////////////
3040
[types.ADD_ROUTE]: (state, payload) => {
@@ -186,8 +196,6 @@ const mutations = {
186196
}
187197
}
188198
state.selectedState = [];
189-
// state.activeComponentObj = null;
190-
// state.activeComponentObj = active;
191199
state.activeComponentObj = { ...active };
192200

193201
state.componentMap = {

src/store/types.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export const TOGGLE_TUTORIAL = 'TOGGLE_TUTORIAL'
6767
export const ADD_ACTIVE_COMPONENT_NOTE = 'ADD_ACTIVE_COMPONENT_NOTE'
6868
export const DELETE_ACTIVE_COMPONENT_NOTE = 'DELETE_ACTIVE_COMPONENT_NOTE'
6969
export const OPEN_NOTE_MODAL = 'OPEN_NOTE_MODAL'
70+
export const REMOVE_ALL_STATE_PROPS_ACTIONS = 'REMOVE_ALL_STATE_PROPS_ACTIONS'
7071

7172
// Actions
7273
export const openNoteModal = 'openNoteModal'

0 commit comments

Comments
 (0)