Skip to content

Commit 932bc51

Browse files
committed
backspace working. need to finish the vuex cycle for routes delete mechanism
2 parents 7927155 + 32b4b04 commit 932bc51

14 files changed

+224
-64
lines changed

quasar.conf.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ module.exports = function (ctx) {
5555
'QTabPanels',
5656
'QTabPanel',
5757
'QFab',
58-
'QFabAction'
58+
'QFabAction',
59+
'QUploader',
60+
'QEditor'
5961
],
6062

6163
directives: [

src/components/CodeSnippet.vue

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<template>
2+
<div class="snip">
3+
<q-editor
4+
v-model="editor"
5+
:definitions="{
6+
bold: {label: 'Bold', icon: null, tip: 'My bold tooltip'}
7+
}"
8+
/>
9+
</div>
10+
</template>
11+
12+
<script>
13+
export default {
14+
data () {
15+
return {
16+
editor: 'Here we are overriding the <b>bold</b> command to include a label instead of an icon and also changing its tooltip.'
17+
}
18+
}
19+
}
20+
</script>
21+
22+
<style>
23+
.snip{
24+
height: 150px;
25+
}
26+
</style>

src/components/CreateComponent.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import Icons from './Icons'
2727
import ParentMultiselect from '../components/ParentMultiselect'
2828
import { mapState, mapActions } from 'vuex'
29-
// import * as types from '../store/types.js'
3029
3130
export default {
3231
name: 'HomeSidebar',

src/components/Footer.vue

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,10 @@
2222

2323
<q-tab-panels v-model="tab" animated class="bg-primary text-white">
2424
<q-tab-panel name="code">
25-
<div class="text-h6">Code Snippet</div>Code Snippet Component Here
26-
<br />asdfadsfasdf
2725
</q-tab-panel>
2826

2927
<q-tab-panel name="tree">
30-
<div class="text-h6">Tree</div>Tree Component Here
28+
<Tree />
3129
</q-tab-panel>
3230

3331
<q-tab-panel name="html">
@@ -39,7 +37,14 @@
3937
</template>
4038

4139
<script>
40+
import Tree from './Tree'
41+
// import CodeSnippet from './CodeSnippet'
42+
4243
export default {
44+
components: {
45+
Tree
46+
// CodeSnippet
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/ParentMultiselect.vue

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div id="parent-select">
33
<br />
44
<multiselect
5-
placeholder="Choose Parent (if applicable)"
5+
placeholder="Parent Component"
66
:multiple="false"
77
:close-on-select="true"
88
:options="options"
@@ -52,5 +52,9 @@ export default {
5252

5353
<style src="vue-multiselect/dist/vue-multiselect.min.css"></style>
5454
<style scoped>
55-
55+
#parent-select{
56+
height: 30px;
57+
margin: 0.75rem;
58+
width: 90%;
59+
}
5660
</style>

src/components/Routes.vue

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
v-for="route in Object.keys(routes)"
77
:key="route"
88
@click="handleClick(route)"
9-
v-on:keyup.delete="deleteRoute(route)"
9+
v-on:keyup.delete="deleteSelectedRoute(route)"
1010
>
1111
<!--
1212
<span class="panel-icon">
@@ -35,13 +35,18 @@ export default {
3535
...mapState(['routes', 'activeRoute'])
3636
},
3737
methods: {
38-
...mapActions(['setActiveRoute']),
38+
...mapActions(['setActiveRoute', 'deleteRoute']),
3939
handleClick (route) {
4040
this.setActiveRoute(route)
41+
console.log(this.routes)
4142
},
42-
deleteRoute (route) {
43-
console.log('routes', route)
44-
console.log('this', this)
43+
deleteSelectedRoute (route) {
44+
for (let key in this.routes) {
45+
if (key === route) {
46+
delete this.routes.route
47+
}
48+
}
49+
this.deleteRoute(route)
4550
}
4651
}
4752
}
@@ -50,5 +55,7 @@ export default {
5055
<style scoped>
5156
.route-view {
5257
margin: 1rem;
58+
display: flex;
59+
flex-direction: column;
5360
}
5461
</style>

src/components/Toolbar.vue

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<template>
2+
<div class="home-sidebar">
3+
<q-btn-group>
4+
<q-btn color="secondary" icon="timeline" />
5+
<q-btn color="secondary" icon="visibility" />
6+
<q-btn color="secondary" icon="update" />
7+
</q-btn-group>
8+
</div>
9+
</template>
10+
11+
<style>
12+
.home-sidebar {
13+
margin: 1rem;
14+
border-radius: 5px;
15+
}
16+
</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>

src/components/UploadImage.vue

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<template>
2+
<div class="home-sidebar">
3+
<q-uploader
4+
url="http://localhost:4444/upload"
5+
label="Upload Image Mockups"
6+
color="teal"
7+
flat
8+
bordered
9+
style="max-width: 100%"
10+
/>
11+
</div>
12+
</template>
13+
14+
<style>
15+
.home-sidebar {
16+
margin: 1rem;
17+
border-radius: 5px;
18+
}
19+
</style>

0 commit comments

Comments
 (0)