Skip to content

Commit 2befc1f

Browse files
committed
committing delete component functionality
1 parent fb994ce commit 2befc1f

File tree

5 files changed

+68
-55
lines changed

5 files changed

+68
-55
lines changed

src/components/ComponentDetails.vue

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,19 @@
99
indicator-color="secondary"
1010
align="left"
1111
>
12+
<q-tab name="code" label="Code Snippet" id="label-text" />
13+
<q-tab name="html" label="HTML Elements" id="label-text" />
1214
<q-tab name="state" label="Component State" id="label-text" />
1315
<q-tab name="actions" label="Component Actions" id="label-text" />
1416
<q-tab name="props" label="Component Props" id="label-text" />
1517
</q-tabs>
1618
<q-tab-panels v-model="tab" animated class="html-bg text-white">
19+
<q-tab-panel name="code">
20+
<CodeSnippet/>
21+
</q-tab-panel>
22+
<q-tab-panel name="html" :style="{height: `${height}vh`}">
23+
<HomeQueue />
24+
</q-tab-panel>
1725
<q-tab-panel name="state">
1826
<ul id="stateList">
1927
<li v-for="comp in compObj.state" :key="comp">
@@ -43,9 +51,15 @@
4351

4452
<script>
4553
import { mapState } from 'vuex'
54+
import HomeQueue from './HomeQueue'
55+
import CodeSnippet from './CodeSnippet'
4656
4757
export default {
4858
name: 'ComponentDetails',
59+
components: {
60+
HomeQueue,
61+
CodeSnippet
62+
},
4963
computed: {
5064
...mapState(['activeComponentObj']),
5165
compObj: {
@@ -56,7 +70,7 @@ export default {
5670
},
5771
data () {
5872
return {
59-
tab: 'state'
73+
tab: 'code'
6074
}
6175
}
6276
}

src/components/Footer.vue

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,31 +22,17 @@ Description:
2222
indicator-color="secondary"
2323
align="left"
2424
>
25-
26-
<q-tab name="code" label="Code Snippet" id="label-text" />
2725
<q-tab name="detail" label="Component Details" id="label-text" />
2826
<q-tab name="tree" label="Project Tree" id="label-text" />
29-
<q-tab name="html" label="HTML Elements" id="label-text" />
3027
<q-tab name="store" label="Vuex Store" id="label-text" />
31-
3228
</q-tabs>
33-
3429
<q-tab-panels v-model="tab" animated class="html-bg text-white" >
35-
<q-tab-panel name="code">
36-
<CodeSnippet />
37-
</q-tab-panel>
38-
<!-- Work in Progress -->
3930
<q-tab-panel name="detail">
4031
<ComponentDetails/>
4132
</q-tab-panel>
42-
<!----------------------->
4333
<q-tab-panel name="tree">
4434
<Tree />
4535
</q-tab-panel>
46-
47-
<q-tab-panel name="html" :style="{height: `${height}vh`}">
48-
<HomeQueue />
49-
</q-tab-panel>
5036
<q-tab-panel name="store">
5137
<VuexStore/>
5238
</q-tab-panel>
@@ -58,16 +44,12 @@ Description:
5844
<script>
5945
import { mapState, mapActions } from 'vuex'
6046
import Tree from './Tree'
61-
import HomeQueue from './HomeQueue'
62-
import CodeSnippet from './CodeSnippet'
6347
import VuexStore from './DashboardVuexStore.vue'
6448
import ComponentDetails from './ComponentDetails'
6549
6650
export default {
6751
components: {
6852
Tree,
69-
HomeQueue,
70-
CodeSnippet,
7153
VuexStore,
7254
ComponentDetails
7355
},

src/components/HomeSideDropDown.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Description:
77
<template>
88
<div class="q-pa-md" style="max-width: 350px">
99
<q-list padding bordered class="rounded-borders drawer-menu">
10-
<q-expansion-item dense dense-toggle expand-separator label="Components">
10+
<q-expansion-item dense dense-toggle expand-separator label="Edit/Delete Components">
1111
<q-card>
1212
<div class="input-container" style='height: 130px'>
1313
<ComponentList />

src/components/HomeSideDropDownItems/ComponentList.vue

Lines changed: 49 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,23 @@ Description:
66

77
<template>
88
<div class="home-sidebar">
9+
<q-input
10+
@keyup.enter.native="editComponentName(newName)"
11+
standout="bg-secondary text-white"
12+
bottom-slots
13+
v-model="newName"
14+
label="Edit name"
15+
dense
16+
class="input-add"
17+
>
18+
<template v-slot:append>
19+
<q-btn
20+
round
21+
dense
22+
flat
23+
icon="add"
24+
@click="createNewAction(textAction)"
25+
/>
926
<multiselect
1027
class='multiselect'
1128
v-model="value"
@@ -20,24 +37,9 @@ Description:
2037
<span slot='noResult'>No components found.</span>
2138
</multiselect>
2239
<br/>
23-
<a
24-
v-for="componentData in activeRouteDisplay"
25-
:key="componentData.componentName"
26-
v-on:click="onActivated(componentData)"
27-
>
28-
<q-list class="list-item" dense bordered separator>
29-
<q-item clickable v-ripple class="list-item">
30-
<q-item-section>
31-
<div class="component-container">
32-
<div class="component-info">
33-
{{componentData.componentName}}
34-
</div>
35-
<q-btn round flat icon="highlight_off" v-on:click.stop="handleClick(componentData)" />
36-
</div>
37-
</q-item-section>
38-
</q-item>
39-
</q-list>
40-
</a>
40+
<h v-if="this.activeComponentObj"> Currently selected component: {{ activeComponentObj.componentName }} </h>
41+
<h v-else> Select a component </h>
42+
<q-btn id="deleteButton" @click="deleteSelectedComp(activeComponentData)" label = 'Delete currently selected'/>
4143
</div>
4244
</template>
4345

@@ -48,21 +50,20 @@ import Multiselect from 'vue-multiselect'
4850
export default {
4951
data () {
5052
return {
51-
value: ''
53+
value: '',
54+
newName: ''
5255
}
5356
},
5457
components: { Multiselect },
5558
computed: {
56-
...mapState(['routes', 'activeRoute', 'activeComponent']),
59+
...mapState(['routes', 'activeRoute', 'activeComponent', 'activeComponentObj']),
5760
activeRouteDisplay () {
5861
let component = this.routes[this.activeRoute]
5962
// console.log('component', component)
6063
return component
6164
},
6265
activeComponentData () {
63-
return this.activeRouteDisplay.filter(componentData => {
64-
return componentData.componentName === this.activeComponent
65-
})[0]
66+
return this.activeComponentObj
6667
},
6768
options () {
6869
const val = this.activeRouteDisplay.map(component => component.componentName)
@@ -77,14 +78,16 @@ export default {
7778
'deleteActiveComponent'
7879
]),
7980
// Set component as active component from left side dropdown
80-
onActivated (componentData) {
81-
this.setActiveComponent(componentData.componentName)
82-
this.activeComponentData.isActive = true
83-
},
81+
// onActivated (componentData) {
82+
// this.setActiveComponent(componentData.componentName)
83+
// this.activeComponentData.isActive = true
84+
// },
8485
// Deletes the selected component
85-
handleClick (componentData) {
86-
this.setActiveComponent(componentData.componentName)
87-
this.deleteActiveComponent(componentData.componentName)
86+
deleteSelectedComp (componentData) {
87+
if (componentData) {
88+
// this.setActiveComponent(componentData.componentName)
89+
this.deleteActiveComponent(componentData.componentName)
90+
}
8891
},
8992
// Select active component from multi-select input
9093
handleSelect (componentName) {
@@ -99,6 +102,14 @@ export default {
99102
}
100103
}
101104
}
105+
// watch: {
106+
// activeComponent: function () {
107+
// // console.log('watching activeComponent in Footer');
108+
// if (this.activeComponent === '' && this.selectedElementList.length !== 0) {
109+
// this.tab = 'html'
110+
// }
111+
// }
112+
// }
102113
}
103114
</script>
104115

@@ -126,7 +137,13 @@ export default {
126137
display: flex;
127138
justify-content: space-between;
128139
}
129-
</style>
130-
131140
141+
h {
142+
color: white;
143+
}
132144
145+
#deleteButton {
146+
background-color: #289ead;
147+
color: white;
148+
}
149+
</style>

src/components/HomeSideDropDownItems/VuexForm.vue

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ Description:
1313
standout="bg-secondary text-white"
1414
bottom-slots
1515
v-model="textAction"
16-
label="Create Action"
16+
label="Create Action in Store"
1717
dense
1818
class="input-add"
1919
>
@@ -63,7 +63,7 @@ Description:
6363
standout="bg-secondary text-white"
6464
bottom-slots
6565
v-model="textState"
66-
label="Create State"
66+
label="Create State in Store"
6767
dense
6868
class="input-add"
6969
>
@@ -107,7 +107,7 @@ Description:
107107
standout="bg-secondary text-white"
108108
bottom-slots
109109
v-model="textProps"
110-
label="Create Props"
110+
label="Create Prop in Store"
111111
dense
112112
class="input-add"
113113
>

0 commit comments

Comments
 (0)