Skip to content

Commit 17c381c

Browse files
committed
activeLayer updated, title WIP
1 parent 037d90a commit 17c381c

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

src/components/HomeQueue.vue

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<template>
22
<section class="home-queue" v-on:click="handleClick">
3-
<span class='list-title' v-if='this.activeComponent !==""'> Viewing Elements in '{{ this.activeComponent }}' </span>
3+
<span class='list-title' v-if='this.activeLayer.id !== ""'> Viewing Elements in '{{ this.activeComponent }} - {{ this.activeLayer.lineage }}' </span>
4+
<!-- <span class='list-title' v-if='this.activeLayer.id !== ""'> Viewing Elements in '{{ this.activeLayer.lineage }}' </span> -->
5+
<span class='list-title' v-else-if='this.activeComponent !==""'> Viewing Elements in '{{ this.activeComponent }}' </span>
46
<span class='list-title' v-else> Elements in Queue </span>
57
<hr>
68
<draggable
@@ -11,8 +13,8 @@
1113
@start="drag = true"
1214
@end="drag = false"
1315
>
14-
<!-- <div class="list-group-item" @dblclick="setActiveElement(element)" v-for="(element) in renderList" :key="element[1] + Date.now()"> -->
1516
<div :class="activeHTML === element[2] ? 'list-group-item-selected' : 'list-group-item'" @dblclick="setActiveElement(element)" v-for="(element) in renderList" :key="element[1] + Date.now()">
17+
<i class="fas fa fa-angle-double-down fa-md" @click="setLayer({text: element[0], id: element[2]})"></i>
1618
{{ element[0] }}
1719
<i class="fas fa fa-trash fa-md" @click="deleteElement(element[1])"></i>
1820
</div>
@@ -23,7 +25,7 @@
2325
<script>
2426
import draggable from 'vuedraggable'
2527
import { mapState, mapActions } from 'vuex'
26-
import { setSelectedElementList, deleteSelectedElement, deleteFromComponentHtmlList, setActiveHTML } from '../store/types'
28+
import { setSelectedElementList, deleteSelectedElement, deleteFromComponentHtmlList, setActiveHTML, setActiveLayer } from '../store/types'
2729
2830
const breadthFirstSearch = (array, id) => {
2931
let queue = [...array.filter(el => typeof el === 'object')];
@@ -81,14 +83,17 @@ export default {
8183
}
8284
},
8385
methods: {
84-
...mapActions(['setActiveHTML']),
86+
...mapActions(['setActiveHTML', 'setActiveLayer']),
8587
deleteElement (index) {
8688
if (this.activeComponent === '') this.$store.dispatch(deleteSelectedElement, index)
8789
else this.$store.dispatch(deleteFromComponentHtmlList, index)
8890
},
8991
setActiveElement (element) {
9092
this.$store.dispatch(setActiveHTML, element)
9193
},
94+
setLayer (element) {
95+
this.$store.dispatch(setActiveLayer, element)
96+
},
9297
handleClick (event) {
9398
console.log(event.target)
9499
if (event.target.className === 'home-queue') {
@@ -151,9 +156,20 @@ li {
151156
cursor: pointer;
152157
color: red;
153158
}
159+
154160
.fa-trash {
155161
position: relative;
156162
left: 20px;
163+
164+
}
165+
.fa-angle-double-down {
166+
position: relative;
167+
right: 20px;
168+
}
169+
170+
.fa-angle-double-down:hover {
171+
cursor: pointer;
172+
color: #41B883;
157173
}
158174
hr {
159175
border: 1px solid grey

src/store/mutations.js

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -44,30 +44,14 @@ const breadthFirstSearchParent = (array, id) => {
4444

4545
const mutations = {
4646

47-
[types.SET_ACTIVE_LAYER]: (state, payload) =>{
47+
[types.SET_ACTIVE_LAYER]: (state, payload) => {
4848
let newLayer = cloneDeep(state.activeLayer)
49-
50-
//should only be reached if we change active component
51-
if (payload === '') {
52-
state.activeLayer = {
53-
id:'',
54-
lineage:[]
55-
}
56-
}
57-
else{
58-
//htmlArray = state.componentMap[state.activeComponent].htmlList
59-
if(newLayer.id === ''){
60-
newLayer.lineage.push(state.activeComponent)
61-
}
62-
else{
63-
newLayer.lineage.push(newLayer.id)
64-
}
65-
newLayer.id = payload
66-
}
49+
newLayer.lineage.push(payload.text)
50+
newLayer.id = payload.id
6751
state.activeLayer = newLayer
52+
state.activeHTML = ''
6853
},
6954

70-
7155
// pushs new component to componentMap
7256
[types.ADD_COMPONENT_TO_COMPONENT_MAP]: (state, payload) => {
7357
const { componentName, htmlList, children, parent, isActive } = payload

0 commit comments

Comments
 (0)