Skip to content

Commit 8edbd69

Browse files
committed
finish adding Child Components to the Icon grid
1 parent bd62c6b commit 8edbd69

File tree

4 files changed

+57
-8
lines changed

4 files changed

+57
-8
lines changed

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

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,20 @@ Description:
1717
<br />
1818
<span>{{ elementName }}</span>
1919
</button>
20+
21+
<button
22+
@click.prevent="changeState(elementName)"
23+
v-for="(elementName, idx) in childrenComp"
24+
:key="idx + Date.now()"
25+
>
26+
<span class="badge"> {{ elementStorage[elementName] }}</span>
27+
<br />
28+
<i :class="childIcon"></i>
29+
<br />
30+
<span>{{ elementName }}</span>
31+
</button>
32+
33+
2034
</section>
2135
</template>
2236

@@ -25,7 +39,10 @@ import { mapState } from "vuex";
2539
2640
export default {
2741
data() {
28-
return {};
42+
return {
43+
//to give the child componenets of the active components icons
44+
childIcon: ["fa-solid fa-code"]
45+
};
2946
},
3047
name: "Icons",
3148
computed: {
@@ -61,6 +78,14 @@ export default {
6178
}
6279
return computedElementalStorage;
6380
},
81+
childrenComp: function () {
82+
let childrenAvailable = [];
83+
84+
if(this.activeComponent) {
85+
childrenAvailable = this.componentMap[this.activeComponent].children
86+
}
87+
return childrenAvailable;
88+
},
6489
},
6590
methods: {
6691
// Logic to decide where to place selected html element

src/store/actions.js

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ const actions = {
261261
},
262262

263263
// Actions dispatched from left hand panel////////////////////////////////////////
264-
265264
[types.addToComponentElementList]: ({ commit }, payload) => {
266265
// adds element to the HTMLQueue
267266
commit(types.ADD_TO_COMPONENT_HTML_LIST, payload);
@@ -278,7 +277,6 @@ const actions = {
278277
// end of left hand panel/////////////////////////
279278

280279
// HTML Element related actions ////////////////////
281-
282280
[types.addNestedHTML]: ({ commit }, payload) => {
283281
commit(types.ADD_NESTED_HTML, payload);
284282
},
@@ -316,7 +314,10 @@ const actions = {
316314
[types.upOneLayer]: ({ commit }, payload) => {
317315
commit(types.UP_ONE_LAYER, payload);
318316
},
319-
//FOR MUTATING HTML WITH DRAG AND DROP
317+
318+
// end of HTML segment ////////////////////////////////////////////////
319+
320+
// Drag-and-drop ///////////////////////////////////////
320321
[types.setIdDrag]: ({ commit }, payload) => {
321322
commit(types.SET_ID_DRAG, payload)
322323
},
@@ -341,10 +342,16 @@ const actions = {
341342
commit(types.DRAG_DROP_SORT_SELECTED_HTML_ELEMENTS)
342343
},
343344

344-
// end of HTML segment ////////////////////////////////////////////////
345+
// end of Drag-and-drop /////////////////////////////////
345346

346-
// Loading ///////////////////////////////////////////////////////
347+
// Place Child Components among the Html Elements //////////////
348+
[types.upgradeIconGridWithChildComponent]: ({ commit }, payload) => {
349+
commit(types.UPGRADE_ICON_GRID_WITH_CHILD_COMPONENT, payload)
350+
},
347351

352+
// end of Place Child Components among the Html Elements ////////
353+
354+
// Loading ///////////////////////////////////////////////////////
348355
[types.openProject]: ({ commit }, payload) => {
349356
commit(types.REMOVE_ALL_STATE_PROPS_ACTIONS)
350357
commit(types.SET_ACTIVE_ROUTE, "HomeView");

src/store/mutations.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -755,7 +755,10 @@ const mutations = {
755755
// state.componentMap[state.activeComponent].htmlList = newHTMLList;
756756
// const newMap = { ...state.componentMap };
757757
// state.componentMap = { ...newMap };
758+
759+
//delete the parent because the payload is no longer a child to the acitive component
758760
delete state.componentMap[payload].parent[state.activeComponent];
761+
759762
// add block
760763
} else {
761764
const child = temp;
@@ -768,6 +771,14 @@ const mutations = {
768771
state.componentMap[state.activeComponent];
769772
}
770773
},
774+
// update Parent's icon Grid with Child Component
775+
[types.UPGRADE_ICON_GRID_WITH_CHILD_COMPONENT]: (state, payload) => {
776+
//Update available Child Components options to be place along side the HTML Elements every time the Child Components are updated
777+
//mutation function with the same payload and using the activeComponent
778+
//if the payload is not and html option added, if it is then delete it
779+
780+
},
781+
771782
// invoked when element is double clicked, changing the boolean value
772783
[types.UPDATE_OPEN_MODAL]: (state, payload) => {
773784
state.modalOpen = payload;

src/store/types.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,15 @@ export const DELETE_ACTIVE_COMPONENT_CLASS = 'DELETE_ACTIVE_COMPONENT_CLASS'
7777
//
7878
export const REMOVE_ALL_STATE_PROPS_ACTIONS = 'REMOVE_ALL_STATE_PROPS_ACTIONS'
7979
export const UPDATE_PASTE_TIMER = 'UPDATE_PASTE_TIMER'
80-
80+
//Drag and Drop
8181
export const SET_ID_DRAG = 'SET_ID_DRAG'
8282
export const SET_ID_DROP = 'SET_ID_DROP'
8383
export const SET_SELECTED_ID_DRAG = 'SET_SELECTED_ID_DRAG'
8484
export const SET_SELECTED_ID_DROP = 'SET_SELECTED_ID_DROP'
8585
export const DRAG_DROP_SORT_HTML_ELEMENTS = 'DRAG_DROP_SORT_HTML_ELEMENTS'
8686
export const DRAG_DROP_SORT_SELECTED_HTML_ELEMENTS = 'DRAG_DROP_SORT_SELECTED_HTML_ELEMENTS'
87+
//
88+
export const UPGRADE_ICON_GRID_WITH_CHILD_COMPONENT = 'UPGRADE_ICON_GRID_WITH_CHILD_COMPONENT'
8789

8890
// Actions
8991
export const openNoteModal = 'openNoteModal'
@@ -158,13 +160,17 @@ export const updateStartingSize = 'updateStartingSize'
158160
export const deleteUserActions = 'deleteUserActions'
159161
export const deleteUserState = 'deleteUserState'
160162
export const toggleTutorial = 'toggleTutorial'
161-
163+
//Drag and Drop
162164
export const setIdDrag = 'setIdDrag'
163165
export const setIdDrop = 'setIdDrop'
164166
export const setSelectedIdDrag = 'setSelectedIdDrag'
165167
export const setSelectedIdDrop = 'setSelectedIdDrop'
166168
export const dragDropSortHtmlElements = 'dragDropSortHtmlElements'
167169
export const dragDropSortSelectedHtmlElements = 'dragDropSortSelectedHtmlElements'
170+
//
171+
export const upgradeIconGridWithChildComponent = 'upgradeIconGridWithChildComponent'
172+
173+
168174

169175
// inactive mutations
170176
// export const SET_STATE = 'SET_STATE'

0 commit comments

Comments
 (0)