Skip to content

Commit c5cfe29

Browse files
authored
Merge pull request #3 from Linhatran/master
commented out SaveProjectButton, OpenProjectFolder, DeleteProjects bu…
2 parents f54647f + bdb365e commit c5cfe29

File tree

3 files changed

+17
-18
lines changed

3 files changed

+17
-18
lines changed

app/src/components/right/ProjectManager.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,9 @@ const ProjectManager = () => {
204204
</Select>
205205
</FormControl>
206206
</div>
207-
{state.isLoggedIn ? <SaveProjectButton /> : ''}
207+
{/* {state.isLoggedIn ? <SaveProjectButton /> : ''}
208208
{state.isLoggedIn ? <ProjectsFolder /> : ''}
209-
{state.isLoggedIn ? <DeleteProjects /> : ''}
209+
{state.isLoggedIn ? <DeleteProjects /> : ''} */}
210210
{/* <div className={classes.btnGroup}>
211211
212212
{/* ---------------------------EXPORT PROJECT BUTTON----------------------------- */}

app/src/helperFunctions/generateCode.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -271,19 +271,19 @@ const generateUnformattedCode = (
271271
const formatCode = (code: string) => {
272272
// in test environment, window.api is not defined,
273273
// so we reference original prettier format function instead
274-
// if (process.env.NODE_ENV === 'test') {
275-
// const { format } = require('prettier');
276-
// return format(code, {
277-
// singleQuote: true,
278-
// trailingComma: 'es5',
279-
// bracketSpacing: true,
280-
// jsxBracketSameLine: true,
281-
// parser: 'babel'
282-
// });
283-
// } else {
284-
// return window.api.formatCode(code);
285-
// }
286-
return code;
274+
if (process.env.NODE_ENV === 'test') {
275+
const { format } = require('prettier');
276+
return format(code, {
277+
singleQuote: true,
278+
trailingComma: 'es5',
279+
bracketSpacing: true,
280+
jsxBracketSameLine: true,
281+
parser: 'babel'
282+
});
283+
} else {
284+
return window.api.formatCode(code);
285+
}
286+
// return code;
287287
};
288288

289289
// generate code based on component hierarchy and then return the rendered code

app/src/helperFunctions/manageSeparators.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const manageSeparators = {};
88
manageSeparators.nextTopSeparatorId = initialState.nextTopSeparatorId;
99

1010
manageSeparators.handleSeparators = (arr, str) => {
11-
if (str === 'delete' && arr.length === 1) {
11+
if ((str === 'delete' || str === 'change position') && arr.length === 1) {
1212
arr.splice(0, 1);
1313
}
1414

@@ -37,14 +37,13 @@ manageSeparators.handleSeparators = (arr, str) => {
3737
// check is length is > 0 or it is a nested element
3838
if (arr[index].children.length) {
3939
// recursive call if children array
40-
(str === 'delete') ? manageSeparators.handleSeparators(arr[index].children, str) : manageSeparators.handleSeparators(arr[index].children);
40+
(str === 'delete' || str === 'change position') ? manageSeparators.handleSeparators(arr[index].children, str) : manageSeparators.handleSeparators(arr[index].children);
4141
}
4242
}
4343
return manageSeparators.nextTopSeparatorId;
4444
};
4545

4646
manageSeparators.mergeSeparator = (arr, index) => {
47-
console.log('mergerSeparator',arr)
4847
return arr.map((child) => {
4948
if (child.name === 'div' && child.children.length) {
5049
const divContents = manageSeparators.mergeSeparator(child.children, index);

0 commit comments

Comments
 (0)