Skip to content

Commit 088d65a

Browse files
authored
Merge branch 'dev' into master
2 parents 9a06a1c + d041a62 commit 088d65a

File tree

8 files changed

+48
-23
lines changed

8 files changed

+48
-23
lines changed

src/components/ComponentDisplay.vue

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,11 @@ export default {
125125
126126
.component-box {
127127
color: white;
128-
border: 3px dashed rgb(227, 203, 71);
128+
border: 1px dashed rgb(227, 203, 71);
129129
background-color: rgba(186, 99, 99, 0.529);
130130
}
131+
132+
.active {
133+
background-color: rgba(57, 63, 84, 0.5);
134+
}
131135
</style>

src/components/HomeSideDropDown.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ export default {
5151
.input-add {
5252
margin: 0em 1em 0em 1em;
5353
}
54-
5554
.input-container {
5655
margin-top: 1rem;
5756
}

src/components/RouteDisplay.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<template>
2-
<div class="route-display">
3-
<q-input
2+
<div>
3+
<q-input
44
@keyup.enter.native="handleEnterKeyPress"
55
standout="bg-teal text-white"
66
bottom-slots
@@ -10,6 +10,10 @@
1010
class="input-add"
1111
>
1212
</q-input>
13+
<!--<div class="route-display">-->
14+
<!--
15+
16+
-->
1317
<Routes></Routes>
1418
</div>
1519
</template>
@@ -32,12 +36,13 @@ export default {
3236
}
3337
},
3438
methods: {
35-
...mapActions(['addRouteToRouteMap']),
39+
...mapActions(['addRouteToRouteMap', 'setRoutes']),
3640
handleEnterKeyPress () {
3741
this.addRouteToRouteMap(this.newRoute)
3842
.then(() => {
3943
this.newRoute = ''
4044
})
45+
4146
.catch(err => console.log(err))
4247
}
4348
}

src/components/Routes.vue

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
11
<template>
2-
<div class="route-view">
2+
<div>
3+
<!--<div class="route-view">-->
34
<a
45
:class="route === activeRoute ? 'panel-block is-active' : 'panel-block'"
56
v-for="route in Object.keys(routes)"
67
:key="route"
78
@click="handleClick(route)"
9+
v-on:keyup.delete="deleteSelectedRoute(route)"
810
>
11+
<!--
912
<span class="panel-icon">
1013
<i class="fas fa-location-arrow" aria-hidden="true"></i>
1114
</span>
12-
{{ route }}
15+
-->
16+
<q-list bordered separator>
17+
<q-item clickable v-ripple>
18+
<q-item-section>{{route}}</q-item-section>
19+
20+
</q-item>
21+
22+
</q-list>
23+
1324
</a>
1425
</div>
26+
1527
</template>
1628

1729
<script>
@@ -23,9 +35,13 @@ export default {
2335
...mapState(['routes', 'activeRoute'])
2436
},
2537
methods: {
26-
...mapActions(['setActiveRoute']),
38+
...mapActions(['setActiveRoute', 'deleteRoute']),
2739
handleClick (route) {
2840
this.setActiveRoute(route)
41+
},
42+
deleteSelectedRoute (route) {
43+
this.deleteRoute(route)
44+
this.setActiveRoute('')
2945
}
3046
}
3147
}

src/components/Tree.vue

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ export default {
3434
},
3535
methods: {
3636
formatComponentMap (compMap) {
37-
console.log('\n Map : ', compMap, '\n')
3837
let result = []
3938
Object.values(compMap).forEach(compData => {
4039
result.push({
@@ -49,29 +48,16 @@ export default {
4948
const nodes = {}
5049
const formattedData = this.formatComponentMap(data)
5150
52-
// console.log('\n >>>> Formatted data <<<<');
53-
// console.log('FormattedData: ', formattedData, '\n');
54-
55-
// console.log('\n >>>> TRANSFORM TO TREE <<<< \n');
56-
5751
formattedData.forEach(component => {
5852
if (!nodes[component.name]) {
5953
nodes[component.name] = { name: component.name, children: [] }
6054
result = nodes
6155
}
62-
// console.log('CURRENT COMPONENT: ', component.name);
6356
component.children.forEach(child => {
64-
// if(typeof child === 'object') child = child.componentName;
6557
nodes[child] = { name: child, children: [] }
6658
nodes[component.name].children.push(nodes[child])
67-
// console.log('Adding child: ', typeof child, child);
68-
// console.log('\n');
6959
})
7060
})
71-
72-
console.log('\n >>>> RESULTS <<<< ')
73-
console.log(result)
74-
console.log('\n >>>> ______ <<<<')
7561
return result
7662
},
7763
@@ -96,7 +82,7 @@ export default {
9682
cursor: pointer;
9783
text-shadow: none !important;
9884
font-weight: bold;
99-
85+
fill: #FFF;
10086
/* none of these classes work
10187
color: white !important;
10288
background: white;

src/store/actions.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ const actions = {
112112
},
113113
[types.parentSelected]: ({ commit }, payload) => {
114114
commit(types.PARENT_SELECTED, payload)
115+
},
116+
[types.deleteRoute]: ({ state, commit }, payload) => {
117+
console.log('stat in actions:', state)
118+
commit(types.DELETE_ROUTE, payload)
115119
}
116120
}
117121

src/store/mutations.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ const mutations = {
103103
...state.routes,
104104
[payload]: []
105105
}
106+
console.log('payload in add_route', payload)
106107
},
107108
// Changes the component map
108109
[types.ADD_ROUTE_TO_COMPONENT_MAP]: (state, payload) => {
@@ -128,6 +129,7 @@ const mutations = {
128129
state.activeComponent = payload
129130
},
130131
[types.SET_ROUTES]: (state, payload) => {
132+
console.log('setroutespayload:', payload)
131133
state.routes = Object.assign({}, payload)
132134
},
133135
// invoked when a component is deleted
@@ -179,6 +181,13 @@ const mutations = {
179181
},
180182
[types.PARENT_SELECTED]: (state, payload) => {
181183
state.parentSelected = payload
184+
},
185+
[types.DELETE_ROUTE]: (state, payload) => {
186+
const stateCopy = state
187+
delete stateCopy.routes[payload]
188+
delete stateCopy.componentMap[payload]
189+
state = stateCopy
190+
console.log('aftermutations state', state)
182191
}
183192
}
184193

src/store/types.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ export const ADD_COMPONENT_TO_COMPONENT_CHILDREN =
3939
'ADD_COMPONENT_TO_COMPONENT_CHILDREN'
4040
export const UPDATE_OPEN_MODAL = 'UPDATE_OPEN_MODAL'
4141
export const PARENT_SELECTED = 'PARENT_SELECTED'
42+
export const DELETE_ROUTE = 'DELETE_ROUTE'
4243

4344
// Actions
4445
export const registerComponent = 'registerComponent'
@@ -71,3 +72,4 @@ export const updateComponentChildrenValue = 'updateComponentChildrenValue'
7172
export const updateComponentNameInputValue = 'updateComponentNameInputValue'
7273
export const updateOpenModal = 'updateOpenModal'
7374
export const parentSelected = 'parentSelected'
75+
export const deleteRoute = 'deleteRoute'

0 commit comments

Comments
 (0)