Skip to content

Commit 8f27213

Browse files
authored
Merge pull request #12 from ziggrace/sean/edit
Sean/edit
2 parents fb8284a + cfdd8e7 commit 8f27213

File tree

8 files changed

+901
-30974
lines changed

8 files changed

+901
-30974
lines changed

package-lock.json

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

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"@quasar/app": "^1.0.0",
5151
"@quasar/quasar-app-extension-testing": "^1.0.0",
5252
"@quasar/quasar-app-extension-testing-unit-jest": "^1.0.0",
53+
"@vue/devtools": "^5.3.4",
5354
"@vue/eslint-config-standard": "^4.0.0",
5455
"babel-eslint": "^10.0.1",
5556
"devtron": "^1.4.0",

src/components/ComponentDisplay.vue

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,7 +342,7 @@ export default {
342342
},
343343
344344
// deactivated is emitted before activated
345-
onDeactivated (componentData) {
345+
onDeactivated () {
346346
if (this.activeComponent !== '') {
347347
this.activeComponentData.isActive = false
348348
}
@@ -382,7 +382,12 @@ export default {
382382
},
383383
watch: {
384384
activeComponent: function () {
385-
this.onActivated(this.activeComponentObj)
385+
if (this.activeComponent){
386+
this.onActivated(this.activeComponentObj)
387+
}
388+
else{
389+
this.onDeactivated()
390+
}
386391
}
387392
}
388393
}

src/components/dashboard_items/CodeSnippet.vue

Lines changed: 12 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -172,21 +172,18 @@ export default {
172172
beforeDestroy () {
173173
window.removeEventListener('resize', this.getWindowHeight)
174174
},
175-
watch: {
176-
177-
activeComponent: {
178-
handler () {
179-
console.log('component Map has changed')
180-
if (this.componentMap[this.activeComponent]) {
181-
console.log('we made it here')
182-
this.code = `${this.createCodeSnippet(
183-
this.activeComponent,
184-
this.componentMap[this.activeComponent].children
185-
)}`
186-
}
187-
}
188-
}
189-
},
175+
// watch: {
176+
// activeComponent: {
177+
// handler () {
178+
// if (this.componentMap[this.activeComponent]) {
179+
// this.code = `${this.createCodeSnippet(
180+
// this.activeComponent,
181+
// this.componentMap[this.activeComponent].children
182+
// )}`
183+
// }
184+
// }
185+
// }
186+
// },
190187
// If HTML elements or components are added, rerenders Code Snippet
191188
componentMap: {
192189
deep: true,

src/components/dashboard_items/ComponentDetails.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<q-tab-panel name="code">
2020
<CodeSnippet/>
2121
</q-tab-panel>
22-
<q-tab-panel name="html" :style="{height: `${height}vh`}">
22+
<q-tab-panel name="html">
2323
<HTMLQueue />
2424
</q-tab-panel>
2525
<q-tab-panel name="state">

src/components/home_sidebar_items/ComponentList.vue

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ Description:
3939
<span slot='noResult'>No components found.</span>
4040
</multiselect>
4141
<br/>
42-
<h v-if="this.activeComponentObj"> Currently selected component: {{ activeComponentObj.componentName }} </h>
43-
<h v-else> Select a component </h>
42+
<p class="editName" v-if="this.activeComponentObj"> Currently selected component: {{ activeComponentObj.componentName }} </p>
43+
<p class="editName" v-else > Select a component </p>
4444
<q-btn id="deleteButton" @click="deleteSelectedComp(activeComponentData)" label = 'Delete currently selected'/>
4545
</div>
4646
</template>
@@ -58,7 +58,7 @@ export default {
5858
},
5959
components: { Multiselect },
6060
computed: {
61-
...mapState(['routes', 'activeRoute', 'activeComponent', 'activeComponentObj']),
61+
...mapState(['routes', 'activeRoute', 'activeComponent', 'activeComponentObj', 'componentMap']),
6262
activeRouteDisplay () {
6363
let component = this.routes[this.activeRoute]
6464
// console.log('component', component)
@@ -112,8 +112,12 @@ export default {
112112
}
113113
},
114114
editCompName (name) {
115-
if (name) this.editComponentName(name)
115+
if (name && name !== this.activeComponent && this.activeComponent) this.editComponentName(name)
116116
this.setActiveComponent(this.activeComponent)
117+
console.log(this.activeComponentObj)
118+
console.log(this.activeComponent)
119+
console.log(this.componentMap)
120+
console.log(typeof this.componentMap)
117121
}
118122
},
119123
watch: {
@@ -149,7 +153,7 @@ export default {
149153
justify-content: space-between;
150154
}
151155
152-
h {
156+
.editName {
153157
color: white;
154158
}
155159

src/components/home_sidebar_items/VuexForm.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Description:
44
Functionality includes: N/A
55
-->
66

7-
<template>
7+
<template @keyup.enter.native="createNewAction(textAction)">
88
<div class="input-container">
99
<hr />
1010
<!-- ACTION SECTION -->

src/store/mutations.js

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,11 +175,19 @@ const mutations = {
175175
let active = (state.routes[state.activeRoute].filter(comp => {
176176
return comp.componentName === state.activeComponent
177177
})[0])
178+
// delete state.componentMap[state.activeComponent]
179+
let temp = active.componentName
178180
active.componentName = payload
179181
state.activeComponentObj = Object.assign({},
180182
state.activeComponentObj, { componentName: payload })
181183
state.activeComponent = payload
182-
state.componentMap[state.activeComponent] = state.activeComponentObj
184+
if (temp !== payload) {
185+
// Object.defineProperty(state.componentMap, state.activeComponent, state.activeComponentObj);
186+
state.componentMap[state.activeComponent] = state.activeComponentObj
187+
delete state.componentMap[temp];
188+
}
189+
// state.componentMap[state.activeComponent] = state.activeComponentObj
190+
// access key of edited child to get componentName of parent
183191
},
184192

185193
// *** HTML ELEMENTS *** //////////////////////////////////////////////
@@ -343,6 +351,7 @@ const mutations = {
343351
isActive
344352
}
345353
})
354+
346355
},
347356

348357
[types.ADD_PARENT]: (state, payload) => {

0 commit comments

Comments
 (0)