Skip to content

Commit daf98c9

Browse files
authored
Merge pull request #11 from drewngyen/master
added gradient styling to dashboard tab and added tree
2 parents ca9283b + 22de70b commit daf98c9

File tree

4 files changed

+126
-52
lines changed

4 files changed

+126
-52
lines changed

src/components/Footer.vue

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
</q-tab-panel>
2828

2929
<q-tab-panel name="tree">
30-
<div class="text-h6">Tree</div>Tree Component Here
30+
<Tree />
3131
</q-tab-panel>
3232

3333
<q-tab-panel name="html">
@@ -39,7 +39,12 @@
3939
</template>
4040

4141
<script>
42+
import Tree from './Tree'
43+
4244
export default {
45+
components: {
46+
Tree
47+
},
4348
data () {
4449
return {
4550
tab: 'code',
@@ -66,12 +71,12 @@ export default {
6671
}
6772
6873
.q-tab-panel {
69-
background: #454d66;
74+
background: rgb(69,77,102);
75+
background: linear-gradient(180deg, rgba(69,77,102,1) 0%, rgba(54,60,78,1) 100%);
7076
}
7177
7278
.q-tab-panels {
73-
background: yellow;
74-
height: 100%;
79+
height: 24vh;
7580
}
7681
7782
.q-tabs {

src/components/FooterTabView.vue

Lines changed: 0 additions & 48 deletions
This file was deleted.

src/components/Routes.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,5 +34,7 @@ export default {
3434
<style scoped>
3535
.route-view {
3636
margin: 1rem;
37+
display: flex;
38+
flex-direction: column;
3739
}
3840
</style>

src/components/Tree.vue

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
<template>
2+
<div class="container">
3+
<tree
4+
:data="tree"
5+
node-text="name"
6+
layoutType="euclidean"
7+
type="tree"
8+
:zoomable="true"
9+
:radius="4"
10+
></tree>
11+
</div>
12+
</template>
13+
14+
<script>
15+
import { tree } from 'vued3tree'
16+
import { mapState } from 'vuex'
17+
export default {
18+
name: 'Tree',
19+
components: {
20+
tree
21+
},
22+
computed: {
23+
...mapState(['componentMap']),
24+
componentMap: {
25+
get () {
26+
return this.$store.state.componentMap
27+
}
28+
}
29+
},
30+
data () {
31+
return {
32+
tree: null
33+
}
34+
},
35+
methods: {
36+
formatComponentMap (compMap) {
37+
console.log('\n Map : ', compMap, '\n')
38+
let result = []
39+
Object.values(compMap).forEach(compData => {
40+
result.push({
41+
name: compData.componentName,
42+
children: compData.children
43+
})
44+
})
45+
return result
46+
},
47+
transformToTree (data) {
48+
let result = {}
49+
const nodes = {}
50+
const formattedData = this.formatComponentMap(data)
51+
52+
// console.log('\n >>>> Formatted data <<<<');
53+
// console.log('FormattedData: ', formattedData, '\n');
54+
55+
// console.log('\n >>>> TRANSFORM TO TREE <<<< \n');
56+
57+
formattedData.forEach(component => {
58+
if (!nodes[component.name]) {
59+
nodes[component.name] = { name: component.name, children: [] }
60+
result = nodes
61+
}
62+
// console.log('CURRENT COMPONENT: ', component.name);
63+
component.children.forEach(child => {
64+
// if(typeof child === 'object') child = child.componentName;
65+
nodes[child] = { name: child, children: [] }
66+
nodes[component.name].children.push(nodes[child])
67+
// console.log('Adding child: ', typeof child, child);
68+
// console.log('\n');
69+
})
70+
})
71+
72+
console.log('\n >>>> RESULTS <<<< ')
73+
console.log(result)
74+
console.log('\n >>>> ______ <<<<')
75+
return result
76+
},
77+
78+
buildTree () {
79+
let build = this.transformToTree(this.componentMap)
80+
this.tree = build['App']
81+
}
82+
},
83+
created () {
84+
this.buildTree()
85+
}
86+
}
87+
</script>
88+
<style>
89+
.container {
90+
height: 100%;
91+
width: 100%;
92+
}
93+
94+
.treeclass .nodetree text {
95+
font-size: 19px !important;
96+
cursor: pointer;
97+
text-shadow: none !important;
98+
font-weight: bold;
99+
100+
/* none of these classes work
101+
color: white !important;
102+
background: white;
103+
margin: 1rem; */
104+
}
105+
/* changes the circle node color */
106+
.treeclass .nodetree circle {
107+
fill: rgb(232, 225, 16);
108+
}
109+
/* changes the stroke color */
110+
.treeclass .linktree {
111+
stroke: rgb(232, 225, 16) !important;
112+
stroke-opacity: .4;
113+
stroke-width: 2px;
114+
}
115+
</style>

0 commit comments

Comments
 (0)