Skip to content

Commit badf89a

Browse files
authored
Merge pull request #9 from oslabs-beta/bryan/Tree
Tree diagram works, including clicking nodes or views to change the d…
2 parents 15572b5 + 9a86d50 commit badf89a

File tree

9 files changed

+356
-132
lines changed

9 files changed

+356
-132
lines changed

src/components/ComponentDisplay.vue

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ export default {
221221
element.enabled = false;
222222
element.$emit("deactivated");
223223
element.$emit("update:active", false);
224-
});
224+
});
225225
}
226226
} else {
227227
// if a component is set to active, highlight it
@@ -328,17 +328,25 @@ export default {
328328
}
329329
if (this.$refs.boxes) {
330330
this.$refs.boxes.forEach((element) => {
331-
if (element.$attrs.id !== componentData?.componentName) {
331+
if (element.$attrs.id !== componentData.componentName) {
332332
element.enabled = false;
333333
element.$emit("deactivated");
334334
element.$emit("update:active", false);
335335
}
336+
if (
337+
this.activeComponent === element.$attrs.id &&
338+
element.enabled === false
339+
) {
340+
element.enabled = true;
341+
element.$emit("activated");
342+
element.$emit("update:active", true);
343+
}
336344
});
337345
}
338346
if (!(componentData.componentName === this.activeComponent)) {
339347
this.setActiveComponent(componentData.componentName);
340348
}
341-
if (componentData){
349+
if (componentData && componentData.hasOwnProperty('componentName')){
342350
this.activeComponentData.isActive = true;
343351
}
344352
},
@@ -378,9 +386,12 @@ export default {
378386
copyActiveComponent() {},
379387
},
380388
watch: {
381-
activeComponent: function () {
389+
activeComponent: {
390+
handler(){
382391
this.onActivated(this.activeComponentObj);
383392
},
393+
deep: true,
394+
},
384395
},
385396
};
386397
</script>

src/components/dashboard_items/ComponentDetails.vue

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ Description:
3232
<HTMLQueue />
3333
</q-tab-panel>
3434
<q-tab-panel name="state">
35-
<p v-if="!this.activeComponentObj.state.length">
36-
No state in component
35+
<p v-if="!this?.activeComponentObj?.state?.length">
36+
No state in component.
3737
</p>
3838
<ul id="stateList">
3939
<li v-for="comp in compObj.state" :key="comp">
@@ -42,21 +42,21 @@ Description:
4242
</ul>
4343
</q-tab-panel>
4444
<q-tab-panel name="actions">
45-
<p v-if="!this.activeComponentObj.actions.length">
45+
<p v-if="!this?.activeComponentObj?.actions?.length">
4646
No actions in component
4747
</p>
4848
<ul id="actionList">
49-
<li v-for="comp in compObj.actions" :key="comp">
49+
<li v-for="comp in compObj?.actions" :key="comp">
5050
{{ comp }}
5151
</li>
5252
</ul>
5353
</q-tab-panel>
5454
<q-tab-panel name="props">
55-
<p v-if="!this.activeComponentObj.props.length">
55+
<p v-if="!this?.activeComponentObj?.props?.length">
5656
No props in component
5757
</p>
5858
<ul id="propsList">
59-
<li v-for="comp in compObj.props" :key="comp">
59+
<li v-for="comp in compObj?.props" :key="comp">
6060
{{ comp }}
6161
</li>
6262
</ul>
@@ -79,7 +79,7 @@ export default {
7979
CodeSnippet
8080
},
8181
computed: {
82-
...mapState(["activeComponentObj"]),
82+
...mapState(["activeComponentObj","activeComponent"]),
8383
compObj: {
8484
get() {
8585
return this.activeComponentObj;

src/components/dashboard_items/Dashboard.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,12 @@ Description:
99
<q-card id="dashboard-cards" class="bord">
1010
<q-tabs
1111
v-model="tab"
12-
dense
1312
class="bg-subaccent text-white"
1413
active-color="secondary"
1514
indicator-color="secondary"
1615
align="left"
16+
dense
17+
breakpoint="1050"
1718
>
1819
<q-tab
1920
name="detail"

src/components/dashboard_items/HTMLQueue.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,15 @@ Description:
66

77
<template>
88
<section class="html-queue">
9-
<i v-if='this.activeLayer.id !== ""' class="fas fa fa-chevron-up fa-md" @click="setParentLayer"></i>
9+
<i v-if='!this.activeLayer.id' class="fas fa fa-chevron-up fa-md" @click="setParentLayer"></i>
1010
<span class='list-title' v-if='this.activeLayer.id !== ""'> Viewing Elements in '{{ depth }}' </span>
11-
<span class='list-title' v-else-if='this.activeComponent !==""'> </span>
11+
<span class='list-title' v-else-if='!this.activeComponent'></span>
1212
<hr>
1313
<div
1414
group="people"
1515
class="list-group"
1616
>
17-
<p v-if='!this.componentMap[this.activeComponent].htmlList.length'>No HTML elements in component</p>
17+
<p v-if='!this.componentMap[this.activeComponent]?.htmlList.length'>No HTML elements in component</p>
1818
<div
1919
:class="activeHTML === element[2] ? 'list-group-item-selected' : 'list-group-item'"
2020
@dblclick.self="setActiveElement(element)"

0 commit comments

Comments
 (0)