Skip to content

Commit 507799e

Browse files
committed
Merge branch 'dev' into Johnny
2 parents d9fdb00 + c45ce89 commit 507799e

File tree

8 files changed

+139
-11
lines changed

8 files changed

+139
-11
lines changed

src/components/left-sidebar/ComponentTab/CreateMenu.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ Description:
4242
@activeLayer="addNestedNoActive"
4343
/>
4444
</div>
45-
<div class="componentHTML">
45+
<button class="componentHTML">
4646
<CreateMenuHTMLQueue></CreateMenuHTMLQueue>
47-
</div>
47+
</button>
4848
<br />
4949

5050
<q-btn

src/components/left-sidebar/ComponentTab/CreateMenuHTMLQueue.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Description:
1010
group="people"
1111
class="list-group"
1212
>
13-
<div
13+
<div
1414
:class="activeHTML === element[2] ? 'list-group-item-selected' : 'list-group-item'"
1515
@dblclick.self="setActiveElement(element)"
1616
v-for="(element) in renderList" :key="element[1] + Date.now()"

src/components/right-sidebar/CodeSnippet.vue

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ export default {
9595
"list-ul": ["<ul>", "</ul>"],
9696
input: ["<input />", ""],
9797
navbar: ["<nav>", "</nav>"],
98-
header:["<header>", "</header>"],
98+
header:["<header>","</header>"],
9999
footer:["<footer>", "</footer>"],
100100
meta: ["<meta>", "</meta>"],
101101
h1:["<h1>", "</h1>"],
@@ -105,7 +105,20 @@ export default {
105105
h5:["<h5>", "</h5>"],
106106
h6:["<h6>", "</h6>"],
107107
};
108-
108+
//test//
109+
// function writeClass(componentName) {
110+
// if (this.componentMap[componentName]?.classList?.length > 0) {
111+
// let commentStr = '<!--'
112+
// this.componentMap[componentName].classList.forEach((el) => {
113+
// commentStr += "\n"
114+
// commentStr += el;
115+
// })
116+
// commentStr += '\n-->\n\n'
117+
// return commentStr;
118+
// } else {
119+
// return ''
120+
// }
121+
// };
109122
// Helper function that recursively iterates through the given html element's children and their children's children.
110123
// also adds proper indentation to code snippet
111124
function writeNested(childrenArray, indent) {

src/components/right-sidebar/HTMLQueue.vue

Lines changed: 72 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Description:
1919
<p v-if='!this.componentMap[this.activeComponent]?.htmlList.length'>No HTML elements in component</p>
2020
<div id="tooltipCon"
2121
:class="activeHTML === element[2] ? 'list-group-item-selected' : 'list-group-item'"
22-
@dblclick.self="setActiveElement(element)"
22+
@click="setActiveElement(element)"
2323
v-for="(element) in renderList" :key="element[1] + Date.now()"
2424
>
2525

@@ -31,6 +31,43 @@ Description:
3131
</div>
3232

3333
</div>
34+
35+
36+
<!-- attribute pop-up -->
37+
<q-dialog v-model="attributeModal" >
38+
<!-- @update:model-value="setActiveElement" -->
39+
<div class="AttributeBox" >
40+
<p class="title">Added attributes to {{ this.activeComponent }}</p>
41+
<div class="AttributeContainer" v-for="element in this.componentMap[this.activeComponent].htmlList" :key="element[1] + Date.now()" >
42+
<p v-if='element.id === this.activeHTML'>Your class is - {{element.class}}</p>
43+
</div>
44+
<div class="formBox">
45+
<q-form autofocus v-on:submit.prevent="submitClass">
46+
<p class="title">Add Class Name:</p><q-input
47+
label="Add your note here"
48+
filled
49+
dark
50+
autofocus true
51+
hide-bottom-space
52+
v-model="classText"
53+
@keyup.enter="submitClass"
54+
></q-input>
55+
<q-btn
56+
id="comp-btn"
57+
class="sidebar-btn"
58+
color="secondary"
59+
label="Submit Attribute"
60+
:disable="classText.length > 0 ? false : true"
61+
@click="submitClass(classText, this.activeHTML)"
62+
/>
63+
<q-btn
64+
label="Close"
65+
@click="this.openAttributeModal"
66+
/>
67+
</q-form>
68+
</div>
69+
</div>
70+
</q-dialog>
3471
</section>
3572
</template>
3673

@@ -52,11 +89,13 @@ export default {
5289
},
5390
data () {
5491
return {
55-
exceptions: ['input', 'img', 'link']
92+
exceptions: ['input', 'img', 'link'],
93+
attributeModal: false,
94+
classText: ''
5695
}
5796
},
5897
computed: {
59-
...mapState(['selectedElementList', 'componentMap', 'activeComponent', 'activeHTML', 'activeLayer']),
98+
...mapState(['selectedElementList', 'componentMap', 'activeComponent', 'activeHTML', 'activeLayer', 'attributeModalOpen']),
6099
renderList: {
61100
get () {
62101
if (this.activeComponent === '') return this.selectedElementList.map((el, index) => [el.text, index, el.id])
@@ -87,14 +126,15 @@ export default {
87126
88127
},
89128
methods: {
90-
...mapActions(['setActiveHTML', 'setActiveLayer', 'upOneLayer']),
129+
...mapActions(['setActiveHTML', 'setActiveLayer', 'upOneLayer', 'openAttributeModal','addActiveComponentClass']),
91130
deleteElement (id) {
92131
if (this.activeComponent === '') this.$store.dispatch(deleteSelectedElement, id[0])
93132
else this.$store.dispatch(deleteFromComponentHtmlList, id[1])
94133
},
95134
setActiveElement (element) {
96135
if (this.activeComponent !== '' && !this.exceptions.includes(element[0])) {
97-
this.setActiveHTML(element)
136+
this.setActiveHTML(element);
137+
this.openAttributeModal(element);
98138
}
99139
},
100140
setLayer (element) {
@@ -104,9 +144,23 @@ export default {
104144
if (this.activeLayer.id !== '') {
105145
this.upOneLayer(this.activeLayer.id)
106146
}
107-
}
147+
},
148+
submitClass(element, idNum){
149+
if (element === ''){
150+
return;
151+
}
152+
let payload = {
153+
class: element,
154+
id: idNum
155+
}
156+
this.addActiveComponentClass(payload);
157+
this.classText = '';
158+
},
108159
},
109160
watch: {
161+
attributeModalOpen (){
162+
this.attributeModal = this.attributeModalOpen;
163+
},
110164
activeComponent: function () {
111165
if (this.activeComponent !== '') {
112166
this.component = true
@@ -198,6 +252,7 @@ hr {
198252
#tooltipCon {
199253
position: relative;
200254
cursor: pointer;
255+
margin-top: 1.3em;
201256
}
202257
203258
@@ -233,4 +288,15 @@ hr {
233288
234289
}
235290
291+
.AttributeBox {
292+
background-color: $subsecondary;
293+
color: $menutext;
294+
width: 65%;
295+
padding: 15px;
296+
height: 65vh;
297+
max-height: 80vh;
298+
}
299+
300+
236301
</style>
302+

src/store/actions.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,19 @@ const actions = {
3131
[types.openNoteModal]: ({ commit }) => {
3232
commit(types.OPEN_NOTE_MODAL)
3333
},
34+
//test
35+
[types.openAttributeModal]: ({ commit }, payload) => {
36+
commit(types.OPEN_ATTRIBUTE_MODAL, payload)
37+
},
38+
39+
[types.addActiveComponentClass]: ({ commit }, payload) => {
40+
commit(types.ADD_ACTIVE_COMPONENT_CLASS, payload)
41+
},
3442

43+
[types.deleteActiveComponentClass]: ({ commit }, payload) => {
44+
commit(types.DELETE_ACTIVE_COMPONENT_CLASS, payload)
45+
},
46+
//
3547
[types.registerComponent]: ({ state, commit }, payload) => {
3648
/* this action has a lot of mutations deployed
3749
Because we have to initialize a whole bunch of properties

src/store/mutations.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,7 @@ const mutations = {
348348
text: payload.elementName,
349349
id: payload.date,
350350
children: [],
351+
class: ''
351352
});
352353
},
353354

@@ -365,6 +366,7 @@ const mutations = {
365366
text: payload.elementName,
366367
id: payload.date,
367368
children: [],
369+
class: ''
368370
});
369371
},
370372

@@ -377,6 +379,7 @@ const mutations = {
377379
text: payload.elementName,
378380
id: payload.date,
379381
children: [],
382+
class: ''
380383
});
381384
},
382385

@@ -385,6 +388,7 @@ const mutations = {
385388
text: payload.elementName,
386389
id: payload.date,
387390
children: [],
391+
class: ''
388392
});
389393
},
390394

@@ -695,6 +699,26 @@ const mutations = {
695699
[types.OPEN_NOTE_MODAL]: (state) => {
696700
state.noteModalOpen = !state.noteModalOpen;
697701
},
702+
//Jace practice for future, not place classList directly in activeComponent
703+
[types.OPEN_ATTRIBUTE_MODAL]: (state) => {
704+
state.attributeModalOpen = !state.attributeModalOpen;
705+
},
706+
707+
[types.ADD_ACTIVE_COMPONENT_CLASS]: (state, payload) => {
708+
state.componentMap[state.activeComponent].htmlList.forEach((el) => {
709+
if (payload.id === el.id) {
710+
el.class = payload.class
711+
}
712+
})
713+
},
714+
[types.DELETE_ACTIVE_COMPONENT_CLASS]: (state, payload) => {
715+
state.componentMap[state.activeComponent].classList.forEach((el, ind) =>{
716+
if (payload === el){
717+
state.componentMap[state.activeComponent].classList.splice(ind, 1)
718+
return;
719+
}
720+
})
721+
},
698722
// *** PROJECTS *** //////////////////////////////////////////////
699723

700724
[types.ADD_PROJECT]: (state, payload) => {

src/store/state/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ const newState = {
5252
componentChildrenMultiselectValue: [],
5353
modalOpen: false,
5454
noteModalOpen: false,
55+
//test
56+
noteAttributeOpen: false,
57+
//
5558
parentSelected: false,
5659
// for storing copied component
5760
copiedComponent: {},

src/store/types.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,11 +67,21 @@ export const TOGGLE_TUTORIAL = 'TOGGLE_TUTORIAL'
6767
export const ADD_ACTIVE_COMPONENT_NOTE = 'ADD_ACTIVE_COMPONENT_NOTE'
6868
export const DELETE_ACTIVE_COMPONENT_NOTE = 'DELETE_ACTIVE_COMPONENT_NOTE'
6969
export const OPEN_NOTE_MODAL = 'OPEN_NOTE_MODAL'
70+
//Jace practest
71+
export const OPEN_ATTRIBUTE_MODAL = 'OPEN_ATTRIBUTE_MODAL'
72+
export const ADD_ACTIVE_COMPONENT_CLASS = 'ADD_ACTIVE_COMPONENT_CLASS'
73+
export const DELETE_ACTIVE_COMPONENT_CLASS = 'DELETE_ACTIVE_COMPONENT_CLASS'
74+
//
7075
export const REMOVE_ALL_STATE_PROPS_ACTIONS = 'REMOVE_ALL_STATE_PROPS_ACTIONS'
7176
export const UPDATE_PASTE_TIMER = 'UPDATE_PASTE_TIMER'
7277

7378
// Actions
7479
export const openNoteModal = 'openNoteModal'
80+
//Jace practest
81+
export const openAttributeModal = 'openAttributeModal'
82+
export const addActiveComponentClass = 'addActiveComponentClass'
83+
export const deleteActiveComponentClass = 'deleteActiveComponentClass'
84+
//
7585
export const deleteActiveComponentNote = 'deleteActiveComponentNote'
7686
export const addActiveComponentNote = 'addActiveComponentNote'
7787
export const addActionSelected = 'addActionSelected'

0 commit comments

Comments
 (0)