Skip to content

Commit eb848d7

Browse files
aleckslujeffreysulkennyeardbendersn163
committed
Fixed issue where project wouldnt save due to parser type error
Co-authored-by: Jeffrey Sul <[email protected]> Co-authored-by: Kenneth Lee <[email protected]> Co-authored-by: Ryan Bender <[email protected]> Co-authored-by: Sonny Nguyen <[email protected]>
1 parent 69bfbbe commit eb848d7

File tree

3 files changed

+11
-144
lines changed

3 files changed

+11
-144
lines changed

src/components/file_system_interface/SaveProjectComponent.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,9 @@ export default {
4444
},
4545
// deletes anything attached to html element
4646
parseAndDelete (htmlList) {
47-
console.log(htmlList)
47+
// console.log('htmlList in saveProjectComp: ', htmlList)
4848
htmlList.forEach(element => {
49+
if (!Array.isArray(element.children)) console.log('This should be an array', element.children)
4950
if (element.children.length > 0) {
5051
// console.log('in recurse')
5152
this.parseAndDelete(element.children)

src/components/home_sidebar_items/ComponentTab/EditDeleteComponents.vue

Lines changed: 0 additions & 131 deletions
Original file line numberDiff line numberDiff line change
@@ -138,138 +138,7 @@ Description:
138138
</q-expansion-item>
139139
</q-list>
140140
</div>
141-
142-
<!-- <q-list>
143-
<q-expansion-item popup default-opened icon="mail" label="Inbox" caption="5 unread emails">
144-
<q-separator />
145-
<q-card>
146-
<q-card-section>
147-
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Quidem, eius reprehenderit eos corrupti
148-
commodi magni quaerat ex numquam, dolorum officiis modi facere maiores architecto suscipit iste
149-
eveniet doloribus ullam aliquid.
150-
</q-card-section>
151-
</q-card>
152-
</q-expansion-item>
153-
</q-list> -->
154-
<!-- dropdown to select a component to edit -->
155141
</div>
156-
<!-- moved this to createComponent -->
157-
<!-- <br/> -->
158-
<!-- removed text that displays what componenet is selected -->
159-
<!-- <p class="editName" v-if="this.activeComponentObj">
160-
Currently selected component: {{ this.activeComponentObj.componentName }}
161-
</p> -->
162-
<!-- removed delete button for now -->
163-
<!-- <p class="editName" v-else>Select a component</p> -->
164-
165-
<!-- <br/>
166-
<div v-if="this.activeComponentData">
167-
<br/> -->
168-
<!-- @input="selectParent"
169-
@open="resetActiveComponent" -->
170-
171-
<!-- <br/> -->
172-
173-
<!-- <section id="counter" style="color: white"> Layer:
174-
<q-btn
175-
class="btn"
176-
color="transparent"
177-
text-color="white"
178-
label="-"
179-
@click="e => handleLayer(e)"
180-
/>
181-
{{ this.activeComponentObj.z }}
182-
<q-btn
183-
class="btn"
184-
color="transparent"
185-
text-color="white"
186-
label="+"
187-
@click="e => handleLayer(e)"
188-
/>
189-
</section>
190-
<br/>
191-
<p> Toggle to edit: </p>
192-
<div class="toggleRow">
193-
<section class="toggleText"> HTML elements</section>
194-
<toggle-button v-model="showHTML" class="toggle"/>
195-
</div>
196-
<HTMLQueue v-if="showHTML"/>
197-
<br/>
198-
<div class="toggleRow">
199-
<section class="toggleText"> State</section>
200-
<toggle-button v-model="showState" class="toggle"/>
201-
</div>
202-
<hr v-if="showState">
203-
<p v-if='showState && !this.activeComponentObj.state.length'>No state in component</p>
204-
<a
205-
v-for="s in this.activeComponentData.state"
206-
:key="s"
207-
>
208-
<q-list v-if="showState" class="list-item" dense bordered separator>
209-
<q-item clickable v-ripple class="list-item">
210-
<q-item-section>
211-
<div class="component-container">
212-
<div class="component-info">
213-
{{s}}
214-
</div>
215-
<q-btn round flat icon="highlight_off" v-on:click="deleteState(s)" />
216-
</div>
217-
</q-item-section>
218-
</q-item>
219-
</q-list>
220-
</a>
221-
<br/>
222-
<div class="toggleRow">
223-
<section class="toggleText"> Actions</section>
224-
<toggle-button v-model="showActions" class="toggle"/>
225-
</div>
226-
<hr v-if="showActions">
227-
<p v-if='showActions && !this.activeComponentObj.actions.length'>No actions in component</p>
228-
<a
229-
v-for="action in this.activeComponentData.actions"
230-
:key="action"
231-
>
232-
<q-list v-if="showActions" class="list-item" dense bordered separator>
233-
<q-item clickable v-ripple class="list-item">
234-
<q-item-section>
235-
<div class="component-container">
236-
<div class="component-info">
237-
{{action}}
238-
</div>
239-
<q-btn round flat icon="highlight_off" v-on:click="deleteAction(action)" />
240-
</div>
241-
</q-item-section>
242-
</q-item>
243-
</q-list>
244-
</a>
245-
<br/>
246-
<div class="toggleRow">
247-
<section class="toggleText">Props </section>
248-
<toggle-button v-model="showProps" class="toggle" justify='end'/>
249-
</div>
250-
<hr v-if="showProps">
251-
<p v-if='showProps && !this.activeComponentObj.props.length'>No props in component</p>
252-
<a
253-
v-for="prop in this.activeComponentData.props"
254-
:key="prop"
255-
> -->
256-
<!-- v-on:click="onActivated(prop)" -->
257-
258-
<!-- <q-list v-if="showProps" class="list-item" dense bordered separator>
259-
<q-item clickable v-ripple class="list-item">
260-
<q-item-section>
261-
<div class="component-container">
262-
<div class="component-info">
263-
{{prop}}
264-
</div>
265-
<q-btn round flat icon="highlight_off" v-on:click.stop="deleteProp(prop)" />
266-
</div>
267-
</q-item-section>
268-
</q-item>
269-
</q-list>
270-
</a>
271-
</div>
272-
<p v-else> <br/> Select Component to Enable Edit </p> -->
273142
</template>
274143

275144
<script>

src/store/mutations.js

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -505,17 +505,12 @@ const mutations = {
505505
state.componentMap[state.parentSelected].children.push(
506506
payload.componentName
507507
)
508-
state.componentMap[state.parentSelected].htmlList.push(
509-
payload.componentName
510-
)
511508
},
512509

513510
[types.ADD_COPIED_PARENT]: (state, payload) => {
514511
const parentSelected = Object.values(payload.parent)[0].componentName;
515512
// push into parent's children array
516513
state.componentMap[parentSelected].children.push(payload.componentName)
517-
// push into parent's htmlList array
518-
state.componentMap[parentSelected].htmlList.push(payload.componentName)
519514
},
520515

521516
[types.DELETE_ACTIVE_COMPONENT]: state => {
@@ -613,6 +608,7 @@ const mutations = {
613608
[types.UPDATE_ACTIVE_COMPONENT_CHILDREN_VALUE]: (state, payload) => {
614609
const temp = state.componentMap[state.activeComponent].children
615610
// delete block
611+
console.log('UPDATE_ACTIVE_COMPONENT_CHILDREN_VALUEs payload', payload)
616612
if (payload.length < temp.length) {
617613
const child = temp.filter(el => !payload.includes(el))
618614
// console.log('delete child: ', child)
@@ -642,13 +638,14 @@ const mutations = {
642638
.children.filter(el => !payload.includes(el))
643639
state.componentMap[child[0]].parent[state.activeComponent] = state.componentMap[state.activeComponent]
644640
}
645-
const copy = [...state.componentMap[state.activeComponent].htmlList]
646-
for (const x in payload) {
647-
if (!copy.includes(payload[x])) {
648-
copy.push(payload[x])
649-
}
650-
}
651-
state.componentMap[state.activeComponent].htmlList = copy
641+
// Adding children strings to htmlList -> removed to prevent JSON parser errors
642+
// const copy = [...state.componentMap[state.activeComponent].htmlList]
643+
// for (const x in payload) {
644+
// if (!copy.includes(payload[x])) {
645+
// copy.push(payload[x])
646+
// }
647+
// }
648+
// state.componentMap[state.activeComponent].htmlList = copy
652649
},
653650
// invoked when element is double clicked, changing the boolean value
654651
[types.UPDATE_OPEN_MODAL]: (state, payload) => {

0 commit comments

Comments
 (0)